Question: addi $sp , $zero, 8 1 8 8 # Assume program stack starts at 8 1 8 8 . Do not modify. # Procedure Main
addi $sp $zero, # Assume program stack starts at Do not modify.
# Procedure Main
Main:
addi $t $zero,
addi $t $zero,
# Call Sum
move $a $t # Move argument $t to $a
move $a $t # Move argument $t to $a
jal Sum # Call Sum procedure
lw $t$sp # Load the result of Sum from the stack into $t
# Call Dif
move $a $t # Move argument $t to $a
move $a $t # Move argument $t to $a
jal Dif # Call Dif procedure
lw $t$sp # Load the result of Dif from the stack into $t
j End # Jump to End label
#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:
I NEED HELP WITH JUST THE MAIN FUNCTION AND GETTING THE CORRECT OUTPUALUE FOR EACH REGISTER. Clone of LAB: Function calls
Given the following program and the mapping of registers to variables, complete the MIPSzy implementation of Main. Do not implement
return ; in main
int Difint int b
return ;
int Sumint int b
return ;
int main
int ;
;
Dif;
return ; Do not implement
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 $ to and $ t are initialized in the simulator as:
the results are stored in $t and $t:
Note: Use the button under the Registers display to initialize register values for $t and $t
Register $ $ $ $ after initializing them
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
