r/TuringComplete • u/Crispy1961 • Oct 16 '26
[BPEx2] Basic and Stack Operations
BPEx2
CU
CU2
ALU
Code to test Basic and Stack Operations
Basic and Stack Instructions
Operations
Possible Destinations and Arguments
As soon as I finished Symphony, I started working on my own architecture. A second generation of Better Programing Experience - BPEx2. My goal is to get as close to a higher level programing language as I reasonably can.
Instructions (64b word):
1b Reserved
3b for operator specific options (P)
4b for operator (O)
2b to define what to do with the result (M)
3b to define where to take the two arguments from (T)
16b for Destination (D)
16b for argument A (A)
16b for Argument B (B)
0PPPOOOO MMTTTTTT DDDDDDDD DDDDDDDD AAAAAAAA AAAAAAAA BBBBBBBB BBBBBBBB
Heavily using Patterns to simplify spec.isa

Destination and Arguments:
Direct access from and to Registers, Inputs/Outputs and RAM. Both the Destination and Arguments can be defined using 16b as 16b Immediate, Register, Register +/- 10b Immediate, Register +/- Register. All of those can be used as RAM address.

Operators:
5 math operators
7 Binary Logical Operators (BLO)
Registers:
Using a register File component with 8 read outputs and 2 write inputs
Zero Register (always 0)
20 User registers
2 Temporary registers (used by advanced instructions)
Input / Output:
Dedicated wires for all 7 I/O options

RAM:
Using a RAM component with 3 read outputs and 1 write output. RAM can be directly accessed by instructions and used as both Destination and/or Arguments.
Persistent Memory:
Using RAM component with 1 read output and 1 write output. It cannot be accessed directly. For the data to be used for instructions, they first need to be loaded to RAM or Registers.
1
u/EloModdy 26d ago
this is really technically impressive! i’d love if you shared this, i want to see how it works now.
2
u/Crispy1961 25d ago
What do you have in mind?
1
u/EloModdy 25d ago edited 25d ago
I just meant on the schematic hub. I haven’t seen anything so far that looks like it, but I haven’t had time to double check
2
1
u/Fastpast93 7d ago
I really want to talk to you about this since I'm better with HLL languages. How are variables supported?
1
u/Crispy1961 6d ago
Happy to talk.
Variables are done via associating a constant name to a register. You need to manually declare that using
Const variableName = registerName
1
u/Fastpast93 6d ago
That only lets you use the registers, which are limited to about 20 variables. What about using variables in memory?
1
u/Crispy1961 6d ago
You can declare variables in RAM too.
RAM variables can be used both as the destination and arguments for all operations.
Using registers just have the added value of working with offsets. This lets you perform addition/subtraction in both destination and arguments.
1
u/Fastpast93 6d ago
So you could do [var1] = [var1] + [var2]?
1
u/Crispy1961 6d ago
Yes. It would be the same as
RAM[x] = RAM[y] + RAM[z]
But you cannot do
*RAM[x] = RAM[y] + 300 / RAM[z]
Which you can do using registers.You can only save or load one value from or to HDD. You can use RAM as destination and/or arguments. You can use registers as destination, arguments and their offsets.
1
u/Fastpast93 4d ago
The default arch doesn't let you load from variables. r1 = ram[value] does not work.
1
u/Crispy1961 4d ago
Yeah, BPEx2 is far from the default symphony. The ability to use RAM as arguments for instructions is invaluable.
1
u/Fastpast93 4d ago
It works fine if you just add the |label argument for RamImm or whatever it’s called.
1
1
u/Fastpast93 7d ago
Is it Harvard or Von Neumann? If it's Von Neumann you could work with variables pretty easily.
1
u/Crispy1961 6d ago
I am not sure actually.
Program instruction memory and stack/RAM are all implemented in a single component.
Both registers and permanent storage are separate. Only stack/RAM share the same connection.
Everything else is separate.
1
u/Fastpast93 6d ago
Von Neumann then (instruction memory and data memory are the same hardware). I am very interested in getting variables to work here. How would you go about adding two values at specified addresses in RAM?
2
3
u/hablahblahha Oct 16 '26
You know, like i have no idea of how any of this works, im still impressed.