πŸ“–
The MIPS instructions set (RISC) have a fixed size for the instructions set as 32 bits. This bits are distributed in different parameters
Parameters
Op (6Bits)β†’ Operation code for the instruction
This field mostly defines the format of the instruction and a major catergory (arithmetic, logic, load, inmediate, …)
Rs (5Bits)β†’ Source 1 registry
Rt (5Bits)β†’ Source 2 registry
Rd (5Bits)β†’ Destination registry
Shamt (5Bits)β†’ Address Shift ammount
This field is used by some instructions that implement shifting any of its values
Func (6Bits)β†’ Variation of the Op instruction selected
This selects the specific operation to be performed (add, sub, addi, …)
πŸ“–
The instructions have different formats based on the task they execute. The format used by the instruciton is determined by the Op field (which is common for all three formats)

Type R (Register operations)

🟣
This type of instructions perform arithmetic and logic operations. This instructions always have 3 registers
notion image
Example
For the instruction add $1, $2, $3 (assuming thoose registes exist and its code matches its symbolic name).
  • The instruction will add the $2 and $3 values and store it in the $1 register
  • The add instruction have code 0
Binary format
  • 0x0 β†’ Code (6Bits): add (arithmetic instructions)
  • 0x2 β†’ Rs (5Bits): $2
  • 0x3 β†’ Rt (5Bits): $3
  • 0x1 β†’ Rd (5Bits): $1
  • 0x0 β†’ Shamt (5Bits)
  • 0x20 β†’ Shamt (5Bits): add

Type L/I (Load/Inmediate)

🟣
Used by instructions that perform memory load/storage and conditional jumps. The inmediate value can be used for comparations or offset value
notion image

Type J (Jump)

🟣
Used by instructions that perform unconditional jump operations
notion image
Β