MIPS The instruction addi 5 0 1 What is the output of the si
MIPS
The instruction addi $5, $0, -1. What is the output of the sign-extend?
Solution
addi $5,$0,-1
The immediate operand of this instruction is 16 bits (as are all MIPS immediate operands). However, when extended to a 32-bit operand by the ALU it is sign extended: The value of the left-most bit of the immediate operand (bit 15) is copied to all bits to the left (into the high-order bits). So if the 16-bit immediate operand is a 16-bit two\'s complement negative integer, the 32-bit ALU operand is a 32-bit version of the same negative integer. The left-most bit of a two\'s complement integer is sometimes called the \"sign bit\".
The immediate operand -1 is sign-extended to 32 bits then added to a 32-bit zero. The sum (-1) can be loaded into $5 .
