Convert the following program into MIPS Code Assume Leah Jen

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;

Solution

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

 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

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site