Question: MIPS PROGRAMMING A famous example of a recursive function is Ackermanns function A(x, y): if x = 0 then y+1 else if y = 0

MIPS PROGRAMMING

A famous example of a recursive function is Ackermanns function A(x, y):

if x = 0 then y+1

else if y = 0 then A(x-1, 1)

else A(x-1, A(x, y-1))

Perform this in MIPS

Create a program named lab7.1.asm which (10 points)

in main prompts the user to enter two non-negative integers; store them in $t0 and $t1

check if any of the numbers entered is negative: if it is negative, then print a message saying so and prompt the user again for numbers

call the procedure named Ackermann whose parameters will be the integers read from the user, and which returns the value of the Ackermanns function for those two integers

pass the parameters in registers

prints a message and the value returned by Ackermann

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!