Foundation of Computers part 3: Full adder

In this article we’ll look at adding together larger binary numbers, and learn how you can apply the process to add numbers of any size.

In a previous article we looked at using the logic gates in integrated circuits to add binary numbers. We can think of the half-adder that we created as being like a jigsaw piece.

Half-adder circuit represented as a jigsaw piece

Half-adder circuit represented by a jigsaw piece

You can attach the two bits that you want to add at the top. The outputs are a sum bit and a carry bit.

Half-adder jigsaw piece showing 1+1=10

Half-adder jigsaw piece showing 1+1=10

We can use the half-adder to add two bits together, but we cannot reuse it to do anything else. The problem is shown in the diagram below. A half-adder can generate a carry bit, but since it cannot take one, we cannot chain them together.

Half-adder jigsaw pieces that cannot be chained together

What we need is jigsaw piece that can accept a carry bit, as well as producing one. This is called a full-adder:

Full-adder represented by a jigsaw piece

Full-adder represented by a jigsaw piece

With a full-adder we can add binary numbers of any size by simply chaining enough pieces together:

Chain of full-adders showing the sum 011+111=1010

Chain of full-adders showing the sum 011+111=1010

Creating a full-adder

Hopefully that metaphor made some sense to you, but if not, just know that the truth table for what we need is as follows:

Carry in A B Carry out Sum
0 0 0 0 0
1 0 0 0 1
0 1 0 0 1
0 0 1 0 1
1 1 0 1 0
0 1 1 1 0
1 0 1 1 0
1 1 1 1 1

We can still use AND and XOR logic gates to achieve this:

Full adder logic gate diagram

Full adder logic gate diagram. The coloured wires correspond with the coloured wires in the following diagram. The numbered logic gates and inputs also match those shown in the following diagram.

Because the integrated circuits that we used in the previous article each contain four logic gates, we have more than enough to build a full-adder. You might have noticed that there is no OR gate in the circuit below. I simply connected the output from both AND gates to the LED. The consequence is that if there is an output from both AND gates, the LED will receive double the voltage.

Full adder breadboard layout

Shown below is a video of the circuit in action. You’ll notice that the DIP switch block is off to the side on a separate mini-breadboard. It stopped holding in place on the main breadboard so I had to move it. The overall design of the circuit is the same.

Using a full-adder integrated circuit

As you may have guessed, there is an integrated circuit that combines all of this functionality together. The following diagram shows the purpose of the pins on a CD74HC283 4-bit binary adder. This integrated circuit contains four full adders chained together, which means that you can add two 4-bit binary numbers.

Labelling of pins (pinout) for the CD74HC283 4-bit binary adder

Labeling of pins (pinout) for the CD74HC283 4-bit binary adder

The VCC and GND pins should be familiar from previous articles. These are the pins that you use to supply power to the IC. The CIN and COUT pins are also easy to explain. These are for the carry-in and carry-out bits. A carry-in for the first full-adder in the chain, and a carry-out for the last full-adder in the chain.

The remaining pins are in four groups, numbered 0, 1, 2, and 3. Each group of pins is for a full-adder in the chain. A and B are the inputs, and S is the sum. The carry bits are handled internally. Going back to the jigsaw metaphor, the inputs and outputs are represented in the following diagram:

4-bit full-adder

Jigsaw representation of the CD74HC283

To start we’ll use a single full-adder in the chip. This is the first jigsaw piece on the right. We’ll add in bits through the CIN, A0, and B0 pins. We’ll take outputs from the S0 and S1 pins. Because we aren’t adding any bits through the A1 or B1 pins, the S1 will be the carry-out from the first full-adder.

The result is a circuit that is a lot simpler than the full-adder that we created before:

Full adder circuit built using a single integrated circuit

The following video shows the circuit in use:

Adding four bits

It is quite simple to convert the previous circuit to one that adds two sets of 4-bits. We need eight switches for the inputs, and five LEDs for the outputs. The breadboard would get a little crowded, so I created a wooden stand to hold everything in place.

Rear of the binary calculator

It may look complicated, but the connections are simple. A switch is connected between Vcc and each input. An LED is connected between each output and ground. Just like the previous circuit, a pull down resistor is connected to each input, and there is a resistor in series with each LED to reduce the voltage. The following breadboard diagram shows a single switch connection and a single LED connection as examples:

Example switch connected to A1 and LED connected to S0

The result is a binary calculator, as demonstrated in the following video:

Comments are closed.