← Back to blogArithmetic circuits

Carry-Lookahead Adder: Faster Than Ripple-Carry

A carry-lookahead adder restructures carry generation with propagate and generate signals. Derive a 4-bit CLA, then see why real designs use hierarchy.

DennyDenny
7 min read
Chalkboard feature illustration for “Carry-Lookahead Adder: Faster Than Ripple-Carry”

TL;DR: Carry lookahead rewrites the serial recurrence Ci+1=Gi+PiCiC_{i+1}=G_i+P_iC_i in terms of per-bit and group generate/propagate signals. A small flat CLA can express several carries directly from the operands. Hierarchical and parallel-prefix versions reduce carry depth from linear toward logarithmic, at the cost of extra cells, fan-out, and wiring.

A 4-bit ripple-carry adder is straightforward: chain four full adders and route each CoutC_{out} into the next CinC_{in}. Its worst-case carry dependency grows with word width. Whether that path meets timing depends on the technology, clock target, cell design, and surrounding datapath; width alone does not make a design “unacceptable.”

Carry-lookahead adders (CLAs) attack the serial dependency by deriving carry expressions from intermediate signals that are available directly from the operands.

What Makes Ripple-Carry Slow?

Recall the full-adder equations:

Si=Ai⊕Bi⊕CiS_i = A_i \oplus B_i \oplus C_i Ci+1=AiBi+(Ai⊕Bi)CiC_{i+1} = A_i B_i + (A_i \oplus B_i) C_i

The sum SiS_i depends on CiC_i. The carry Ci+1C_{i+1} also depends on CiC_i. So the chain of dependencies is C0→C1→C2→⋯→CnC_0 \to C_1 \to C_2 \to \dots \to C_n. If a single carry stage takes tct_c time, the worst-case total addition time is approximately:

Tripple≈n⋅tc+tsumT_{ripple} \approx n \cdot t_c + t_{sum}

The first-order dependency is linear in word width. Absolute nanoseconds require a specified implementation, so gate-delay counts are useful here only for comparing topology. This is the kind of propagation-delay limit that motivates faster carry networks.

Generate and Propagate

Look again at the carry equation:

Ci+1=AiBi+(Ai⊕Bi)CiC_{i+1} = A_i B_i + (A_i \oplus B_i) C_i

The first term, AiBiA_i B_i, is true exactly when both operand bits are 1 — in which case stage ii unconditionally produces a carry-out, regardless of what arrives at CiC_i. Define:

Gi=Ai⋅BiG_i = A_i \cdot B_i

This is the generate signal — stage ii generates a carry on its own.

The second term, (Ai⊕Bi)Ci(A_i \oplus B_i) C_i, says: if exactly one of the operand bits is 1, then whatever arrives at CiC_i propagates straight through. Define:

Pi=Ai⊕BiP_i = A_i \oplus B_i

This is the propagate signal — stage ii passes any incoming carry to its output.

The carry equation collapses to:

Ci+1=Gi+Pi⋅CiC_{i+1} = G_i + P_i \cdot C_i

This is the AND gate and OR gate you already know, doing exactly the work their truth tables describe — but now combined into a recurrence that you can flatten.

Flattening the Carry Recurrence

Substitute the recurrence into itself. Starting from a known C0C_0:

C1=G0+P0C0C_1 = G_0 + P_0 C_0

C2=G1+P1C1=G1+P1(G0+P0C0)=G1+P1G0+P1P0C0C_2 = G_1 + P_1 C_1 = G_1 + P_1(G_0 + P_0 C_0) = G_1 + P_1 G_0 + P_1 P_0 C_0

C3=G2+P2C2=G2+P2G1+P2P1G0+P2P1P0C0C_3 = G_2 + P_2 C_2 = G_2 + P_2 G_1 + P_2 P_1 G_0 + P_2 P_1 P_0 C_0

C4=G3+P3G2+P3P2G1+P3P2P1G0+P3P2P1P0C0C_4 = G_3 + P_3 G_2 + P_3 P_2 G_1 + P_3 P_2 P_1 G_0 + P_3 P_2 P_1 P_0 C_0

The pattern is clean. Each carry Ci+1C_{i+1} is a sum-of-products over generate and propagate signals from stages 0 through ii. Logically, every expression depends only on GG, PP, and C0C_0, rather than on a completed physical transition at the preceding full adder. Physically, wide product terms and their wiring still require finite gates, buffers, and routing.

A worked 4-bit example

Add A=10112A=1011_2 (11) and B=01102B=0110_2 (6), with C0=0C_0=0. Write the bits least-significant first:

Bit iiAiA_iBiB_iPi=Ai⊕BiP_i=A_i\oplus B_iGi=AiBiG_i=A_iB_iCiC_iSi=Pi⊕CiS_i=P_i\oplus C_i
0101001
1110100
2011010
3101010

The carry equations give C1=0C_1=0, C2=1C_2=1, C3=1C_3=1, and C4=1C_4=1. Reading C4S3S2S1S0C_4S_3S_2S_1S_0 produces 100012=1710001_2=17, as expected. The arithmetic matches ripple carry; only the carry-network topology changes.

Group generate and propagate

For a bit group from ii through jj, define a group propagate and group generate:

Pj:i=PjPj−1⋯PiP_{j:i}=P_jP_{j-1}\cdots P_i

Gj:i=Gj+PjGj−1+⋯+PjPj−1⋯Pi+1GiG_{j:i}=G_j+P_jG_{j-1}+\cdots+P_jP_{j-1}\cdots P_{i+1}G_i

Then the carry leaving the group is:

Cj+1=Gj:i+Pj:iCiC_{j+1}=G_{j:i}+P_{j:i}C_i

Two adjacent groups can be combined with the same operation:

(GH,PH)∘(GL,PL)=(GH+PHGL,  PHPL)(G_H,P_H)\circ(G_L,P_L) = (G_H+P_HG_L,\;P_HP_L)

This associativity is the key to hierarchy and parallel-prefix adders: pairs combine, then pairs of pairs, forming a tree rather than a serial chain.

The 4-Bit CLA Architecture

At the Boolean level, a 4-bit flat CLA has three functions:

  1. Generate/propagate layer. nn AND gates produce Gi=AiBiG_i = A_i B_i in one delay; nn XOR gates produce Pi=Ai⊕BiP_i = A_i \oplus B_i in one delay. These run in parallel.
  2. Carry network. AND-OR logic computes C1C_1 through C4C_4 from the expanded formulas. With hypothetical unbounded-fan-in gates this looks like two logic levels; a real library decomposes wide terms, so depth and load increase with width.
  3. Sum layer. nn XOR gates produce Si=Pi⊕CiS_i = P_i \oplus C_i in one delay. (Note that Si=Ai⊕Bi⊕Ci=Pi⊕CiS_i = A_i \oplus B_i \oplus C_i = P_i \oplus C_i once PiP_i is computed.)

For four bits, this can shorten the carry path relative to a chain of full-adder cells. Extending the flat equations indefinitely is not practical, which is why larger CLAs introduce groups.

Block Diagram of a 4-Bit CLA

A0,B0 ─┬── XOR ── P0 ──┐                           ┌── XOR ── S0
       └── AND ── G0 ──┤                           │
                       │   ┌─── carry network ───┐ │
A1,B1 ─┬── XOR ── P1 ──┤   │                     │ ├── XOR ── S1
       └── AND ── G1 ──┤   │   computes          │ │
                       ├──>│   C1, C2, C3, C4    │─┤
A2,B2 ─┬── XOR ── P2 ──┤   │   from expanded     │ ├── XOR ── S2
       └── AND ── G2 ──┤   │                     │ │
                       │   │   carry expressions  │ │
                       │   └─────────────────────┘ │
A3,B3 ─┬── XOR ── P3 ──┤                           ├── XOR ── S3
       └── AND ── G3 ──┘                           │
                                                   └────────── C4
C0 ──────────────────────>┘

Fan-in, wiring, and the hidden cost

For C4C_4, the longest flat expression contains a five-input product term when C0C_0 is included. For C16C_{16}, the corresponding term would contain 17 inputs. Standard-cell libraries provide only limited fan-in, and long wires plus large loads add delay. A literal flat CLA therefore stops scaling gracefully even though its Boolean expression looks shallow.

The usual fix is hierarchy. Group bits—often in blocks of four—compute group GG and PP, then combine those groups at another level. A 16-bit design can use four 4-bit groups plus a second lookahead stage. Parallel-prefix adders apply the associative group operation throughout a tree.

The trade-off is not captured by one universal gate-count table:

ArchitectureCarry dependencyTypical strengthTypical cost
Ripple carryLinearSmall area, simple routingLong worst-case carry path
Block carry lookaheadHierarchicalModerate speed/area compromiseWider local logic and group wiring
Carry selectPrecompute both carry casesShorter decision pathDuplicate sum hardware
Parallel prefixTree-likeLow logical depthMore prefix cells, wiring, and sometimes high fan-out

Actual delay, area, and energy must be measured after mapping and physical implementation. A topology that wins in abstract gate levels can lose after congestion, buffering, and load are included.

Beyond CLA: Parallel-Prefix Adders

The carry-lookahead idea generalizes. The recurrence Ci+1=Gi+PiCiC_{i+1} = G_i + P_i C_i is associative under a custom operator — you can pair up adjacent positions, then pairs of pairs, in a tree. This is the parallel-prefix family:

  • Kogge–Stone — low prefix depth and bounded logical fan-out, but dense wiring and many prefix nodes.
  • Brent–Kung — fewer prefix nodes and less wiring, with greater depth.
  • Han-Carlson, Ladner-Fischer, Sklansky — different trade-offs of fanout, wiring complexity, and depth.

Production adders may also mix prefix structures, use sparsity, or place carry-select logic around selected groups. The choice is made against a specific timing, area, power, and routing budget; a processor’s clock frequency alone does not reveal its adder topology.

Implementing a CLA in DigiSim

You can build a 4-bit CLA from primitives: four AND gates for generate, four XOR gates for propagate, the carry equations above, and four final XOR gates for sum. The higher-level adder and 8-bit adder components are behavioral conveniences; do not infer their internal architecture unless the component documentation specifies it.

To compare topology, chain four full adders as ripple carry and build a separate 4-bit CLA. First verify all operand combinations for functional equivalence. Then, if the simulator models per-gate delay, compare the latest settling time after an input change. If its gates are ideal, count dependent logic levels instead; an ideal waveform cannot predict silicon timing.

Common Pitfalls

  • Forgetting that PiP_i uses XOR, not OR. Either definition — Pi=Ai+BiP_i = A_i + B_i or Pi=Ai⊕BiP_i = A_i \oplus B_i — produces a correct carry, because the Ai=Bi=1A_i = B_i = 1 case is already covered by GiG_i. The reason to prefer XOR is that the same wire feeds the sum stage: Si=Pi⊕CiS_i = P_i \oplus C_i. With OR-defined PiP_i that reuse breaks down and you need a separate XOR for the sum.
  • Underestimating fan-in scaling. A flat 16-bit expansion contains a 17-literal term when C0C_0 is included. Practical wide designs decompose or group the logic.
  • Assuming CLA is always faster. For narrow widths, a ripple implementation can win on area and may meet timing comfortably. There is no architecture-independent crossover width.
  • Mixing up sum and carry critical paths. The carry network’s depth dominates total delay, but the final sum XOR adds one more gate delay. Specifying delay as “carry-network depth” is a common error.

What’s Next

Continue with How an ALU Works: Arithmetic Logic Unit From Gates, then Booth Multiplier Explained for a different arithmetic optimization.

To compare the two adder architectures hands-on, open the full-adder-with-carry template, chain four instances as a ripple-carry adder, and watch the bit-by-bit carry propagation on the logic analyzer. Then build the equivalent 4-bit CLA from the equations in this post and time both circuits — the difference is the entire reason high-speed ALUs exist.

Apply the concept in a simulator model.