next up previous
Next: Traditional Carry Lookahead Analysis Up: Integer Representation and Arithmetic Previous: Incrementing Integers

Fast Addition of Integers (Carry-Lookahead)

In examining how incrementing can be made faster, we saw that the carry signal is propagated whenever there is a one in the input. If there is a one in the input, the carry bit is set if and only the previous carry bit is set. If there is a zero in the input, the carry bit is never set. We see similar behavior in general addition circuits.

Carry $carry_{n-1}$ $carry_{n-2}$ $carry_{n-3}$ ... $carry(2)$ $carry(1)$ $carry(0)$  
Input X   $x_{n-1}$ $x_{n-2}$ ... $x_3$ $x_2$ $x_1$ $x_0$
Input Y   $y_{n-1}$ $y_{n-2}$ ... $y_3$ $y_2$ $y_1$ $y_0$
Output $out_n$ $out_{n-1}$ $out_{n-2}$ ... $out_3$ $out_2$ $out_1$ $out_0$

\begin{eqnarray*}
carry_0 & = & x_0 \land y_0 \\
carry_i & = & \mathit{majority}(x_i, y_i, carry_{i-1}) \\
\end{eqnarray*}



If both $x_i$ and $y_i$ are set to one, then $carry_i$ is always set - this is called generating the carry bit. If one of these bits is one and the other is zero, then $carry_i = carry_{i-1}$ (with the exception of $carry_0$) - this is called propagating the carry bit. If both $x_i$ and $y_i$ are set to zero, then $carry_i$ is always zero. We abstract this into two bits $g_i$ and $p_i$ representing whether the carry value is generated and propagated respectively.

\begin{eqnarray*}
g_i & = & (x_i = 1) \land (y_i = 1) \\
p_i & = & ((x_i = 1) \land (y_i = 0)) \lor ((x_i = 0) \land (y_i = 1)) \\
\end{eqnarray*}



We can reformulate the carry bits in terms of the $g$ and $p$ bits.

\begin{eqnarray*}
carry_i & = & g_i \lor (p_i \land carry_{i-1}) \\
\end{eqnarray*}



If we unwind the recursion, we eventually get the following formula.

\begin{eqnarray*}
carry_i & = & g_i \lor (p_i \land g_{i-1}) \lor \ldots \lor (p...
...p_2 \land g_1) \lor (p_i \land \ldots \land p_{1} \land g_0) \\
\end{eqnarray*}





Subsections
next up previous
Next: Traditional Carry Lookahead Analysis Up: Integer Representation and Arithmetic Previous: Incrementing Integers
Jeffrey Considine 2001-05-01