Why we have addressing modes

📖
The addresing modes are used because sometimes is more efficient to not to store the operands in the instruction format. Operands can be located at:
  • Directly in the instruction (Inmmediates)
  • In a register
  • In memory

Addressing modes

Inmediate addressing (5Bits)
📖
The 3rd parameter value is an inmediate.
Example: add $1, $2, 99 → We use 99 as the 3rd parameter
Direct addressing (5Bits)
📖
The 3rd parameter value is contained in a register
Example: add $1, $2, $3 → We use the value stored at $3 as the 3rd parameter
Indirect addressing with offset (5Bits)
📖
The 3rd parameter value is the result of adding the value of the register and an offset value: offset + $register
Example: lw $1, 99($3) → We use the value at $3 + 99 as the 3rd parameter
Relative addressing (labels)
📖
The 3rd parameter value is the result of adding the value of the register and an offset value: offset + $PC
Example: bne $1, $2, MyLabel → We use a label to access an address in memory
Pseudoindirect addressing
📖
The 3rd parameter value is the result of adding the value of the register and an offset value
Example: j 9999 → We use the value 9999 to be shifted by 2 (x4)