Adding Two Numbers in Hardware
This article introduces hardware arithmetic design in Module 2. At the physical level, digital circuits perform addition using logic gates and voltage signals. However, positional addition introduces a sequential data dependency known as the carry chain. This carry propagation delay represents the primary performance bottleneck in processor arithmetic execution units.
Positional Addition and Carry Dependencies
Consider manual decimal addition of 17 and 25:
1 7
+ 2 5
------
4 2
- Units Column: Compute $7 + 5 = 12$. Write the sum digit 2 and generate a carry digit 1.
- Tens Column: Compute $1 + 2 + 1 = 4$. Write the sum digit 4.
The computation in the tens column cannot complete until the carry from the units column arrives. The columns cannot evaluate independently in parallel.
Binary addition operates identically using base-2 digits.
For example, add $17_{10}$ (0001_0001_2) and $25_{10}$ (0001_1001_2).
Each column takes two input bits and a carry-in from the adjacent right bit position.
The column generates a sum bit and passes a carry-out bit to the left.
Single-Bit Addition Slice
Every column in an $N$-bit binary adder requires a standardized logic slice with three inputs and two outputs:
- Inputs: Operand bits $A_i$ and $B_i$, and carry-in bit $C_{\text{in}}$ ($C_i$).
- Outputs: Sum bit $S_i$ and carry-out bit $C_{\text{out}}$ ($C_{i+1}$).
An $N$-bit adder cascades $N$ of these single-bit stages in series. Connecting the carry-out of each stage to the carry-in of the next stage forms the carry chain.
The Carry Propagation Bottleneck
To compute sum bit $S_i$, the circuit requires carry-in $C_i$. Carry $C_i$ depends on stage $i-1$, which in turn depends on stage $i-2$. The dependency extends back to the least significant bit ($C_0$). The carry signal ripples sequentially from bit 0 to bit $N-1$.
In a 64-bit adder, bit 63 cannot generate its final sum until the carry signal traverses all 63 preceding stages. In the worst case, every stage generates or propagates a carry. The entire circuit must wait for the carry signal to stabilize.
Quantifying Latency in Modern Processors
High-performance microprocessors operate at clock frequencies between 3 GHz and 5 GHz. At 3 GHz, one clock cycle equals 333 picoseconds (ps). A 64-bit arithmetic operation must complete within this clock period.
In modern CMOS process nodes, a basic logic gate exhibits an average propagation delay of 20 to 30 ps. A standard 64-bit ripple-carry adder requires approximately 130 logic gate delays along its worst-case carry path. At 30 ps per gate delay:
$$t_{\text{ripple}} \approx 130 \times 30\text{ ps} = 3{,}900\text{ ps} = 3.9\text{ ns}$$
A delay of 3.9 ns is more than ten times the available 333 ps clock period. Therefore, processors cannot use simple ripple-carry adders in high-speed execution pipelines.
Architectural Strategies for High-Speed Addition
Engineers use three primary architectural strategies to eliminate the carry chain bottleneck:
- Carry-Lookahead Addition (Do Not Wait): Computes carries directly from input operands $A$ and $B$ using generate ($G$) and propagate ($P$) logic. This technique reduces carry computation latency to $O(\log N)$ gate delays.
- Carry-Select Addition (Speculate Both Values): Precomputes two parallel addition results for higher-order bit blocks: one assuming $C_{\text{in}} = 0$ and one assuming $C_{\text{in}} = 1$. When the true carry-in arrives, a multiplexer selects the correct result immediately. Latency scales with $O(\sqrt{N})$.
- Carry-Skip Addition (Bypass Inactive Blocks): Detects when all bits within a block propagate a carry. The circuit routes the incoming carry around the block through a bypass multiplexer.
Table 1 summarizes these adder architectures:
| Architecture | Carry Latency Growth | Relative Silicon Area | Typical Usage |
|---|---|---|---|
| Ripple-Carry | $O(N)$ | Minimal ($1\times$) | Low-power microcontrollers, non-critical paths |
| Carry-Skip | $O(\sqrt{N})$ | Moderate ($1.2\times$) | Low-power arithmetic units |
| Carry-Select | $O(\sqrt{N})$ | High ($1.8\times$) | Fast adders with moderate area budgets |
| Carry-Lookahead | $O(\log N)$ | High ($2.0\times$) | High-frequency CPU ALUs |
Roadmap for Section 2.1
Section 2.1 analyzes the implementation of these adder architectures:
- Half Adder and Full Adder: Gate-level design of single-bit addition slices.
- Ripple-Carry Adder: Cascaded multi-bit networks and exact critical path timing analysis.
- Carry-Lookahead Adder: Mathematical derivation of generate/propagate logic and lookahead carry units.
- Carry-Select Adder: Speculative dual-carry topologies and multiplexer selection.
- Architectural Trade-Offs: Comparative analysis across ASIC and FPGA technologies.
In the next article, we derive gate-level schematics for the half adder and the full adder.