- Notifications
You must be signed in to change notification settings - Fork0
Tiny virtual machine for math calculations
License
NotificationsYou must be signed in to change notification settings
mandriota/impvm
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
By Mark Mandriota
organization method | kind size |
---|---|
static stack | 64-bit |
CODE | LOOPF | LF | EF | GF |
---|---|---|---|---|
4-bit | 1-bit | 1-bit | 1-bit | 1-bit |
(total size: 8-bit)
code | name | arg stack | ret stack | synopsis |
---|---|---|---|---|
0x0 | REDO | mm | mm; mm | duplicate last |
0x1 | UNDO | mm | delete last | |
0x2 | HROT | mm; mm | mm; mm | rotate stack up-down |
0x3 | TROT | mm; mm | mm; mm | rotate stack down-up |
0x4 | SWAP | mm; mm | mm; mm | exchange 2 elements |
0x5 | JUMP | mm | jump to code position | |
0x6 | TEST | mm | compare values | |
0x7 | IPUT | mm | get in data | |
0x8 | OPUT | mm | put out data | |
0x9 | LINC | mm; mm | mm | x+y |
0xA | LDEC | mm; mm | mm | x-y |
0xB | QINC | mm; mm | mm | x=x+k |
0xC | QDEC | mm; mm | mm | x=x-k |
0xD | ||||
0xE | ||||
0xF |
If flag is setted, then popsN
from the stack andrepeats instruction whilecondf≠0 and k<N
code | name | combination | synopsis |
---|---|---|---|
0b100 | LF | LF | x<y (lower) |
0b011 | NLF | GF ;EF | x≥y (not lower) |
0b010 | EF | EF | x=y (equal) |
0b101 | NEF | LF ;GF | x≠y (not equal) |
0b001 | GF | GF | x>y (greater) |
0b110 | NGF | LF ;EF | x≤y (not greater) |
0b111 | AF | LF ;GF ;EF | 1 (always) |
0b000 | AF | 1 (always) |