This section will translate the following addi instruction to machine code.
addi $s2, $t8, 37
The MIPS Greensheet specifies the
addi instruction as an I-format instruction and the op- code/function for the
addi as 8 (note that there is no function for an I-format instruction). This means the 6 bits for the op code are 001000.
Register Rt is
$s2 is also register
Register Rs is
$t8 is also register
The immediate value is 37, or
The Result is the following I-format instruction.
To write this instruction's machine code, the bits are organized in groups of 4, and hex values given. This results in the number 0010 0011 0001 0010 0000 0000 0010 01012 or 0x23120025.
When translating the I-format instruction, be careful to remember that Rt is destination register.