addi $s3, $sl, 5
lw $s2, 4($s3)
lw $s4, 3($s1)
add $s2, $s3, $s2
sw $s2, 0($s3)
Identify all the data dependencies, and for each one say if it requires forwarding,
stalling, both stalling and forwarding, or no forwarding/stalling is necessary.
If there is no forwarding or hazard detection, insert NOPs to ensure correct execution.
Now, change and/or rearrange the code to minimize the number of NOPs needed.
You can assume register $t0 can be used to hold temporary values in your modified code.
If the processor has forwarding, but we forgot to implement the hazard detection unit, what happens when the original code executes?
If there is forwarding, for the first seven cycles during the execution of this code, specify which signals are asserted in each cycle by hazard detection and forwarding units in the figure above.
If there is no forwarding, what new input and output signals do we need for the hazard detection unit in the figure? Using this instruction sequence as an example, explain why each signal is needed.
For the new hazard detection unit implemented, specify which output signals it asserts in each of the first five cycles during the execution of this code.