Question: I'm writing a factorial method in MIPS Assembly and my method loops infinitely. Can someone help explain why or how to solve? If you need,

I'm writing a factorial method in MIPS Assembly and my method loops infinitely. Can someone help explain why or how to solve? If you need, I can add the rest of the code.

It seems like the problem is where I have my "j loop" but I'm still learning the language and I don't understand. Thank you!

factorial: #compute the factorial of a number li $t0, 1 move $s1, $a0 # set i to n loop: blez $s1, exit # exist if done mul $t0, $t0, $t2 addi $s0, $s0, -1 #i-- j loop exit: move $v0, $t0 jr $ra

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!