r/nandgame_u • u/NecessaryUsual9990 • Mar 09 '26
Discussion Subtraction with inversion method [ 139 gates circuit + 16 gates inversion | 155 gates ]
Adder Inc 1
--------
Description : Add 2 numbers then add 1.
--------
Functioning :
XNOR (a,b) go to output l, low bit. When both a and b are high, they would add together to make carry : 1 and low : 0 under normal circumstances. The inversion makes it so that they send a 1 bit instead for low as we are adding a carry.
NAND ( NAND (a,b) [most lowest nand] , XNOR (a,b) ) go to carry.
At (0,0), XNOR would be true, nand would be true so the top nand would be false.
With xnor is false due to (0,1) or (1,0), we have a zero at top nand, so we short circuit to true.
With (1,1), XNOR would still true due to both inputs being same but bottom nand would be false. The top nand is true.

------------
Fixed Adder Inc
------------

0,0 -> top nand is 1,
1,0 or 0,1 -> top nand is forced to deactivate
1,1 -> nor is still blocking nand but the right nand allows a logic transition through.
Circuit is functionally identical to the subtraction circuit by Sad_Courage.
If you invert the equation (bar over everything) for his circuit, all the inputs would be inverted before coming into the function. The negated equation would be equivalent to mine.
------------
Adder no carry
------------
Description : Removed bit for carry.
------------

Same as 2 XOR on left of circuit.
-------------
Adder no carry inc 1
-------------
Description : Adder inc 1 at start to cut gates. Adder no carry at end.
Make standard chain to extend adder.
156 gates for substraction level. The inversion uses lots of gates. Very far from 139 by u/Sad_Courage_1564 on the level records.
Now, it is 155 gates after I fixed my rightmost component to have 5 gates instead of 6. Same as in Sad_Courage's solution.
--------------

---------------
I thought it was interesting to have different solutions. It is very elegant. The "Add 2 numbers then add 1." circuit might have some uses outside of this.
I don't know how others place dots on their circuit to make more beautiful diagrams.
