Skip to content
This repository has been archived by the owner on Jan 31, 2021. It is now read-only.

Instruction Listing

Mithun Hunsur edited this page May 24, 2016 · 14 revisions

load

Loads the value located in [src] into dst.

  • Opcode: 0x00
  • Operand Format: Destination, source (DstSrc)

store

Stores the value located in src into [dst].

  • Opcode: 0x01
  • Operand Format: Destination, source (DstSrc)

loadli

Load the immediate into the lower half of src.

  • Opcode: 0x02
  • Operand Format: Destination, unsigned immediate (DstUimm)

loadui

Load the immediate into the upper half of src.

  • Opcode: 0x03
  • Operand Format: Destination, unsigned immediate (DstUimm)

add

Add src1 and src2 together, and store the result in dst.

  • Opcode: 0x04
  • Operand Format: Destination, source, source (DstSrcSrc)

Unallocated opcode

add

Add the immediate to src, and store the result in dst.

  • Opcode: 0x06
  • Operand Format: Destination, source, immediate (DstSrcImm)

sub

Subtract src2 from src1, and store the result in dst.

  • Opcode: 0x07
  • Operand Format: Destination, source, source (DstSrcSrc)

mul

Multiply src1 by src2, and store the result in dst.

  • Opcode: 0x08
  • Operand Format: Destination, source, source (DstSrcSrc)

div

Divide src1 by src2, and store the result in dst.

  • Opcode: 0x09
  • Operand Format: Destination, source, source (DstSrcSrc)

not

Bitwise-NOT src, and store the result in dst.

  • Opcode: 0x0A
  • Operand Format: Destination, source (DstSrc)

and

Bitwise-AND src1 with src2, and store the result in dst.

  • Opcode: 0x0B
  • Operand Format: Destination, source, source (DstSrcSrc)

or

Bitwise-OR src1 with src2, and store the result in dst.

  • Opcode: 0x0C
  • Operand Format: Destination, source, source (DstSrcSrc)

xor

Bitwise-XOR src1 with src2, and store the result in dst.

  • Opcode: 0x0D
  • Operand Format: Destination, source, source (DstSrcSrc)

shl

Shift src1 by src2 bits to the left, and store the result in dst.

  • Opcode: 0x0E
  • Operand Format: Destination, source, source (DstSrcSrc)

shr

Shift src1 by src2 bits to the right, and store the result in dst.

  • Opcode: 0x0F
  • Operand Format: Destination, source, source (DstSrcSrc)

cmp

Compare dst to src, and update the flags register appropriately.

  • Opcode: 0x10
  • Operand Format: Destination, source (DstSrc)

j

Jump to the given label unconditionally.

  • Opcode: 0x11
  • Operand Format: Label (Label)

je

If the zero flag is set, jump to the given label.

  • Opcode: 0x12
  • Operand Format: Label (Label)

jne

If the zero flag is not set, jump to the given label.

  • Opcode: 0x13
  • Operand Format: Label (Label)

jgt

If the greater flag is set, jump to the given label.

  • Opcode: 0x14
  • Operand Format: Label (Label)

jlt

If the less flag is set, jump to the given label.

  • Opcode: 0x15
  • Operand Format: Label (Label)

Unallocated opcodes (41 free)

halt

Halt operation.

  • Opcode: 0x3F
  • Operand Format: None (None)

call

Store the current instruction pointer in ra, and then jump to the given label.

  • Opcode: Pseudo
  • Operand Format: Label (Label)

callsv

Push the current return address, call the given label, and pop the return address.

  • Opcode: Pseudo
  • Operand Format: Label (Label)

dw

Create a word containing arg2.

  • Opcode: Pseudo
  • Operand Format: None (None)

jr

Jump to the given register.

  • Opcode: Pseudo
  • Operand Format: Label (Label)

loadi

Load the given 32-bit immediate, or label, into a register.

  • Opcode: Pseudo
  • Operand Format: Unsigned immediate (Uimm)

move

Copy the value in src to dst.

  • Opcode: Pseudo
  • Operand Format: Destination, source (DstSrc)

pop

Pop the given register from the stack (i.e. load register, sp; add sp, 4).

  • Opcode: Pseudo
  • Operand Format: Destination (Dst)

push

Push the given register onto the stack (i.e. add sp, -4; store sp, register).

  • Opcode: Pseudo
  • Operand Format: Destination (Dst)

rep

Repeat the following instruction arg1 times.

  • Opcode: Pseudo
  • Operand Format: Unsigned immediate (Uimm)