Adder Anatomy

How do you make wires add two numbers? The logic gates we already know come to the rescue.

To add two bits, we need two results: the sum itself and the carry bit (the "one to carry over" when we add 1+1). The XOR gate is perfect for computing the sum — it outputs 1 only when the inputs are 0 and 1, and outputs 0 when both inputs are 1. To catch the carry bit, we put an AND gate in parallel — it fires only when we add two ones at the same time.

This pairing of XOR and AND is called a "half-adder." But to add larger numbers in a chain, we need a "full adder." Its key difference is that it has a third input — it can accept a carry bit from its younger neighbor. A cascade of such full adders can add numbers of any length!

Practical example. To add two 8-bit numbers (say, 113 + 29), a chain of eight full adders works simultaneously. The two least significant bits (1 and 1) go into the first adder, which computes a sum of 0 and a carry of 1. This carry immediately flows into the next adder, which now adds three signals: bit A, bit B, and the incoming carry. In a single signal pass through the entire chain, the processor gets the finished 8-bit result.