Question
Write a MIPS program called recurse.s that computes f(N), where N is an integer greater than zero that is input to the program. f(N) =
Write a MIPS program called recurse.s that computes f(N), where N is an integer greater than zero that is input to the program. f(N) = 3*(N-1)+f(N-1)+1. The base case is f(0)=2. Your code must be recursive, and it must follow proper MIPS calling conventions. The key aspect of this program is to teach you how to obey calling conventions; code that is not recursive or that does not follow MIPS calling conventions will be severely penalized (-75% penalty)! Your program should prompt the user for the value of N via the console and receive input from the user via the console using syscalls.
Note: the calling conventions must be followed in every function, including main! Your main function should return (jr $ra) when finished rather than using the exit syscall. Caller- and callee-saved registers should be saved as needed at the appropriate times. There should be no data sharing via registers between functions other than $a for arguments and $v for return values.
You will upload recurse.s into Sakai (via Assignments). The following tests cases are provided:
Test # | Input | Expected output file | What is tested |
0 | 1 | recurse_expected_0.txt | input of 1 |
1 | 2 | recurse_expected_1.txt | recursion of 2 |
2 | 3 | recurse_expected_2.txt | deeper recursion |
3 | 4 | recurse_expected_3.txt | even more recursion |
Please I need help with my homework and this has to be in MIPS language. Thank you
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started