Question

Prompt: Write a code in MARS MIPS that uses a stack to recursively compute the series...

Prompt: Write a code in MARS MIPS that uses a stack to recursively compute the series from 1 to 10.

Homework Answers

Answer #1

Greetings!!

Code:

main:
addi $a0,$0,1       #arguement set in register a0

jal series       #call function

addi $v0,$0,10       #termination parameter
syscall

series:
beq $a0,11,done       #check upper limit
addi $v0,$0,1       #parameter for display number
syscall           #display
addi $a0,$a0,1       #increment number
jal series       #recursive call to the function
done:
jr $ra

Output screenshot:

Hope this helps

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
In MIPS/MARS 1)Write a program that prints your name in a Triangle.
In MIPS/MARS 1)Write a program that prints your name in a Triangle.
C++ code: How to add a file to read/write to a code that prompt user to...
C++ code: How to add a file to read/write to a code that prompt user to add (write) infos and read infos from the file?
Write a piece of R code to compute the following series: em = 1 + 0.8...
Write a piece of R code to compute the following series: em = 1 + 0.8 (1*80%) + 0.64 (0.8*80%) + 0.512 (0.64*80%) + … em = function(n, r = 0.8){ Body of code }
(MIPS Assembly Language): Write the following sequence of code using *native* MIPS instructions: x = x...
(MIPS Assembly Language): Write the following sequence of code using *native* MIPS instructions: x = x - y[0] + y[1]; In memory x, y are stored beginning at 0x010000cc. Use registers $s1 for x,  and $s2 for the base address of y. Make sure your code includes all necessary declarations such that it could run in SPIM.
Without using move or li, write MIPS assembly language using MARS simulator to print a half...
Without using move or li, write MIPS assembly language using MARS simulator to print a half pyramid depending on a value n of a user input. Such that if n = 5 were entered the following would be printed: 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5
In MIPS assembly, write an assembly language version of the following C code segment: int A[100],...
In MIPS assembly, write an assembly language version of the following C code segment: int A[100], B[100]; for (i=1; i < 100; i++) { A[i] = A[i-1] + B[i]; }
Loop unroll the following MIPS code loop 4 times. Write the resulting code including any re-ordering...
Loop unroll the following MIPS code loop 4 times. Write the resulting code including any re-ordering necessary for maximum performance. loop: sw $zero, 0($s0) addi $s0, $s0, -4 bne $s0, $zero, loop
Write the MIPS assembly code that creates the 32-bit constant 0010 0000 0000 0001 0100 1001...
Write the MIPS assembly code that creates the 32-bit constant 0010 0000 0000 0001 0100 1001 0010 0100two and stores that value to register $t1, and print the value of $t1 to stdout in binary - i.e., as a 32 bit sequence of '1's and '0's (use the MIPS syscall functionality for I/O).
write a java code. Write a program using loops to compute the sum of the 30...
write a java code. Write a program using loops to compute the sum of the 30 terms of the series below. 91/(3 + 2 + 2) + 92/(4 - 4 + 5) + 93/(5 + 6 - 8) + 94/(6 - 8 + 11) + 95/(7 + 10 + 14) + 96/(8 - 12 - 17) + . . . . Output: Term Ratio Sum 1 13 13 2 18.4 31.4 etc etc
Write and test code in MIPS assembly language program to implement algorithms "The Non-Restoring Algorithm "of...
Write and test code in MIPS assembly language program to implement algorithms "The Non-Restoring Algorithm "of an 8-bit integer the user shoud insert the number then by the algo well find the square root