2-bit carry-lookahead adder: build and simulate it online

Compute every carry at once from P = A ⊕ B and G = A · B, instead of waiting for it to ripple.

Build the 2-bit carry-lookahead adder in the free online simulator — it checks your circuit automatically.

What you need

  • 4 logic switches labelled A1, A0, B1, B0
  • 3 probes labelled S1, S0, Cout
  • 2 XOR gates (P)
  • 2 AND gates (G)
  • 2 OR gates
  • 4 XOR gates in all

Step by step

  1. Inputs and outputs. From the Logic section of the library, drop digital inputs (0/1 boxes) or logic switches for the inputs, and digital outputs or probes for the outputs; give each its label in the inspector (the checker finds them by label). Cin is a Logic 0. Switches A1, A0, B1, B0; Probes S1, S0, Cout
  2. Propagate and generate. P = A ⊕ B says a carry would pass through; G = A · B says this bit makes one. P0, P1: 2 XOR gates; G0, G1: 2 AND gates
  3. The lookahead carries. C1 = G0 + P0·Cin, Cout = G1 + P1·G0 + P1·P0·Cin — flat two-level logic (set an AND to 3 inputs). C1: AND + OR; Cout: ANDs + a 3-input OR
  4. Sums and proof. S0 = P0 ⊕ Cin, S1 = P1 ⊕ C1. 2 more XOR gates; Check all 16 additions

Truth table

A1A0B1B0CoutS1S0
0000000
0001001
0010010
0011011
0100001
0101010
0110011
0111100
1000010
1001011
1010100
1011101
1100011
1101100
1110101
1111110

Frequently asked questions

How do you build a 2-bit carry-lookahead adder?

Compute every carry at once from P = A ⊕ B and G = A · B, instead of waiting for it to ripple. In short: inputs and outputs, then propagate and generate, then the lookahead carries, then sums and proof.

What is the truth table of a 2-bit carry-lookahead adder?

It has 4 inputs (A1, A0, B1, B0) and 3 outputs (Cout, S1, S0), so 16 rows. The full table is on this page; the Embedded Lab checks all of them against your circuit.

What parts do you need for a 2-bit carry-lookahead adder?

2 XOR gates (P); 2 AND gates (G); 2 OR gates; 4 XOR gates in all — plus logic switches for the inputs and probes for the outputs.

Can I simulate a 2-bit carry-lookahead adder online for free?

Yes. Open it in the BitForBytes Embedded Lab, a free browser-based circuit and logic simulator: drag in the gates, wire them, and press "Check my circuit" — every input combination is simulated and marked for you. No download or sign-up needed.

Part of DSD 11 · Carry-lookahead adder in the free BitForBytes digital system design course.

More adders builds