The parent note showed you the machine and two clean examples. Now we stress-test it. Real inputs are messy: what if every bit generates? What if nothing does? What if the carry-in c 0 = 1 instead of the comfortable 0 ? What if a carry has to leap across a long chain of propagate bits, or dies halfway up? This page walks one example per messy corner, so no scenario can ever surprise you.
Before we count cases, one reminder of the machinery from the parent — written out so nothing is assumed :
Every CLA problem falls into one of these cells . The examples below are labelled with the cell(s) they cover.
Cell
What makes it special
Where it can bite
C1 Plain add, c 0 = 0
some generates, some propagates
baseline sanity
C2 Long propagate chain
one generate rides across many p i = 1
carry "travels"
C3 All generate
every g i = 1
max carries, overflow-out
C4 All zero / degenerate
A = B = 0
no carry ever forms
C5 Carry-in c 0 = 1
the c 0 ∏ p j term matters
forgetting c 0
C6 Carry born, then dies
generate below a p i = 0 gap
chain broken
C7 Real-world word problem
decimal → binary → CLA
translation
C8 Exam twist: OR-vs-XOR trap
wrong p i definition
sum breaks
We hit all eight below.
A = 0101 , B = 0011 , c 0 = 0
Forecast: 5 + 3 = 8 = 100 0 2 . Guess: do you expect a carry-out? (No — the sum 8 fits in 4 bits.)
Step 1 — per-bit p , g . Why this step? g i , p i depend only on the inputs, so we build them first — they are the raw predictors nothing waits on.
i
a i
b i
g i = a i b i
p i = a i ⊕ b i
0
1
1
1
0
1
0
1
0
1
2
1
0
0
1
3
0
0
0
0
Step 2 — carries by lookahead. Why this step? Each carry is a flat AND–OR of the g 's and p 's; no carry waits for another.
c 1 = g 0 + p 0 c 0 = 1 + 0 = 1
c 2 = g 1 + p 1 c 1 = 0 + 1 ⋅ 1 = 1
c 3 = g 2 + p 2 c 2 = 0 + 1 ⋅ 1 = 1
c 4 = g 3 + p 3 c 3 = 0 + 0 ⋅ 1 = 0
Step 3 — sums s i = p i ⊕ c i . Why this step? The sum bit reuses p i (that's why CLA computes p i once and shares it).
s 0 = 0 ⊕ 0 = 0
s 1 = 1 ⊕ 1 = 0
s 2 = 1 ⊕ 1 = 0
s 3 = 0 ⊕ 1 = 1
Result: S = 1000 , carry-out c 4 = 0 .
Verify: 010 1 2 + 001 1 2 = 5 + 3 = 8 = 100 0 2 . ✓ Carry-out 0 as forecast.
Notice how the generate at bit 0 was propagated through bits 1 and 2 (both p = 1 ) and then stopped at bit 3 (where p 3 = 0 ). That's cell C1's flavour — a carry that lives and dies inside the word.
A = 0111 , B = 0001 , c 0 = 0
Forecast: 7 + 1 = 8 . A single generate at bit 0 must ride up three propagate bits. Watch it travel.
Step 1 — per-bit p , g . Why? Establish that only bit 0 generates and bits 1–3 propagate.
i
a i
b i
g i
p i
0
1
1
1
0
1
1
0
0
1
2
1
0
0
1
3
0
0
0
0
Step 2 — carries. Why? This is the cell where we see a carry "leap" without waiting.
c 1 = g 0 = 1 (born here)
c 2 = g 1 + p 1 c 1 = 0 + 1 ⋅ 1 = 1 (propagated)
c 3 = g 2 + p 2 c 2 = 0 + 1 ⋅ 1 = 1 (propagated again)
c 4 = g 3 + p 3 c 3 = 0 + 0 ⋅ 1 = 0 (dies — p 3 = 0 )
Look at the figure: the red carry token is created at bit 0 and copied straight up.
Step 3 — sums.
s 0 = 0 ⊕ 0 = 0 , s 1 = 1 ⊕ 1 = 0 , s 2 = 1 ⊕ 1 = 0 , s 3 = 0 ⊕ 1 = 1
Result: S = 1000 , carry-out 0 .
Verify: 011 1 2 + 000 1 2 = 7 + 1 = 8 = 100 0 2 . ✓ In ripple-carry this same carry would visit each bit one at a time ; in CLA the flat formula produced c 2 , c 3 simultaneously — that is the whole point.
A = 1111 , B = 1111 , c 0 = 0
Forecast: 15 + 15 = 30 . That needs 5 bits, so expect carry-out = 1 and S = 1110 .
Step 1 — per-bit p , g . Why? When both inputs are 1, g i = 1 (generate) and p i = 1 ⊕ 1 = 0 (no propagate). Every column makes its own carry.
i
a i
b i
g i
p i
0
1
1
1
0
1
1
1
1
0
2
1
1
1
0
3
1
1
1
0
Step 2 — carries. Why? Since every p i = 0 , the propagate terms vanish and each carry is just its own generate.
c 1 = g 0 = 1
c 2 = g 1 + p 1 c 1 = 1 + 0 = 1
c 3 = g 2 + p 2 c 2 = 1 + 0 = 1
c 4 = g 3 + p 3 c 3 = 1 + 0 = 1
Step 3 — sums s i = p i ⊕ c i = 0 ⊕ c i = c i :
s 0 = c 0 = 0 , s 1 = c 1 = 1 , s 2 = c 2 = 1 , s 3 = c 3 = 1
Result: S = 1110 , carry-out c 4 = 1 → full answer 1 111 0 2 .
Verify: 15 + 15 = 30 . 1 111 0 2 = 16 + 8 + 4 + 2 = 30 . ✓ This is the CLA's maximum-carry case — no propagation at all, pure generation.
A = 0000 , B = 0000 , c 0 = 0
Forecast: 0 + 0 = 0 , no carry anywhere. This is the degenerate floor case — every signal is 0.
Step 1 — p , g . Why? Confirm the machine produces all-zero predictors. g i = 0 ⋅ 0 = 0 , p i = 0 ⊕ 0 = 0 for all i .
Step 2 — carries. Why? With every g i = 0 and every p i = 0 , the recursion c i + 1 = g i + p i c i = 0 collapses to zero at every stage.
Step 3 — sums: s i = p i ⊕ c i = 0 ⊕ 0 = 0 for all i .
Result: S = 0000 , carry-out 0 .
Verify: 0 + 0 = 0 . ✓ Degenerate input → every wire idle. This is the sanity anchor: if your circuit lights up any signal here, something is wired wrong.
A = 0011 , B = 0100 , with c 0 = 1
Forecast: 3 + 4 + 1 = 8 . This is where the often-forgotten c 0 ∏ p j term earns its keep — watch c 0 ride up.
Step 1 — p , g . Why? Same as always; c 0 does not change the predictors.
i
a i
b i
g i
p i
0
1
0
0
1
1
1
0
0
1
2
0
1
0
1
3
0
0
0
0
Every lower bit propagates (p 0 = p 1 = p 2 = 1 ); nobody generates. The only carry source is c 0 itself.
Step 2 — carries. Why? Here we MUST keep the c 0 term — this cell is the classic "forgot c 0 " trap.
c 1 = g 0 + p 0 c 0 = 0 + 1 ⋅ 1 = 1
c 2 = g 1 + p 1 c 1 = 0 + 1 ⋅ 1 = 1
c 3 = g 2 + p 2 c 2 = 0 + 1 ⋅ 1 = 1
c 4 = g 3 + p 3 c 3 = 0 + 0 ⋅ 1 = 0
Equivalently by the fully-expanded formula: c 3 = g 2 + p 2 g 1 + p 2 p 1 g 0 + p 2 p 1 p 0 c 0 = 0 + 0 + 0 + 1 ⋅ 1 ⋅ 1 ⋅ 1 = 1 . The last term p 2 p 1 p 0 c 0 is the whole story.
Step 3 — sums:
s 0 = p 0 ⊕ c 0 = 1 ⊕ 1 = 0
s 1 = p 1 ⊕ c 1 = 1 ⊕ 1 = 0
s 2 = p 2 ⊕ c 2 = 1 ⊕ 1 = 0
s 3 = p 3 ⊕ c 3 = 0 ⊕ 1 = 1
Result: S = 1000 , carry-out 0 .
Verify: 3 + 4 + 1 = 8 = 100 0 2 . ✓ If you had dropped c 0 , you'd get c 1 = 0 and the wrong answer 0111 = 7 . The c 0 term is not optional.
A = 1001 , B = 0011 , c 0 = 0
Forecast: 9 + 3 = 12 = 110 0 2 . A generate at bit 0 will die at bit 1 (a non-propagate gap), then a fresh generate appears higher up. Two separate carry "events."
Step 1 — p , g .
i
a i
b i
g i
p i
0
1
1
1
0
1
0
1
0
1
2
0
0
0
0
3
1
0
0
1
Why note the gaps? p 2 = 0 means position 2 blocks any carry from below — the chain can't cross it.
Step 2 — carries. Why? We want to see the carry from bit 0 get killed at the p 2 = 0 wall.
c 1 = g 0 = 1 (born at bit 0)
c 2 = g 1 + p 1 c 1 = 0 + 1 ⋅ 1 = 1 (propagated through bit 1)
c 3 = g 2 + p 2 c 2 = 0 + 0 ⋅ 1 = 0 (dies — p 2 = 0 blocks it)
c 4 = g 3 + p 3 c 3 = 0 + 1 ⋅ 0 = 0 (nothing to propagate)
Step 3 — sums:
s 0 = 0 ⊕ 0 = 0 , s 1 = 1 ⊕ 1 = 0 , s 2 = 0 ⊕ 1 = 1 , s 3 = 1 ⊕ 0 = 1
Result: S = 1100 , carry-out 0 .
Verify: 9 + 3 = 12 = 110 0 2 . ✓ The lesson: a p i = 0 position is a carry wall . Compare with C2, where every p i = 1 let the carry fly all the way.
Worked example A cash register adds two coin counts stored as 4-bit binary registers. Slot X holds
13 coins, slot Y holds 6 coins. The overflow line feeds a warning LED. Using CLA logic, what does each output wire read?
Forecast: 13 + 6 = 19 , which is bigger than the max 4-bit value 15 — so the overflow LED (carry-out) lights up , and the 4-bit result wraps to 19 − 16 = 3 = 0011 .
Step 1 — translate to binary. Why? The CLA operates on bits, so decimal must become a i , b i . 13 = 110 1 2 , 6 = 011 0 2 , and c 0 = 0 (no incoming carry).
Step 2 — p , g .
i
a i
b i
g i
p i
0
1
0
0
1
1
0
1
0
1
2
1
1
1
0
3
1
0
0
1
Step 3 — carries. Why? The overflow LED is exactly c 4 ; we must chase the carry to the top.
c 1 = g 0 + p 0 c 0 = 0 + 0 = 0
c 2 = g 1 + p 1 c 1 = 0 + 1 ⋅ 0 = 0
c 3 = g 2 + p 2 c 2 = 1 + 0 = 1 (generate at bit 2)
c 4 = g 3 + p 3 c 3 = 0 + 1 ⋅ 1 = 1 (propagated → LED on )
Step 4 — sums:
s 0 = 1 ⊕ 0 = 1 , s 1 = 1 ⊕ 0 = 1 , s 2 = 0 ⊕ 1 = 1 … wait, recompute: s 2 = p 2 ⊕ c 2 = 0 ⊕ 0 = 0 ; s 3 = p 3 ⊕ c 3 = 1 ⊕ 1 = 0 .
So s 0 = 1 , s 1 = 1 , s 2 = 0 , s 3 = 0 .
Result: register reads S = 0011 = 3 , overflow LED = 1 .
Verify: 13 + 6 = 19 . Modulo 16 : 19 − 16 = 3 = 001 1 2 , and overflow = 1 . ✓ Units check: coin counts (dimensionless integers), result correctly flags that the 4-bit slot can't hold 19.
Worked example A student defines propagate as
p i = a i + b i (OR ) instead of XOR, then computes the sum with s i = p i ⊕ c i . Take A = 0011 , B = 0011 , c 0 = 0 . Show the carry is still right but the sum bit breaks .
Forecast: 3 + 3 = 6 = 011 0 2 . The parent's mistake box warns that OR-propagate corrupts the sum. Let's expose exactly where.
Step 1 — build BOTH tables. Why? We compare correct XOR-propagate against the buggy OR-propagate side by side.
i
a i
b i
g i
p i XOR
p i OR
0
1
1
1
0
1
1
1
1
1
0
1
2
0
0
0
0
0
3
0
0
0
0
0
The two definitions differ only where a i = b i = 1 (bits 0 and 1) — exactly the columns where g i = 1 .
Step 2 — carries are identical. Why? In any differing column g i = 1 , so c i + 1 = g i + p i c i = 1 regardless of p i . The generate dominates.
Correct: c 1 = g 0 = 1 , c 2 = g 1 + p 1 c 1 = 1 , c 3 = g 2 + p 2 c 2 = 0 , c 4 = 0 .
OR version: c 1 = 1 , c 2 = g 1 + p 1 OR c 1 = 1 + 1 ⋅ 1 = 1 , c 3 = 0 + 0 = 0 , c 4 = 0 . Same carries. ✓
Step 3 — sums diverge. Why? s i = p i ⊕ c i uses p i directly, so the wrong p i poisons the sum at bit 1.
Correct sum: s 0 = p 0 XOR ⊕ c 0 = 0 ⊕ 0 = 0 ; s 1 = 0 ⊕ c 1 = 0 ⊕ 1 = 1 ; s 2 = 0 ⊕ c 2 = 0 ⊕ 1 = 1 ; s 3 = 0 ⊕ 0 = 0 → S = 0110 = 6 . ✓
Buggy sum: s 0 = p 0 OR ⊕ c 0 = 1 ⊕ 0 = 1 (wrong! ); s 1 = 1 ⊕ 1 = 0 ; s 2 = 0 ⊕ 1 = 1 ; s 3 = 0 → S = 0101 = 5 . ✗
Result: OR-propagate yields the correct carry-out but the wrong number 5 instead of 6 .
Verify: 3 + 3 = 6 = 011 0 2 (correct XOR path). The OR path gives 010 1 2 = 5 = 6 . ✓ Moral, straight from the parent: always use p i = a i ⊕ b i so the shared signal serves the sum too.
Recall Which cell does each example cover? (quick self-test)
Long-propagate-chain example number? ::: Example 2 (Cell C2).
Which example forces you to keep the c 0 ∏ p j term? ::: Example 5 (Cell C5).
Which example shows a carry dying at a p i = 0 wall? ::: Example 6 (Cell C6).
Which example proves OR-propagate breaks only the sum, not the carry? ::: Example 8 (Cell C8).
What is special about the all-1s input (Example 3)? ::: Every g i = 1 , every p i = 0 — maximum carries, no propagation.
"BORN, RIDE, DIE" — a carry is BORN at a generate (g i = 1 ), RIDE s up through propagate bits (p i = 1 ), and DIE s at a wall (p i = 0 ). Examples 2, 5, 6 show exactly these three verbs.
Carry-lookahead adder — parent; this page stress-tests its formulas.
Full Adder — each column here is one full adder's g , p , s logic.
Ripple-Carry Adder — the "carry rides slowly" baseline our Example 2 beats.
Boolean Algebra — Example 8's OR-vs-XOR argument is pure Boolean identity.
Propagation Delay & Fan-in — why all-generate (Example 3) still costs constant depth.
Prefix Adders (Kogge-Stone) — generalizes the "born/ride/die" carry chains logarithmically.