BCD adder: 25 + 48 with the +6 correction — adders

edge casewhen binary addition is not decimal addition

Answer

01110011 = 73

Why this example is worth doing

Adding packed BCD in a binary adder produces a wrong digit whenever the result exceeds nine, because binary rolls over at sixteen and decimal at ten. Adding six re-aligns it and generates the decimal carry. The page shows the detection condition and the corrected digit, and hands off to the BCD converter for the representation. It is the clearest case on the site of a representation forcing a change in the arithmetic hardware.

Try your own input in the Half adder & full adder. Truth tables, K-maps and circuits for both adders, and the ripple-carry chain.

How the answer is reached

BCD addition 00100101 + 01001000

Work least significant digit first. Add the two digits and the carry in. If the raw sum exceeds 9 OR the 4-bit add carried out, add 0110 and carry 1 into the next digit.

Most significant digit first, as it is written on paper — BCD addition 00100101 + 01001000
digitraw sum5-bit> 9?nibble carrycorrectiondigitcarry out
12 + 4 + 1 = 700111no0-0111 (7)0
05 + 8 + 0 = 1301101yes0+01100011 (3)1

result0111 001173

why 616 - 10 = 6BCD skips the six codes 1010..1111, so a binary carry (weight 16) has to be realigned with a decimal carry (weight 10)

Warning:

Correction applied at digit 0 (counting from the least significant digit).

Compare with

Open the Half adder & full adder

This input is entered in the tool itself — it is too rich for a link to carry.

Note:

Notation this page assumes

  • Symbols: · is AND, + is OR, ⊕ is XOR, a prime or an overline is NOT. The field also takes ∧ ∨ ¬ ~ ! & | and the words.
  • Operator precedence, tightest first: NOT, then AND (including juxtaposition), then XOR/XNOR, then NAND/NOR, then OR, then IMPLIES, then IFF.
  • Gate symbols follow whichever standard the header toggle is set to: ANSI/IEEE Std 91-1984 distinctive shapes, or IEC 60617-12 rectangles.

Sources

  • Shannon, “A Symbolic Analysis of Relay and Switching Circuits” (1938)
  • ANSI/IEEE Std 91-1984, Graphic Symbols for Logic Functions