Question: Given code for a 5 - stage single - pipeline microarchitecture ( fetch , decode, execute, memory, write - back ) Loop: lw x 1

Given code for a 5-stage single-pipeline microarchitecture (fetch, decode,
execute, memory, write-back)
Loop: lw x1,0(x2)
addi x1,x1,1
sw x1,0(x2)
addi x2,x2,4
sub x4,x3,x2
bnz x4,Loop
All ops are one cycle except LW and SW, which are 1+2 cycles, and branches,
which are 1+1 cycles. There is no forwarding.
1. Show the phases of each instruction per clock cycle for one iteration of the loop.
2. How many clock cycles per loop iteration are lost to branch overhead?
3. Assume a static branch predictor, capable of recognizing a backward branch in
the decode stage. Now how many clock cycles are wasted on branch
overhead?
4. Assume a dynamic branch predictor. How many cycles are lost on a correct
prediction?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!