Question: Convert the high level language conditional instructions to MIPS assembly: if (i == j) f = g + h; else f = g - h;
Convert the high level language conditional instructions to MIPS assembly:
if (i == j)
f = g + h;
else
f = g - h;
Let:
$s3 contain the value of i
$s4 contain the value of j
$s1 contain the value of g
$s2 contain the value of h
| A. | bne $s3, $s4, Exit
add $s0, $s1, $s2 j Exit Else: sub $s0, $s1, $s2 Exit: | |
| B. | bne $s3, $s4, Else
add $s0, $s3, $s4 j Exit Else: sub $s0, $s3, $s4 Exit: | |
| C. | bne $s3, $s4, Else
add $s0, $s1, $s2 Else: sub $s0, $s1, $s2
| |
| D. | bne $s3, $s4, Else
add $s0, $s1, $s2 j Exit Else: sub $s0, $s1, $s2 Exit: |

Convert the high level language conditional instructions to MIPS assembly: f=g+h; else =g-h; Let: . $s3 contain the value of i $$4 contain the value of j . $s1 contain the value of g . $s2 contain the value of h bne $s3, $s4, Exit add $s0, $s1, $s2 j Exit Else: sub $s0, $s1, $s2 Exit: bne $s3, $s4, Else add $s0, $s3, $S4 j Exit Else: sub $s0, $s3, $s4 Exit bne $s3, $s4, Else add $s0, $s1, $s2 Else: sub $s0, $s1, $s2 bne $s3, $s4, Else add $s0, $s1, $s2 j Exit Else: sub $s0, $s1, $s2 Exit
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
