# How Boolean Logic Works

The logic table for a full adder is slightly more complicated than the tables we have used before, because now we have 3 input bits. It looks like this:

### CI  A  B Q CO

0   0  0  0  0

0   0  1  1  0

0   1  0  1  0

0   1  1  0  1

1   0  0  1  0

1   0  1  0  1

1   1  0  0  1

1   1  1  1  1

Full adders can be implemented in a wide variety of ways.

There are many different ways that you might implement this table. I am going to present one method here that has the benefit of being easy to understand. If you look at the Q bit, you can see that the top 4 bits are behaving like an XOR gate with respect to A and B, while the bottom 4 bits are behaving like an XNOR gate with respect to A and B. Similarly, the top 4 bits of CO are behaving like an AND gate with respect to A and B, and the bottom 4 bits behave like an OR gate. Taking those facts, the following circuit implements a full adder:

This definitely is not the most efficient way to implement a full adder, but it is extremely easy to understand and trace through the logic using this method. If you are so inclined, see what you can do to implement this logic with fewer gates.

Now we have a piece of functionality called a "full adder." What a computer engineer then does is "black-box" it so that he or she can stop worrying about the details of the component. A black box for a full adder would look like this:

With that black box, it is now easy to draw a 4-bit full adder:

In this diagram the carry-out from each bit feeds directly into the carry-in of the next bit over. A 0 is hard-wired into the initial carry-in bit. If you input two 4-bit numbers on the A and B lines, you will get the 4-bit sum out on the Q lines, plus 1 additional bit for the final carry-out. You can see that this chain can extend as far as you like, through 8, 16 or 32 bits if desired.