Encoding Overview
Instructions can range from 1 to 7 bytes, depending on operand size and count. Instructions do not require or enforce a particular memory alignment, thus allowing the tightest possible packing of code in memory.
The instruction format appears as follows:
PC + 0 7 8 9 C D F 10
+--------+-+----+---+--------+--------+-+----+---+--------+--------+
|OPCODE |T|MOD |DSP| DEST OPERAND |T|MOD |DSP| SOURCE OPERAND |
+--------+-+----+---+--------+--------+-+----+---+--------+--------+
DEST AMOD SRC AMOD
NOTE: Not all instructions will use every part of the above diagram. For example, a byte-sized operand will consume one byte instead of two, and some instructions may use zero or one operand.
AMOD Byte
In the ILXIM architecture, the AMOD (Addressing MODe) byte describes the semantic interpretation of the following operand. It contains three fields: type, mode, and displacement.
Following is a description of the fields of the AMOD bytes from the above diagram.
T: Type
The "T" field describes the data type of the following operand.
Value | Interpretation |
---|---|
0 | Byte |
1 | Word (2 bytes) |
MOD: Mode
The four "MOD" bits describe the addressing mode of the following operand.
Value | Interpretation |
---|---|
0 | Immediate |
1 | Register Direct |
2 | Memory Direct |
3 | Register Direct + Displacement |
4 | Memory Direct + Displacement |
5 | Register Indirect |
6 | Memory Indirect |
7 | Register Indirect + Displacement |
8 | Memory Indirect + Displacement |
DSP: Displacement
The three "DSP" bits specify a displacement to be added to the operand.
Value | Bytes Displacement |
---|---|
0 | 2 |
1 | 4 |
2 | 8 |
3 | 16 |
4 | 32 |
5 | 64 |
6 | 128 |
7 | 256 |
Opcodes
Opcode (Decimal) | Instruction |
---|---|
001 | COPY |
002 | CPSZ |
003 | ADD |
004 | SUB |
005 | MUL |
006 | DIV |
007 | SHL |
008 | SHR |
009 | OR |
010 | NOT |
011 | AND |
012 | XOR |
013 | EQV |
014 | CMP |
015 | CMPSZ |
020 | BRANCH |
021 | BEQ |
022 | BNE |
023 | BZ |
025 | BLT |
026 | BGT |
027 | SCALL |
028 | LCALL |
029 | ICALL |
030 | SRET |
031 | LRET |
032 | IRET |
033 | PUSH |
034 | POP |
040 | IN |
041 | OUT |
254 | NOP |
255 | HLT |