Question: Consider the following C function ( attached below ) that accepts three arguments, an integer array and the length of the array size and a

Consider the following C function (attached below) that accepts three arguments, an integer array and the length of the array size and a variable k. The starting MIPS assembly instruction address is 1600. Here, the variables x, sum, mul, and j are in address $S0, $S1, $S2 and $S3 respectively.
int superFunc (int array[], int size, int k)
{
int x = k, sum =0, mul =1;
while ( x < size-1)
{
int j = array[x+1];
while(j!= array[x])
{
mul *=5;
j--;
}
sum +=(mul+j);
array[x-1]= sum;
x +=2;
}
if(sum < mul )
return sum;
else
return sum + mul ;
}
a. Convert the code to the corresponding MIPS assembly instructions.
b. Convert Line number 1620 to 1648 of your assembly instructions to the corresponding machine code. No need to convert it to binary.
c. Consider an array A, whose base address is in $s3. The ISA is double word addressable that is the memory can contain double words. What will be the corresponding MIPS assembly code for loading the address of the 9th element of the array, i.e A[9], increase the value by 6 and Then store the Value to the address of the 4th element of the array, i.e A[4].

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!