Question: Needs to be done with MARS simulator Download link : http://courses.missouristate.edu/KenVollmar/MARS/download.htm (If text needed instead of Screenshot of the asm file let me know) fact4b.asm

Needs to be done with MARS simulator

Download link: http://courses.missouristate.edu/KenVollmar/MARS/download.htm

(If text needed instead of Screenshot of the asm file let me know)

Needs to be done with MARS simulator Download link: http://courses.missouristate.edu/KenVollmar/MARS/download.htm (If text

needed instead of Screenshot of the asm file let me know) fact4b.asm

fact4b.asm (File Screenshot)

(File Screenshot) Coding Assignment (100 points in total) Implement the Fibonacci functionin MIPS given the following C code int fib (int n) return

n; else return fib (n 1)+ fib (n - 2); Note that

this code contains two recursive calls. Be careful and save the result

of the first fib before calling it again There is only one

Coding Assignment (100 points in total) Implement the Fibonacci function in MIPS given the following C code int fib (int n) return n; else return fib (n 1)+ fib (n - 2); Note that this code contains two recursive calls. Be careful and save the result of the first fib before calling it again There is only one input, so pass n in register SaO in the main procedure The input n should be asked from the keyboard and the output should be print out by another syscall. Check Lab 5 to implement the I/O calls Templates: Assembly coding templates have been provided for the main procedure (main_template4b.asm) and for other procedures (proc_template4b.asm). To simplify the assembly coding, these templates assume the following: (i) no procedure call needs more than 4 arguments;i) any local variables are placed in registers and not created on the stack; (ii) no "temporary" registers need to be protected from a subsequent call to another procedure You may develop your code for each procedure in a separate file using the templates provided, but for this lab, all your final assembly code must be within one file; simply copy-and-paste your procedures below main. You can also choose not to use the template, and please add comment to your code to earn partial credits Factorial Example: As an example of how to use these templates to write a recursive procedure, assembly code is provided for calculating factorial in a recursive fashion, using the "4b" templates. Please carefully study the code for the main procedure as well as the recursive factorial procedure. The two procedures have been concatenated together into a single assembly file (fact4b.asm); open this file in Mars and run it step-by-step to follow the execution of the recursive procedure. Use these files as guidance to develop your code for this exercise Coding Assignment (100 points in total) Implement the Fibonacci function in MIPS given the following C code int fib (int n) return n; else return fib (n 1)+ fib (n - 2); Note that this code contains two recursive calls. Be careful and save the result of the first fib before calling it again There is only one input, so pass n in register SaO in the main procedure The input n should be asked from the keyboard and the output should be print out by another syscall. Check Lab 5 to implement the I/O calls Templates: Assembly coding templates have been provided for the main procedure (main_template4b.asm) and for other procedures (proc_template4b.asm). To simplify the assembly coding, these templates assume the following: (i) no procedure call needs more than 4 arguments;i) any local variables are placed in registers and not created on the stack; (ii) no "temporary" registers need to be protected from a subsequent call to another procedure You may develop your code for each procedure in a separate file using the templates provided, but for this lab, all your final assembly code must be within one file; simply copy-and-paste your procedures below main. You can also choose not to use the template, and please add comment to your code to earn partial credits Factorial Example: As an example of how to use these templates to write a recursive procedure, assembly code is provided for calculating factorial in a recursive fashion, using the "4b" templates. Please carefully study the code for the main procedure as well as the recursive factorial procedure. The two procedures have been concatenated together into a single assembly file (fact4b.asm); open this file in Mars and run it step-by-step to follow the execution of the recursive procedure. Use these files as guidance to develop your code for this exercise

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!