Loads (LW, LH, LB):
Instruction | First Operand |
Second Operand | Third Operand |
Example | Action taken |
Load Byte | Dest Reg | Src Reg | Variable Name | LB R1, R2, X | R1 <- MEM[(contents of R2)+Address Offset] |
Load Halfword | Dest Reg | Src Reg | Variable Name | LH R1, R2, X | R1 <- MEM[(contents of R2)+Address Offset] |
Load Word | Dest Reg | Src Reg | Variable Name | LW R1, R2, X | R1 <- MEM[(contents of R2)+Address Offset] |
Note: Address Offset refers to the result of calculating the distance between the current location and the specified data variable.
Example:
LW R6, R7, X ; assume that the offset for X is 2A
The opcode for this instruction is 05, the source register is R7 and the destination register is R6.
opcode | source register |
destination register |
immediate value |
000101 | 00111 | 00110 | 0000000000101010 |
Regrouped, this produces:
0001 0100 1110 0110 0000 0000 0010 1010
or, 14E6002A in hexadecimal
Stores (SW, SH, SB):
Instruction | First Operand |
Second Operand | Third Operand |
Example | Action taken |
Store Byte | Dest Reg | Variable Name | Src Reg | SB R1, X, R2 | MEM[(contents of R1)+Address Offset] <- R2 |
Store Halfword | Dest Reg | Variable Name | Src Reg | SH R1, X, R2 | MEM[(contents of R1)+Address Offset] <- R2 |
Store Word | Dest Reg | Variable Name | Src Reg | SW R1, X, R2 | MEM[(contents of R1)+Address Offset] <- R2 |
Note: Address Offset refers to the result of calculating the distance between the current location and the specified data variable.
Example:
SH R4, X, R5 ; assume that the offset for X is 32
The opcode for this instruction is 07, the source register is R5 and the destination register is R4.
opcode | source register |
destination register |
immediate value |
000111 | 00101 | 00100 | 0000000000110010 |
Regrouped, this produces:
0001 1100 1010 0100 0000 0000 0011 0010
or, 1CA40032 in hexadecimal
Jump Absolute (JA, JAL):
Instruction | First Operand |
Example | Action taken |
Jump Absolute | Dest Reg (Address Register) | JA R1 | PC <- (contents of R1) |
Jump Absolute and Link | Dest Reg (Address Register) | JAL R1 | R31 <- PC, PC <- (contents of R1) |
Example:
JA R9
The opcode for this instruction is 0C and the destination register is R9. There is no source register and no immediate value.
opcode | source register |
destination register |
immediate value |
001100 | 00000 | 01001 | 0000000000000000 |
Regrouped, this produces:
0011 0000 0000 1001 0000 0000 0000 0000
or, 30090000 in hexadecimal