Instruction: Arith. - RainbowUnicon/PISAx32 GitHub Wiki
General
Opcode Format
Syntax:
CCCC IIIII Z L DDDDD SSSSSSSSSSSSSSSS
Where:
C: Condition I: Instruction Z: Size Bit L: Immediate Bit D: Destination S: Source
Detail:
- If Z = 0, instruction will only consider last 8 bits of destination and source.
- If Z = 1, instruction will consider whole 32 bits of destination and source.
- 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 {B} src dest
Where:
- cond: condition
- instr: instruction name
- src: source register or 16 bit immediate
- dest : destination Register
Detail:
- If src is a register, L bit won't be set.
- If src is a 16 bit immediate, L bit will set.
- If the type of dest is integer, instruction will be considered as integer type.
- If the type of dest is float, instruction will be considered as float type.
- Any immediate will be considered as integer type.
- It is not recommended to use different types for src and dest. (WARNING)
- If B is used, Z bit will be set.
- If B is used, and src is immediate greater than 256, than NOP will be generated. (WARNING)
Instruction Specific
ADD
Description:
Add source and destination values
Detail:
- Carry will be stored in high bit register.
SUB
Description:
Subtract source value from destination value.
Detail:
- Carry will be stored in high bit register.
DIV
Description:
Divide destination with source value.
MUL
Description:
Multiply source and destination values.
Detail:
- If Z bit is 0 and the result is greater than 2^32-1, then the high bit will be stored in high bit register.
- If Z bit is 1 and the result is greater than 2^8-1, then the high bit will be stored in high bit register.
MOD
Description:
Modulus destination value with source value.
Detail:
- The type of this instruction will be always integer.
ASR
Description:
Arithmetic shift right by source value on destination value.
Detail:
- The type of this instruction will be always integer.
ASL
Description:
Arithmetic shift left by source value on destination value.
Detail:
- The type of this instruction will be always integer.
CMP
Description:
Subtract destination value with source value and set corresponding flag values. (It doesn't change destination value)