Adapted from this unattributed source, with
help from some
others.
Arithmetic and Logical Instructions
Instruction | Type | Opcode/Function | Syntax | Operation |
add | R | 000000 / 100000 | add $d, $s, $t | $d = $s + $t |
addu | R | 000000 / 100001 | addu $d, $s, $t | $d = $s + $t |
addi | I | 001000 / - | addi $d, $s, i | $d = $s + SE(i) |
addiu | I | 001001 / - | addiu $d, $s, i | $d = $s + SE(i) |
and | R | 000000 / 100100 | and $d, $s, $t | $d = $s & $t |
andi | I | 001100 / - | andi $d, $s, i | $t = $s & ZE(i) |
div | R | 000000 / 011010 | div $s, $t | lo = $s / $t; hi = $s % $t |
divu | R | 000000 / 011011 | divu $s, $t | lo = $s / $t; hi = $s % $t |
mult | R | 000000 / 011000 | mult $s, $t | hi:lo = $s * $t |
multu | R | 000000 / 011001 | multu $s, $t | hi:lo = $s * $t |
nor | R | 000000 / 100111 | nor $d, $s, $t | $d = ~($s | $t) |
or | R | 000000 / 100101 | or $d, $s, $t | $d = $s | $t |
ori | I | 001101 / - | ori $d, $s, i | $t = $s | ZE(i) |
sll | R | 000000 / 000000 | sll $d, $t, a | $d = $t << a |
sllv | R | 000000 / 000100 | sllv $d, $t, $s | $d = $t << $s |
sra | R | 000000 / 000011 | sra $d, $t, a | $d = $t >> a |
srav | R | 000000 / 000111 | srav $d, $t, $s | $d = $t >> $s |
srl | R | 000000 / 000010 | srl $d, $t, a | $d = $t >>> a |
srlv | R | 000000 / 000110 | srlv $d, $t, $s | $d = $t >>> $s |
sub | R | 000000 / 100010 | sub $d, $s, $t | $d = $s - $t |
subu | R | 000000 / 100011 | subu $d, $s, $t | $d = $s - $t |
xor | R | 000000 / 100110 | xor $d, $s, $t | $d = $s ^ $t |
xori | I | 001110 / - | xori $d, $s, i | $d = $s ^ ZE(i) |
Comparison Instructions
Instruction | Type | Opcode/Function | Syntax | Operation |
slt | R | 000000 / 101010 | slt $d, $s, $t | $d = ($s < $t) |
sltu | R | 000000 / 101001 | sltu $d, $s, $t | $d = ($s < $t) |
slti | I | 001010 / - | slti $d, $s, i | $t = ($s < SE(i)) |
sltiu | I | 001011 / - | sltiu $d, $s, i | $t = ($s < SE(i)) |
Branch Instructions
Instruction | Type | Opcode/Function | Syntax | Operation |
beq | I | 000100 / - | beq $s, $t, label | if ($s == $t) pc += i << 2 |
bgtz | I | 000111 / - | bgtz $s, label | if ($s > 0) pc += i << 2 |
blez | I | 000110 / - | blez $s, label | if ($s <= 0) pc += i << 2 |
bne | I | 000101 / - | bne $s, $t, label | if ($s != $t) pc += i << 2 |
Jump Instructions
Instruction | Type | Opcode/Function | Syntax | Operation |
j | J | 000010 / - | o label | pc += i << 2 |
jal | J | 000011 / - | o label | $31 = pc; pc += i << 2 |
jr | R | 000000 / 001000 | o labelR | pc = $s |
jalr | R | 000000 / 001001 | o labelR | $31 = pc; pc = $s |
Load Instructions
Instruction | Type | Opcode/Function | Syntax | Operation |
lw | I | 100011 / - | lw $t, i ($s) | $t = MEM [$s + i]:4 |
lb | I | 100000 / - | lb $t, i ($s) | $t = SE (MEM [$s + i]:1) |
lbu | I | 100100 / - | lbu $t, i ($s) | $t = ZE (MEM [$s + i]:1) |
Store Instructions
Instruction | Type | Opcode/Function | Syntax | Operation |
sw | I | 101011 / - | sw $t, i ($s) | MEM [$s + i]:4 = $t |
sb | I | 101000 / - | sb $t, i ($s) | MEM [$s + i]:1 = LB ($t) |
Data Movement Instructions
Instruction | Type | Opcode/Function | Syntax | Operation |
mfhi | R | 000000 / 010000 | mfhi $d | $d = hi |
mflo | R | 000000 / 010010 | mflmflo $d | $d = lo |