Guide · Digital logic

Designing a BCD to 7-segment decoder

Seven four-variable functions with don’t cares: truth table, the map for segment e, minimal expressions for every segment and shared products.

Reviewed on against the site’s tools.

A 7-segment display shows a digit by lighting seven bars, named a to g clockwise starting from the top, with g in the middle. The decoder receives a 4-bit BCD digit (ABCD, A the most significant) and turns on the required bars. It is a classic problem because it combines seven four-variable functions with don’t cares.

1. The truth table

A convention has to be chosen: here 6 has its top bar (a), 7 has no f and 9 has its bottom bar (d). Inputs 10 to 15 are not BCD digits, so they are don’t cares for every segment.

DigitABCDabcdefg
000001111110
100010110000
200101101101
300111111001
401000110011
501011011011
601101011111
701111110000
810001111111
910011111011
101010XXXXXXX
111011XXXXXXX
121100XXXXXXX
131101XXXXXXX
141110XXXXXXX
151111XXXXXXX

2. One segment step by step: e

Segment e (bottom left) is only lit for 0, 2, 6 and 8: e = Σm(0, 2, 6, 8) + d(10…15). On the map:

AB \ CD00011110
0010010312
0104050716
11X12X13X15X14
101809X11X10
  • The four corners (m0, m2, m8 and m10, the last one a don’t care) form a group with B = 0 and D = 0: B'D'.
  • m6 is left out. Column CD = 10 (m2, m6, m14 and m10) is a group of 4 with C = 1 and D = 0 thanks to two don’t cares: CD'.
e = B'D' + CD'

Without the don’t cares, m6 could only be grouped with m2 (A'CD') and m8 with m0 (B'C'D'), and the expression would be longer.

3. All seven segments

Repeating the process for each segment gives the table below. Every expression is computed by the site’s minimizer and the link opens its map:

SegmentMinimal expressionTermsLiterals
aB'D' + C + BD + A46open
bB' + C'D' + CD35open
cC' + D + B33open
dB'D' + B'C + BC'D + CD' + A510open
eB'D' + CD'24open
fC'D' + BC' + BD' + A47open
gB'C + BC' + A + CD'47open

If you reach a different expression by hand, it may be just as valid: it only has to give the same output for inputs 0 to 9 and have the same number of terms and literals.

4. Sharing products between segments

Adding up the terms of the seven expressions gives 25 products, but many repeat. A real circuit only needs one AND gate per distinct product: there are 15. These are the ones used by more than one segment:

  • B'D' — a, d, e
  • A — a, d, f, g
  • C'D' — b, f
  • B'C — d, g
  • CD' — d, e, g
  • BC' — f, g

5. What changes with another convention

If 6 is drawn without its top bar or 9 without its bottom bar, the functions of a and d change (and f if 7 has a side bar). It is a good exercise: change the segment’s minterms in the minimizer and compare the size of the expressions.

Practise what you read

Minimize using don’t cares

Write a minimal sum of products for F(A,B,C,D) = Σm(1, 3, 7, 11, 15) + d(0, 2, 5). Use A, B, C, D and an apostrophe for NOT (for example A'B).

Syntax: products side by side (AB), sum with +, NOT with an apostrophe (A') or a leading !.

Open in the tool

References

  • S. L. Harris, D. Harris — Digital Design and Computer Architecture: RISC-V Edition (Morgan Kaufmann) — combinational logic, Karnaugh maps, 7-segment decoder and RISC-V microarchitecture
  • M. Karnaugh, “The Map Method for Synthesis of Combinational Logic Circuits”, Transactions of the AIEE, Part I, vol. 72, no. 5, 1953 — original paper describing the map method