8. (10 points) If the ‘beq’ instruction is implemented in the ID stage, how do t
ID: 3706926 • Letter: 8
Question
8. (10 points) If the ‘beq’ instruction is implemented in the ID stage, how do the codes below execute
correctly? We would like to use forwarding to reduce the use of ‘nops’.
a):
sub t1, t2, t3
beq t1, t2, label
b):
sub t1, t2, t3
add t0, t2, t3
beq t1, t2, label
c):
lw t1, 5(s0)
beq t1, t0, label
Explanation / Answer
a) sub t1,t2,t3
nops
beq t1,t2,label //forward t1 from MEM->ID
b) sub t1,t2,t3
add t0,t2,t3
nops
nops
beq t1,t2,label //Forward at instruction #1 to instruction #3 at WB -> EX and at instruction #2 to instruction #3 at MEM -> EX
c) lw t1,5(s0)
nops
nops
beq t1,t0,label //forward to from WB->ID
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.