forked from AbleOS/holey-bytes
updates spec
This commit is contained in:
parent
7f2676af91
commit
f85e3eb062
|
@ -35,40 +35,40 @@ constmod!(pub opcode(u8) {
|
||||||
NEG = 13, "BB; #0 ← ~#1";
|
NEG = 13, "BB; #0 ← ~#1";
|
||||||
NOT = 14, "BB; #0 ← !#1";
|
NOT = 14, "BB; #0 ← !#1";
|
||||||
|
|
||||||
ADDI = 18, "BBD; #0 ← #1 + imm #2";
|
ADDI = 15, "BBD; #0 ← #1 + imm #2";
|
||||||
MULI = 19, "BBD; #0 ← #1 × imm #2";
|
MULI = 16, "BBD; #0 ← #1 × imm #2";
|
||||||
ANDI = 20, "BBD; #0 ← #1 & imm #2";
|
ANDI = 17, "BBD; #0 ← #1 & imm #2";
|
||||||
ORI = 21, "BBD; #0 ← #1 | imm #2";
|
ORI = 18, "BBD; #0 ← #1 | imm #2";
|
||||||
XORI = 22, "BBD; #0 ← #1 ^ imm #2";
|
XORI = 19, "BBD; #0 ← #1 ^ imm #2";
|
||||||
SLI = 23, "BBD; #0 ← #1 « imm #2";
|
SLI = 20, "BBD; #0 ← #1 « imm #2";
|
||||||
SRI = 24, "BBD; #0 ← #1 » imm #2";
|
SRI = 21, "BBD; #0 ← #1 » imm #2";
|
||||||
SRSI = 25, "BBD; #0 ← #1 » imm #2 (signed)";
|
SRSI = 22, "BBD; #0 ← #1 » imm #2 (signed)";
|
||||||
CMPI = 26, "BBD; #0 ← #1 <=> imm #2";
|
CMPI = 23, "BBD; #0 ← #1 <=> imm #2";
|
||||||
CMPUI = 27, "BBD; #0 ← #1 <=> imm #2 (unsigned)";
|
CMPUI = 24, "BBD; #0 ← #1 <=> imm #2 (unsigned)";
|
||||||
|
|
||||||
CP = 28, "BB; Copy #0 ← #1";
|
CP = 25, "BB; Copy #0 ← #1";
|
||||||
SWA = 29, "BB; Swap #0 and #1";
|
SWA = 26, "BB; Swap #0 and #1";
|
||||||
LI = 30, "BD; #0 ← imm #1";
|
LI = 27, "BD; #0 ← imm #1";
|
||||||
LD = 31, "BBDB; #0 ← [#1 + imm #3], imm #4 bytes, overflowing";
|
LD = 28, "BBDB; #0 ← [#1 + imm #3], imm #4 bytes, overflowing";
|
||||||
ST = 32, "BBDB; [#1 + imm #3] ← #0, imm #4 bytes, overflowing";
|
ST = 29, "BBDB; [#1 + imm #3] ← #0, imm #4 bytes, overflowing";
|
||||||
BMC = 33, "BBD; [#0] ← [#1], imm #2 bytes";
|
BMC = 30, "BBD; [#0] ← [#1], imm #2 bytes";
|
||||||
BRC = 34, "BBB; #0 ← #1, imm #2 registers";
|
BRC = 31, "BBB; #0 ← #1, imm #2 registers";
|
||||||
|
|
||||||
JMP = 35, "BD; Unconditional jump [#0 + imm #1]";
|
JMP = 32, "BD; Unconditional jump [#0 + imm #1]";
|
||||||
JEQ = 36, "BBD; if #0 = #1 → jump imm #2";
|
JEQ = 33, "BBD; if #0 = #1 → jump imm #2";
|
||||||
JNE = 37, "BBD; if #0 ≠ #1 → jump imm #2";
|
JNE = 34, "BBD; if #0 ≠ #1 → jump imm #2";
|
||||||
JLT = 38, "BBD; if #0 < #1 → jump imm #2";
|
JLT = 35, "BBD; if #0 < #1 → jump imm #2";
|
||||||
JGT = 39, "BBD; if #0 > #1 → jump imm #2";
|
JGT = 36, "BBD; if #0 > #1 → jump imm #2";
|
||||||
JLTU = 40, "BBD; if #0 < #1 → jump imm #2 (unsigned)";
|
JLTU = 37, "BBD; if #0 < #1 → jump imm #2 (unsigned)";
|
||||||
JGTU = 41, "BBD; if #0 > #1 → jump imm #2 (unsigned)";
|
JGTU = 38, "BBD; if #0 > #1 → jump imm #2 (unsigned)";
|
||||||
ECALL = 42, "N; Issue system call";
|
ECALL = 39, "N; Issue system call";
|
||||||
|
|
||||||
ADDF = 43, "BBB; #0 ← #1 +. #2";
|
ADDF = 40, "BBB; #0 ← #1 +. #2";
|
||||||
MULF = 44, "BBB; #0 ← #1 +. #2";
|
MULF = 41, "BBB; #0 ← #1 +. #2";
|
||||||
DIRF = 45, "BBBB; #0 ← #2 / #3, #1 ← #2 % #3";
|
DIRF = 42, "BBBB; #0 ← #2 / #3, #1 ← #2 % #3";
|
||||||
|
|
||||||
ADDFI = 46, "BBD; #0 ← #1 +. imm #2";
|
ADDFI = 43, "BBD; #0 ← #1 +. imm #2";
|
||||||
MULFI = 47, "BBD; #0 ← #1 *. imm #2";
|
MULFI = 44, "BBD; #0 ← #1 *. imm #2";
|
||||||
});
|
});
|
||||||
|
|
||||||
#[repr(packed)]
|
#[repr(packed)]
|
||||||
|
|
60
spec.md
60
spec.md
|
@ -93,22 +93,22 @@
|
||||||
|
|
||||||
| Opcode | Name | Action |
|
| Opcode | Name | Action |
|
||||||
|:------:|:----:|:-----------------------:|
|
|:------:|:----:|:-----------------------:|
|
||||||
| 18 | ADDI | Wrapping addition |
|
| 15 | ADDI | Wrapping addition |
|
||||||
| 19 | MULI | Wrapping subtraction |
|
| 16 | MULI | Wrapping subtraction |
|
||||||
| 20 | ANDI | Bitand |
|
| 17 | ANDI | Bitand |
|
||||||
| 21 | ORI | Bitor |
|
| 18 | ORI | Bitor |
|
||||||
| 22 | XORI | Bitxor |
|
| 19 | XORI | Bitxor |
|
||||||
| 23 | SLI | Unsigned left bitshift |
|
| 20 | SLI | Unsigned left bitshift |
|
||||||
| 24 | SRI | Unsigned right bitshift |
|
| 21 | SRI | Unsigned right bitshift |
|
||||||
| 25 | SRSI | Signed right bitshift |
|
| 22 | SRSI | Signed right bitshift |
|
||||||
|
|
||||||
### Comparsion
|
### Comparsion
|
||||||
- Comparsion is the same as when RRR type
|
- Comparsion is the same as when RRR type
|
||||||
|
|
||||||
| Opcode | Name | Action |
|
| Opcode | Name | Action |
|
||||||
|:------:|:-----:|:-------------------:|
|
|:------:|:-----:|:-------------------:|
|
||||||
| 26 | CMPI | Signed comparsion |
|
| 23 | CMPI | Signed comparsion |
|
||||||
| 27 | CMPUI | Unsigned comparsion |
|
| 24 | CMPUI | Unsigned comparsion |
|
||||||
|
|
||||||
## Register value set / copy
|
## Register value set / copy
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@
|
||||||
|
|
||||||
| Opcode | Name | Action |
|
| Opcode | Name | Action |
|
||||||
|:------:|:----:|:------:|
|
|:------:|:----:|:------:|
|
||||||
| 28 | CP | Copy |
|
| 25 | CP | Copy |
|
||||||
|
|
||||||
### Swap
|
### Swap
|
||||||
- Type BB
|
- Type BB
|
||||||
|
@ -126,7 +126,7 @@
|
||||||
|
|
||||||
| Opcode | Name | Action |
|
| Opcode | Name | Action |
|
||||||
|:------:|:----:|:------:|
|
|:------:|:----:|:------:|
|
||||||
| 29 | SWA | Swap |
|
| 26 | SWA | Swap |
|
||||||
|
|
||||||
### Load immediate
|
### Load immediate
|
||||||
- Type BD
|
- Type BD
|
||||||
|
@ -134,7 +134,7 @@
|
||||||
|
|
||||||
| Opcode | Name | Action |
|
| Opcode | Name | Action |
|
||||||
|:------:|:----:|:--------------:|
|
|:------:|:----:|:--------------:|
|
||||||
| 30 | LI | Load immediate |
|
| 27 | LI | Load immediate |
|
||||||
|
|
||||||
## Memory operations
|
## Memory operations
|
||||||
- Type BBDH
|
- Type BBDH
|
||||||
|
@ -143,8 +143,8 @@
|
||||||
### Load / Store
|
### Load / Store
|
||||||
| Opcode | Name | Action |
|
| Opcode | Name | Action |
|
||||||
|:------:|:----:|:---------------------------------------:|
|
|:------:|:----:|:---------------------------------------:|
|
||||||
| 31 | LD | `#0 ← [#1 + imm #3], copy imm #4 bytes` |
|
| 28 | LD | `#0 ← [#1 + imm #3], copy imm #4 bytes` |
|
||||||
| 32 | ST | `[#1 + imm #3] ← #0, copy imm #4 bytes` |
|
| 29 | ST | `[#1 + imm #3] ← #0, copy imm #4 bytes` |
|
||||||
|
|
||||||
## Block copy
|
## Block copy
|
||||||
- Block copy source and target can overlap
|
- Block copy source and target can overlap
|
||||||
|
@ -154,7 +154,7 @@
|
||||||
|
|
||||||
| Opcode | Name | Action |
|
| Opcode | Name | Action |
|
||||||
|:------:|:----:|:--------------------------------:|
|
|:------:|:----:|:--------------------------------:|
|
||||||
| 33 | BMC | `[#0] ← [#1], copy imm #2 bytes` |
|
| 30 | BMC | `[#0] ← [#1], copy imm #2 bytes` |
|
||||||
|
|
||||||
### Register copy
|
### Register copy
|
||||||
- Type BBB
|
- Type BBB
|
||||||
|
@ -162,7 +162,7 @@
|
||||||
|
|
||||||
| Opcode | Name | Action |
|
| Opcode | Name | Action |
|
||||||
|:------:|:----:|:--------------------------------:|
|
|:------:|:----:|:--------------------------------:|
|
||||||
| 34 | BRC | `#0 ← #1, copy imm #2 registers` |
|
| 31 | BRC | `#0 ← #1, copy imm #2 registers` |
|
||||||
|
|
||||||
## Control flow
|
## Control flow
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@
|
||||||
|
|
||||||
| Opcode | Name | Action |
|
| Opcode | Name | Action |
|
||||||
|:------:|:----:|:---------------------:|
|
|:------:|:----:|:---------------------:|
|
||||||
| 35 | JMP | Jump at `#0 + imm #1` |
|
| 32 | JMP | Jump at `#0 + imm #1` |
|
||||||
|
|
||||||
### Conditional jumps
|
### Conditional jumps
|
||||||
- Type BBD
|
- Type BBD
|
||||||
|
@ -179,19 +179,19 @@
|
||||||
|
|
||||||
| Opcode | Name | Comparsion |
|
| Opcode | Name | Comparsion |
|
||||||
|:------:|:----:|:------------:|
|
|:------:|:----:|:------------:|
|
||||||
| 36 | JEQ | = |
|
| 33 | JEQ | = |
|
||||||
| 37 | JNE | ≠ |
|
| 34 | JNE | ≠ |
|
||||||
| 38 | JLT | < (signed) |
|
| 35 | JLT | < (signed) |
|
||||||
| 39 | JGT | > (signed) |
|
| 36 | JGT | > (signed) |
|
||||||
| 40 | JLTU | < (unsigned) |
|
| 37 | JLTU | < (unsigned) |
|
||||||
| 41 | JGTU | > (unsigned) |
|
| 38 | JGTU | > (unsigned) |
|
||||||
|
|
||||||
### Environment call
|
### Environment call
|
||||||
- Type N
|
- Type N
|
||||||
|
|
||||||
| Opcode | Name | Action |
|
| Opcode | Name | Action |
|
||||||
|:------:|:-----:|:-------------------------------------:|
|
|:------:|:-----:|:-------------------------------------:|
|
||||||
| 42 | ECALL | Cause an trap to the host environment |
|
| 39 | ECALL | Cause an trap to the host environment |
|
||||||
|
|
||||||
## Floating point operations
|
## Floating point operations
|
||||||
- Type BBB
|
- Type BBB
|
||||||
|
@ -199,15 +199,15 @@
|
||||||
|
|
||||||
| Opcode | Name | Action |
|
| Opcode | Name | Action |
|
||||||
|:------:|:----:|:--------------:|
|
|:------:|:----:|:--------------:|
|
||||||
| 43 | ADDF | Addition |
|
| 40 | ADDF | Addition |
|
||||||
| 44 | MULF | Multiplication |
|
| 41 | MULF | Multiplication |
|
||||||
|
|
||||||
### Division-remainder
|
### Division-remainder
|
||||||
- Type BBBB
|
- Type BBBB
|
||||||
|
|
||||||
| Opcode | Name | Action |
|
| Opcode | Name | Action |
|
||||||
|:------:|:----:|:--------------------------------------:|
|
|:------:|:----:|:--------------------------------------:|
|
||||||
| 45 | DIRF | Same flow applies as for integer `DIR` |
|
| 42 | DIRF | Same flow applies as for integer `DIR` |
|
||||||
|
|
||||||
## Floating point immediate operations
|
## Floating point immediate operations
|
||||||
- Type BBD
|
- Type BBD
|
||||||
|
@ -215,8 +215,8 @@
|
||||||
|
|
||||||
| Opcode | Name | Action |
|
| Opcode | Name | Action |
|
||||||
|:------:|:-----:|:--------------:|
|
|:------:|:-----:|:--------------:|
|
||||||
| 46 | ADDFI | Addition |
|
| 43 | ADDFI | Addition |
|
||||||
| 47 | MULFI | Multiplication |
|
| 44 | MULFI | Multiplication |
|
||||||
|
|
||||||
# Registers
|
# Registers
|
||||||
- There is 255 registers + one zero register (with index 0)
|
- There is 255 registers + one zero register (with index 0)
|
||||||
|
|
Loading…
Reference in a new issue