r/TuringComplete • • 1d ago

I feel like I made a poor hack-around for when 0 > 0

Post image
8 Upvotes

r/TuringComplete • • 3d ago

Don't know how efficient this is but it works!

4 Upvotes

Divide Level was kicking my ass. Was able to pass it with this.

The custom component combines less and equal.


r/TuringComplete • • 4d ago

Does anybody have any hints for this level?

Post image
2 Upvotes

I've been trying at it for genuinely hours at this point and I have no clue. With a counter, delay line or register this would be easy, but I don't have any of those.


r/TuringComplete • • 5d ago

Tuto

1 Upvotes

Bonsoir , existe-t-il des guides pour comprendre les portes logiques , je suis bloqué au début du jeu , depuis hier je m'arrache les cheveux. Le développeur lâche le joueur dans la nature sans aucune indication.


r/TuringComplete • • 5d ago

Used Symphony to learn how fixed-point arithmetic works in practice ;)

24 Upvotes

r/TuringComplete • • 5d ago

I am not built for this stuff

Post image
26 Upvotes

I thought this was decent then I saw a YouTube tutorial


r/TuringComplete • • 5d ago

Concierto - 16 bit CPU project (my biggest project so far)

5 Upvotes

(Picture 1 is memory, registers, decoders and IO, picture 2 is branch logic and ALU, pictures 3-5 are instruction decoders, 6 is the program counter, 7-10 is the program example) This has been a project scrapped quite a few times but finally managed to get it working properly after a few months. It uses 16 bits for data, with 16-32 bit instructions. 13 all purpose registers r1-r13 and three special purpose registers zr, link and sp. It uses 1 byte for an immediate mode and opcode, then 2 nybbles for register arguments. Finally, in immediate mode, the instruction takes up 4 bytes with two of them being a 16 bit literal. It's somewhat similar to the Intel 8086 in using 16 bits and only using 2 arguments in ALU operations. The encoding looks like this: m = imm_mode, o = opcode, a = dest/arg_a, b = arg_b, i = immediate MOOOOOOO AAAABBBB or MOOOOOOO AAAA0000 %i[15:0] (yes, I recognize the first byte looks like an onomatopoeia for a very disgruntled cow) It was nice to make a unique architecture, where I had to come up with most of the logic myself. It also helped me realize how much simply trimming the register arguments and using variable length instructions helped to make a 16 bit processor more-or-less as capable as Symphony (excluding the fact I was a bit lazy regarding keyboard and screen support, I might add them later at some point) Pictures 7-10 shows a prng UNIX xorshift library that lets you generate random values, then it being used. Then, I will also include the video of it running, where it stores the result in r5.

The ISA is:
[fields]

register
zr 0000
r1 0001
r2 0010
r3 0011
r4 0100
r5 0101
r6 0110
r7 0111
r8 1000
r9 1001
r10 1010
r11 1011
r12 1100
r13 1101
link 1110
sp 1111

cond
eq 011001
b 011010
be 011011
a 011100
ae 011101
lt 011110
le 011111
gt 100000
ge 100001
ne 100010

[patterns]
[instructions]

add %a(register), %b(register)
00000000 aaaabbbb
# %a += %b
add %a(register), %i:U16(immediate|label)
10000000 aaaa0000 %i[15:0]
# %a += %i
add %a(register), %i:S16(immediate|label)
10000000 aaaa0000 %i[15:0]
# %a += %i

sub %a(register), %b(register)
00000001 aaaabbbb
# %a -= %b
sub %a(register), %i:U16(immediate|label)
10000001 aaaa0000 %i[15:0]
# %a -= %i
sub %a(register), %i:S16(immediate|label)
10000001 aaaa0000 %i[15:0]
# %a -= %i

and %a(register), %b(register)
00000010 aaaabbbb
# %a &= %b
and %a(register), %i:U16(immediate|label)
10000010 aaaa0000 %i[15:0]
# %a &= %i
and %a(register), %i:S16(immediate|label)
10000010 aaaa0000 %i[15:0]
# %a &= %i

nand %a(register), %b(register)
00000011 aaaabbbb
# %a !&= %b
nand %a(register), %i:U16(immediate|label)
10000011 aaaa0000 %i[15:0]
# %a !&= %i
nand %a(register), %i:S16(immediate|label)
10000011 aaaa0000 %i[15:0]
# %a !&= %i

or %a(register), %b(register)
00000100 aaaabbbb
# %a |= %b
or %a(register), %i:U16(immediate|label)
10000100 aaaa0000 %i[15:0]
# %a |= %i
or %a(register), %i:S16(immediate|label)
10000100 aaaa0000 %i[15:0]
# %a |= %i

nor %a(register), %b(register)
00000101 aaaabbbb
# %a !|= %b
nor %a(register), %i:U16(immediate|label)
10000101 aaaa0000 %i[15:0]
# %a !|= %i
nor %a(register), %i:S16(immediate|label)
10000101 aaaa0000 %i[15:0]
# %a !|= %i

xor %a(register), %b(register)
00000110 aaaabbbb
# %a ^= %b
xor %a(register), %i:U16(immediate|label)
10000110 aaaa0000 %i[15:0]
# %a ^= %i
xor %a(register), %i:S16(immediate|label)
10000110 aaaa0000 %i[15:0]
# %a ^= %i

xnor %a(register), %b(register)
00000111 aaaabbbb
# %a !^= %b
xnor %a(register), %i:U16(immediate|label)
10000111 aaaa0000 %i[15:0]
# %a !^= %i
xnor %a(register), %i:S16(immediate|label)
10000111 aaaa0000 %i[15:0]
# %a !^= %i

not %a(register), %b(register)
00001000 aaaa0000
# %a = !%a

lsl %a(register), %b(register)
00001001 aaaabbbb
# %a <<= %b
lsl %a(register), %i:U16(immediate|label)
10001001 aaaa0000 %i[15:0]
# %a <<= %i
lsl %a(register), %i:S16(immediate|label)
10001001 aaaa0000 %i[15:0]
# %a <<= %i

lsr %a(register), %b(register)
00001010 aaaabbbb
# %a >>= %b
lsr %a(register), %i:U16(immediate|label)
10001010 aaaa0000 %i[15:0]
# %a >>= %i
lsr %a(register), %i:S16(immediate|label)
10001010 aaaa0000 %i[15:0]
# %a >>= %i

asr %a(register), %b(register)
00001011 aaaabbbb
# %a >>= %b (signed)
asr %a(register), %i:U16(immediate|label)
10001011 aaaa0000 %i[15:0]
# %a >>= %i (signed)
asr %a(register), %i:S16(immediate|label)
10001011 aaaa0000 %i[15:0]
# %a >>= %i (signed)

rol %a(register), %b(register)
00001100 aaaabbbb
# %a <<<= %b
rol %a(register), %i:U16(immediate|label)
10001100 aaaa0000 %i[15:0]
# %a <<<= %i
rol %a(register), %i:S16(immediate|label)
10001100 aaaa0000 %i[15:0]
# %a <<<= %i

ror %a(register), %b(register)
00001101 aaaabbbb
# %a >>>= %b
ror %a(register), %i:U16(immediate|label)
10001101 aaaa0000 %i[15:0]
# %a >>>= %i
ror %a(register), %i:S16(immediate|label)
10001101 aaaa0000 %i[15:0]
# %a >>>= %i

mul %a(register), %b(register)
00001110 aaaabbbb
# %a *= %b
mul %a(register), %i:U16(immediate|label)
10001110 aaaa0000 %i[15:0]
# %a *= %i
mul %a(register), %i:S16(immediate|label)
10001110 aaaa0000 %i[15:0]
# %a *= %i

div %a(register), %b(register)
00001111 aaaabbbb
# %a /= %b
div %a(register), %i:U16(immediate|label)
10001111 aaaa0000 %i[15:0]
# %a /= %i
div %a(register), %i:S16(immediate|label)
10001111 aaaa0000 %i[15:0]
# %a /= %i

mod %a(register), %b(register)
00010000 aaaabbbb
# %a %= %b
mod %a(register), %i:U16(immediate|label)
10010000 aaaa0000 %i[15:0]
# %a %= %i
mod %a(register), %i:S16(immediate|label)
10010000 aaaa0000 %i[15:0]
# %a %= %i

inc %a(register)
00010001 aaaa0000
# %a += 1

dec %a(register)
00010010 aaaa0000
# %a -= 1

mov b[%b(register)], %a(register)
00010011 aaaabbbb
# mem[%b] = %a
mov b[%i:U16(immediate|label)], %a(register)
10010011 aaaa0000 %i[15:0]
# mem[%b] = %a

mov w[%b(register)], %a(register)
00010100 aaaabbbb
# mem[%b] = %a
mov w[%i:U16(immediate|label)], %a(register)
10010100 aaaa0000 %i[15:0]
# mem[%i] = %a

mov %a(register), b[%b(register)]
00010101 aaaabbbb
# mem[%b] = %a
mov %a(register), b[%i:U16(immediate|label)]
10010101 aaaa0000 %i[15:0]
# mem[%i] = %a

mov %a(register), w[%b(register)]
00010110 aaaabbbb
# mem[%b] = %a
mov %a(register), w[%i:U16(immediate|label)]
10010110 aaaa0000 %i[15:0]
# mem[%i] = %a

mov %a(register), %b(register)
00010111 aaaabbbb
# %a = %b
mov %a(register), %i:U16(immediate|label)
10010111 aaaa0000 %i[15:0]
# %a = %i
mov %a(register), %i:S16(immediate|label)
10010111 aaaa0000 %i[15:0]
# %a = %i

in %a(register)
00011000 aaaa0000
# %a = input

jmp %b(register)
00100011 0000bbbb
# Jumps to address offset in %b
jmp %i:U16(label|immediate)
10100011 00000000 iiiiiiiiiiiiiiii
# Jumps to %i

j%c(cond) %i:U16(label|immediate)
10cccccc 00000000 iiiiiiiiiiiiiiii
# Jumps to %i if last ALU operation has the "%c" flag

out %b(register)
00100100 0000bbbb
# Outputs %b
out %i:U16(immediate|label)
10100100 00000000 %i[15:0]
# Outputs %i
out %i:S16(immediate|label)
10100100 00000000 %i[15:0]
# Outputs %i

cmp %a(register), %b(register)
00100101 aaaabbbb
# Compares %a and %b without overwriting %a
cmp %a(register), %i:U16(immediate|label)
10100101 aaaa0000 %i[15:0]
# Compares %a and %b without overwriting %a
cmp %a(register), %i:S16(immediate|label)
10100101 aaaa0000 %i[15:0]
# Compares %a and %b without overwriting %a

halt
00100110
# Halts system

pc %a(register)
00100111 aaaa0000
# Moves program counter address to %a

unix %a(register)
00101000 aaaa0000
# Moves lower 16 bits of current UNIX time to %a

/* Aliases */

swap %a(register), %b(register)
assert(%a != %b, "Cannot swap the same register")
00000110 aaaabbbb 00000110 bbbbaaaa 00000110 aaaabbbb
# Swaps %a and %b
swap %a(register), %b(register)
00000000 00000000
# Swaps %a and %b

push %a(register)
10000001 11110000 0000000000000010 00010100 aaaa1111
# Pushes %a onto the stack (sub sp, 2 : mov w[sp], %a)

pop %a(register)
00010110 aaaa1111 10000000 11110000 0000000000000010
# Pops value off stack into %a (mov %a, w[sp] : add sp, 2

call %i:U16(label|immediate)
00100111 11100000 10000000 11100000 0000000000001110 10000001 11110000 0000000000000010 00010100 11101111 10100011 00000000 %i[15:0]
# Calls subroutine %i (pc link : add link, 14 : push link : jmp %i)

return
00010110 11101111 10000000 11110000 0000000000000010 00100011 00001110
# Returns from subroutine (pop link : jmp link)

test %a(register)
%end = $end
10010111 aaaa0000 eeeeeeeeeeeeeeee


r/TuringComplete • • 6d ago

Symphony architecture that runs Linux natively

Thumbnail
gallery
100 Upvotes

not vm . I add interrupt system to support Linux 6.1 no MMU

https://b23.tv/Xfh0r8S. This is the show.

Codex helped me to write a lot of driver and assembly code,then we use our llvm backend to compile the Linux into symphony code.


r/TuringComplete • • 6d ago

Halt real quick

2 Upvotes

I added halting to synthony


r/TuringComplete • • 11d ago

Exponents!

Post image
7 Upvotes

search up "Exponents!" on the schematic hub and you'll find it, I hope.


r/TuringComplete • • 13d ago

How to do modulo

Post image
10 Upvotes

r/TuringComplete • • 20d ago

BPM viewer of yajuu senpai

Post image
8 Upvotes

Symphony arch


r/TuringComplete • • 23d ago

[BPEx2] Pointers and Tables

Thumbnail
gallery
21 Upvotes

I implemented pointers (for registers) and tables (both in registers and RAM) into my custom BPEx2 architecture. As always, the aim of this architecture is to get as close to higher-level programming languages as possible.

Here is the spec.isa file.

Pointers and Register Tables

Both pointers and register tables take advantage of the previously implemented ability to select a register using a value from Register A and either a value from Register B or an immediate value:

  • Register(value from Register A +/- value from Register B)
  • Register(value from Register A +/- 10-bit immediate value)

Pointers

Pointers inherently use the Zero Register as Register A, meaning that Register B or the immediate value serves as the address of the target register.

I implemented the * and & modifiers:

  • The * modifier treats immediate values as register addresses.
  • The & modifier treats register addresses as immediate values.

Register Tables

Register tables use the base address of Register A as index 0 of the table, while the value from Register B or the immediate value acts as the offset (which is essentially the table index).

Immediate values are calculated during compilation into a single immediate value for the index.

RAM Tables

RAM tables utilize the previously implemented functionality of direct RAM access:

  • RAM[16-bit Immediate]
  • RAM[Register A + 10-bit Immediate]

The only difference is that the immediate address is treated as the start of the table, and Register A acts as the offset. This limits the address of RAM tables using a register A as an offset to below 1024.

Furthermore, the user must set the value of Register A to the actual RAM byte-address rather than the logical index. For example, to access index 2, the value of Register A must be 8.

Further Improvements

Currently, every line translates directly into a single instruction. We can solve these limitations by translating a line into multiple instructions.

For example, we could first compute the proper offset in a temporal register and then use it to access values in tables. This would enable using Register A as a logical index for RAM tables located at address 1024 and above.


r/TuringComplete • • 24d ago

Help needed; how to solve the stack level for Symphony?

1 Upvotes

I've been stuck on the level where you need to make a stack that can push and pull for a while now. I tried a few things myself, nothing. Asked ChatGPT, nothing. Looked up a full guide, found a really good one, didn't work. Is it bugged, or does anyone have a working solution?


r/TuringComplete • • 25d ago

Further Optimized Carry Look-Ahead Adder

Post image
44 Upvotes

Few months ago I posted my attempt at an Optimized Carry Look-Ahead Adder which I was satisfied with at the time. Since then I have taken further steps to optimize it further.

Taking advantage of the 3 delay solution for unlimited input AND gate (NOT SW NOT) showcased by 8bit CCLA (Collapsed Carry-Lookahead Adder) I was able to get the delay to 8. However this lead to a significant increase in gate count (Switches count as 2 gates to counterbalance this use case), which I slowly cut down to the final count of 250.

To save gates, I implemented 3 ways to create multi input AND gates.

  1. Sequential waterfall (grey wires) - Highest delay, but lowest gate count
  2. Parallel AND gates (orange wires) - Moderate delay and moderate gate count
  3. NOT SW NOT (yellow wire) - Static delay of 3 and high gate count

In the end I only needed 7 inputs to use Parallel AND Gates and 3 to use NOT SW NOT. Everything else uses Sequential waterfall.

Here is the improvement in stats:

  • Gate Count: 287 -> 250
  • Delay: 10 -> 8

r/TuringComplete • • 25d ago

LFSR RNG taps behavior

1 Upvotes

I'm looking for a reference chart or table of 16-bit primitive polynomials for a Galois right-shift LFSR that lists high-weight (dense) tap masks. Most tables only list sparse taps (like 4 active bits). Is there a catalog that includes high-weight, maximal-period masks with 8 or more active bits?


r/TuringComplete • • 26d ago

3-bit decoder optimization Spoiler

2 Upvotes

I'm speed hunting atm. Any way to make this quicker and cheaper?

Gates: 28

Delay: 4

Energy cost: 112


r/TuringComplete • • 26d ago

IRL Computer Building

2 Upvotes

Hey, so I'm trying to build the leg architecture IRL and I think I have it mostly figured out, but I can't figure out how to do the delay lines. I'd like the computer to be hand clocked (every time you press a particular button a tick passes) but idk how I'd actually do this. Does anyone have ideas for how I could do this/what components I would use for it?


r/TuringComplete • • 27d ago

Compact Multiplier

Post image
11 Upvotes

r/TuringComplete • • Oct 28 '26

Problems with the Byte-Adder achievement

Post image
8 Upvotes

I have trouble with the fast-adder achievement: It says I have a delay of 32, yet the achievement doesn't trigger. I did get other achievements. What am I missing?


r/TuringComplete • • Oct 27 '26

I've been building a free logic circuit creator which might interest some of you

Post image
40 Upvotes

There are only two primitive 'gates' - Inverter and diode, but you can create components for your own gates or any re-usable functionality you want.

Components are bigger on the inside and may themselves contain other components. You can also customise their ports, and even expose displays and buttons on their sides.

It's free to play at boolboard.com. I'd love to hear what you think of it.

PS: I checked with the mods about posting about this here - I thought it might be something you guys might like.


r/TuringComplete • • Oct 27 '26

My solution of the divide level. Spoiler

2 Upvotes

Might had shorten gate cost to about 1.3k if replace adders with non carry ones, but ig it mostly maximum of this type of solution :3


r/TuringComplete • • Oct 24 '26

custom 9 input Majority

Post image
2 Upvotes

Unlike traditional popcount based threshold circuits, this divides its inputs into three groups of three, using 3 input majority gates and some error correction by XOR'ing the groups of inputs and then detecting if all XOR's are 111 or 000, if all 3 majority gates are NOT 111 or 000, and disagreement between the Maj of XOR's and MAJ of MAJ to tell if the output needs to be changed to the MAJ of the XOR's instead of MAJ of MAJ.

I had to make the correction logic because without it, just using 3 MAJ gates into another MAJ gate failed on 2 cases. Any combination of 110 110 000 and any combination of 111 100 100. it passed all other cases so i just had to fix those two using what i mentioned to have a 9MAJ i could call my own.

The result is a custom 9 input Majority gate I'm kind of proud of :). usually i do the popcount threshold method but i like this lol.

it's for a 9 input neuron if your curious. this would just be the structure that combines the XNOR'ed weights and inputs


r/TuringComplete • • Oct 23 '26

Small, easy-to-build divider Spoiler

6 Upvotes

I was thinking it'd be easy to reduce a divider's component count if left shift had a carry input, since the long division algorithm requires shifting in the dividend one bit at a time. But I remembered that adders have a carry input, and an adder with 2 of the same input behaves like a left shifter, which means that 8 adders is adequate to shift in 8 bits. From there I managed to make a divider out of 15 byte adders, 7 byte multiplexers, 1 byte negator, one splitter, and one maker.

Gate count is 1.4k and delay is 354 so it's not the most efficient solution, but it's easy to make.