Sub topic 7
Ripple-Carry Versus Carry-Lookahead Addition
Prerequisites and the carry equation
Assume you know binary addition, Boolean AND and OR, XOR, and the operation of a full adder. A full adder adds two operand bits and an incoming carry bit.
For bit position \(i\), let \(ai\) and \(bi\) be the operand bits. The carry equation is
\[ c{i+1}=gi+pi ci \]
where:
- \(gi=ai bi\) is the generate term. The bit pair generates a carry regardless of \(ci\).
- \(pi=ai \oplus b_i\) is the propagate term. The bit pair passes an incoming carry forward.
- \(c_i\) is the carry entering position \(i\).
- \(c_{i+1}\) is the carry leaving position \(i\).
The sum bit is
\[ si=pi \oplus c_i \]
Ripple-carry adder
A ripple-carry adder connects full adders in series. The carry output from one stage becomes the carry input of the next stage.
Each stage must wait for the previous carry. If one full-adder stage has propagation delay \(t{FA}\), an \(n\)-bit ripple-carry adder has a worst-case carry delay approximately proportional to \(n t{FA}\).
| Adder | Carry calculation | Main advantage | Main limitation |
|---|---|---|---|
| Ripple-carry | One stage after another | Small area and simple wiring | Delay grows with bit width |
| Carry-lookahead | Carries calculated in parallel groups | Much lower carry delay | More logic and wiring |
Carry-lookahead adder
A carry-lookahead adder expands the carry equations so that each carry depends directly on the input carry and the generate and propagate signals.
For four bits:
\[ \begin{aligned} c1 &= g0+p0c0\\ c2 &= g1+p1g0+p1p0c0\\ c3 &= g2+p2g1+p2p1g0+p2p1p0c0\\ c4 &= g3+p3g2+p3p2g1+p3p2p1g0+p3p2p1p0c0 \end{aligned} \]
These expressions allow the carries to be computed in parallel. The circuit still has propagation delay, but the delay grows more slowly than in a simple ripple chain. Large adders usually use groups of bits and a hierarchy of group-generate and group-propagate signals.
module cla4(
input [3:0] a,
input [3:0] b,
input cin,
output [3:0] sum,
output cout
);
wire [3:0] p, g;
wire [4:0] c;
assign p = a ^ b;
assign g = a & b;
assign c[0] = cin;
assign c[1] = g[0] | (p[0] & c[0]);
assign c[2] = g[1] | (p[1] & g[0]) |
(p[1] & p[0] & c[0]);
assign c[3] = g[2] | (p[2] & g[1]) |
(p[2] & p[1] & g[0]) |
(p[2] & p[1] & p[0] & c[0]);
assign c[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]);
assign sum = p ^ c[3:0];
assign cout = c[4];
endmoduleExercise
For a four-bit adder, why can a carry-lookahead design be faster than a ripple-carry design?
Show answer
It computes carries from generate, propagate, and the input carry in parallel instead of waiting for each preceding full adder to finish.