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.
Evaluation: Your code should be appropriately commented. 25% will be deducted if the high-level language code is not in a comment as specified above.
The output from your run should look similar to (though obviously not identical to) the Fibonacci output.
Implement a program to calculate the 2's complement of a number entered by the user. The program should only use the XOR and ADD operators. Your program should include a proper and useful prompt for input, and print the results in a meaningful manner, similar to above.
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