Binary and addition

Full Adder: Carry In, Carry Out and the Two Half Adders

A full adder adds three separate one-bit inputs, A, B and Cin, and outputs S and Cout. When Cin=1 the column counts one more unit of its place value; when Cin=0 it adds nothing. S is the remainder of the total divided by 2 and Cout is the total divided by 2 rounded down, so A+B+Cin=2Cout+S.

The path through two half adders

The first half adder, H1, adds A and B to get S1=A XOR B and C1=A AND B. The second half adder, H2, adds only S1 and Cin to get S=S1 XOR Cin and C2=S1 AND Cin. Finally, an OR combines C1 and C2 into Cout.

C1 is never fed into H2's one-unit input. It already stands for two units in the next column, so it goes straight to Cout. When C1=1, A and B are both 1, so S1 must be 0 and C2 is 0. The two carries are never both 1, and no carry is counted twice.

In a multi-bit adding machine, a column's Cin usually comes from the Cout of the column one place lower. This page looks at a single column, so the Cin in each example is simply set to 0 or 1; it doesn't mean another machine has already sent a carry.

All 8 rows with intermediate values

A, B and Cin in each row are three separate inputs, not one three-digit binary number.

Full adder intermediate values: S1 and C1 come from the first half adder, S and C2 from the second, and Cout is C1 OR C2
ABCinS1C1SC2Cout
00000000
00100100
01010100
01110011
10010100
10110011
11001001
11101101

011 and 110 side by side

Both cases give Cout=1, but the carry comes from a different half adder.

  • A=0, B=1, Cin=1: H1 gives S1=1, C1=0. H2 adds S1=1 and Cin=1, giving S=0, C2=1. The OR gives Cout=1.
  • A=1, B=1, Cin=0: H1 gives S1=0, C1=1. H2 adds S1=0 and Cin=0, giving S=0, C2=0. The OR gives Cout=1.

A = 0, B = 1, Cin = 1

  1. H1 · First half adder

    A = 0, B = 1

    S1 = 1, C1 = 0

  2. H2 · Second half adder

    S1 = 1, Cin = 1

    S = 0, C2 = 1

  3. OR · OR gate

    C1 = 0, C2 = 1

    Cout = 1

0 + 1 + 1 = 10₂

A = 1, B = 1, Cin = 0

  1. H1 · First half adder

    A = 1, B = 1

    S1 = 0, C1 = 1

  2. H2 · Second half adder

    S1 = 0, Cin = 0

    S = 0, C2 = 0

  3. OR · OR gate

    C1 = 1, C2 = 0

    Cout = 1

1 + 1 + 0 = 10₂

First case, A=0, B=1, Cin=1: H1 outputs S1=1, C1=0; H2 outputs S=0, C2=1; the OR outputs Cout=1. Second case, A=1, B=1, Cin=0: H1 outputs S1=0, C1=1; H2 outputs S=0, C2=0; the OR outputs Cout=1.

When all three inputs are 1

With A=1, B=1, Cin=1, H1 gives S1=0, C1=1. H2 adds 0 and 1, giving S=1, C2=0, and Cout=1. The outputs Cout=1 and S=1 are written 11₂, meaning 3. That is the output, not the input set 111.

In the course you follow this path by using the adding box twice; you aren't asked to build an OR gate yourself.

Check yourself

  1. For A=0, B=1, Cin=1, what are S1, C1, S, C2 and Cout?

    Answer

    S1=1, C1=0; S=0, C2=1; Cout=1. Check: 0+1+1=2=2×1+0.

  2. For A=1, B=1, Cin=0, what are the intermediate values?

    Answer

    S1=0, C1=1; S=0, C2=0; Cout=1. The carry comes from H1, and C1 is not fed into H2.

  3. For A=1, B=1, Cin=1, what are the intermediate values?

    Answer

    S1=0, C1=1; S=1, C2=0; Cout=1. The total 3 equals 2×1+1, written 11₂.