Designing code converters.
Three more codes for the decimal digits, and the designer's best friend: the don't care.
The three codes
| Decimal | BCD | Excess-3 | 2421 | 9's complement |
|---|---|---|---|---|
| 0 | 0000 | 0011 | 0000 | 1001 |
| 1 | 0001 | 0100 | 0001 | 1000 |
| 2 | 0010 | 0101 | 0010 | 0111 |
| 3 | 0011 | 0110 | 0011 | 0110 |
| 4 | 0100 | 0111 | 0100 | 0101 |
| 5 | 0101 | 1000 | 1011 | 0100 |
| 6 | 0110 | 1001 | 1100 | 0011 |
| 7 | 0111 | 1010 | 1101 | 0010 |
| 8 | 1000 | 1011 | 1110 | 0001 |
| 9 | 1001 | 1100 | 1111 | 0000 |
Excess-3 adds 0011 to BCD. It is self complementing: invert the bits and you get the code of 9 - d.
The 2421 code has weights 2, 4, 2, 1: 7 = 1101 = 2 + 4 + 0 + 1. It is self complementing too.
The 9's complement is used to subtract decimal numbers with an adder.
Don't cares
BCD never uses 1010 to 1111, so the outputs for those six inputs do not matter. Mark them X on the K-map: an X may join a group when it helps and is left out when it does not. Below is W of the excess-3 code: 5 to 9 are 1, 10 to 15 are don't cares.
| AB \ CD | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 00 | ||||
| 01 | ||||
| 11 | ||||
| 10 |
F = Σm(5, 6, 7, 8, 9) = A'BD + A'BC + AB'C'
Click a cell to cycle 0, 1, X (don't care). The rows and columns follow the Gray code, so neighbouring cells differ in one variable.BCD to excess-3
BCD to 2421
9's complement
Write 9 - d for each digit, then one K-map per output with the six don't cares. You should find a very small circuit: one output is a plain wire.
Check yourself
Q1Excess-3 of 6?
1001.
Q22421 of 8?
1110 (2 + 4 + 2 + 0).
Q3Which output of the 9's complement circuit needs no gate?
Y = C.
Q4Why may an X be used as 1 in one group and as 0 in another map?
Its input never occurs, so either value is correct; each output is simplified on its own.