Forums - Open Redstone Engineers
4-bit stack based IS - Printable Version

+- Forums - Open Redstone Engineers (https://forum.openredstone.org)
+-- Forum: ORE General (https://forum.openredstone.org/forum-39.html)
+--- Forum: Projects & Inventions (https://forum.openredstone.org/forum-19.html)
+---- Forum: Completed Projects (https://forum.openredstone.org/forum-21.html)
+---- Thread: 4-bit stack based IS (/thread-2436.html)



4-bit stack based IS - MelvinS4_ - 02-15-2014

I recently found the wonderful world of stack based processor architectures. I've made a simple IS that I hope to implement in a minecraft CPU, but before that I was hoping to get some feedback from folks who are more knowledgeable than me Smile

Without further endue, here is the IS:
Code:
0 0000    PUSH:STACK   pushes first element (0 if stack is empty)
1 0001    PUSH:REG     pushes from the GPR
2 0010    PUSH:RAM     pushes from RAM
3 0011    PUSH:RAMA    pushes from RAM address reg
4 0100    POP:STACK    deletes first element
5 0101    POP:REG      pops to the GPR
6 0110    POP:RAM      pops to RAM
7 0111    POP:RAMA     pops to RAM address reg
8 1000    JMP:C        jump if carry out is on
9 1001    JMP:>        jump if a > b
a 1010    JMP:<        jump if a < b
b 1011    JMP:=        jump if a = b
c 1100    ALU:A        push A + B
d 1101    ALU:AC       push A + B + 1
e 1110    ALU:N        push A NAND B
f 1111    HALT         halts the CPU
As you might have figured out already there is one GPR and one register for storing the current RAM address.

The things which are yet to be decided upon are:

1. if a is the GPR and b is the top of stack OR a is the top of stack and b is the second item in stack,

2. if ALU calls will simply push the result OR pop it's operands first

3. if JMP calls will jump to the value in the GPR OR in the top of the stack.

(Please note the difference in capitalization of a and A, A and B are the top and second items in the stack, while a and b have not yet been decided.)

Any feedback and suggestions are welcome! Big Grin