4-bit ripple-carry adder

Four full adders in a chain — add two nibbles and watch the carry ripple. A ready-made arithmetic circuit you can open in the TorchAnvil simulator.

Stacking four full adders

The full adder takes three input bits — A, B, and a carry-in — and produces a Sum bit plus a Cout. On its own it handles a single column of binary addition. Chain four of them together, feeding each stage's Cout into the next stage's Cin, and you've built a 4-bit ripple-carry adder: a circuit that adds two nibbles and produces a 5-bit result (four sum bits plus the final carry).

This is the same structure sitting inside every CPU's arithmetic unit. Scale it up to 8, 16, 32, or 64 bits and you can add any integer your programming language knows about.

How it works

Read the circuit column by column. From the levers on the left, each bit i feeds its own full adder:

  1. Half-adder #1: A_i XOR B_i (partial sum), A_i AND B_i (partial carry).
  2. Half-adder #2: the partial sum meets C_i (the carry in from bit i-1) in another XOR to make the final S_i, and in an AND to make the second partial carry.
  3. OR the two partial carries — that's C_{i+1}, the carry ripple out to bit i+1.

Bit 0's carry-in is the Cin lever (set it low for plain addition, or high if you want to add one as well). Bit 3's carry-out becomes the final Cout lamp — bit 4 of the 5-bit result.

Why it's called "ripple"

The name is literal. When you flip a lever in the bottom-right, bit 0 updates, which recomputes its carry, which updates bit 1, whose carry then updates bit 2, and so on. In real silicon this is the adder's critical path: the carry has to cross every bit before the result settles. At four bits nobody notices; at 64 bits with billions of cycles per second, engineers switch to fancier designs like carry-lookahead, carry-select, or Kogge-Stone adders. But every one of them is just an optimization of what you're looking at.

Reading the output

The result is a 5-bit number: Cout S3 S2 S1 S0, with S0 on the least-significant end. For example:

Try this