• PC NEWS: 1.4.2.3 update is out! More info here. Report bugs here
  • Journey's End on Xbox and PlayStation!: Get all the info by clicking here. A new patch is in QA - expect some Gamepad love, the return of Red's Pick and more. Click here for Known Issues and FAQ. For any other bugs, report them (with as much detail as possible) here.
  • MOBILE NEWS: Stay up to date with the latest mobile news here. Report mobile bugs here

1.3.1 Another Approach to Ripple Carry Addition using only AND gates

DicemanX

Brain of Cthulhu
Since we have some examples of ripple carry adders already (first from Yoraiz0r, and then a couple of others based on real world schematics), I decided to do this quick post showcasing another approach, avoiding the use of the 1.3.1 XOR gates completely and only simulating their function by connecting multiple inputs via the same wire. This approach aims to minimize the number of gates in each full adder, and make it easier to extend the ripple carry adder and make it as big as one wants (via TEdit copy/paste function if one wants to do it quickly).

Here is the ripple-carry adder in action:

Video:

https://gfycat.com/MatureLikableDorking


The ripple carry addition initiates in the rightmost column (using a half adder) and is propagated through the full adders, one in each adjacent column. The calculations are "real time", so as I alter the inputs the addition is performed immediately. The sum of the two binary numbers is displayed at the bottom.

I use the same color wire hooked up to both inputs and the carry from the previous full adder (thus achieving XOR function). The carry to the next full adder is determined by two AND gates. Since we don't have any basic gates that can detect the presence of 2 or more "high" inputs, two AND gates do the trick. The first AND gate sends a pulse (indicating a carry of 1) if both bits are 1. The second AND gate sends a pulse if the input carry is 1 and either bit is 1. This is accomplished by simply hooking up the switches from both bits to the same lamp in the second AND gate, and hooking up the other lamp to the carry from the previous adder. This set-up ensures that only one of the AND gates can ever be turned on at a time, and if either of them turns on, a carry of 1 is sent to the next full adder.

This set-up saves on some gates at the expense of connecting two wires to the input switches. Those switches will be replaced by logic gate boxes once the ripple carry adder is combined with other components.


Schematics:

TGT4eay.png
447ZA32.png



Explanation of Wiring:

Each pair of stacked AND gates represents a full adder, which adds two bits together. The bottom AND gate has a third lamp that is turned on - its only purpose is to make some room so that separate same-colored wires don't end up touching.

The two switches at the top in each column are connected via a green wire to the torches in the display at the bottom. The wire is also extended to the two AND gate boxes in the previous full adder; a signal from either of those AND gates represents a carry of 1.

The red wire in each full adder connects the top switch to a lamp in the first AND gate and a lamp in the second AND gate.

The blue wire in each full adder connects the bottom switch to the bottom lamp in the first AND gate and the same lamp as the red wire in the bottom AND gate.

The yellow wires connect the AND gates from a full adder to the second lamp in the second AND gate in the next full adder.
 
Last edited:

Niranufoti

Plantera
The bottom AND gate has a third lamp that is turned on - its only purpose is to make some room so that separate same-colored wires don't end up touching.
You could've just connected the red&blue wires to the bottom lamp and moved the top gates one tile to the left to avoid contact of the yellow wires, making everything more compact without sacrificing understandability.

Other than that, good job.
 

DicemanX

Brain of Cthulhu
You could've just connected the red&blue wires to the bottom lamp and moved the top gates one tile to the left to avoid contact of the yellow wires, making everything more compact without sacrificing understandability.

Right on! I was too fixated on keeping the AND gates in a column thus missing this nice way of compacing the build even more :).
[doublepost=1464445492,1464388396][/doublepost]Here's what the set-up will look like when the switches are replaced with gates:

rDXPKe6.png
FoNMSzS.png


The switches are still present because the adder isn't hooked up to anything yet, but once it's hooked up to another component that component will turn on the lamps in the single-lamp AND gates. The lever resets all the inputs - it connects to all the transistors in the entire circuit. The outputs do not need to be reset since they automatically reset when the inputs reset.
 
Top Bottom