Faulty Logic or Sub-tick Computation

Romixal

Terrarian
I did some prototyping and i find out that regular logic gates are quite wanky in terms of complex computations.

Here one of mine first implementation of the full adder:
hQneNvz.png

It fails, because sometimes AND gate (bottom-right) tries to change it's state 2 times in one tick.
I bypassed this problem, and came up with this 4bit adder:
z3pghTQ.png

It seems to work really well, so i moved on.

Then i done some raw prototyping on BCD to Binary converter.
It contains within itself cascade of binary adders:
emeZApj.png

And here you can already see some issues:
For example, if i try to input number 86 XOR gate that i marked will emit smoke and break everything.
Probably you can find a fix for that case, but I'm talking about this sort of problems in general.
Or if i try to move some values from registers into 4bit adder (shown above), adder will emit smoke too,
because we can't change state of any of the lamp above regular logic gates more then once per tick.

But i like how consistent faulty logic gates are.
For example, here is example of keypad with it's driver:
XMTidhT.png

It decode pressed button (outputs on one of the Green or Yellow wire) and after that send pulse on the Red wire.
It works really well and it's easier to plan whole execution (at least for me).
Here i made some logic gates using faulty logic:
kdxdXuy.png

I don't really like how it gets too big to quickly, but level of control of this is really stunning.
Still, we can't use faulty gates more than once per tick, but at least we can load all of the data into it and execute when we want, unlike regular logic gates, when we only can update one lamp per tick.
So, i thinking about all of this, trying to make ends meet.
Want to know what do you think about all of this.
 
Last edited:
Still, we can't use faulty gates more than once per tick, but at least we can load all of the data into it and execute when we want, unlike regular logic gates, when we only can update one lamp per tick.
Actually you can activate multiple lamps on a single gate per tick. The gate smoking or ''shorting out'' is caused that the two signals are not arriving to the gate in the same amount of logic steps. This is so for not making a loop with infinite activations per tick and crashing the game. To prevent that from happening you need to ''delay'' one of the signals and that will make them work as intended.
PS. can't demonstrate anything because dorm internet blocks steam and iv'e recently reinstalled it so logging on is necessary to launch the game.
[doublepost=1479822151,1479821680][/doublepost]PPS. you could go to my calculator and see what I am trying to say. All of the buffer gates (colored purple) are making sure the circuit doesn't short out.
 
Actually you can activate multiple lamps on a single gate per tick. The gate smoking or ''shorting out'' is caused that the two signals are not arriving to the gate in the same amount of logic steps.

Oh, i can see now. Well, that's sucks.
Faulty logic is ENORMOUS, but lining up execution order is quite complex too.
I'm not into "toggle logic". It surely mess up data flow in a way, that i don't like.
For me it's easier to have module, that have "compute" button, that's why i try to came out with "faulty logic".

I can only think about some equivalent of "faulty lamp".
0Wc7xEl.png

"Okay Lamp" that makes logic gate produce their outputs, but only when that "Okay Lamp" is actuated (similar to faulty lamp, except output will be legit).
For now we can only make one-directional propagation (except faulty logic, that's still an option).
I know, that somewhere there is probably exist some workarounds, but I'll give up because this stuff is unproductive.
 
Does it not bother you that, when you flip the switch to process the inputs, you have to then flip it again to clear the output and only then be able to change the inputs so you don't break the circuit?
[doublepost=1479838504,1479836414][/doublepost]
I can only think about some equivalent of "faulty lamp".
0Wc7xEl.png

"Okay Lamp" that makes logic gate produce their outputs, but only when that "Okay Lamp" is actuated
Well this made me think a bit and we can totally simulate that:
33PjLXh.png

the xor gate can be changed to a different one if needed

the lesson is to not over-complicate things :D
 
Does it not bother you that, when you flip the switch to process the inputs, you have to then flip it again to clear the output and only then be able to change the inputs so you don't break the circuit?

You probably didn't get what do I mean.
Look at my implementation of faulty logic gates (last pic in op), they behave exactly as i wanted.
However your implementation has this problem, as you described (flip to process and flip back).

Basically in Terraria we can emit pulses that propagates through wires.
Most of the "active" objects in Terraria changing own state (on/off) when receiving these pulses, with several exceptions (like teleporters).
Logic gates inherently have this weird behavior: they send one pulse when their statement is true, and send another pulse when their statement is no longer true.
Terraria implies that we need to work with this "toggle" type logic, which is illogical to me, especially when it's all powered by pulses.

So, I don't want to change state of stuff, i want to route pulses.
Lblby3A.png


And i will repeat myself: this hypothetical "okay lamps" work exactly as the "faulty lamps", except they will make logic gate emit pulse when it's statement is true (rather then by random chance).
 
Last edited:
You probably didn't get what do I mean.
Look at my implementation of faulty logic gates (last pic in op), they behave exactly as i wanted.
However your implementation has this problem, as you described (flip to process and flip back).

Basically in Terraria we can emit pulses that propagates through wires.
Most of the "active" objects in Terraria changing own state (on/off) when receiving these pulses, with several exceptions (like teleporters).
Logic gates inherently have this weird behavior: they send one pulse when their statement is true, and send another pulse when their statement is no longer true.
Terraria implies that we need to work with this "toggle" type logic, which is illogical to me, especially when it's all powered by pulses.

So, I don't want to change state of stuff, i want to route pulses.
Lblby3A.png


And i will repeat myself: this hypothetical "okay lamps" work exactly as the "faulty lamps", except they will make logic gate emit pulse when it's statement is true (rather then by random chance).
Alright so I tested out everything and both xor versions worked identically, but by the others my ''design'' failed. Sooooo.... yeah you win (but now we know that there is a cheap alternative for the most complex of the three)
 
Alright so I tested out everything and both xor versions worked identically.
Indeed.
9erB6LJ.png

I'm glad that you get my point.
Now I'm feeling more enthusiastic about this.
I will try to make some prototypes to show all benefits of this approach.
But i really had too much of Terraria for the past month, so I will probably take a break.
 
Last edited:
Now I'm feeling more enthusiastic about this.
glad to hear read that.


Anyways I reworked my design a bit and the circuit should work universally with other gates:
aFdvuPY.png

this beats the purpose that I wanted it to be the most compact version possible, but now it exists ¯\_(ツ)_/¯
if anyone is interested in this, I added a world download to check it out.
 

Attachments

  • things_n_stuff.wld
    23.3 KB · Views: 91
glad to hear read that.

I continue my research.
Today i was able to move value from "register" to "increment/decrement module", increment the value and write it back in the same "register" all in one tick.
hBMwgUl.png

This stuff have great potential, but execution order alignment still a thing.

Also, here some prototype of the RAM cell.
hWLfNlu.png

P.S. I will do more broad explanation when i will have something more complete.
[doublepost=1479944410,1479929064][/doublepost]
fCYDR2k.jpg

k75oVfv.gif

Y4dGANu.gif
 
Research, research and research...
IHx0LC7.png


Carrying data using pulses is very handy, and if we wanna get CPU that can initiate operations by itself we also want to have circuits that can be executed by pulse.
Sometimes "faulty" circuits is very useful, but some times easier to make driver for regular "toggle" circuits.

Here, for example, "4 bit adder" and "shift-and-add-3":
c7pTj43.png

kdSUtO8.png

I really like how 4 bit adder works, how small it is and how clean it looks.
However "shift-and-add-3" looks like trash, although it works.

By the way, we missed smallest and simplest faulty XOR:
Onz2EvL.png
 
I continue my research.
Today i was able to move value from "register" to "increment/decrement module", increment the value and write it back in the same "register" all in one tick.
hBMwgUl.png

This stuff have great potential, but execution order alignment still a thing.

Also, here some prototype of the RAM cell.
hWLfNlu.png

P.S. I will do more broad explanation when i will have something more complete.
[doublepost=1479944410,1479929064][/doublepost]
fCYDR2k.jpg

k75oVfv.gif

Y4dGANu.gif
QUESTION: are you using a shift register for the RAM, and what kind of flip-flops are you using, ive been testing RAM with D-Flip-flops and those require a clock

EDIT: Thanks for getting me inspired to play this game again, I havent played in a while, I actually started doing this stuff IRL, I bought a ton of breadboards and IC's and have been making math circuits
 
QUESTION: are you using a shift register for the RAM, and what kind of flip-flops are you using

Here is the memory address driver:
UnCOcnN.png


It can increment, decrement and set address to zero.
As a result we get AND Gate enabled that correspond to memory cell that should be "Open" for read and write.

Here is the actual 4-bit memory cells:
INtMNgm.png


Pair of lamps, connected by yellow wire, is the actual bits.
Blue wire enables these cells into read bus and the green wire set all the cells to zero.
Write bus just toggle cell bits, so before writing the data we need reset cell first (by pulsing green wire).
Red wire just opens and closes the cell.
 
Back
Top Bottom