add | |
---|---|
Description | Place the sum of register1 and register2 into register0 |
Syntax | add register0, register1, register2 |
Example | add $t0, $t1, $t2 |
Example implies | $t0 = $t1 + $t2 |
addi | |
---|---|
Description | Place the sum of register1 and value into register0 |
Syntax | addi register0, register1, value |
Example | addi $t0, $t1, 42 |
Example implies | $t0 = $t1 + 42 |
Range of value | -32,768 to 32,767 |
and | |
---|---|
Description | Place the logical AND of register1 and register2 into register0 |
Syntax | and register0, register1, register2 |
Example | and $t0, $t1, $t2 |
Example implies | $t0 = binary bitwise ($t1 AND $t2) |
andi | |
---|---|
Description | Place the logical AND of register1 and value into register0 |
Syntax | andi register0, register1, value |
Example | andi $t0, $t0, 42 |
Example implies | $t0 = binary bitwise ($t0 AND 42) |
Range of value | 0 to 65,535 |
beq | |
---|---|
Description | Branch (jump to) label if register0 equals register1 |
Syntax | beq register0, register1, label |
Example | beq $t0, $t1, end |
Example implies | Jump straight to "end:" if $t0 = $t1 |
bne | |
---|---|
Description | Branch (jump to) label if register0 does NOT equal register1 |
Syntax | bne register0, register1, label |
Example | bne $t0, $t1, end |
Example implies | Jump straight to "end:" if $t0 != $t1 |
j | |
---|---|
Description | Jump unconditionally to the instruction at the named label |
Syntax | j label |
Example | j end |
Example implies | jump straight to label "end:" |
jal | |
---|---|
Description | Jump straight to the instruction at the named label, and save the address of the next instruction (after jal) in $ra |
Syntax | jal label |
Example | jal subroutine1 |
Example implies | Jump to "subroutine1:", storing following instruction's address in $ra |
jr | |
---|---|
Description | Jump straight to the instruction whose address is in register0 |
Syntax | jr register0 |
Example | jr $t0 |
Example implies | Jump to the instruction stored in $t0 |
lb | |
---|---|
Description | Load byte currently in memory to register |
Syntax | lb register0, offset(register1) |
Example | lb $t0, 44($s0) |
Example implies | $t0 = memory contents of address ($s0 + 44 bytes) |
Range of offset | -32,768 to 32767 |
lui | |
---|---|
Description | Load value into the upper halfword of register0, setting lower bits to 0 |
Syntax | lui register0, value |
Example | lui $t0, 65535 |
Example implies | Load "ffff" into the upper of $t0 |
Range of value | 0 to 65,535 |
lw | |
---|---|
Description | load word from memory into a register address |
Syntax | lw register0, offset, register1 |
Example | lw $t0, 16($s0) |
Example implies | $t0 = memory contents of ($s0 + 16 bytes) |
Range of offset | -32,768 to 32,767 |
nop | |
---|---|
Description | Do nothing (useful for aligning programs in memory with external examples) |
Syntax | nop |
Example | nop |
Example implies | No operation performed |
nor | |
---|---|
Description | Place the logical NOT OR of register1 and register2 into register0 |
Syntax | nor register0, register1, register2 |
Example | nor $t0, $zero, $t1 |
Example implies | $t0 = NOT ($zero OR $t1) |
or | |
---|---|
Description | Place the logical OR of register1 and register2 into register0 |
Syntax | or register0, register1, register2 |
Example | or $t0, $t1, $t2 |
Example implies | $t0 = binary bitwise ($t1 OR $t2) |
ori | |
---|---|
Description | Place the logical OR of register1 and value into register0 |
Syntax | ori register0, register1, value |
Example | ori $t0, $s0, 64000 |
Example implies | $t0 = binary bitwise ($s0 OR 64000) |
Range of value | 0 to 65,535 |
sb | |
---|---|
Description | Save byte currently in register to memory |
Syntax | sb register0, offset(register1) |
Example | sb $t0, 44($s0) |
Example implies | Memory contents of address ($s0 + 44 bytes) = $t0 |
Range of offset | -32,768 to 32767 |
sll | |
---|---|
Description | Shift the bits in register1 to the left by value places, and put result into register0 |
Syntax | sll register0, register1, value |
Example | sll $t0, $t1, 4 |
Example implies | $t0 = bits in $t1 shifted 4 places to left |
Range of value | 0 to 31 |
slt | |
---|---|
Description | Set register0 to 1 if register1 is less than register2 |
Syntax | slt register0, register1, register2 |
Example | slt $t0, $t1, $t2 |
Example implies | $t0 will hold 1 if $t1 is less than $t2; otherwise $t0 is set to 0 |
srl | |
---|---|
Description | Shift the bits in register1 to the right by value places, and put result into register0 |
Syntax | srl register0, register1, value |
Example | srl $t0, $t1, 4 |
Example implies | $t0 = bits in $t1 shifted 4 places to right |
Range of value | 0 to 31 |
sub | |
---|---|
Description | Place the result of register1 minus register2 into register0 |
Syntax | sub register0, register1, register2 |
Example | sub $t0, $t1, $t2 |
Example implies | $t0 = $t1 - $t2 |
sw | |
---|---|
Description | save word into memory from a register address |
Syntax | sw register0, offset, register1 |
Example | sw $t0, 16($s0) |
Example implies | memory contents of ($s0 + 16 bytes) = $t0 |
Range of offset | -32,768 to 32,767 |