Question: ( Q 4 ) [ 2 0 points ] Assume No branching hazards and no pipelining in this question. ( a ) Translate the following

(Q4)[20 points]
Assume No branching hazards and no pipelining in this question.
(a) Translate the following c code into MIPS Assembly?
Assume the following:
i$s0, j $s1, outerLoopLimit 5, innerLoopLimit 10, sum $s3, prod $s4
// c code Nested looping example
int i=0; int j=0;
while (i 5)
{ j=0;
while (j 10)
{
if (i==j)
sum= i+ j ;
else
prod = i* j ;
j+=4 ;
}// end inner loop
i++;
}// end outer loop
b) The translation of the statement sum= i + j ; into MIPS instruction is: add $t0,$s0,$s1, how many times this instruction gets executed in your MIPS code with branches get executed. Trace your MIPS code
( Q 4 ) [ 2 0 points ] Assume No branching

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