Sub topic 10
Ripple-Carry and Carry-Lookahead Adders
Prerequisites
This chapter assumes that you know binary addition, Boolean logic, and the role of a multiplexer and a register. An adder is a combinational circuit that produces a sum from binary inputs without storing the result.
The one-bit full adder
A full adder adds three one-bit values:
- A: the first operand bit
- B: the second operand bit
- Cᵢ: the carry entering from the lower position
It produces:
- S: the sum bit
- Cᵢ₊₁: the carry sent to the next position
The equations are:
- S = A XOR B XOR Cᵢ
- Cᵢ₊₁ = (A AND B) OR (Cᵢ AND (A XOR B))
For an n-bit addition, one full adder is needed for each bit position.
Ripple-carry adder
A ripple-carry adder connects full adders in a chain. The carry output of bit i becomes the carry input of bit i + 1. The carry therefore travels, or ripples, from the least significant bit to the most significant bit.
If each full adder takes a fixed delay, the worst-case delay grows approximately linearly with n. For example, a carry generated at bit 0 may need to pass through all four full adders before the final sum is known.
This design is simple and uses relatively little hardware. Its weakness is speed.
Carry-lookahead adder
A carry-lookahead adder computes carries in parallel instead of waiting for each carry to arrive.
For bit i, define:
- Generate: Gᵢ = Aᵢ AND Bᵢ
- Propagate: Pᵢ = Aᵢ XOR Bᵢ
The carry equation becomes:
Cᵢ₊₁ = Gᵢ OR (Pᵢ AND Cᵢ)
For four bits:
- C₁ = G₀ OR P₀C₀
- C₂ = G₁ OR P₁G₀ OR P₁P₀C₀
- C₃ = G₂ OR P₂G₁ OR P₂P₁G₀ OR P₂P₁P₀C₀
The circuit expands these equations so that several carries are calculated at the same time. The sum bits then use Sᵢ = Pᵢ XOR Cᵢ.
Trade-offs
| Adder | Carry method | Delay trend | Hardware cost |
|---|---|---|---|
| Ripple-carry | Sequential carry chain | O(n) | Low |
| Carry-lookahead | Parallel carry equations | Much lower for practical widths | Higher |
A large lookahead circuit can become expensive because its logic gates have limited fan-in. Real processors therefore often use hierarchical lookahead: small carry-lookahead blocks are connected using another level of lookahead logic.
Exercise
Why does a ripple-carry adder have a worst-case delay proportional to the number of bits?
Show answer
Because the carry from the least significant position may need to pass through every full adder before the most significant sum is determined.