Question: Consider the following MIPS loop: LOOP: sit St 2 , SO . St 1 beq St 2 , SO , DONE subi St 1 ,

Consider the following MIPS loop:
LOOP: sit St2, SO. St1 beq St2, SO, DONE subi St1, $t1,1
addi $s2, Ss2,2 j LOOP
DONE:
1)(10pts) Assume that the register Stl is initialized to the value 50. For each of the loops above, write the equivalent C code routine. Assume that the registers Ss1, $s2, Stl, and St2 are integers A, B, i, and temp, respectively.
2)(10pts) For the loops written in MIPS assembly above, assume that the register Stl is initialized to the value N. How many MIPS instructions are executed?

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!