Question: Using Mips and SPIM: Write a main program that prompts the user to enter a decimal integer between 1 and 12, inclusive. The main program

Using MipsUsing Mips and SPIM: Write a main program that prompts the user and SPIM:

Write a main program that prompts the user to enter a decimal integer between 1 and 12, inclusive. The main program should call a recursive function (recurse) and pass the integer as an argument to the function. The recursive function accepts a single positive integer as an input argument and is defined as recurse(n)-1 if n-o recurse(n)-nrecurse(n-1)1 if n >O In addition, the recursive function should print an entry message each time that the function is entered and an exit message upon each return from the recursive function The entry message should consist of 2n spaces (where n is the function argument), followed by "Recursing", followed by the decimal value of the argument n. The exit message should consist of 2n spaces, followed by "Returning", followed by the decimal value of the returned result. While you don't need to completely follow the MIPS procedure call conventions, you should at least save and restore any registers that are modified in your procedure and are designated as "preserved across a call" on the MIPS greern card Make sure that you include a comment block at the head of the source file that specifies your name and explains the purpose of the program. Also comment the code to make it easier to read and follow the program logic. After you have written and tested your program using the SPIM simulator, submit a text-only version of the source code with a.s file extension Write a main program that prompts the user to enter a decimal integer between 1 and 12, inclusive. The main program should call a recursive function (recurse) and pass the integer as an argument to the function. The recursive function accepts a single positive integer as an input argument and is defined as recurse(n)-1 if n-o recurse(n)-nrecurse(n-1)1 if n >O In addition, the recursive function should print an entry message each time that the function is entered and an exit message upon each return from the recursive function The entry message should consist of 2n spaces (where n is the function argument), followed by "Recursing", followed by the decimal value of the argument n. The exit message should consist of 2n spaces, followed by "Returning", followed by the decimal value of the returned result. While you don't need to completely follow the MIPS procedure call conventions, you should at least save and restore any registers that are modified in your procedure and are designated as "preserved across a call" on the MIPS greern card Make sure that you include a comment block at the head of the source file that specifies your name and explains the purpose of the program. Also comment the code to make it easier to read and follow the program logic. After you have written and tested your program using the SPIM simulator, submit a text-only version of the source code with a.s file extension

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!