這個是題目
For the following C statement, what is the corresponding MIPS assembly code?
Assume that the variables f, g, h, i, and j
are assigned to registers $s0, $s1, $s2, $s3, and $s4, respectively.
Assume that the base address of the arrays A and B are in registers $s6 and
$7, respectively.
B[8] = A[i–j];
然後我在網路上找的答案說
sub $t0, $s3, $s4 # $t0 = i-j
sll $t0, $t0, 2 # $t0 = (i-j) * 4
lw $t1, 0($s6) # $t1 = A[0]
add $t1, $t1, $t0 # $t1 = &A[i-j] <