• For issues you find with the Switch and Console releases, please follow this link and give as much detail as possible. This is the speediest way to get info to Pipeworks and get a hotfix in the works.
  • 1.4 will bring many changes to the PC version. We strongly advise making plans to back up your worlds and players prior to updating your game. More details here.
  • Begin your search for Journey's End information here and here. Please report bugs and issues for Journey's End here.
  • For issues you find with the Mobile 1.3 update, please follow this link and give as much detail as possible. This is the speediest way to get info to DR Studios to look at your issue. Also, some troubleshooting hints here.

Theoretical Smallest possible binary adder with logic gates

quixilver87

Terrarian
Guide Category
Wiring/Mechanics
just what it says on the tin. Was looking it up earlier today and realized how crazy and complicated the hoiktronics binary adders were and I couldn't find a single person using the xor and method... so I figured I'd throw my hand into the ring. My original goal was to count the number of mobs coming from multiple spawning lanes I had setup in my dungeon farm. With these results my expectations are tempered. I'd need like 4 of these mechanisms per lane to be able to get accurate overnight counts without overflow.
Figured it'd take me a day or two to come up with a workable design, since I couldn't find an example of one that didn't take up half a screen.
20 minutes later I had this.

being this simple, I doubt I'm the first person to come up with it or even to post it here, but I couldn't find a thread about anything close to this efficient.

the red wire from the lever is the incrementor, and switches the first bit. the rest of the bits are built on XOR flip and and output. I switched the logic blocks order every other one so I can eliminate wire paths between modules.

In each XOR AND pair, the 'input' (or 'carry' in some parlance) activates the top 2 lamps in the pair. The xor toggles all 4 lamps in the pair. the and only outputs to the bit indicator and the next input lamps.


Logic flow- First press toggles lone gemspark block on, toggles top 2 lamps on XOR/AND module (LAMP STATE on-on over off-off) XOR activates and toggles all lamps (off-off over on-on). 2nd press toggles gemspark off, toggles top 2 lamps on, AND activates and XOR turns off. XOR flips all lamps leaving you back at all lamps off (AND deactivates but cannot send more than one signal per tick so the 'off' signal is dropped')
The AND's input to the next module can be considered that module's "first press".


each bit can be individually toggled by activating the wire on the AND block coresponding to that bit indicator and the proper carry circtuitry will be activated automatically, making an in-place binary adder just a link between lanes with a manual AND gate.



Tl/DR: smallest binary counter and adder possible- This is how CPU's do it. 30x5 per 8 bits
bump this if you want to see this actually made into a 9 bit full adder with video.
 

Attachments

pbq

Terrarian
I probably should have read the entire post before replying, ..but have you explored the possibilities of faulty lamps yet?
 

quixilver87

Terrarian
I probably should have read the entire post before replying, ..but have you explored the possibilities of faulty lamps yet?
I'd had a bunch of experience with them in the past(scrolling text on a programmable text board) but that was 3 years ago and I'd forgotten about them since.
excuse me please, I must have been very tired. I have a version with just faulty lamps that existed in my gadgets world (like 2screens away from that monstrosity in that link^^)


that said, I still am having trouble finding examples of the faulty block incrementor...
 
Top Bottom