go to previous page   go to home page   go to next page hear noise

After the instruction ori $8,$0,0x2 executes, what is in $8?

Answer:

The 16-bit 0x2 immediate operand has been zero-extended and copied into register $8.


OR Immediate Instruction

Because the OR operation was done with the zeros in register $0, the result was a copy of the zero-extended immediate operand. Copying a bit pattern into a register is usually called loading the register. Register $8 was loaded with a 32-bit pattern. The pattern could represent a positive two. If so, register $8 was loaded with positive two. Here is a description of the ori instruction when used to load a register:

ori  d,$0,const    # register d <-- const.
                   # const is 16-bits, so
                   # 0x0000 ... const ... 0xFFFF

If const represents an integer, then 0 ≤ const ≤ 65535. The three operands of the assembly instruction d, $0, and const must appear in that order.


QUESTION 4:

Can the immediate operand of an ori be regarded as a signed integer?