This exercise deals with recursive procedure calls. For the following problems, the table has an assembly code

Question:

This exercise deals with recursive procedure calls. For the following problems, the table has an assembly code fragment that computes the factorial of a number. However, the entries in the table have errors, and you will be asked to ix these errors. For number n, factorial of n = 1 x 2 x 3 x .. .. x n.a. FACT: sw sw addi $ra, 4($sp) $a0, 0($sp) $sp, $sp, -8 slti $t0, $a0, 1 $t0, $0. Ll $v0, $0, 1 $sp. $sp, 8b. FACT: addi $sp, $sp, 8. sw sw $ra, 4($sp) $a0, 0($sp) add $50, $0, $a0 slti $t0, $a0, 2 beq $t0, $0, L1

The MIPS assembly program above computes the factorial of a given input. The integer input is passed through register $a0, and the result is returned in register $v0. In the assembly code, there are a few errors. Correct the MIPS errors.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Computer Organization And Design The Hardware Software Interface

ISBN: 9780123747501

4th Revised Edition

Authors: David A. Patterson, John L. Hennessy

Question Posted: