Question: Implement the following C code in MIPS assembly. In other words, you must implement the recursive calls. You need to test the program for n

Implement the following C code in MIPS assembly. In other words, you must implement the recursive calls.

 Implement the following C code in MIPS assembly. In other words,

You need to test the program for n = 1, 2, 3, 5, 7, and 10 respectively. I'm adding a program down which you must use to test it. Include the results as well (output).

Test Program:

# $s7 - save $ra # $s1 - s6 - used as a temporary register # $a0 - for function parameter / syscall parameter # $v0 - syscall number / function return value .text .globl main main: addu $s7, $ra, $zero, # Save the ra la $a0, int_prompt # Display the prompt li $v0, 4 syscall li $v0, 5 # Read an integer from the user syscall bgtz $v0, positive # If the number is not positive, # we negate the number. sub $v0, $zero, $v0 positive: slti $s1, $v0, 1001 # is $v0  

Also, what is the total number of MIPS instructions needed to execute the function n = 10?

Thanks!

int my fib(int n)( if (n= 0) else if (n=-1) else return my_fib(n-1) +my fib(n-2); return 2; return 3

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!