Digital Logic Design · Lab 7 · read before the labAll labsGo to the lab →

Designing code converters.

Three more codes for the decimal digits, and the designer's best friend: the don't care.

01

The three codes

DecimalBCDExcess-324219's complement
00000001100001001
10001010000011000
20010010100100111
30011011000110110
40100011101000101
50101100010110100
60110100111000011
70111101011010010
81000101111100001
91001110011110000
+3

Excess-3 adds 0011 to BCD. It is self complementing: invert the bits and you get the code of 9 - d.

2 4 2 1

The 2421 code has weights 2, 4, 2, 1: 7 = 1101 = 2 + 4 + 0 + 1. It is self complementing too.

9 - d

The 9's complement is used to subtract decimal numbers with an adder.

02

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 \ CD00011110
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.
Click cells 10 to 15 twice to make them X and watch W shrink to A + BC + BD.
03

BCD to excess-3

WA + BC + BD = A + B(C + D)
XB'C + B'D + BC'D' = B ⊕ (C + D)
Y, ZY = CD + C'D' = (C ⊕ D)', Z = D'
04

BCD to 2421

WA + B(C + D)
XA + B(C + D')
Y, ZY = A + B'C + BC'D, Z = D
05

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.

06

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.

I am ready, go to the lab →