Question: Write and debug a MIPS program that computes factorial of a given number iteratively (not recursively). This is a MIPS program with looping. Instructions and
Write and debug a MIPS program that computes factorial of a given number iteratively (not recursively). This is a MIPS program with looping.
Instructions and Hints: 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 have the same prompts to the user and output format and 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. Do not consult code available online for this problem, other than the high level algorithm you should write your assembly code using only your knowledge of MIPS for register/memory manipulation.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
