3.3.2 · D3Combinational Circuits

Worked examples — Ripple-carry adder

4,074 words19 min readBack to topic

Before the matrix, one reminder of the only two equations we ever use, from the parent:

We work everything on 4-bit words unless told otherwise, and we always go LSB first (bit 0, the rightmost) because the carry only flows upward.


The scenario matrix

Every RCA question is one (or a blend) of these cells. The rightmost column says which worked example below nails it.

Cell What makes it special What you must watch Example
U1 Plain unsigned add, no final carry Result fits in bits Ripple can still cross several stages Ex 1
U2 Unsigned add with Sum too big for bits = unsigned overflow (real!) Ex 2
UC Unsigned add with (not subtraction) Extra "+1" injected at the bottom The carry-in adds one to the whole sum Ex 3
Z Zero / degenerate inputs One operand is , or both Everything passes through unchanged Ex 4
F All-ones "worst case" Carry ripples through every stage Ex 5
S1 Subtraction, positive result with Invert , set , drop top carry Ex 6
S2 Subtraction, negative result with Answer comes out in Two's complement form Ex 7
O+ Signed overflow, pos+pos Two positives give a "negative" Use , not Ex 8
O- Signed overflow, neg+neg Two negatives give a "positive" Same rule, mirror case Ex 9
T Timing / real-world twist "How long? / how many gates?" Delay ; count stages Ex 10

The full worst-case carry path — the thing all these examples secretly stress — looks like this:

Figure — Ripple-carry adder

The worked examples

Ex 1 — Cell U1: plain unsigned add, result fits


Ex 2 — Cell U2: unsigned add that overflows ()


Ex 3 — Cell UC: unsigned add with (not a subtraction)


Ex 4 — Cell Z: zero and degenerate inputs


Ex 5 — Cell F: all-ones, the ripple worst case


Ex 6 — Cell S1: subtraction with a positive result


Ex 7 — Cell S2: subtraction with a negative result


Why detects signed overflow


Ex 8 — Cell O+: signed overflow, positive + positive


Ex 9 — Cell O-: signed overflow, negative + negative


Ex 10 — Cell T: timing / real-world twist


Recall Quick self-test across the whole matrix

Which cell needs at setup? ::: The subtraction cells S1/S2 (the "+1" of two's complement) and the plain UC add — a carry-in adds one either way. Unsigned overflow flag? ::: (Ex 2). Signed overflow flag? ::: (Ex 8 pos+pos, Ex 9 neg+neg) — different from unsigned! Why does detect signed overflow? ::: When the carry into the MSB and the carry out of it disagree, the sign bit flipped dishonestly — the true answer left the range . In subtraction, what does a final carry-out of mean? ::: Non-negative result; discard the carry (Ex 6). A means a negative result in two's-complement form (Ex 7). Which example shows the true worst case? ::: Ex 5, all-ones, carry propagated through every stage. What is ? ::: The delay for one full adder to turn a settled carry-in into a settled carry-out; total RCA delay is .

Connections