Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1 2 . 1 6 Zylab 5 - Recursive Procedure Call 1 2 . 1 6 Zylab 5 - Recursive Procedure Call This lab will
Zylab Recursive Procedure Call Zylab Recursive Procedure Call
This lab will be available until February rd: PM MST
Write a MIPS program using Recursive Procedure Execution to perform the following tasks: If your code runs perfectly, but you
didn't use Procedure Execution correctly, you will be given zero points.
Write the following functions in MIPS.
main
inputs: integers ab
task: Compute the integer: aFababbFbaba
recursion Fxy
inputs: integers xy
task:
FxyFxyFxy if xy
Fxyy if xy
Fxyx if yx
Fxy if xy
Following is a sample C code segment. You may modify the code for the functions, but the task performed should not be changed, ie you
should use recursive procedure calls.
int main int a int b
int result arecursionabs ababs abbrecursionabs baabs ba;
int recursion int x int y
if x && y
return ;
else if x&y
return x;should use recursive procedure calls.
int mainint a int b
int result a recursion abs ababs abb recursion abs baabs ba;
int recursionint x int y
if x && y
return ;
else if x && y
return x;
else if x & & y
returny;
else
returnrecursion xyrecursionxy;
Example Test: If the values of $ s and $$ are initialized in the simulator as:
Use the button under the Registers display to initialize register values for $$$s
The resultant registers are: $s result
Example Test: If the values of $s and $ s are initialized in the simulator as:
Use the button under the Registers display to initialize register values for $s$s
The resultant registers are:
Grading: Manual score points will be added after the deadline.
automated tests each worth points. The registers $s$s and $s will be checked by the automated tests.
Comments specifying your choice of registers and each line of your code points
Correct use of Recursive Procedure Calls points
Submission Attempts: You will have limited number of submissions ie only attempts to compare with the automated tests, but you
can run the simulator any number of times without clicking on submit for grading. Also, the first time you open the assignment, canvas will
consider it as the first attempt even if you do not click submit to canvas.
Write a MIPS program using Recursive Procedure Execution to perform the following tasks: Note: If your code runs perfectly, but you didn't use Procedure Execution correctly, you will be given zero points.
Write the following functions in MIPS.
main
inputs: integers a b
task: Compute the integer: a Fabab b Fbaba
recursion Fx y
inputs: integers x y
task:
Fx y Fx y Fx y if x y
Fx y y if x y
Fx y x if y x
Fx y if x y
Following is a sample C code segment. You may modify the code for the functions, but the task performed should not be changed, ie you should use recursive procedure calls.
int mainint a int b
int result a recursionabsab absab b recursionabsba absba;
int recursionint x int y
if x && y
return;
else if x && y
returnx;
else if x && y
returny;
else
returnrecursionx y recursionx y;
should use recursive procedure calls.
int mainint int b
int result recursion recursion ;
int recursionint int
if &&
return ;
else if &&
return ;
else if & &
returny;
else
returnrecursion recursion;
Example Test: If the values of $ s and $$ are initialized in the simulator as:
Use the button under the Registers display to initialize register values for $$$
The resultant registers are:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started