我的 z 变量 (mips) 有问题

Trouble with my z variable (mips)

我正在参加 class 我们学习 mips 的课程,但我有点迷茫。

我应该: 将内存位置 a、b 和 c 中的值相加;然后从你的小计中减去 d 中的值并将答案放入内存位置 z.

但是当我 assemble 我的代码时,我的 z 号码总是出错。

.data 

a: .word 1
b: .word 2
c: .word 2
d: .word 1
z: .word 1

.text

lw $s0, a
lw $s1, b
lw $s2, c
lw $s3, d


add $s2, $s0, $s1
add $s4, $s2, $s3

sub $s5, $s3, $s4

sw $s5, z

我不确定我做错了什么。有人能把我推向正确的方向吗? 这是我的结果:

a should be 16 and is 16
b should be 7 and is 7
c should be 5 and is 5
d should be 15 and is 15
z should be 13 and is -23
add $s2, $s0, $s1

通过这样做,您将覆盖在 s2 中加载的 c 的值!

要么将此计算的结果存储在 s0s1 中,要么在需要时才加载 c