Digital Logic Tutorial

Binary Addition

If you can't see the simulation below, try the Half Adder on Falstad.com

Believe it or not, 4 NAND gates can add a pair of binary numbers and find the sum. The only trick is that the binary numbers must be very small... Only one digit each. This adder can add 0+0=0, 0+1=1, 1+0=1, and 1+1=2. If you try to add even 0+2, it will fail to give the right output. But as with many things in digital logic, we can set many of these little adders side by side and make one that can do just about any size number. That is next. For now, look at how this works:

Isn't that cool!

You might notice that the sum (the right most column of the output, or lowest order bit) is just the XOR of the two inputs. It is 0 when the inputs are the same, and 1 when they are different. You can see the XOR circuit... just exclude the bottom right "carry" NAND gate.

The carry (left column, higher order bit) is just the AND (or NOT NAND) of the two inputs. It is only 1 when input A AND input B are 1. We make this by using the NAND gate at the input, and then adding a NAND configured as an inverter, picking off the output of that first NAND.

Next

Full adder can carry us into modules which will lead to a Big Binary Adder