Question: Consider the following MIPS assembly program executing on a pipelined datapath with no hardware for hazard handling. Assume a branch penalty of 2 cycles. Loop:
Consider the following MIPS assembly program executing on a pipelined datapath with no hardware for hazard handling. Assume a branch penalty of 2 cycles.
Loop: add
sub $4, $5, $1
or $5, $6, $7
and $8, $9, $10
slt $11, $12, $5
beq $13, $14, Loop
add $15, $16, $17
a) Add as few NOPs as possible to this instruction sequence to ensure that hazards are eliminated and the code executes correctly. Do not reorder any instructions.
b) Now reorder the instructions to eliminate as many NOPs as possible without affecting the correctness of execution.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
