2.19.1 For the following problems, the table holds C code functions. Assume that the first
function listed in the table is called first. You will be asked to translate these C code
routines into MIPS assembly.
a. int fib(int n){
if (n==0)
return 0;
else if (n == 1)
return 1;
else
fib(n-1) + fib(n–2);
b. int positive(int a, int
b) {
if (addit(a,
b) > 0)
return 1;
else
return 0;
}
int addit(int a, int
b) {
return a+b;
}
[15] <2.8> Implement the C code in the table in MIPS assembly. What is
the total number of MIPS instructions needed to execute the function?
 
 
View Solution
 
 
 
<< Back Next >>