is it possible to add -1 value in add instruction in MIPS32

52 views Asked by At

is it this instruction is correct Using SPIM ?

add $t1,$zero,-1

after run program the $t1 is fill by "ffffffff"

1

There are 1 answers

1
Zack On

You want addi instead of add

addi $t1, $zero, -1

The addi instruction sign-extends the 16-bit immediate, so it should place 0xffffffff in $t1.