It is useful to consider how incrementing an integer works. Incrementing a number is a very common operation (e.g. updating the counter of a for loop). While incrementing is usually not implemented as an instruction separate from addition, it is useful in understanding how to speed up calculating the carry bits.
Starting from a normal addition circuit and hardwiring one of the
numbers to be one, we see that each of the
-bit adders after the
first is effectively reduced to having two inputs - one of the input
bits was hardcoded to zero. One of these inputs is the bit from the
number being incremented and the other is the carry bit. The
-bit
adders being used can then be simplified like the first
-bit adder
of normal addition. The output bit is the parity of the input bit and
the carry bit so it is the XOR of the two. The carry bit is the AND of
these two bits allowing us to give a recursive formulation for the
carry bit.
| Carry | ... | |||||||
| Input | ... | |||||||
| One | ... | 1 | ||||||
| Output | ... |
The first bit of the input number which is zero causes its
carry bit to be zero. In turn, this causes all of the following carry
bits to also be zero. If we implement the circuit directly from the
recursive description, we get a circuit of linear size (
AND
gates) and linear depth (
) similar to the ripple-carry
adder. However, we can derive a faster equation for the carry bits by
unwinding the recursion.
This equation can be implemented in logarithmic depth
(
) and linear size (
AND gates)
per carry bit. The total number of gates to implement each carry bit
is quadratic since they are not sharing components any more. Similar
ideas will be used to speedup calculation in carry-lookahead
adders.