Question: 1. Write and debug a MIPS program that computes factorial iteratively (not recursively). This is a MIPS program with looping. 2. You should in general

1. Write and debug a MIPS program that computes factorial iteratively (not recursively). This is a MIPS program with looping.

2. You should in general be familiar with the algorithms for calculating both Factorial and Fibonacci. You must have practiced and understood the iterative Fibonacci calculation. Attached at the end of this assignment is a practice problem in both Python and MIPS assembler. Note that it would have been possible to write the Python differently to achieve the same function.

3. Begin by writing the factorial calculation in your favorite high-level programming language and including the entire program as a comment in your MIPS program like the Python code as in the practice problem. Your high-level code must work correctly for any value from 0! upward (remember that 0! =1 by definition) for answers that will fit in 32 bits. Your high level language implementation and your MIPS implementation must use the SAME algorithm (same type of loop, same number of and location of branches, no try statements etc.) You will want to use an algorithm that will minimize the number of branches necessary to make the assembly version simpler.

4. Your code should display an error message for answers that will not fit in 32 bits.

5. If you wish, you can start with the Fibonacci practice program and modify it to complete this assignment.

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!