Binary Adder

Digit 1

Digit 2

Carry In

Sum Digit

Carry Out

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

The easiest way to turn this into a circuit
is to imagine the table split into a top half and a bottom half. The top half
of the table occurs when the Digit 1 input is 0. In this case, the Sum digit
is equivalent to an XOR gate and the Carry Out digit is equivalent to an AND
gate. The bottom half of the table occurs when the Digit 1 input is 1. In this
case, the Sum digit is the opposite of the XOR (i.e. equivalent to an Exclusive
OR with the output inverted) and the Carry Out digit is equivalent to an OR
gate. This would give a circuit as follows:

Although there are really only three inputs
to the circuit, we have written each of the inputs twice (once for the Sum Digit
and once for the Carry Out). Don't be put off by this - just assume that both
the lines marked "Digit 1" are connected to the same input, that both
the lines marked "Digit 2" are connected to the same input and that
both the lines marked "Carry In" are connected to the same input.
In practice, there's not a great deal that you can do with adding a single pair
of digits. We duplicate the circuit that you see above several times (8 times,
16 times or 32 times - usually a power of 2) to form a proper binary adder:

In this diagram each of the yellow rectangles
represents one instance of the circuit that we developed above. It has two digit
inputs and a Carry In input which is the Carry Out output from the previous
column. Each Carry Out output is then connected to the Carry In input of the
next column. The initial Carry In input is fed from a binary digit called the
Carry Flag, which is usually set to 0 ). The final Carry Out output is fed back
into the Carry Flag for use later on.

In the example given in the diagram, the two numbers being added are 11010011
and 11101010. They produce an answer which is 10111101 with a final Carry Out.
This is equivalent to adding the decimal numbers 211 and 234 and getting the
answer 189. I realise that 211 + 234 is not 189, but this has happened because
the answer has "overflowed" off the end of the adding unit, and the
fact that a Carry Out was produced from the final calculation indicates that
the real answer should be (256) + 189 = 445. Unfortunately, this adding device
is an 8-bit device which cannot produce answers larger than 255, so it sets
the Carry Flag at the end to indicate that there is a 256 missing from the answer.
Incidentally, the same circuit can be used to perform subtraction, except the
number to be subtracted is inverted (all the bits are reversed, so 1 becomes
0 and vice-versa) and 1 is added to it.