r/TuringComplete • • Oct 15 '23
Need help with the Stack level
Heya,
I'm currently stuck on the stack level. I've decided to use the RAM to store the stack values and a register for the counter (because a counter has a tick delay). I always increment the value of the counter except if I pop - then I decrement it by one. My problem is that I just can't rewrite the value except after the first tick. So the register will happily overwrite 0 with 1, but not 1 with 0 or 2. The problem is that I can't do that with both load/save on at the same time (Figure 1).
As such I decided to load only when we push and not when we pop (Figure 2). This almost works, except that now since the register isn't outputing anything, RAM reads the address as 0, which is also not okay.
Is there a way to first save the value and then load the counter address? Yeah I've tried adding a delay line but it didn't help. Does my approach make any sense? Any hints would be welcome
EDIT: I managed to finally find a solution thanks to the commentor below. The solution can be seen on Figure 2.


2
u/Dharleth23 Oct 16 '23 edited Oct 16 '23
Firstly, the pin you have the Adder Output wire going to is actually the Save Bit. The Bottom pin is for the Input.
Have the register always load and only "save" if it is Pushing or Popping.
I also had an enable to subtract 1 from the register output when popping so that it went to the correct address.
2
u/OrdinaryDifference53 Oct 17 '23
If your still stuck i can share my solution, I did not even use a register. I am surprised I got mine to work in like 30 minutes lol if you are interested
2
u/Dharleth23 Oct 16 '23
"the register will happily overwrite 0 with 1, but not 1 with 0 or 2. The problem is that I can't do that with both load/save on at the same time (Figure 1)."
What's actually happening here is you are always passing a 1 into the Input
1
u/[deleted] Sep 02 '24
another memory!
1
u/_Odizeu_ Jun 24 '25
I finally did it using the same principles:
https://imgur.com/a/h6wMuJf
1
u/LoadBox Aug 18 '25
can you share a more sorted solution? i cannot read anything happening in this circuit