Question: *** DO NOT USE LI INSTRUCTION***** Write a MIPSzy subroutine, fact, that accepts 1 argument n and computes n! (i.e. 1x2x3 ...X(n-1)xn). You can

*** DO NOT USE "LI" INSTRUCTION*****

*** DO NOT USE "LI" INSTRUCTION***** Write a MIPSzy subroutine, fact, that

Write a MIPSzy subroutine, fact, that accepts 1 argument n and computes n! (i.e. 1x2x3 ...X(n-1)xn). You can assume that n is larger than 0. The main program passes the parameter and receives the return value through the program stack. Test your subroutine with the following program: addi $t0, $zero, 5 addi $t1,$t0, 3 sw $t0,($sp) addi $sp,$sp,4 jal fact lw $t0,($sp) addi $sp,$sp, -4 sw $t1, 0(Ssp) addi $sp,$sp, -4 jal fact lw $t1, 0($sp) addi $sp,$sp, -4 j done power: *** Put your subroutine here done: Note that your program will be tested with a main program that is like the above program but uses different registers. Make sure that your subroutine restores the values of all the registers to the that it uses to their original values before returning. Make sure that your program is clearly commented (including the test program above.) There is no

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!