Computing Library › Digital Logic & Circuits
Digital Logic & Circuits

Ripple-Carry Adder

A ripple-carry adder chains full adders so each carry-out feeds the next stage, giving simple hardware but delay that grows with word width.

Structure

An n-bit ripple-carry adder places n full adders side by side. Bit i takes operand bits Ai and Bi and the carry-out of bit i-1 as its carry-in. The carry-in of the lowest bit is usually 0 for addition.

Why it is slow

Kronos motion — next scientists

Each stage cannot compute a correct carry until the stage below it has settled. The carry ripples from the least significant bit up to the most significant. In the worst case the delay is proportional to n, the number of bits, because a carry generated at the bottom may need to travel the full width.

Worst case

Adding 0111 + 0001 forces a carry to propagate through every stage: bit 0 generates a carry, which flips bit 1, which flips bit 2, and so on. This is the pattern that defines the critical path.

Trade-off

The ripple-carry adder uses the least hardware of any adder and is easy to lay out, so it is common for narrow words or where speed is not critical. Wider or faster designs use carry-lookahead or carry-select schemes to break the linear delay.

In code

python
def ripple_add(a_bits, b_bits):
    carry = 0
    out = []
    for a, b in zip(a_bits, b_bits):  # LSB first
        s = a ^ b ^ carry
        carry = (a & b) | (carry & (a ^ b))
        out.append(s)
    return out, carry