- 2081 Bhadra · 2+4 marks
BCD code and 3-bit binary-to-Gray converter
Short answer
BCD encodes each decimal digit in 4-bit binary (8421), valid 0000–1001. A 3-bit binary to Gray converter: G2 = B2, G1 = B2⊕B1, G0 = B1⊕B0, implemented with two XOR gates. Example: binary 101 yields Gray 111.
What is a BCD code? Design a 3-bit binary to Gray code converter.
BCD code
BCD (Binary Coded Decimal) represents each decimal digit separately by its 4-bit binary value (8421 weights). Only 0000–1001 are valid; 1010–1111 are invalid. Example: = 1001 0011 (BCD), while in binary . BCD is used in calculators, clocks and 7-segment displays.
3-bit binary to Gray code converter
Inputs: binary ( = MSB). Outputs: Gray . In Gray code, successive values differ in only one bit.
Truth table (3-bit binary to Gray)
| 0 | 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 0 | 1 |
| 0 | 1 | 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 1 | 0 |
| 1 | 0 | 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 1 | 1 | 1 |
| 1 | 1 | 0 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 | 0 | 0 |
Simplification (K-maps)
K-map for (rows , columns ):
B1B0
B2 00 01 11 10
0 | 0 | 0 | 1 | 1 |
1 | 1 | 1 | 0 | 0 |
Logic circuit
B2 ---+------------------------ G2
| +-------+
+--->| |
| XOR |----------- G1
B1 ---+--->| |
| +-------+
| +-------+
+--->| |
| XOR |----------- G0
B0 ------->| |
+-------+
The converter needs only two XOR gates: the MSB passes straight through and each other Gray bit is the XOR of two neighbouring binary bits.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Gray code and 3-bit binary-to-Gray converter · Digital Logic, chapter 1
- ASCII code and binary-to-Excess-3 converter · Digital Logic, chapter 1 · asked 2×
- Excess-3 code and binary-to-Excess-3 converter · Digital Logic, chapter 1 · asked 2×
- 3-bit Gray code synchronous counter · Digital Logic, chapter 8 · asked 2×
- Sync vs async; 3-bit Gray code counter · Digital Logic, chapter 8
- Gray vs binary code, convert (10110)₂ to Gray · Digital Logic, chapter 1
- 8085 ALP: BCD to binary conversion · Microprocessor, chapter 2