When MIPS instructions are classified according to coding format, they fall into four categories: R-type, I-type, J-type, and coprocessor. The coprocessor instructions are not considered here.
The classification below refines the classification according to coding format, taking into account the way that the various instruction fields are used in the instruction. The details of the execution activities and the required control signal values depend almost entirely on the instruction type in this classification.
In the remainder of this web page, the instruction fetch and instruction decode activities are omitted since they are the same for all instructions. The PC update activity only shows updates beyond the standard PC increment (PC ← PC + 4).
The summary at the end of this presentation is available as a PDF document here.
Non-jump R-type instructions include all R-type instructions except
jr
and jalr
.
This includes all of the integer arithmetic and bitwise operations,
along with the non-branching compare instructions such as slt, sgt,
and seq.
They use the R coding format.
The opcode bits are all 0.
There is no update beyond the normal increment.
The two source operands are rs and rt.
The ALU operation is determined by the function field.
There is no memory access for data.
The result from the ALU is written to rd.
Most immediate operand instructions perform arithmetic or logical operations using one operand that is coded into the instruction. The immediate operand group also includes the comparison instructions slti and sltiu and the lui instruction. Immediate operand instructions use the I coding format.
There is no update beyond the normal increment.
The two source operands are rs and the immediate field. For all instructions except sltiu the immediate field is sign extended. For sltiu the immediate field is zero extended. This instruction is not considered in Patterson and Hennessey.
The ALU operation is determined by the opcode.
There is no memory access for data.
The result from the ALU is written to rt.
Branch instructions conditionally branch to an address whose distance is coded into the instruction. Branch instructions use the I coding format.
If the branch condition is true (see ALU operation),
PC ← PC + 4 + (sign-extended immediate field)<<2.
The two source operands are rs and rt.
The source operands are subtracted for comparison.
There is no memory access for data.
There is no register write.
Load instructions move data from memory into a register. The address for the load is the sum of a register specified in the instruction and a constant value that is coded into the instruction. Load instructions use the I coding format.
There is no update beyond the normal increment.
The two source operands are rs and the sign extended immediate field.
The two source operands are added to get the memory address.
A memory read control signal is sent to memory. The result from the ALU is sent to memory as the address.
The data from memory is written to rt.
Store instructions move data from a register into memory. The address for the store is the sum of a register specified in the instruction and a constant value that is coded into the instruction. Store instructions use the I coding format.
There is no update beyond the normal increment.
The two source operands are rs and the sign extended immediate field. The rt register is also fetched.
The two source operands are added to get the memory address.
A memory write control signal is sent to memory. The result from the ALU is sent to memory as the address. The contents of rt are sent to memory as the write data.
There is no register write.
The only non-register jump instructions are j
and
jal
.
Non-register jump instructions use the J coding format.
jr and jalr : |
PC ← target address |
The target address is the concatenation of the high order 4 bits of PC + 4, the target field of the instruction, and two 0 bits.
There is no source operand fetch.
There is no ALU operation.
There is no memory access for data.
j: | There is no register write. |
jal: | $ra ← PC + 4 |
The only register jump instructions are jr
and
jalr
.
Register jump instructions use the R coding format.
The opcode bits are all 0.
jr and jalr : |
PC ← rs |
The only source operand that is used is the rs register.
There is no ALU operation.
There is no memory access for data.
jr : |
There is no register write. |
jalr : |
rd ← PC + 4 |