Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle9i Database Administration

Authors: Sam R. Alapati

1st Edition

1590590228, 978-1590590225

More Books

Students also viewed these Databases questions