Home / Expert Answers / Computer Science / the-answer-must-be-in-the-assembly-language-using-mips-task-3-division-the-following-mips-loop-pa423

(Solved): The answer must be in the assembly language using MIPS. Task 3: Division The following MIPS loop ...



The answer must be in the assembly language using MIPS.

Task 3: Division
The following MIPS loop computes the gcd of two numbers stored in registers \( \$ \mathbf{a} \boldsymbol{0}

Task 3: Division The following MIPS loop computes the gcd of two numbers stored in registers \( \$ \mathbf{a} \boldsymbol{0} \) and \( \$ \mathbf{\$ a 1} \). The result is computed in register \( \$ \mathbf{a} \theta \). Observe the usage of the instruction \( \mathbf{m f h i} \) ! . text .globl main main: li \( \$ a 0,30 \) \#umber a li \( \$ a 1,18 \) \# number b gcd: div \( \$ a 0, \$ a 1 \# \mathrm{HI}= \) remainder, \( \mathrm{LO}= \) quotient move \( \$ a 0, \$ a 1 \# \$ a 0= \) number \( \mathrm{b} \) mfhi \( \$ a 1 \# \$ a 1=a \) b b (remainder) bnez sal, gcd \# loop if (b != 0) li \( \$ v 0,10 \) syscall Modify the above program by asking the user to enter two integers, compute the gcd then display the result.


We have an Answer from Expert

View Expert Answer

Expert Answer


# Here is the MIPS program to read two integers from user, and then to display the GCD result .data prompt1: .asciiz "Enter first number: " prompt2: .
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe