How to build an excess-3 to BCD code converter
An excess-3 to BCD converter subtracts 3 from a 4-bit excess-3 code E3 E2 E1 E0 to get the decimal digit back as B3 B2 B1 B0. Using the six unused codes as don't-cares it takes six gates: B0 = NOT E0, B1 = E1 XOR E0, B2 = E2 XNOR (E1 AND E0) and B3 = E3 AND (E2 OR E1 E0).
Excess-3 stores each decimal digit as its value plus 3, so the digits 0 to 9 become 0011 to 1100 and the codes 0000 to 0010 and 1101 to 1111 never occur. Those six codes are free in the K-maps, which is what keeps the equations this small. The low bits follow from the subtraction itself: taking away 0011 always flips bit 0, and bit 1 becomes E1 XOR E0. This is the reverse of the BCD to excess-3 converter. Excess-3 is self-complementing: inverting all four bits of a digit's code gives the code of 9 minus that digit, which made it handy for subtraction in early decimal machines. The ten valid codes are checked before the page is built, and the live circuit starts at 0011, the code for 0.
Open this circuit in the lab →
What you need
- 1× NOT: B0 = NOT E0
- 1× XOR: B1 = E1 XOR E0
- 1× AND: E1 AND E0, shared by B2 and B3
- 1× XNOR: B2 = E2 XNOR (E1 AND E0)
- 1× OR: E2 OR (E1 AND E0)
- 1× AND: B3 = E3 AND (E2 OR E1 E0)
Step by step
- Place inputs
E3toE0and probesB3toB0. - Write the table for the ten valid codes (B = E - 3) and mark codes 0000, 0001, 0010, 1101, 1110 and 1111 as don't-cares.
- Read the low bits off directly:
B0 = NOT E0andB1 = E1 XOR E0. - From the K-maps:
B2 = E2 XNOR (E1 E0)andB3 = E3 (E2 + E1 E0), sharing the AND of E1 and E0. - Step through 0011 to 1100: the outputs count 0000 to 1001.
Excess-3 to BCD table
| Digit | Excess-3 E3 E2 E1 E0 | BCD B3 B2 B1 B0 |
|---|---|---|
| 0 | 0011 | 0000 |
| 1 | 0100 | 0001 |
| 2 | 0101 | 0010 |
| 3 | 0110 | 0011 |
| 4 | 0111 | 0100 |
| 5 | 1000 | 0101 |
| 6 | 1001 | 0110 |
| 7 | 1010 | 0111 |
| 8 | 1011 | 1000 |
| 9 | 1100 | 1001 |
Codes 0000, 0001, 0010, 1101, 1110 and 1111 never appear in excess-3, so the circuit's output for them does not matter; the equations above use that freedom.
You can also read the full theory in the lesson on BCD. Prefer to build it yourself from scratch? Open the digiwleea lab and place the gates on the canvas, or start from the logic gate simulator.
Build more parts from gates
Each of these is one step from a transistor to a working CPU. Build every gate from CMOS transistors and work all the way up in the free digiwleea lab, with the free theory reference alongside.
Open the excess-3 to BCD code converter in the lab →Frequently asked
How do you convert excess-3 to BCD?
Subtract 3 (0011) from each 4-bit group. In hardware, a six-gate circuit does it: B0 = NOT E0, B1 = E1 XOR E0, B2 = E2 XNOR (E1 AND E0) and B3 = E3 AND (E2 OR E1 E0).
Why is excess-3 called self-complementing?
Because inverting every bit of a digit's excess-3 code gives the excess-3 code of its 9's complement: 2 is 0101, and its inverse 1010 is the code of 7. That made subtraction easy in decimal machines.
What is 7 in excess-3?
7 + 3 = 10, so 7 is 1010 in excess-3.
Why are don't-cares allowed in the converter?
Six of the sixteen 4-bit codes are never valid excess-3 digits, so whatever the circuit outputs for them never matters, and the K-maps can treat those cells as 0 or 1, whichever gives smaller groups.