r/TuringComplete • • Oct 16 '26

[BPEx2] Basic and Stack Operations

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.

22 Upvotes

25 comments sorted by

View all comments

Show parent comment

1

u/Crispy1961 8d 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 6d ago

The default arch doesn't let you load from variables. r1 = ram[value] does not work.

1

u/Crispy1961 6d ago

Yeah, BPEx2 is far from the default symphony. The ability to use RAM as arguments for instructions is invaluable.

1

u/Fastpast93 6d ago

It works fine if you just add the |label argument for RamImm or whatever it’s called.

1

u/Crispy1961 6d ago

Wait, what are you talking about?

1

u/Fastpast93 6d ago

what do you mean it's invaluable? Using variables (as in from RAM) is a lot of high level language syntax.

1

u/Crispy1961 6d ago

Yes, it means its a great feature. Symphony can only save or load from RAM, not use it directly as arguments for operations. Thats why I made my own BPEx2 architecture.

1

u/Fastpast93 6d ago

I see what you meant. Invaluable is a weird word sometimes. But anyways, I added |label for RamImm pattern so that variables could be used.

1

u/Crispy1961 6d ago

How does that help?
You can do:

r3 = 32
const variable = r3
r10 = ram[variable]

or

const variable = 32
r10 = ram[variable]

But I havent been able to declare constant as RAM address. Something like this doesnt work.

const variable = ram[32]
r10 = variable

1

u/Fastpast93 6d ago

That's a max of 20 ish variables, no? And RAM is where you should be storing stuff anyways, otherwise it's just a program