Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started