Question: Translate the following C code into a MIPS assembly code. Consider, the variable i is stored in $s1 and the base address of the arrays,

Translate the following C code into a MIPS assembly code.

Consider,

the variable i is stored in $s1 and

the base address of the arrays, f_arr, and s_arr are stored in $s5 and $s6 respectively.

You cannot use MUL, MULT, or DIV instructions for multiplication or division. You do not need to worry about any potential indexing error.

int i=0;

while(i<100)

{

if (f_arr[i]>5)

f_arr[i] = f_arr[s_arr[i+3]] / 8 ;

else

f_arr[i] = f_arr[s_arr[i+3]] * 4 ;

i++;

}

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!