Skip to content
digiwleeaTools
LearnGlossaryAboutCheat sheetHow a CPU worksBuild a CPUToolsOpen the lab →

Carry lookahead generator: all four carries at once, live

A carry lookahead generator computes every carry of a 4-bit adder directly from each bit's generate G and propagate P signals and the carry in C0, in two gate levels instead of a ripple. It also outputs group propagate P and group generate G, so several generators can be combined for wider adders.

Each bit of an adder generates a carry when both its operand bits are 1 (G = A AND B) and propagates an incoming carry when exactly one is (P = A XOR B, or A OR B). The carry into bit n is then 1 if some bit below generates a carry and every bit between propagates it: C1 = G0 + P0 C0, C2 = G1 + P1 G0 + P1 P0 C0, and C3 = G2 + P2 G1 + P2 P1 G0 + P2 P1 P0 C0. Every carry is an AND-OR expression of the inputs, so all of them are ready after the same short delay. The group signals summarize the whole block: P = P3 P2 P1 P0 says a carry would pass straight through, and G = G3 + P3 G2 + P3 P2 G1 + P3 P2 P1 G0 says the block makes one itself. That is exactly the job of the classic 74182 chip, which works with active-low signals. The full adder that uses these carries is the 4-bit carry lookahead adder; prefix adders such as Kogge-Stone push the same idea further.

Big circuit: pinch, scroll or tap + to zoom in, then drag to move around.

Live circuit: click the inputs to toggle them and watch the outputs update. It runs the real simulator, right here on the page.

Open this circuit in the lab →

Embed or cite this circuit

Free to embed on a course page, blog or worksheet: paste this code. The circuit stays live, and the small digiwleea badge links back here.

To cite it: digiwleea, “4-bit carry lookahead generator”, https://digiwleea.wleeaf.dev/tools/build/carry-lookahead-generator/

What you need

Step by step

  1. Place inputs G3 to G0, P3 to P0 and C0, and probes C1, C2, C3, P and G.
  2. C1 = G0 OR (P0 AND C0).
  3. C2 = G1 OR (P1 AND G0) OR (P1 AND P0 AND C0); C3 adds one more level of the same pattern.
  4. P = P3 AND P2 AND P1 AND P0, and G = G3 OR P3 G2 OR P3 P2 G1 OR P3 P2 P1 G0. Set a generate low in the block and propagates above it, and watch every carry above go high at once.

Carry lookahead equations

OutputEquationIs 1 when
C1G0 + P0 C0bit 0 generates, or propagates the carry in
C2G1 + P1 G0 + P1 P0 C0bit 1 generates, or passes on a carry from below
C3G2 + P2 G1 + P2 P1 G0 + P2 P1 P0 C0bit 2 generates, or passes on a carry from below
PP3 P2 P1 P0a carry in would propagate through all four bits
GG3 + P3 G2 + P3 P2 G1 + P3 P2 P1 G0the block produces a carry out by itself

All 512 combinations of G3 to G0, P3 to P0 and C0 are checked against the ripple definition (each carry is G or P AND the carry below) before the page is built.

You can also read the full theory in the lesson on faster adders and carry lookahead. Prefer to build it yourself from scratch? Open the digiwleea lab and place the gates on the canvas, or start from the logic gate simulator.

More builds: Arithmetic

All 246 build guides, by topic

Each of these is one step from a transistor to a working CPU. Build every gate from CMOS transistors and work all the way up in the free digiwleea lab, with the free theory reference alongside.

Open the 4-bit carry lookahead generator in the lab →

Frequently asked

What is a carry lookahead generator?

A combinational block that computes all the carries of an adder group directly from the generate and propagate signals of each bit and the carry in, instead of waiting for them to ripple. It also outputs group generate and propagate signals for building larger adders.

What is the 74182?

The classic look-ahead carry generator chip. It does what this circuit does for four bits, with active-low generate and propagate signals, and is used with ALU chips such as the 74181 to build fast wide adders.

What are generate and propagate?

Generate (G = A B) means a bit position produces a carry by itself; propagate (P = A XOR B, or A + B) means it passes an incoming carry on. A carry reaches bit n if some lower bit generates it and every bit in between propagates it.

Why is carry lookahead faster than ripple carry?

In a ripple-carry adder each carry waits for the one below, so delay grows with the width. Lookahead computes every carry in a fixed two-level AND-OR form, so all carries are ready at about the same time.