Abstract


+--------+------+------+------+------+------+
| Opcode |  Rs  |  Rt  |  Rd  | Shamt| Funct|
| 6 bits |5 bits|5 bits|5 bits|5 bits|6 bits|
+--------+------+------+------+------+------+
  • Opcode is always 000000
  • funct combined with opcode exactly specifies the instruction
  • rs specifies register containing first operand
  • rt specifies register containing second operand. Set to 0 for shift instructions
  • rd specifies register which will receive result of computation
  • shamt for sll and srl. Set to 0 for non-shift instructions

2 types of instructions

  1. arith $rd, $rs, $rt
  2. shift $rd, $rt, shamt

Important

R format instructions has only registers as Instruction Operand except the shift instructions.

Function Code

Examples


srl

  • Shift Right Logical
  • Source Register is 0
  • Shifts the value right by n bits, discarding the lower n bits
  • Dividing the value in register $s0 by 16 (2^4) - srl $s0, $s0, 4

Terminologies


Destination Register