Question: * * * PLEASE MAKE SURE YOU DO NOT USE OP CODES: la , li , syscall, bgtz , blez, beqz, bgez, sltz . *
PLEASE MAKE SURE YOU DO NOT USE OP CODES: la li syscall, bgtz blez, beqz, bgez, sltz AND DO NOT MANUALLY INITIALIZE THE REGISTERS $s and $s in the code. It should be initialized in the registers.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;
Registers Variables
$s a
$s b
$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
Registers Data
$s
$s
$s
The resultant registers are:
Registers Data
$s
$s
$s
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
