Computer Engineering is coming soon

We're still writing and reviewing the notes for every subject, and we'll open it when every subject is ready. Meanwhile you can practise aptitude, ask Aria about any subject, or see the branches that are ready.

BCD adder and look-ahead carry generator

How to add two BCD digits using a binary adder plus a decimal correction (add 6) and how a 4-bit look-ahead carry generator computes carries fast using generate and propagate signals.

Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.

Why it matters

Two common, practical tasks in digital design are (1) adding decimal digits stored in BCD (Binary-Coded Decimal) and (2) making binary adders fast. A BCD adder is used in calculators, digital clocks and any system that must produce human-readable decimal digits. A look-ahead carry generator (carry look-ahead adder) is used inside high-speed ALUs to reduce the time waiting for carry signals and so increase arithmetic throughput.

Key ideas

Start with small definitions and build up.

  • Binary digit (bit): a value 0 or 1. We number bit positions from 0 (least significant bit, LSB) upward.
  • BCD (Binary-Coded Decimal): a way to encode one decimal digit (0–9) in 4 bits. Valid BCD codes are 0000 through 1001 (0 through 9). Codes 1010 through 1111 (10–15) are invalid for a single decimal digit.
  • 4-bit binary adder: a circuit that adds two 4-bit binary numbers A3 A2 A1 A0 and B3 B2 B1 B0 plus an input carry C0 to produce sum bits S3..S0 and carry out C4.

BCD adder concept (stepwise):

  1. Add the two BCD digits (and carry-in) using a 4-bit binary adder. The binary result S3 S2 S1 S0 might be 0..15.
  2. If the binary result represents 0..9 and there is no end carry, that 4-bit result is the decimal digit. If the binary result represents 10..15, or if the binary adder produced a carry-out, we must form a corrected result by adding binary 6 (0110) to the 4-bit sum. The decimal carry-out equals the detect signal D = C4 OR (S3 AND (S2 OR S1)); do not rely on the correction adder's carry alone because for cases with C4 = 1 and S in 0000..0011 its carry is 0.
  • Decimal correction value: add binary 6 (0110) when correction is needed. This converts sums 10..15 (binary) into 0..5 plus one decimal carry.

When to correct? The usual detection condition (useful in exams and practical ICs) is:

  • Correct if C4 (carry-out from initial 4-bit adder) = 1 OR (S3 AND (S2 OR S1)) = 1. Explain: for binary sums 10(1010) through 15(1111) the most-significant result bit S3 is 1 and at least one of S2 or S1 is 1. For 8 (1000) and 9 (1001) this condition is false and C4 is 0, so no correction.

How to implement: draw one 4-bit adder for A,B,Cin producing S and Cout (call this Adder1). Feed S and Cout to a small logic block (correction detect). If detect=1, feed S and 0110 into a second 4-bit adder (Adder2) to produce the corrected 4-bit BCD digit; the decimal carry-out is D. If detect=0 you may bypass Adder2 and use S directly.

Look-ahead carry generator (4-bit): define two signals for each bit i (i = 0..3):

  • Generate Gi = Ai · Bi. Means bit i generates a carry regardless of input carry.
  • Propagate Pi = Ai ⊕ Bi. Means bit i will propagate an incoming carry to the next stage if exactly one operand bit is 1.

With these definitions the carry recursion is Ci+1 = Gi + Pi · Ci. For a 4-bit group (bits 0..3) you expand: C1 = G0 + P0·C0 C2 = G1 + P1·G0 + P1·P0·C0 C3 = G2 + P2·G1 + P2·P1·G0 + P2·P1·P0·C0 C4 = G3 + P3·G2 + P3·P2·G1 + P3·P2·P1·G0 + P3·P2·P1·P0·C0.

Using the precomputed Gi and Pi, a look-ahead generator can compute C1..C4 in parallel (a few gate levels) rather than waiting ripple-wise through each full adder.

Diagrams to draw (for exams):

  • BCD adder block diagram: Draw two 4-bit adders stacked horizontally. Label left Adder1 with inputs A3..A0, B3..B0, Cin; outputs S3..S0 and Cout. Draw a small logic box labelled "Detect" with inputs S3..S0 and Cout, output D (detect). Draw Adder2 below or to the right with inputs S3..S0 and 0110 gated by D (i.e., when D=1 add 0110, otherwise add 0000). Label final outputs as Digit (4 bits) and Carry_out = D (i.e., C4 OR (S3 AND (S2 OR S1))).
  • 4-bit carry look-ahead block: draw four boxes for bit slices with Ai,Bi inputs producing Gi and Pi. Show a separate block (CLA generator) that takes G0..G3 and P0..P3 and C0 and outputs C1..C4 using the expanded equations.

Assumptions you must state in answers: inputs are valid BCD digits (0–9); bit numbering convention (bit 0 is LSB); Pi defined as XOR; propagate defined as "propagate a carry if exactly one operand bit is 1".

Where I am unsure: some books define Pi = Ai + Bi (OR) instead of XOR; both definitions give correct carry equations but change how you compute sum bits. I use Pi = Ai ⊕ Bi here because it matches the sum formula Si = Pi ⊕ Ci. If you adopt Pi = Ai + Bi, keep Ci+1 = Gi + Pi·Ci but compute sums as Si = Ai ⊕ Bi ⊕ Ci (not Pi ⊕ Ci).

Formulas

Gi = Ai · Bi — Gi is generate for bit i; dimensionless (bit). Applies for bitwise carry generation. Pi = Ai ⊕ Bi — Pi is propagate for bit i; dimensionless (bit). Applies when using sum Si = Pi ⊕ Ci. Ci+1 = Gi + Pi · Ci — carry recursion for bit i; Ci and Ci+1 are carries (0 or 1). Applies to any binary adder bit. C1 = G0 + P0·C0 — first-level carry. C2 = G1 + P1·G0 + P1·P0·C0 — second-level carry. C3 = G2 + P2·G1 + P2·P1·G0 + P2·P1·P0·C0 — third-level carry. C4 = G3 + P3·G2 + P3·P2·G1 + P3·P2·P1·G0 + P3·P2·P1·P0·C0 — fourth-level (carry-out). For hierarchical CLAs, define the 4-bit group propagate and group generate as Pg = P3·P2·P1·P0 and Gg = G3 + P3·G2 + P3·P2·G1 + P3·P2·P1·G0, so C4 = Gg + Pg·C0. Correction condition D = C4 OR (S3 AND (S2 OR S1)) — when D=1 add 6 (0110). Add 6 (binary) = 0110 — constant used for BCD correction. Si = Pi ⊕ Ci — sum bit formula for each bit.

Worked examples

Example 1 — BCD addition: 7 + 8 (both single BCD digits), Cin = 0.

  1. Represent inputs: 7 = 0111, 8 = 1000.
  2. First 4-bit binary add: 0111 + 1000 + C0(=0) = 1111 (decimal 15). Write S3..S0 = 1 1 1 1 and Cout C4 = 0.
  3. Detection: C4 = 0. Check S3 AND (S2 OR S1) = 1 AND (1 OR 1) = 1. So D = 1 → need correction.
  4. Add 0110 to 1111: 1111 + 0110 = 1 0101 (binary). That is carry = 1 and corrected digit = 0101 (5).
  5. Final decimal result: tens = 1, units = 5 → 15. Bold final: 1 0101 (tens=0001, units=0101). (Units shown in 4 bits; the leading 1 is the decimal carry.)

Example 2 — 4-bit CLA carry computation and sum: A = 1011 (11), B = 0110 (6), C0 = 0. Number bits LSB=bit0: A0..A3 = 1,1,0,1; B0..B3 = 0,1,1,0.

  1. Compute Gi and Pi: G0 = 1·0 = 0, P0 = 1 ⊕ 0 = 1 G1 = 1·1 = 1, P1 = 1 ⊕ 1 = 0 G2 = 0·1 = 0, P2 = 0 ⊕ 1 = 1 G3 = 1·0 = 0, P3 = 1 ⊕ 0 = 1
  2. Compute carries using CLA formulas: C1 = G0 + P0·C0 = 0 + 1·0 = 0 C2 = G1 + P1·G0 + P1·P0·C0 = 1 + 0 + 0 = 1 C3 = G2 + P2·G1 + P2·P1·G0 + P2·P1·P0·C0 = 0 + 1·1 + 0 + 0 = 1 C4 = G3 + P3·G2 + P3·P2·G1 + P3·P2·P1·G0 + P3·P2·P1·P0·C0 = 0 + 0 + 1·1 + 0 + 0 = 1
  3. Compute sums Si = Pi ⊕ Ci: S0 = 1 ⊕ 0 = 1 S1 = 0 ⊕ 0 = 0 S2 = 1 ⊕ 1 = 0 S3 = 1 ⊕ 1 = 0
  4. Result: 4-bit sum = 0001 with carry-out C4 = 1. The 5-bit result is 1 0001 (decimal 17), matching 11+6.

Common mistakes

  • Using the correction condition S3·(S2|S1) without explaining why it excludes 8 (1000) and 9 (1001).
  • Drawing blocks without showing which signals go into the detect logic and which go into Adder2.
  • Wrong bit-ordering when expanding CLA equations (remember index 0 = LSB).

For your exam

Typical question forms:

  • Definition: "What is a BCD adder? Give detection condition and correction method."
  • Short note: Draw and explain the BCD adder block diagram.
  • Derivation: Prove the CLA expressions C2, C3, C4 by repeated substitution from Ci+1 = Gi + Pi·Ci.
  • Numerical: Add two BCD digits using your circuit and show intermediate binary sums and correction.
  • Design: Given A,B arrays, design a single-digit BCD adder using two 4-bit adders and minimal logic gates. Draw and label all signals. What a full-marks answer includes:
  • Clear definitions (BCD, Gi, Pi), bit-numbering, and assumptions.
  • Correct detect logic formula and explanation.
  • Correct block diagram with labeled inputs/outputs and the correction path.
  • If CLA asked, show Gi/Pi table and step-by-step expansion to C4.
  • For numericals, show all binary steps and final decimal/Binary-coded-decimal outputs.

Quick check

  1. When do you add binary 0110 in a BCD adder?
  2. Write the generate and propagate definitions used in CLA.
  3. For A=0110 and B=0101 with C0=0, is correction needed after the initial 4-bit add? (Show result bits quickly.)

Answers: 1) Add 0110 when initial adder carry-out = 1 OR (S3 AND (S2 OR S1)). 2) Gi = Ai·Bi, Pi = Ai ⊕ Bi. 3) 0110 + 0101 = 1011 (11); detection: S3=1, S2=0, S1=1 so S3·(S2|S1)=1 so correction needed (1011+0110=1 0001 -> decimal 11 -> 1 and 1).

Finished this topic? Mark it so your progress, study plan and readiness keep up.

Stuck on something here?