Instruction Definitions

Core instructions appear in green.
Instructions "borrowing" opcodes (not pseudo-instructions) appear in blue.
Unimplemented instructions appear in red.

 

Arithmetic

Instruction Type Description
add R Add the numbers in two registers and place the sum in a third register.
sub R Subtract the numbers in two registers and place the difference in a third register.
mult R Multiply the numbers in two registers and place the product in a third register.
div R Divide the numbers in two registers and place the quotient in a third register.

 

Logical

Instruction Type Description
and R Perform a logical and on the numbers in two registers and place the result in a third register.
andi M2 Perform a logical and on the number in a registers and an immediate value and place the result in the original register.
or R Perform a logical or on the numbers in two registers and place the result in a third register.
ori M2 Perform a logical or on the number in a registers and an immediate value and place the result in the original register.
xor R Perform a logical xor on the numbers in two registers and place the result in a third register.
nand R Perform a logical nand on the numbers in two registers and place the result in a third register.
nor R Perform a logical nor on the numbers in two registers and place the result in a third register.
xnor R Perform a logical xnor on the numbers in two registers and place the result in a third register.
slt R If the rs register is less than the rt register, store the value 1 in register rd; otherwise, store the value 0 in register rd.

 

Shift

Instruction Type Description
sll I Perform a logical left shift on the value in a register and place the result in the destination register.
srl I Perform a logical right shift on the value in a register and place the result in the destination register.

 

Memory and Register

Instruction Type Description
lw I Load the 16-bit word from the memory address found by summing the base address register and the offset constant, and place the value in the destination register.
sw I Store the value in the source register to the memory address found by summing the base address register and the offset constant.
copy R Copy the value from one register to another.
lui M Load the constant into the upper half-word (8 bits) of the register.
mtm I Copy a value from the source memory address to the destination memory address.
swap R Switch the values of 2 registers.
swra I Store the value from the RA register into memory. Similar to sw.
lwra I Load a value from memory into the RA register. Similar to lw.

 

Branch

Instruction Type Description
beq I If the values of the two registers are equal, go to the instruction at Label (a signed PC-relative address).
bne I If the values of the two registers are not equal, go to the instruction at Label (a signed PC-relative address).

 

Jump

Instruction Type Description
j J Go to the instruction at the given memory address, which is the right 12 bits of the full address. The highest-order nybble is taken from that of the PC.
jr R Go to the instruction at the memory address stored in the given register.
jal J Go to the instruction at the given memory address (same as j) and update the return address register to show the next line that would otherwise have been executed.
jm M Go to the instruction at the memory address stored in the given memory location.
jra R Go to the instruction at the memory address stored in the RA register.