Question: For the following C code, what is the corresponding MIPS assembly instructions. What is the total number of MIPS instructions needed to execute the function?
For the following C code, what is the corresponding MIPS assembly instructions. What is the total number of MIPS instructions needed to execute the function?
int recFunc(int a, int b){
if (b == 0)
return a;
else
return recFunc(a+1,b-1);
Translate the following loop into C. Assume the C-level integer x is held in $t1 and integer y is held in $t2. Also, assume $s0 holds the base address of the integer Array1. The base address= 0x00000000.
LOOP: addi $t1, $0, 16
lw $s1, 0($s0)
add $s1, $s1, $t1
sw $s1, 0($s0)
addi $s0, $s0, 4
addi $t2, $t1, 100
beq $t1, $s0, END
beq $t2, $t1, END
j LOOP
END:
Rewrite the loop from exercise 2 to reduce the number of MIPS instructions executed.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
