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:

31-26 25-21 20-16 15-11 10-6 5-0
opcode (000000) rs rt rd shamt funct

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):

31-26 25-21 20-16 15-0
opcode rs rt immed.

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):

31-26 25-21 20-16 15-0
opcode rs rt address

rs = address base register; rt = source (store) or destination(load)  location in register file; immed. = offset address

I-Type Instruction Format (Branch):

31-26 25-21 20-16 15-0
opcode rs rt address

rs = operand A for conditional branch; rt = operand B for conditional branch; immed. = offset address for branch

J-Type Instruction Format (Jump):

31-26 25-0
opcode target

target = destination location for jump operation