Question: 8. Write a MIPS assembly code fragment that computes (n/2)2 if n is even ((n+1)/2)2 if n is odd Assume that a0 is used for

8. Write a MIPS assembly code fragment that computes (n/2)2 if n is even ((n+1)/2)2 if n is odd Assume that a0 is used for the input argument and initially contains n, a positive integer. Assume that SvO is used for the output or return value. You may not use multiply or divide instructions for your code. Comment your code to explain the computation. Use the MARS MIPS simulator to test different values of n (at least one even and one odd positive integer) to show correctness of your code. For each n value, screen capture the program input and output (computed value) to include in your submission
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
