Question: Can someone please help me fix my code the code is what is within main Given the following C program and the mapping of registers
Can someone please help me fix my code
the code is what is within main
Given the following C program and the mapping of registers to variables, complete the MIPSzy implementation of Main. Do not implement return ; in main
int Difint a int b return a b; int Sumint a int b return a b; int main int x y; w Sumx y; z Dify x; return ; Do not implement
RegistersVariables$tx$ty$tw$tz
Hints: Use program stack to pass arguments, return values, and preserve saved registers. Remember to pop the stack after each function returns.
Ex: If the values of $t and $t are initialized in the simulator as:
RegistersData$t$t
the results are stored in $t and $t:
RegistersData$t$t$t$t
Note: Use the button under the Registers display to initialize register values for $t and $t
addi $sp $zero, # Assume program stack starts at Do not modify.
# Procedure Main
Main:
# Type your code here.
addi $sp $sp
sw $t$sp
sw $t$sp
jal Sum
addi $sp $sp
addi $sp $sp
sw $t$sp
sw $t$sp
jal Dif
lw $t$sp
addi $sp $sp
j End
# Procedure Sum Do not modify
Sum:
lw $t$sp
lw $t$sp
add $t $t $t
sw $t$sp
jr $ra
# Procedure Dif Do not modify
Dif:
lw $t$sp
lw $t$sp
sub $t $t $t
sw $t$sp
jr $ra
End: Initial storage
Resulting storage
Yours
Graded
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
