Question: 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
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.
For each function call, show the contents of the stack after the function call is made. Assume the stack pointer is originally at address 0x7ffffffc, and follow the register conventions as speciied in Figure 2.11.
a. b. int fib(int n) { if (n=-0) int return 0; else if (n = 1) return 1; else fib(n-1) + fib(n-2); positive(int if (addit(a, b) > 0) return 1; else return 0; } int addit(int a, int b) { return a+b; } a, int b) {
Step by Step Solution
3.47 Rating (157 Votes )
There are 3 Steps involved in it
In MIPS assembly language its important to understand the function call conventions which include using the stack to pass arguments save the return ad... View full answer
Get step-by-step solutions from verified subject matter experts
