Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Convert the following program into MIPS Code. Assume Leah, Jenna, Andrew, and Ha

ID: 3933951 • Letter: C

Question

Convert the following program into MIPS Code. Assume Leah, Jenna, Andrew, and HaHey ($t0, $t1, $t2, $t_3, respectively) are all variables holding integer cost representing an amount of money. Assume Cookies and Candy ($td and $t5, respectively) are also Integer values representing the cost of each item. Finally Total Money and AverageMoney ($s0 and $s1, respectively) are also integer values representing values. To divide, use the "Shift Right Logical' Instruction. Jenna = Jenna - (Cookies + Candy); TotalMoney = Leah + Jenna + Andrew + Halley; AverageMoney = TotalMoney/4;

Explanation / Answer

add $s0, $t4, $t5                  #s0 = cookies + candy
sub $t1, $t1, $s0                  #update jenny, by subtracting s0
add $s0, St0, $t1                #calculating totalmoney, by adding to s0
add $s0, $s0, $t2
add $s0, $s0, $t3          
slr $s1, Ss0, 2                      #calculating average money