Related Concepts: 01 BCD & Weighted Digital Codes | 03 Gray Code & Code Conversions | 04 Error Control, Parity Generators & Checkers
2.02 Excess-3 Code & Self-Complementing Logic
What is a Self-Complementing Code?
A 4-bit binary code is defined as Self-Complementing if the 1’s complement {bitwise inversion: } of any decimal digit’s code word yields the exact code word of its 9’s decimal complement ().
graph LR subgraph Self-Complementing Symmetry D2[Decimal Digit 2: 0101] -->|Bitwise Inversion| InvD2[1's Comp: 1010] InvD2 -->|Equals| D7[Decimal Digit 7 = 9 - 2: 1010] end
1. What is Excess-3 Code?
[concept] Concept: Excess-3 Definition Excess-3 (XS-3) is a non-weighted binary code. Each decimal digit (0 through 9) is represented by the 4-bit binary value of .
- Decimal:
- Excess-3 representation:
Why do we use Excess-3?
- Simplified Subtraction (Self-Complementing): The primary advantage of Excess-3 is that the 1’s complement of an Excess-3 digit is the Excess-3 representation of its 9’s complement (e.g. 1’s complement of
0100[1] is1011[8]). This makes subtraction circuits in early decimal calculators incredibly simple to design. - Transmission Reliability: Unlike standard BCD where is represented by
0000(which is indistinguishable from a line disconnection or fault), the smallest valid Excess-3 code word is0011(decimal 0). This prevents signal transmission line faults from being misread as valid data.
2. Excess-3 Addition Mechanics
Because Excess-3 values always have an extra offset of built-in, adding two Excess-3 digits yields:
To restore the correct Excess-3 bias of :
- Case A: A carry is generated (Sum ) Add
0011() to correct the sum nibble. - Case B: No carry is generated (Sum ) Subtract
0011() (or add1101) to correct the sum nibble.
Step-by-Step Addition Examples:
Example 1: Excess-3 Addition with Sum (No Carry)
Add and in Excess-3:
0101 & (2 + 3 = 5) \\ +0110 & (3 + 3 = 6) \\ \hline 1011 & (\text{Raw Binary Sum} = 11_{10} \to \text{No Carry}) \\ -0011 & (\text{No Carry} \implies \text{Subtract } 3) \\ \hline \mathbf{1000} & (\text{Corrected Sum} = 8_{10} \implies 5_{\text{decimal}} \text{ in XS-3}) \end{array}$$ **Final Answer:** **$1000_{\text{XS-3}}$** (corresponds to $5_{10}$).
Example 2: Excess-3 Addition with Sum (Carry Generated)
Add and in Excess-3:
1001 & (6 + 3 = 9) \\ +1000 & (5 + 3 = 8) \\ \hline \mathbf{1} \ 0001 & (\text{Raw Binary Sum} \to \text{Carry generated!}) \\ +0011 & (\text{Carry generated} \implies \text{Add } 3 \text{ to sum nibble}) \\ \hline \mathbf{1} \ 0100 & (\text{Carry is pushed to next nibble}) \end{array}$$ Grouped into 4-bit nibbles: $\mathbf{0100\ 0100_{\text{XS-3}}}$ (corresponds to $11_{10}$ in decimal).
3. Mathematical Proof: Excess-3 is a Self-Complementing Code
Major Exam Proof (2021, 2023, 2025 - 8 to 10 Marks)
Question: Prove mathematically that Excess-3 (XS-3) code is a self-complementing code.
Step-by-Step Proof:
-
Definition of Excess-3 Code: The Excess-3 code word for any decimal digit () is constructed by adding to its standard 4-bit binary equivalent:
-
Evaluating the 9’s Complement of (): The Excess-3 code word for the 9’s complement of is:
-
Evaluating the 1’s Complement of : Taking the bitwise 1’s complement of a 4-bit number is mathematically equivalent to subtracting it from (): Substituting :
-
Comparing Results:
4. Complete 9’s Complement Symmetry Table
| Decimal Digit () | BCD (8421) | Excess-3 Code () | 1’s Comp of XS-3 | 9’s Comp Digit () | XS-3 Code of () |
|---|---|---|---|---|---|
| 0 | 0000 | 0011 | 1100 | 9 | 1100 |
| 1 | 0001 | 0100 | 1011 | 8 | 1011 |
| 2 | 0010 | 0101 | 1010 | 7 | 1010 |
| 3 | 0011 | 0110 | 1001 | 6 | 1001 |
| 4 | 0100 | 0111 | 1000 | 5 | 1000 |
| 5 | 0101 | 1000 | 0111 | 4 | 0111 |
| 6 | 0110 | 1001 | 0110 | 3 | 0110 |
| 7 | 0111 | 1010 | 0101 | 2 | 0101 |
| 8 | 1000 | 1011 | 0100 | 1 | 0100 |
| 9 | 1001 | 1100 | 0011 | 0 | 0011 |
5. Design: BCD to Excess-3 Code Converter
Major Exam Design Problem (2018 - 10 Marks)
Question: Design a combinational logic circuit to convert a 4-bit BCD input () to a 4-bit Excess-3 code output ().
Boolean Function Derivation (K-Map Simplification):
- Inputs: (Don’t care conditions ).
- Outputs: .
- Output (LSB):
- Output :
- Output :
- Output (MSB):
Past Year Questions (PYQs)
- [PYQ 2017, 2021, 2023, 2025]: Define self-complementary code. (04 Marks)
- [PYQ 2021, 2023, 2025]: Prove mathematically that Excess-3 code is a self-complementary code. (08-10 Marks)
- [PYQ 2018]: Design a BCD to Excess-3 code converter circuit. (10 Marks)