Question: how would this be calculated in mips? calculate ans1 = 2a - b + 9 (use a+a for 2a) and store the result calculate ans2

how would this be calculated in mips?

  • calculate ans1 = 2a - b + 9 (use a+a for 2a) and store the result
  • calculate ans2 = c - b + (a - 5) and store the result
  • calculate ans3 = (a - 3) + (b + 4) - (c + 7) and store the resul

currently have

#calculate ans1

add $s0, $t0, $t1 add $s0, $s0, $t2 sw $s0, ans1

#calculate ans2

add $s0, $t1, $t2 sub $s0, $s0, $t0 sw $s0, ans2

#calculate ans3

add $t0, $t0, 2 sub $t1, $t1, 5 sub $t2, $t2, 1 add $s0, $t0, $t1 sub $s0, $s0, $t2 sw $s0, ans3

which is very wrong

help appreciated ty

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!