Cole J
Cole J

Reputation: 19

Size of Offset for MIPS load word instruction

100011 10011 01010 1111111111101100 OP base rt offset

The above machine code translates to a load word MIPS instruction of lw $t2,?($s3)

Can the the offset be 65516, which is the decimal value of the binary offset? Is there a maximum offset number?

Upvotes: 0

Views: 1365

Answers (1)

Chris Dodd
Chris Dodd

Reputation: 126243

The offset field in the I format instructions is a 16-bit signed1 (2s complement) value, so it can be any value in the range -32768...32767. In your example, the binary value 1111111111101100 is -20


1It's signed for most instructions -- including all the load and store instructions. It is unsigned for logical instructions (andi/ori/xori) where it is a mask value rather than an offset

Upvotes: 1

Related Questions