Question: Question : Use the following code fragment: Loop: ld x 1 , 0 ( x 2 ) ; load x 1 from address 0 +

Question :
Use the following code fragment:
Loop: ld x1,0(x2); load x1 from address 0+x2
addi x1,x1,1; x1=x1+1
sd x1,0,(x2); store x1 at address 0+x2
addi x2,x2,4; x2=x2+4
sub x4,x3,x2; x4=x3-x2
bnez x4,Loop; branch to Loop if x4!=0
Assume that the initial value of x3 is x2+396.
Show the timing of this instruction sequence for the 5-stage RISC pipeline without any forwarding or
bypassing hardware but assuming that a register read and a write in the same clock cycle "forwards" through
the register file, as between the add and or shown in Figure C.5 of Appendix C. Use a pipeline timing chart like
that in Figure C.8 of Appendix C.
Assume that the branch is handled by flushing the pipeline. If all memory references take 1 cycle, how many
cycles does this loop take to execute?
Book to refer: Morgan Kaufman Introduction to Computer Architecture Principles
 Question : Use the following code fragment: Loop: ld x1,0(x2); load

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 Databases Questions!