(MIPS Assembly Language):
Write the following sequence of code using *native* MIPS instructions: x = x - y[0] + y[1];
In memory x, y are stored beginning at 0x010000cc. Use registers $s1 for x, and $s2 for the base address of y.
Make sure your code includes all necessary declarations such that it could run in SPIM.
Please find the answer below.
Please do comments in case of any issue. Also, don't forget to rate
the question. Thank You So Much.
# x is in s1
# base address of y is in s2
lw $t0,0($s1)#load y[0]
lw $t1,4($s1)#load y[1]
sub $t2,$s1,$t0 #get x-y[0]
add $s1,$t2,$t1 #get x-y[0]+y[1]
Get Answers For Free
Most questions answered within 1 hours.