PROJECTENGRAM

[PS] BINARY-CODED DECIMAL

Problem Set - Binary-Coded Decimal

Tags: #◇Computer Science #◇CSARCH2 #◇Computer Architecture #◇Data Representation #◇Binary-Coded Decimal #◇Decimal Arithmetic


◇Overview

Binary-Coded Decimal (BCD) is a class of digital encodings where each decimal digit (00 through 99) is represented by a dedicated sequence of binary bits. Unlike pure positional binary notation, BCD eliminates fractional precision loss during base-10 financial and commercial arithmetic, providing exact decimal representation for banking, tax accounting, and human-facing embedded displays. This problem set investigates the architectural formats of BCD—including Unpacked BCD, Packed BCD, and Densely Packed BCD (DPD) (as standardized in IEEE 754-2008 decimal floating-point)—alongside weighted codes (84218421, 24212421), self-complementing codes (Excess-3), and the arithmetic correction mechanics of BCD addition.


◇Key Definitions

  • Binary-Coded Decimal (BCD): An encoding format in which each decimal digit of a number is individually converted into a fixed-width binary pattern.
  • Natural BCD (8421 Code): The most common weighted BCD format, where the 4 bits of each nibble represent weights 23=82^3 = 8, 22=42^2 = 4, 21=22^1 = 2, and 20=12^0 = 1. The 10 valid codes are 000020000_2 (00) through 100121001_2 (99). Bit patterns 10102…111121010_2 \dots 1111_2 (10…1510 \dots 15) are invalid (pseudo-tetrades).
  • Unpacked BCD: A representation where each decimal digit is stored in an entire 8-bit byte (11 octet). The upper 4 bits are conventionally padded with zeros (000020000_2) or ASCII zone bits (001120011_2), while the lower 4 bits hold the BCD digit.
  • Packed BCD: A more compact representation where two decimal digits are packed into a single 8-bit byte (4 bits per digit). For nn decimal digits, it requires ⌈n/2⌉\lceil n / 2 \rceil bytes.
  • Signed Packed BCD: Packed BCD representation appending a sign nibble at the least significant position. By convention (derived from accounting terminology for Credit and Debit):
    • Positive sign (++ / Credit): 110021100_2 (0xC0\text{xC})
    • Negative sign (−- / Debit): 110121101_2 (0xD0\text{xD})
  • Densely Packed BCD (DPD): A highly efficient compression algorithm that encodes 33 decimal digits (1212 BCD bits) into exactly 1010 binary bits (Declet), achieving a storage efficiency of 99.67%99.67\% (compared to pure binary's theoretical limit of log⁡2(1000)≈9.966\log_2(1000) \approx 9.966 bits). Developed by Mike Cowlishaw based on Chen-Ho encoding.
  • Excess-3 Code (Stibitz Code): An unweighted, self-complementing decimal code formed by adding 33 (001120011_2) to each 8421 BCD digit. The 9's complement of an Excess-3 number is obtained directly by bitwise inverting (1's complement) its bits.
  • 2421 Code (Aiken Code): A weighted, self-complementing code with bit weights 2,4,2,12, 4, 2, 1.
  • BCD Addition Correction (+6+6 Rule): When adding two BCD digits in binary, if the intermediate sum produces a value greater than 99 (100121001_2) or generates a binary carry-out (K=1K=1), adding +6+6 (011020110_2) skips the 66 invalid states (10102…111121010_2 \dots 1111_2) and produces the correct BCD digit and decimal carry.

◇Theoretical Framework & Encoding Tables

1. Comparison of Decimal Encodings

Decimal Digit8421 BCD (Natural)Excess-3 (BCD+00112\text{BCD} + 0011_2)2421 (Aiken Code)Unpacked BCD (Byte)
00000001100000000 0000
10001010000010000 0001
20010010100100000 0010
30011011000110000 0011
40100011101000000 0100
50101100010110000 0101
60110100111000000 0110
70111101011010000 0111
81000101111100000 1000
91001110011110000 1001

2. Densely Packed BCD (DPD) Forward Encoding Table

Let three decimal digits d1,d2,d3d_1, d_2, d_3 be represented in 8421 BCD as 12 bits:
Digit 1: (a b c d)Digit 2: (e f g h)Digit 3: (i j k m)\text{Digit 1: } (a\ b\ c\ d) \quad \text{Digit 2: } (e\ f\ g\ h) \quad \text{Digit 3: } (i\ j\ k\ m)
where a,e,ia, e, i are the Most Significant Bits (MSBs) indicating whether each digit is ≥8\ge 8 (a,e,i=1a,e,i = 1) or <8< 8 (a,e,i=0a,e,i = 0).

DPD maps these 12 bits into a 10-bit declet: (p q r s t u v w x y)(p\ q\ r\ s\ t\ u\ v\ w\ x\ y) using the control bits a,e,ia, e, i:

aaeeiippqqrrssttuuvvwwxxyyDescription / Active Range
000bbccddffgghh0jjkkmmAll 3 digits <8< 8 (Small-Small-Small)
001bbccddffgghh100mmDigit 3 is ≥8\ge 8 (Small-Small-Large)
010bbccddjjkkhh101mmDigit 2 is ≥8\ge 8 (Small-Large-Small)
011bbccdd10hh111mmDigits 2 & 3 are ≥8\ge 8 (Small-Large-Large)
100jjkkddffgghh110mmDigit 1 is ≥8\ge 8 (Large-Small-Small)
101ffggdd01hh111mmDigits 1 & 3 are ≥8\ge 8 (Large-Small-Large)
110jjkkdd00hh111mmDigits 1 & 2 are ≥8\ge 8 (Large-Large-Small)
11100dd11hh111mmAll 3 digits ≥8\ge 8 (Large-Large-Large)

3. Densely Packed BCD (DPD) Reverse Decoding Table

To reconstruct the original 12 BCD bits (a b c d) (e f g h) (i j k m)(a\ b\ c\ d)\ (e\ f\ g\ h)\ (i\ j\ k\ m) from the 10-bit declet (p q r s t u v w x y)(p\ q\ r\ s\ t\ u\ v\ w\ x\ y), we inspect the control bits v,w,xv, w, x (and s,ts, t when vwx=1112vwx = 111_2):

Control Bits v w x s tv\ w\ x\ s\ tDigit 1 (a b c da\ b\ c\ d)Digit 2 (e f g he\ f\ g\ h)Digit 3 (i j k mi\ j\ k\ m)Decoded Condition
0 . . . .0 p q rp\ q\ r0 s t us\ t\ u0 w x yw\ x\ yv=0v = 0: all three digits <8< 8
1 0 0 . .0 p q rp\ q\ r0 s t us\ t\ u1 0 0 yyd3≥8d_3 \ge 8
1 0 1 . .0 p q rp\ q\ r1 0 0 uu0 s t ys\ t\ yd2≥8d_2 \ge 8
1 1 0 . .1 0 0 rr0 s t us\ t\ u0 p q yp\ q\ yd1≥8d_1 \ge 8
1 1 1 0 01 0 0 rr1 0 0 uu0 p q yp\ q\ yd1,d2≥8d_1, d_2 \ge 8
1 1 1 0 11 0 0 rr0 p q up\ q\ u1 0 0 yyd1,d3≥8d_1, d_3 \ge 8
1 1 1 1 00 p q rp\ q\ r1 0 0 uu1 0 0 yyd2,d3≥8d_2, d_3 \ge 8
1 1 1 1 11 0 0 rr1 0 0 uu1 0 0 yyd1,d2,d3≥8d_1, d_2, d_3 \ge 8

4. BCD Addition & Correction Mechanics

In 8421 BCD arithmetic, adding two 4-bit digits using a standard binary adder yields an intermediate 4-bit sum SS and binary carry KK:
Ai+Bi+Cin=(K,S3S2S1S0)2A_i + B_i + C_{\text{in}} = (K, S_3 S_2 S_1 S_0)_2

The Correction Condition:

A correction is required if and only if:

  1. The intermediate binary sum exceeds 99 (100121001_2), meaning S∈[10102,11112]S \in [1010_2, 1111_2], OR
  2. A binary carry-out is generated (K=1K = 1).

Boolean correction detection function:
Cout=K+S3S2+S3S1C_{\text{out}} = K + S_3 S_2 + S_3 S_1

When Cout=1C_{\text{out}} = 1:

  • Add +6+6 (011020110_2) to the intermediate 4-bit sum.
  • Propagate a decimal carry Cout=1C_{\text{out}} = 1 to the next higher decimal digit position.

Why +6+6? A 4-bit register has 24=162^4 = 16 states, but decimal only uses 1010 states (0…90 \dots 9). Adding +6+6 skips the 66 invalid states, aligning the arithmetic modulo-16 accumulator with base-10 modulo arithmetic (16−10=616 - 10 = 6).


◇Worked Examples and Step-by-Step Problem Solutions

Section 1: Forward Decimal to BCD Conversions

Problem 1: Encoding Decimal 989989

Problem Statement:
Convert the 3-digit decimal number 989989 into:

  1. Packed BCD
  2. Unpacked BCD
  3. Densely Packed BCD (DPD)

Show bit-level derivations and total bit counts.

Derivation:
  • Decimal digits: d1=9,d2=8,d3=9d_1 = 9, d_2 = 8, d_3 = 9.
  • 4-bit 8421 BCD for each digit:
    • d1=9→10012  ⟹  a=1,b=0,c=0,d=1d_1 = 9 \to 1001_2 \implies a=1, b=0, c=0, d=1
    • d2=8→10002  ⟹  e=1,f=0,g=0,h=0d_2 = 8 \to 1000_2 \implies e=1, f=0, g=0, h=0
    • d3=9→10012  ⟹  i=1,j=0,k=0,m=1d_3 = 9 \to 1001_2 \implies i=1, j=0, k=0, m=1
  1. Packed BCD:

    • Concatenate 4-bit nibbles:
      Packed BCD=1001 1000 10012\text{Packed BCD} = 1001\ 1000\ 1001_2
    • Total Bit Count: 3×4=123 \times 4 = 12 bits (1.51.5 bytes).
  2. Unpacked BCD:

    • Pad each 4-bit nibble to 8 bits with leading zeros:
      Unpacked BCD=00001001 00001000 000010012\text{Unpacked BCD} = 00001001\ 00001000\ 00001001_2
    • Total Bit Count: 3×8=243 \times 8 = 24 bits (33 bytes).
  3. Densely Packed BCD (DPD):

    • Check the MSBs: a=1,e=1,i=1  ⟹  a e i=1 1 1a=1, e=1, i=1 \implies a\ e\ i = 1\ 1\ 1 (All 3 digits ≥8\ge 8).
    • Lookup rule for 1 1 11\ 1\ 1:
      p q r s t u v w x y=0 0 d 1 1 h 1 1 1 mp\ q\ r\ s\ t\ u\ v\ w\ x\ y = \mathbf{0\ 0}\ d\ \mathbf{1\ 1}\ h\ \mathbf{1\ 1\ 1}\ m
    • Substitute variable LSBs (d=1,h=0,m=1d=1, h=0, m=1):
  • p=0p = 0
  • q=0q = 0
  • r=d=1r = d = 1
  • s=1s = 1
  • t=1t = 1
  • u=h=0u = h = 0
  • v=1v = 1
  • w=1w = 1
  • x=1x = 1
  • y=m=1y = m = 1
    • Form 10-bit declet:
      DPD=00111011112(Grouped: 001 110 1 1112)\text{DPD} = 0011101111_2 \quad (\text{Grouped: } 001\ 110\ 1\ 111_2)
    • Total Bit Count: 1010 bits.

Problem 2: Encoding Decimal 88088808

Problem Statement:
Convert the 4-digit decimal number 88088808 into:

  1. Packed BCD
  2. Unpacked BCD
  3. Densely Packed BCD (DPD)

Show bit-level derivations and total bit counts.

Derivation:
  • Decimal digits: d1=8,d2=8,d3=0,d4=8d_1 = 8, d_2 = 8, d_3 = 0, d_4 = 8.
  • 4-bit 8421 BCD for each digit:
    • Digit 8→100028 \to 1000_2
    • Digit 8→100028 \to 1000_2
    • Digit 0→000020 \to 0000_2
    • Digit 8→100028 \to 1000_2
  1. Packed BCD:

    • Concatenate 4-bit nibbles:
      Packed BCD=1000 1000 0000 10002\text{Packed BCD} = 1000\ 1000\ 0000\ 1000_2
    • Total Bit Count: 4×4=164 \times 4 = 16 bits (22 bytes).
  2. Unpacked BCD:

    • Pad each 4-bit nibble to 8 bits:
      Unpacked BCD=00001000 00001000 00000000 000010002\text{Unpacked BCD} = 00001000\ 00001000\ 00000000\ 00001000_2
    • Total Bit Count: 4×8=324 \times 8 = 32 bits (44 bytes).
  3. Densely Packed BCD (DPD):

    • DPD operates on 3-digit declet groups. A 4-digit number can be structured in two standard architectural conventions:

    • Convention A (Standard 2 Declets with 6-digit Zero Padding):
      Pad 88088808 to 66 digits: 008 808008\ 808 (22 full declets).

  • Declet 1 (008008): d1=0 (00002),d2=0 (00002),d3=8 (10002)d_1=0\,(0000_2), d_2=0\,(0000_2), d_3=8\,(1000_2)

  • a=0,e=0,i=1  ⟹  a e i=0 0 1a=0, e=0, i=1 \implies a\ e\ i = 0\ 0\ 1

  • Rule: b c d f g h 1 0 0 m=0 0 0 0 0 0 1 0 0 02=00000010002b\ c\ d\ f\ g\ h\ \mathbf{1\ 0\ 0}\ m = 0\ 0\ 0\ 0\ 0\ 0\ 1\ 0\ 0\ 0_2 = 0000001000_2

  • Declet 2 (808808): d1=8 (10002),d2=0 (00002),d3=8 (10002)d_1=8\,(1000_2), d_2=0\,(0000_2), d_3=8\,(1000_2)

  • a=1,e=0,i=1  ⟹  a e i=1 0 1a=1, e=0, i=1 \implies a\ e\ i = 1\ 0\ 1

  • Rule: f g d 0 1 h 1 1 1 m=0 0 0 0 1 0 1 1 1 02=00001011102f\ g\ d\ \mathbf{0\ 1}\ h\ \mathbf{1\ 1\ 1}\ m = 0\ 0\ 0\ 0\ 1\ 0\ 1\ 1\ 1\ 0_2 = 0000101110_2

  • Combined 2-declet DPD (2020 bits):
    DPD20=0000001000 00001011102\text{DPD}_{20} = 0000001000\ 0000101110_2

    • Convention B (1 Leading BCD Digit + 1 Declet for Lowest 3 Digits):
  • Leading digit 8→100028 \to 1000_2 (44 bits)

  • Lowest 3 digits 808→00001011102808 \to 0000101110_2 (1010 bits)

  • Combined DPD (1414 bits):
    DPD14=1000 00001011102\text{DPD}_{14} = 1000\ 0000101110_2


Section 2: Reverse Densely Packed BCD (DPD) Decoding

Problem 3: Decoding DPD Declet 1001101011

Problem Statement:
Given the 10-bit Densely Packed BCD string 1001101011, reconstruct the original 3-digit decimal number using the DPD analysis method.

Step 1: Map 10 Bits to Declet Variables

pqrstuvwxy1001101011\begin{array}{|c|c|c|c|c|c|c|c|c|c|} \hline p & q & r & s & t & u & v & w & x & y \\ \hline 1 & 0 & 0 & 1 & 1 & 0 & 1 & 0 & 1 & 1 \\ \hline \end{array}

Step 2: Analyze Control Bits (v,w,xv, w, x)
  • Control bits: v=1,w=0,x=1  ⟹  vwx=1012v = 1, w = 0, x = 1 \implies vwx = 101_2.
Step 3: Lookup Expansion Pattern

From the DPD decoding table, pattern vwx=1012vwx = 101_2 corresponds to:

  • Digit 1 (a b c da\ b\ c\ d): 0 p q r0\ p\ q\ r
  • Digit 2 (e f g he\ f\ g\ h): 1 0 0 u1\ 0\ 0\ u
  • Digit 3 (i j k mi\ j\ k\ m): 0 s t y0\ s\ t\ y
Step 4: Substitute Bit Values
  1. Digit 1 (a b c da\ b\ c\ d):
    a=0,b=p=1,c=q=0,d=r=0  ⟹  01002=4a=0, \quad b=p=1, \quad c=q=0, \quad d=r=0 \implies 0100_2 = \mathbf{4}
  2. Digit 2 (e f g he\ f\ g\ h):
    e=1,f=0,g=0,h=u=0  ⟹  10002=8e=1, \quad f=0, \quad g=0, \quad h=u=0 \implies 1000_2 = \mathbf{8}
  3. Digit 3 (i j k mi\ j\ k\ m):
    i=0,j=s=1,k=t=1,m=y=1  ⟹  01112=7i=0, \quad j=s=1, \quad k=t=1, \quad m=y=1 \implies 0111_2 = \mathbf{7}
Step 5: Verification
  • Re-encode decimal 487\mathbf{487}:

    • 4=01002  ⟹  a=0,b=1,c=0,d=04 = 0100_2 \implies a=0, b=1, c=0, d=0
    • 8=10002  ⟹  e=1,f=0,g=0,h=08 = 1000_2 \implies e=1, f=0, g=0, h=0
    • 7=01112  ⟹  i=0,j=1,k=1,m=17 = 0111_2 \implies i=0, j=1, k=1, m=1
    • a e i=0 1 0  ⟹  b c d j k h 1 0 1 m=1 0 0 1 1 0 1 0 1 12=10011010112a\ e\ i = 0\ 1\ 0 \implies b\ c\ d\ j\ k\ h\ 1\ 0\ 1\ m = 1\ 0\ 0\ 1\ 1\ 0\ 1\ 0\ 1\ 1_2 = 1001101011_2 (Matches).
  • Final Decoded Decimal: 487\mathbf{487}


Problem 4: Decoding DPD Declet 0100101111

Problem Statement:
Given the 10-bit Densely Packed BCD string 0100101111, reconstruct the original 3-digit decimal number using the DPD analysis method.

Step 1: Map 10 Bits to Declet Variables

pqrstuvwxy0100101111\begin{array}{|c|c|c|c|c|c|c|c|c|c|} \hline p & q & r & s & t & u & v & w & x & y \\ \hline 0 & 1 & 0 & 0 & 1 & 0 & 1 & 1 & 1 & 1 \\ \hline \end{array}

Step 2: Analyze Control Bits (v,w,x,s,tv, w, x, s, t)
  • Primary control bits: v=1,w=1,x=1  ⟹  vwx=1112v = 1, w = 1, x = 1 \implies vwx = 111_2.
  • Secondary control bits: s=0,t=1  ⟹  st=012s = 0, t = 1 \implies st = 01_2.
  • Combined control code: vwxst=111012vwxst = 11101_2.
Step 3: Lookup Expansion Pattern

From the DPD decoding table, pattern vwxst=111012vwxst = 11101_2 corresponds to:

  • Digit 1 (a b c da\ b\ c\ d): 1 0 0 r1\ 0\ 0\ r
  • Digit 2 (e f g he\ f\ g\ h): 0 p q u0\ p\ q\ u
  • Digit 3 (i j k mi\ j\ k\ m): 1 0 0 y1\ 0\ 0\ y
Step 4: Substitute Bit Values
  1. Digit 1 (a b c da\ b\ c\ d):
    a=1,b=0,c=0,d=r=0  ⟹  10002=8a=1, \quad b=0, \quad c=0, \quad d=r=0 \implies 1000_2 = \mathbf{8}
  2. Digit 2 (e f g he\ f\ g\ h):
    e=0,f=p=0,g=q=1,h=u=0  ⟹  00102=2e=0, \quad f=p=0, \quad g=q=1, \quad h=u=0 \implies 0010_2 = \mathbf{2}
  3. Digit 3 (i j k mi\ j\ k\ m):
    i=1,j=0,k=0,m=y=1  ⟹  10012=9i=1, \quad j=0, \quad k=0, \quad m=y=1 \implies 1001_2 = \mathbf{9}
Step 5: Verification
  • Re-encode decimal 829\mathbf{829}:

    • 8=10002  ⟹  a=1,b=0,c=0,d=08 = 1000_2 \implies a=1, b=0, c=0, d=0
    • 2=00102  ⟹  e=0,f=0,g=1,h=02 = 0010_2 \implies e=0, f=0, g=1, h=0
    • 9=10012  ⟹  i=1,j=0,k=0,m=19 = 1001_2 \implies i=1, j=0, k=0, m=1
    • a e i=1 0 1  ⟹  f g d 0 1 h 1 1 1 m=0 1 0 0 1 0 1 1 1 12=01001011112a\ e\ i = 1\ 0\ 1 \implies f\ g\ d\ 0\ 1\ h\ 1\ 1\ 1\ m = 0\ 1\ 0\ 0\ 1\ 0\ 1\ 1\ 1\ 1_2 = 0100101111_2 (Matches).
  • Final Decoded Decimal: 829\mathbf{829}


Section 3: BCD Arithmetic & Multi-Format Storage Comparison

Problem 5: Step-by-Step BCD Addition (6710+581067_{10} + 58_{10})

Problem Statement:
Perform the addition of decimal numbers 6767 and 5858 using 8421 BCD arithmetic. Show binary addition, +6+6 correction steps, and carry generation.

Step-by-Step Execution:
  1. Represent in 8421 BCD:
    6710=0110 0111BCD67_{10} = 0110\ 0111_{\text{BCD}}
    5810=0101 1000BCD58_{10} = 0101\ 1000_{\text{BCD}}

  2. Add Least Significant Digits (Units Position: 7+87 + 8):

    『』
    TEXT
      0111 (7)
    + 1000 (8)
    ------
      1111 (Raw binary sum = 15)
    
    • Check condition: Raw sum 11112=15>91111_2 = 15 > 9.
    • Correction: Add +6+6 (011020110_2):
    『』
    TEXT
      1111 (15)
    + 0110 (6)
    ------
     10101 -> Carry out = 1, Corrected sum nibble = 0101 (5)
    
  3. Add Most Significant Digits (Tens Position: 6+5+Carry 16 + 5 + \text{Carry } 1):

    『』
    TEXT
      0110 (6)
    + 0101 (5)
    + 0001 (Carry in = 1)
    ------
      1100 (Raw binary sum = 12)
    
    • Check condition: Raw sum 11002=12>91100_2 = 12 > 9.
    • Correction: Add +6+6 (011020110_2):
    『』
    TEXT
      1100 (12)
    + 0110 (6)
    ------
     10010 -> Carry out = 1, Corrected sum nibble = 0010 (2)
    
  4. Assemble Final Result:

    • Hundreds digit: 000120001_2 (11)
    • Tens digit: 001020010_2 (22)
    • Units digit: 010120101_2 (55)
      Final BCD Sum=0001 0010 0101BCD=12510\text{Final BCD Sum} = 0001\ 0010\ 0101_{\text{BCD}} = \mathbf{125_{10}}

Comprehensive Multi-Format Storage Comparison Table

Decimal ValueUnsigned Binary (Min Bits)Packed BCD (8421)Unpacked BCDDensely Packed BCD (DPD)
77111 (33 bits)0111 (44 bits)0000 0111 (88 bits)000 000 0 111 (1010 bits)
5252110100 (66 bits)0101 0010 (88 bits)00000101 00000010 (1616 bits)000 101 0 010 (1010 bits)
18318310110111 (88 bits)0001 1000 0011 (1212 bits)00000001 00001000 00000011 (2424 bits)001 010 1 011 (1010 bits)
256256100000000 (99 bits)0010 0101 0110 (1212 bits)00000010 00000101 00000110 (2424 bits)010 101 0 110 (1010 bits)
489489111101001 (99 bits)0100 1000 1001 (1212 bits)00000100 00001000 00001001 (2424 bits)100 100 1 111 (1010 bits)
9899891111011101 (1010 bits)1001 1000 1001 (1212 bits)00001001 00001000 00001001 (2424 bits)001 110 1 111 (1010 bits)
9999991111100111 (1010 bits)1001 1001 1001 (1212 bits)00001001 00001001 00001001 (2424 bits)001 111 1 111 (1010 bits)
24012401100101100001 (1212 bits)0010 0100 0000 0001 (1616 bits)4 \text{ bytes} (3232 bits)0000000010 1000000001 (2020 bits)

◇Common Pitfalls & Edge Cases

[!warning] Key BCD Implementation Pitfalls

  1. Omission of the +6+6 Correction on Binary Carry: When a 4-bit addition generates a binary carry (K=1K=1), even if the raw sum nibble appears ≤9\le 9 (e.g., 8+9=17=1 000128 + 9 = 17 = 1\ 0001_2, where lower nibble is 11), adding +6+6 is mandatory to produce the correct digit (00012+01102=01112=70001_2 + 0110_2 = 0111_2 = 7).
  2. Illegal States in 8421 BCD: Nibbles in the range 10102…111121010_2 \dots 1111_2 (10…1510 \dots 15) are undefined in standard BCD. Decoders should treat these as invalid data exceptions unless assigned as sign codes (0xC,0xD0\text{xC}, 0\text{xD}).
  3. DPD Bit Grouping Ordering: DPD places the primary selector bit vv at position index 66 (bit 77 from the left). Misaligning v,w,xv, w, x with payload variables p,q,r,s,t,u,yp, q, r, s, t, u, y will corrupt the entire decoded decimal triplet.
  4. Self-Complementing Codes: Excess-3 is self-complementing, meaning bitwise inversion directly yields the 9's complement. Natural 8421 BCD is not self-complementing, requiring explicit subtraction logic (9−D9 - D).

◇References & Navigation