Explaining carry-lookahead logic
Providing a clear explanation of carry-lookahead addition focusing on generate (G) and propagate (P) signals, how carries are computed via parallel formulas to avoid ripple delay, and group generate/propagate concepts that enable constant-time carry calculation within small blocks using hierarchical logic.
In a one–bit full–adder the carry–out (c_{i+1}) depends on the two addend bits and the carry–in in a very simple way. Writing (a_i,b_i) for the bits in position (i),
- If both (a_i) and (b_i) are 1 a carry will be generated regardless of what (c_i) is.
- If exactly one of (a_i,b_i) is 1 the carry–out will be whatever the carry–in was; the stage will propagate a carry.
- If both are 0 the carry–out is 0.
Those cases are captured by two signals per bit:
- generate: (G_i = a_i \cdot b_i)
- propagate: (P_i = a_i \oplus b_i) (you will also see (P_i = a_i + b_i) in some texts).
The usual full–adder equation
[
c_{i+1} = a_i b_i;+;(a_i \oplus b_i),c_i
]
is just
[
c_{i+1} = G_i + P_i;c_i.
]
Carry‑lookahead logic uses these relations recursively so that you don’t have to wait for (c_i) to ripple all the way up from bit 0. For example, expanding the recurrence gives the first few carries in terms of the primary inputs (G), (P) and the external carry‑in (c_0):
c1 = G0 + P0 c0
c2 = G1 + P1 G0 + P1 P0 c0
c3 = G2 + P2 G1 + P2 P1 G0 + P2 P1 P0 c0
c4 = G3 + P3 G2 + P3 P2 G1 + P3 P2 P1 G0 + P3 P2 P1 P0 c0
…
These are just sum‑of‑products expressions. There is no data‑dependent “waiting” as there is in a ripple chain: once (a_i), (b_i) and (c_0) are stable, all of the terms above can be formed in parallel by a few levels of AND/OR gates and all of the carries become valid after a fixed number of gate delays.
For wider adders you don’t literally build the whole expansion because of fan‑in limits. Instead you combine bits into groups and form group‑generate/group‑propagate signals with the same structure:
- A group of bits 0…3 propagates if (P_3 P_2 P_1 P_0) is true.
- A group of bits 0…3 generates if (G_3 + P_3 G_2 + P_3 P_2 G_1 + P_3 P_2 P_1 G_0) is true.
Those group (G) and (P) can then be fed into the next level. Arranging the logic in a tree (Brent–Kung, Kogge–Stone, etc.) gives you a carry path of (O(\log n)) gate levels rather than (O(n)), and for a fixed word width the time is effectively constant. Once the carry‑ins are computed, the sums are simply (s_i = P_i \oplus c_i).