Question: Consider the following assembly program written for 3 2 - bit RISC: ld r 2 0 , 1 6 0 0 0 # load immediate

Consider the following assembly program written for 32-bit RISC:
ld r20,16000 # load immediate
ld r19,20000
ld r18,40000
start:
add r3, r20, r19
ld r1,0(r3) # load into r1 from memory
add r4, r20, r18
ld r2,0(r4)
mult r2, r1, r2
st 0(r4), r2 # store r2 into memory
ld r2,4
sub r20, r20, r2
bnez r20, start # jump to start if r20 not equal with zero
a) Write a C program that is equivalent to the given assembly program.
b) Open the loop in assembly language up to 4 iterations. Reduce the program by renaming registers as follows: Change it to minimize the number of stalls.

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!