Question: Write a MIPS program using * Recursive Procedure Execution to perform the following tasks: * Note: * If your code runs perfectly, but you didn't
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 Important: only use the opcode below Arithmetic:add, addi, div, mul, mult, sub Data transfer: lb lbu, lh lhu, lui, lw move, mfhi, mflo, sb sh sw Logical: and, andi, nor, or ori, slt slti, sltiu, sltu, sll srl Conditional branch: beq, bgt bge, blt ble, bne Unconditional jump: j jal, jr
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
