ILDEArch initial architecture discussion
Opened this issue · 0 comments
loco-choco commented
This issue will serve as a way to document the decisions made for design of the ILDEArch architecture. Fell free to comment your ideas.
Current ICMC architecture
From monografia_compilador.pdf and ProcessadorICMC2.pdf we can derive that the architecture has:
- 8 "common" registers (r0 -> r7)
- 16 bits addrs and 16 bits words
- 5 special registers:
- Flag Register (FR)
- Stack Pointer (SP)
- Program Counter (PC)
- Instruction Register (IR) [Internal to the micro-controller]
- Memory Addr Register (MAR)
- internal VGA video card
- unique instructions:
- for halting the processor (HALT)
- for inserting break points (BREAKP)
- for outputing to the video card (OUTCHAR)
- for receiving keyboard input (INCHAR)
- no hardware interrupts
It has a RISC instruction set with the following 72 instructions:
Instruction | Usage | Description | Binary (16 bits per world) |
---|---|---|---|
Store (Direct) |
store END, RX | Stores the data from RX in the memory pointed by END |
110001|RX|xxx|xxx|x END |
Load (Direct) |
load RX, END | Reads the data pointed by END and stores in RX |
110000|RX|xxx|xxx|x END |
STOREI (Indirect) |
storei RX, RY | Stores the data from RX in the memory pointed by RY |
111101|RX|RY|xxx|x |
LOADI (Indirect) |
loadi RX, RY | Reads the data pointed by RY and stores in RX |
111100|RX|RY|xxx|x |
LOADN (Immediatly) |
loadn RX, #NR | Stores #NR in RX | 111000|RX|xxx|xxx|x NR |
MOV | mov RX, RY | Stores the data from RY in RX |
110011|RX|RY|xx|x0 |
MOV | mov RX, SP | Stores the data from SP in RX |
110011|RX|xxx|xx|01 |
MOV | mov SP, RX | Stores the data from RX in SP |
110011|RX|xxx|xx|11 |
ADD | add RX, RY, RZ | Stores result of RY + RZ in RX |
100000|RX|RY|RZ|0 |
ADDC | addc RX, RY, RZ | Stores result of RY + RZ + Carry in RX |
100000|RX|RY|RZ|1 |
SUB | sub RX, RY, RZ | Stores result of RY - RZ in RX |
100001|RX|RY|RZ|0 |
SUBC | subc RX, RY, RZ | Stores result of RY - RZ + Carry in RX |
100001|RX|RY|RZ|1 |
MULT | mult RX, RY, RZ | Stores result of RY * RZ in RX |
100010|RX|RY|RZ|0 |
MULTC | multc RX, RY, RZ | Stores result of RY * RZ + Carry in RX |
100010|RX|RY|RZ|1 |
DIV | div RX, RY, RZ | Stores result of RY / RZ in RX |
100011|RX|RY|RZ|0 |
DIVC | divc RX, RY, RZ | Stores result of RY / RZ + Carry in RX |
100011|RX|RY|RZ|1 |
INC | inc RX | Increases the value of RX by one |
100100|RX|0|xxx|xxx |
DEC | dec RX | Decreases the value of RX by one |
100100|RX|1|xxx|xxx |
MOD | mod RX, RY, RZ | Stores result of RY % RZ in RX |
100101|RX|RY|RZ|x |
AND | and RX, RY, RZ | Stores result of RY & RZ in RX |
010010|RX|RY|RZ|x |
OR | or RX, RY, RZ | Stores result of RY | RZ in RX |
010011|RX|RY|RZ|x |
XOR | xor RX, RY, RZ | Stores result of RY ^ RZ in RX |
010100|RX|RY|RZ|x |
NOT | not RX, RY | Stores result of !RY in RX |
010101|RX|RY|xxx|x |
ROTL | rotl RX, N | Rotates RX left N times |
010000|RX|10x|NNN|N |
ROTR | rotr RX, N | Rotates RX right N times |
010000|RX|11x|NNN|N |
SHIFTL0 | shitl0 RX, N | Shifts RX to the left N times filling with 0 |
010000|RX|000|NNN|N |
SHIFTL1 | shitl1 RX, N | Shifts RX to the left N times filling with 1 |
010000|RX|001|NNN|N |
SHIFTR0 | shitr0 RX, N | Shifts RX to the right N times filling with 0 |
010000|RX|010|NNN|N |
SHIFTR1 | shitr1 RX, N | Shifts RX to the right N times filling with 1 |
010000|RX|011|NNN|N |
CMP | cmp RX, RY | Stores to the Flag Register the result of RX = RY, RX > RY, and RX < RY |
010110|RX|RY|xxx|x |
INCHAR | inchar RX | Stores the ASCII representation of the current keyboard key in RX |
110101|RX|xxx|xxx|x |
OUTCHAR | outchar RX, RY | Stores the value of RX to the frame buffer pixel pointed by RY |
110010|RX|RY|xxx|x |
JMP | jmp END | Jumps to END | 000010|0000|x|xxxxx END |
JEQ | jeq END | Jumps to END if Equal flag is set (?) |
000010|0001|x|xxxxx END |
JNE | jne END | Jumps to END if Equal flag is not set (?) |
000010|0010|x|xxxxx END |
JZ | jz END | Jumps to END if Zero flag is set (?) |
000010|0011|x|xxxxx END |
JNZ | jnz END | Jumps to END if Zero flag is not set (?) |
000010|0100|x|xxxxx END |
JC | jc END | Jumps to END if Carry flag is set (?) |
000010|0101|x|xxxxx END |
JNC | jnc END | Jumps to END if Carry flag is not set (?) |
000010|0110|x|xxxxx END |
JGR | jgr END | Jumps to END if Greater flag is set (?) |
000010|0111|x|xxxxx END |
JLE | jle END | Jumps to END if Lesser flag is set (?) |
000010|1010|x|xxxxx END |
JEG | jeg END | Jumps to END if Equal or Greater flag is set (?) |
000010|1001|x|xxxxx END |
JEL | jel END | Jumps to END if Equal or Lesser flag is set (?) |
000010|1010|x|xxxxx END |
JOV | jov END | Jumps to END if Overflow flag is set (?) |
000010|1011|x|xxxxx END |
JNOV | jnov END | Jumps to END if Overflow flag is not set (?) |
000010|1100|x|xxxxx END |
JN | jn END | Jumps to END if Negative flag is set (?) |
000010|1101|x|xxxxx END |
JDZ | jdz END | Jumps to END if DivByZero flag is set (?) |
000010|1110|x|xxxxx END |
CALL | call END | Calls END | 000011|0000|x|xxxxx END |
CEQ | ceq END | Calls END if Equal flag is set (?) |
000011|0001|x|xxxxx |
CNE | cne END | Calls END if Equal flag is not set (?) |
000011|0010|x|xxxxx |
CZ | cz END | Calls END if Zero flag is set (?) |
000011|0011|x|xxxxx |
CNZ | cnz END | Calls END if Zero flag is not set (?) |
000011|0100|x|xxxxx |
CC | cc END | Calls END if Carry flag is set (?) |
000011|0101|x|xxxxx |
CNC | cnc END | Calls END if Carry flag is not set (?) |
000011|0110|x|xxxxx |
CGR | cgr END | Calls END if Greater flag is set (?) |
000011|0111|x|xxxxx |
CLE | cle END | Calls END if Lesser flag is set (?) |
000011|1000|x|xxxxx |
CEG | ceg END | Calls END if Equal or Greater flag is set (?) |
000011|1001|x|xxxxx |
CEL | cel END | Calls END if Equal or Lesser flag is set (?) |
000011|1010|x|xxxxx |
COV | cov END | Calls END if Overflow flag is set (?) |
000011|1011|x|xxxxx |
CNOV | cnov END | Calls END if Overflow flag is not set (?) |
000011|1100|x|xxxxx |
CN | cn END | Calls END if Negative flag is set (?) |
000011|1101|x|xxxxx |
CDZ | cdz END | Calls END if DivByZero flag is set (?) |
000011|1110|x|xxxxx |
RTS | rts | Returns to the instruction after the CALL |
000100|xxxx|x|xxxxx |
PUSH | push RX | Pushes the value of RX to the Stack |
000101|RX|0|xxxxxx |
PUSH | push FR | Pushes the value of FR to the Stack |
000101|xxx|1|xxxxxx |
POP | pop RX | Pops the Stack to RX |
000110|RX|0|xxxxxx |
POP | pop FR | Pops the Stack to FR |
000110|xxx|1|xxxxxx |
CLEARC | clearc | Clears Carry | 001000|0|xxxxxxxxx |
SETC | setc | Sets Carry | 001000|1|xxxxxxxxx |
HALT | halt | Halts the processor | 001111|x|xxxxxxxxx |
NOOP | noop | No opeation | 000000|x|xxxxxxxxx |
BREAKP | breakp | Inserts a break point (?) | 001110|x|xxxxxxxxx |