Instruction: Memory - RainbowUnicon/PISAx32 GitHub Wiki

General

Opcode Format

Syntax:

CCCC IIIII A L DDDDD SSSSSSSSSSSSSSSS

Where:

  • C: Condition
  • I: Instruction
  • A: Auxiliary Bit
  • L: Immediate Bit
  • D: Destination
  • S: Source

Detail:

  • Auxiliary bit will be instruction specific.
  • If L = 0, source will be register.
  • If L = 1, source will be immediate.
  • If source is register, then last 5 bits will be used.

Assembly Format

Syntax:

{cond} instr {aux} src dest

Where:

  • cond: condition
  • instr: instruction name
  • src: source register or 16 bit immediate
  • dest : destination Register
  • aux : Instruction specific

Detail:

  • If src is a register, L bit won't be set.
  • If src is a 16 bit immediate, L bit will set.
  • All instruction will be considered as memory operation on integer.
  • It is not recommended to use float register for src. (WARNING)

Instruction Specific

MOV

Description:

Copy the value in source to destination.

Detail:

  • In Assembly syntax, aux can be {L|H|B|C}.If aux is not set, then it will be consder as "L".
  • If instruction bits ends with 0 and Auxiliary bit is 0, instruction will be MOVL.
  • If instruciton bits ends with 0 and Auxiliary bit is 1, instruction will be MOVH.
  • If instruction bits ends with 1 and Auxiliary bit is 1, instruction will be MOVB.
  • If instruction bits ends with 1 and Auxiliary bit is 1, instruction will be MOVC.
  • MOVL copies entire register value to the destination.
  • MOVH copies the last 16 bits of the source register value to the destination.
  • MOVB copies the last 8 bits of the source register value to the destination.
  • MOVC copies and "cast" the value in source register to the destination.
    • Integer register -> Integer register: Same as MOVL (WARNING)
    • Integer register -> Float register: Cast the integer value to float. (similar to C++ cast operation)
    • Float register -> integer register: Cast the float value to integer. (similar to C++ cast operation)
    • Float register -> Float register: Same as MOVL (WARNING)

STO

Description:

Store the value in destination register to the address in source register.

Detail:

  • In assembly syntax, aux can be {B|L}. If aux is not set, then it will be considered as "L"
  • If aux = B, then aux bit will be set.
  • If aux = L, then aux bit won't be set.
  • If aux bit = 0, then whole 32 bits value will be stored in memory.
  • If aux bit = 1, then only last 8 bit will be stored in memory.

LOD

Description:

Load the value at the address in source register to the destination register.

Detail:

  • In assembly syntax, aux can be {B|L}. If aux is not set, then it will be considered as "L"
  • If aux = B, then aux bit will be set.
  • If aux = L, then aux bit won't be set.
  • If aux bit = 0, then whole 32 bits value will be loaded from memory.
  • If aux bit = 1, then only last 8 bit will be loaded from memory.