Binary Addition & Adder Circuits Tutorial

For AP Computer Science - Digital Logic Design

1. Understanding Binary Addition

Binary addition works just like decimal addition, but we only have two digits: 0 and 1. When we add two binary digits, we may need to carry a bit to the next column, just like carrying in decimal addition.

Basic Binary Addition Rules:

Example 1: Simple Binary Addition (No Carry)

  101 (5 in decimal)
+ 010 (2 in decimal)
-----
  111 (7 in decimal)

Example 2: Binary Addition with Carry

  11 (carry bits)
  110 (6 in decimal)
+ 011 (3 in decimal)
-----
 1001 (9 in decimal)
Key Concept: When we add 1 + 1, we get 0 in the current column and carry a 1 to the next column. This is exactly what adder circuits implement in hardware!

Example 3: Multi-bit Addition with Multiple Carries

 1111 (carry bits)
  1011 (11 in decimal)
+ 0111 (7 in decimal)
------
 10010 (18 in decimal)

2. Half Adder Circuit

A half adder adds two single binary digits (A and B) and produces a sum (S) and a carry (C). It's called "half" because it doesn't account for a carry-in from a previous addition.

Half Adder Truth Table:

A B Sum (S) Carry (C)
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1

Logic Equations:

Sum (S) = A ⊕ B (XOR gate)
Carry (C) = A · B (AND gate)
Why XOR for Sum? The sum output is 1 only when A and B are different (exclusive OR).
Why AND for Carry? The carry output is 1 only when both A and B are 1.

Half Adder Circuit Diagram:

XOR AND A B Sum Carry

3. Full Adder Circuit

A full adder adds three binary digits: two significant bits (A and B) plus a carry-in (Cin) from a previous addition. This is essential for multi-bit addition where carries propagate through multiple bit positions.

Full Adder Truth Table:

A B Cin Sum (S) Cout
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

Logic Equations:

Sum (S) = A ⊕ B ⊕ Cin
Cout = (A · B) + (A · C) + (B · C)
(alternate) Cout = (A · B) + (Cin · (A ⊕ B))
Analysis:

Full Adder Circuit Diagram (Using Two Half Adders):

Half Adder HA1 Half Adder HA2 OR A B Cin S1 C1 C2 Sum Cout

4. Building a Multi-Bit Adder

To add multi-bit binary numbers, we chain multiple full adders together in a ripple-carry adder. The carry-out from each bit position becomes the carry-in for the next higher bit position.

Bit positions: 3 2 1 0
----+----+----+----
A: 1 0 1 1
B: 0 1 1 1
----+----+----+----
Sum: 1 0 0 1 0
Circuit Structure:
• Bit 0 (LSB): Can use a half adder (no carry-in needed)
• Bits 1-3: Use full adders, each taking the carry from the previous bit
• The final carry-out becomes the MSB of the result (overflow bit)

5. Design Summary

Circuit Inputs Outputs Sum Logic Carry Logic
Half Adder A, B S, C A ⊕ B A · B
Full Adder A, B, Cin S, Cout A ⊕ B ⊕ Cin (A·B) + (Cin·(A⊕B))

6. Practice Questions

  1. Complete the binary addition: 1101 + 1011 = ?
  2. How many full adders are needed to build a 4-bit ripple-carry adder?
  3. Why does the carry output use an AND gate in a half adder?
  4. What happens if you add 1111 + 0001 in a 4-bit adder? (Hint: overflow)
  5. Design a truth table for a circuit that detects when exactly two of three inputs are 1.

7. Next Steps in Your Design

For your circuit implementation:

Tutorial created for AP Computer Science - Digital Logic Design