# CPU Components – Adders

This post is part of a series in which I am following the structure of J. Clark Scott’s book But How Do It Know? (Affiliate Link – commission supports my knowledge quest). You can check out his website at http://www.buthowdoitknow.com/ (not an affiliate link). It’s written with no assumption of knowledge or background in computers, which has been great for me ðŸ˜‰

## How Does an Adder Work?

As its name suggests, an adder takes two binary values and adds them together. My first thought was “that’s cool but how do you make it 32 or 64 bit?” which is a reasonable question. We’ll get to that, and it’s fairly straightforward. But understanding the simple (half) adder is key to understanding how the more complex ones work.

So if A = 1 and B = 1, this contraption using an XOR and AND gate will add them together to get O (output) = 0 and C (carry) = 1. Binary 10, aka 2. 1 + 1 = 2 right? You’ll find if you change out other values for A and B they’ll come out correct.

This also serves to illustrate that there are 10 kinds of people in the world, those who understand binary and those who don’t! Haha! ………ahem.

## The Full Adder

A full adder is just a simple adder with another input. It’s called “carry in”, because the idea is to string together however many adders you want so you can add together 2, 4, 8, 32, 64 or some other number of bits. The full adder logical implementation is more complicated, but it works (I don’t show it here, I didn’t find it particularly important for the discussion. Also I’m a bit lazy).

So when you hook two together, the carry out of the first adder in the chain becomes the carry in of the second adder in the chain.

So if the the two A’s were the two bits of the first number you want to add, and the two B’s are the two bits of the second number that you wanted to add to the first, for example 10 and 11, the first O would be 1, the second would be 0, and the Co at the far right would be 1.

2 + 3 = 5 (binary 10 + 11 = 101), am I right?

J. Clark Scott (affiliate link, supports my knowledge quest) makes a good point – it’s an amazingly simple device for what it does. Although as it turns out, simply chaining adders together produces a fairly inefficient device for chemical and physical reasons. Modern adders are apparently more complex, but faster. It’s a pity life can’t be simple.