Exercises — Ripple-carry adder
Before we start, one reminder of the two equations that power every stage. For inputs (first bit), (second bit), (carry arriving from the right):
Level 1 — Recognition
L1.1
State the truth-table row for a full adder when . Give and .
Recall Solution
Arithmetic sum . In binary , so the "twos place" is and the "ones place" is . Check with the equations: . Fold the first pair: (they match), then fold in the third: (they differ). So . ✓ . ✓ Answer: .
L1.2
Which single-bit block is an -bit ripple-carry adder made of, and what wire connects one stage to the next?
Recall Solution
It is made of full adders (see Full adder). The connecting wire is the carry: the carry-out of stage becomes the carry-in of stage . That single wire chain is what makes the carry "ripple".
L1.3
True or false: the sum bit is computed by a majority vote of the three inputs.
Recall Solution
False. The sum bit uses XOR (odd-parity): it is when an odd number of the three inputs are . The carry-out is the majority vote. Mixing these up is the single most common error — see the L1 mistake box below.
Level 2 — Application
L2.1
Add and with using a 4-bit RCA. Show every stage's and carry, then the final result.
Recall Solution
Work LSB (bit 0) first. I write bits as and .
- Bit 0: . . Carry . → .
- Bit 1: . . Carry . → .
- Bit 2: . . Carry . → .
- Bit 3: . . Carry . → .
Result . Check . ✓
L2.2
Add and , . Watch the carry ripple all the way through.
Recall Solution
, . I keep the variable names on every line so it stays readable.
- Bit 0: . , carry . → .
- Bit 1: . , carry . → .
- Bit 2: . , carry . → .
- Bit 3: . , carry . → .
Result . Check . ✓ The carry born at bit 0 travelled through all four stages — the worst-case ripple.
L2.3
Compute for , using the RCA-as-subtractor trick: invert , set .
Recall Solution
Two's-complement subtraction (see Two's complement): . . Set . Now add and with carry-in .
- Bit 0: . , carry . → .
- Bit 1: . , carry . → .
- Bit 2: . , carry . → .
- Bit 3: . , carry . → .
Result bits , and is simply discarded in two's-complement subtraction. Check . ✓ (Here , so a carry did come out. The next problem shows what happens when .)
L2.4
Edge case . Compute for , using the same subtractor trick (invert , ). What comes out, and what does the absence of a carry-out mean?
Recall Solution
. Here , and . Add , , carry-in .
- Bit 0: . , carry . → .
- Bit 1: . , carry . → .
- Bit 2: . , carry . → .
- Bit 3: . , carry . → .
Result bits , and this time — no carry came out. Read the result as a signed two's-complement number: top bit is , so it is negative, with value . And indeed . ✓ What the missing carry means: when the pushes past and a carry-out appears (that we discard). When the sum never reaches , so no carry emerges () — the "borrow" is expressed instead as the two's-complement negative pattern in the result bits. In hardware, after a subtraction is exactly the borrow signal telling you the answer went negative.
Level 3 — Analysis
L3.1
A single full adder's carry path has delay , and forming a sum bit from an arrived carry takes an XOR delay . What is the worst-case delay of a 32-bit RCA, and which output bit is last to settle?
Recall Solution
The carry is serial: cannot be right until is right (see Propagation delay). The dominant term is the carry rippling through all stages: The MSB sum is the last data bit, and it needs (the carry into stage 31), which appears after carry stages, then one more XOR to form the sum: Why the sum-XOR delay is usually dropped: is a single constant tacked on at the very end — it does not grow with , while the carry chain grows as . So for the scaling story we write and fold the one-time into the "". Here the honest number is depending on whether you time or the final ; the point is that it is linear in .
L3.2
For unsigned 4-bit addition , , : does the result fit in 4 bits? What is ?
Recall Solution
True value , but 4 unsigned bits hold only . So it cannot fit. Run it: bit 0 (); bit 1 ; bit 2 ; bit 3 → . Result bits with . For unsigned numbers signals the answer overflowed the word — the true value is . ✓
L3.3
Signed two's-complement 4-bit: add and , . Is there signed overflow? Use .
Recall Solution
- Bit 0: : .
- Bit 1: : .
- Bit 2: : .
- Bit 3: : .
Result bits , which as signed two's complement is . But , and can't be stored in 4 signed bits (range ). Overflow flag → overflow, yes (see Overflow detection). Notice here, so relying on carry-out alone would have missed it — that is exactly why signed overflow uses .
Level 4 — Synthesis
L4.1
Show how to build one full adder from two half adders plus one OR gate. A half adder takes two bits and outputs and . Give the wiring and prove the outputs match the full-adder equations.
Recall Solution
See the figure. Wire it like this:
- HA1 takes → produces (partial sum) and (generate carry).
- HA2 takes and → produces and .
- OR gate: .

Proof the sum matches: (folding two XORs, exactly as the [!intuition] box explained). ✓ Exactly the full-adder sum.
Proof the carry matches (the one nontrivial step — let's actually prove it): we must show Intuition first: the left side says "carry out if both (generate), OR if exactly one of is and (propagate an incoming carry)." The right side is the raw majority vote. They should agree because "at least two of three are " splits into two cases: either the two s are themselves (), or one of them is paired with exactly one of . Algebra: expand , so Now build the right side and compare. Take and split each on the other variable: So (the repeated term merges by ). That equals . Adding the term: Finally (since in OR, this is absorption). Hence So two half adders (see Half adder) plus an OR reproduce a full adder exactly.
L4.2
Design a combined adder/subtractor: one control line where computes and computes . What gate do you place on each line and what do you feed to ?
Recall Solution
Put an XOR gate on each line: feed into the adder, and set .
- When : (unchanged) and . The adder computes . ✓
- When : (inverted) and . The adder computes . ✓ The XOR acts as a controlled inverter — that is the elegant trick: one control line reshapes the same Ripple-carry adder into both an adder and a subtractor.
L4.3
You have two 4-bit RCAs. Chain them into an 8-bit adder. Which carry wire connects them, and what is the total worst-case delay if each full adder's carry delay is ?
Recall Solution
Connect the carry-out of the low 4-bit adder () to the carry-in of the high 4-bit adder. Set the low adder's carry-in to the overall ; the high adder's carry-out is the overall . The carry now ripples through all stages in series, so: Chaining does not help speed — it is still . That linear growth is precisely the limitation the Carry-lookahead adder was invented to remove.
Level 5 — Mastery
L5.1
Full trace with signed interpretation. Compute for , in 4-bit RCA, . Report: (a) unsigned result and whether it overflows unsigned; (b) signed two's-complement values of and result, and whether it overflows signed via .
Recall Solution
Run the adder:
- Bit 0: : .
- Bit 1: : .
- Bit 2: : .
- Bit 3: : .
Result bits , with and .
(a) Unsigned: , , true sum . Stored bits , and (the missing ). Since , unsigned overflow: yes (). Reconstruct: . ✓
(b) Signed: has top bit → negative. Value . . True sum . Result bits , which is in range , so it is correct. Overflow flag → signed overflow: no. ✓ The punchline: same bit pattern , but flags unsigned overflow while correctly says no signed overflow. The interpretation, not the bits, decides.
L5.2
A 16-bit RCA has carry delay per stage and each stage also has a fixed sum-XOR delay of after its carry arrives. Estimate when the MSB sum is valid.
Recall Solution
The carry must ripple through stages to reach , but only needs (the carry into the last stage), which is produced after carry stages: . Then the last XOR forms : add . (The final carry-out settles slightly later at .) Still linear in — the defining weakness of ripple carry.
L5.3
Prove that for an -bit RCA the worst-case carry-propagation is a real, achievable case, by exhibiting inputs where the carry born at bit 0 forces every higher stage to wait. Use as your witness.
Recall Solution
We need each stage to be in propagate mode () so it merely passes an incoming carry, and a carry that is actually generated at bit 0. Take , , :
- Bit 0: : generate → , .
- Bit 1: : propagate (), in → , .
- Bit 2: : propagate, in → , .
- Bit 3: : , incoming → , , .
The carry generated at bit 0 was propagated untouched through bits 1 and 2, and only "consumed" at bit 3. therefore could not settle until the carry crossed three stages. Result . ✓
So what — tying the trace back to the general claim: this is not a fluke of . The recipe generalises: put a generate at bit 0 (set ) and make every middle bit a propagate (set exactly one of to so ). Then the single carry born at bit 0 is forced to travel through all intermediate stages before any high sum bit can settle — the carry chain has length . Because such an input pattern always exists for any width , the worst-case latency is genuinely achievable, not a pessimistic over-estimate. That is exactly why real machines abandon ripple carry for wide words in favour of the Carry-lookahead adder.
Connections
- Ripple-carry adder — the parent note these exercises drill.
- Full adder — the block traced in every stage; rebuilt in L4.1.
- Half adder — combined in L4.1 to form a full adder.
- Two's complement — powers the subtraction in L2.3, L2.4 and L4.2.
- Overflow detection — the rule in L3.3 and L5.1.
- Propagation delay — the timing analysed in L3.1, L4.3, L5.2.
- Carry-lookahead adder — the fix for the delay these problems expose.
- Combinational circuits — the family the RCA belongs to.