digiwleeaLearn
Open the lab →

Adding 8-bit numbers

The ripple-carry adder

5 min read

A ripple-carry adder chains eight full adders, each carry-out feeding the next adder's carry-in, so it adds two 8-bit numbers in a single pass. It is the arithmetic core the ALU is built around.

The full adder adds three bits, A, B, and a carry-in, and produces a sum bit and a carry-out. That is one column of an addition. To add two whole 8-bit numbers you do what you do on paper: add the columns right to left, carrying into the next column as you go. In hardware that means eight full adders in a row, with each stage's carry-out wired into the next stage's carry-in. See the same carry chain on real numbers in the binary calculator, or step through the ripple carry column by column in the interactive binary addition walkthrough.

Carry ripples left, column by column

Number the bits 0 (least significant) to 7 (most significant). Stage i adds Ai, Bi, and the carry coming from stage i-1. Its sum bit is Si; its carry-out goes on to stage i+1. The very first stage has no column to its right, so its carry-in is the external CIN (tie it to 0 for plain addition). The last stage's carry-out is COUT, the ninth bit of the answer, which signals overflow past 8 bits.
Si, carry_out = FULLADDER(Ai, Bi, carry_in), carry_in(0) = CIN, carry_in(i) = carry_out(i-1)
  1. Place eight full adders in a row, one per bit position.
  2. Feed Ai and Bi into stage i, and read its sum on Si.
  3. Wire each stage's carry-out into the next stage's carry-in: stage 0 to stage 1, stage 1 to stage 2, and so on.
  4. Tie stage 0's carry-in to CIN (use 0 for addition); the top stage's carry-out is COUT.
Worked example: 00001111 + 00000001 (15 + 1). Stage 0 adds 1 + 1 = 10, so S0 = 0 and it carries 1. That carry ripples: stage 1 adds 1 + 0 + 1 = 10 again, carry on. The carry keeps rippling up through the four low 1s until stage 4 adds 0 + 0 + 1 = 1 with no carry. The result is 00010000, which is 16. The carry literally walked left through the stages, one column per step.
An 8-bit ripple-carry adder (ADD8): eight full adders with the carry chained from CIN through to COUT. Inputs A0-A7 and B0-B7 are the two operands; S0-S7 is the sum. Open it in the lab, set two bytes, and read the sum (watch COUT light up when the total passes 255).
Try it
On the 8-bit adder, set A = 200 and B = 100 (with CIN = 0). The true sum is 300, which does not fit in 8 bits. What do S0-S7 read, and what does COUT do?
The cost of this simplicity is delay. The top sum bit cannot settle until the carry has rippled through all eight stages below it, so a wide ripple adder is slow. Real CPUs use cleverer carry-lookahead adders to compute the carries in parallel, but they compute the exact same sum. Ripple-carry is the right place to start: it is correct, and it is just the full adder you already built, eight times.
An adder only adds. But with one XOR trick on the B input you can make this very same hardware subtract as well, which is the next lesson, negative numbers and subtraction. Add plus subtract on one block is the heart of the ALU.

Frequently asked

How does a ripple-carry adder work?

A ripple-carry adder chains eight full adders, one per bit position, with each stage's carry-out wired into the next stage's carry-in. It adds two 8-bit numbers the way you add on paper: column by column, right to left, carrying into the next column. The rightmost stage's carry-in is tied to 0 for plain addition.

Why is it called "ripple" carry?

Because the carry literally walks left through the stages, one column per step. When you add 15 + 1, the carry out of stage 0 ripples up through the four low 1s until a stage adds with no carry. The top sum bit cannot settle until the carry has rippled through all stages below it.

What does the carry-out (COUT) of an 8-bit adder mean?

COUT is the carry out of the top column, the ninth bit of the answer, so it signals overflow past 8 bits. Adding 200 + 100 = 300 does not fit: the low eight bits show 44 on S0-S7 and COUT = 1 flags that the real total is 256 + 44 = 300.

Why are ripple-carry adders slow?

The cost of their simplicity is delay: the top sum bit cannot settle until the carry has rippled through all eight stages, so a wide ripple adder is slow. Real CPUs use carry-lookahead adders that compute the carries in parallel, but they produce the exact same sum. Ripple-carry is the right starting point: correct, and just the full adder you already built, eight times.

Every lesson here builds toward one thing: a working CPU, from the transistor up.

Open the free lab →
Found this useful? Share itShare on X