MIPS R2000 Instruction Types
All instructions in the MIPS R2000 Architecture are 32 bits in length. There are three different instruction formats: R-Type instructions, I-Type instructions, and J-Type instructions. R-Type instructions, or Register instructions are used for register based ALU operations. The two operands and the destination of the result are specified by locations in the register file. I-Type instructions, or Immediate instructions, can be either Load/Store operations, Branch operations, or Immediate ALU operations. In these instructions, one two register file locations are specified as well as a 16-bit immediate value which may be used as an operand or an address. J-Type instructions, or Jump instructions, devote all of the non-opcode space to a 26-bit jump destination field. The rs and rt register addresses, which are present in both R- and I-type instructions, specify the two addresses which the register file is to read. In R-Type instructions the destination (write) register for the register file is specifies by rd and in I-Type instructions the destination register is specified by rt (the second read from the register file is ignored).
An R-Type instruction contains 6 fields: a 6 bit function code (funct), a 5 bit shift amount (shamt), three 5 bit register addresses (rd, rt, rs), and a 6 bit operation code (opcode) which is always zero.
An I-Type instruction contains 4 fields: a 16 bit immediate field (immed. or address), two 5 bit register addresses (rt, rs) and a 6 bit operation code (opcode).
A J-Type instruction contains 2 fields: a 26 bit jump destination (target) and a 6 bit operation code (opcode).
R-Type Instruction Format:
rs = operand A location in register file; rt = operand B location in register file; rd = result destination location in register file; shamt = shift amount; funct = function code
I-Type Instruction Format (ALU immediate):
rs = operand A location in register file; rt = result destination location in register file; immed. = operand B location in register file
I-Type Instruction Format (Load or Store):
rs = address base register; rt = source (store) or destination(load) location in register file; immed. = offset address
I-Type Instruction Format (Branch):
rs = operand A for conditional branch; rt = operand B for conditional branch; immed. = offset address for branch
J-Type Instruction Format (Jump):
target = destination location for jump operation