I'm probably missing something really obvious here, but I've been going over this over and over and I'm decidedly stuck. In the code below, $8
is incremented only if $2 != $0
. Now I double and triple checked and the beq
instruction works (for example if I change lop to end2, it does go there).
However, for some reason, $8
is incremented regardless, even if the branch is executed.
lop: beq $3, $0, end2
and $2, $3, $4
sll $3, $3, 1
beq $2, $0, lop
addi $8, $8, 1
j lop
I've got to admit I'm completely stumped.