G3.2.1 A Seven-Segment Output with don't-cares

MediumOptimizeIcarus · browser samples / server checksReview the topic

Minimize the bottom-left bar of a decimal display by using the six input codes that never occur.

Hardware context: The bottom-left bar of a decimal seven-segment display, driven from a BCD digit. Minimize one segment of a BCD display decoder with its don't-cares.

A parking garage shows its free level on a seven-segment display. The level arrives as one decimal digit in four bits, a b c d, where a is the most significant bit. Only the codes 0 to 9 are ever sent.

Your output is the bottom-left bar of the display. It is lit when the shape of the digit uses that bar. For the codes 10 to 15 its value has no effect, because those codes never arrive.

This is an Optimize problem. Start from the words: build the truth table from the digit shapes, then the map. The starter treats the unused codes as 0. It is correct, but it does not use them.

You write no logic. Your answer is a table of product terms. The check builds the sum of products from the table and tests the ten digits. It then counts your terms and literals against the true minimum.

Signals in the Timeline

SignalWidthRole
row4input of each check
Full specification
The ten digits as the display draws them. The bottom-left bar is the | at the lower left of a digit.
 _         _    _         _    _    _    _    _ 
| |    |   _|   _|  |_|  |_   |_     |  |_|  |_|
|_|    |  |_    _|    |   _|  |_|    |  |_|   _|
 0    1    2    3    4    5    6    7    8    9 

Read which digits light the bottom-left bar, and write the truth table for the codes 0 to 9. The codes 10 to 15 are don't-cares: you may treat each as 1 or as 0.

How one term is written: the term a b' (a is 1, b is 0, c and d are not used)
CARE  = 4'b1100   // the term uses a and b
VALUE = 4'b1000   // a must be 1, b must be 0
RuleDetail
Bit orderEach group of 4 bits is in the order a b c d: a is the left bit.
Term orderTerm 0 is the rightmost group in the braces. The order of terms does not change the result.
NThe number of terms that count, from 0 to 8. Groups beyond N are ignored.
LiteralOne used variable in one term. The check counts the 1 bits of CARE in the first N terms.
VALUE where CARE is 0Ignored. Write 0 there to keep the table easy to read.
ModuleKeep the module name answer and its three outputs. Change only N, CARE and VALUE.

Each row check reports the bar for one digit. The codes 10 to 15 are not checked. The two cost checks pass only for a cover that no correct cover can beat.

Examples

Example 1

The Digit 8
Input
abcd = 1000
Output
f = 1

The cell at row ab = 10, column cd = 00 holds a 1: every bar of the display is lit for an 8.

Example 2

The Digit 9
Input
abcd = 1001
Output
f = 0

The cell at row ab = 10, column cd = 01 holds a 0. It sits beside x cells, so a group that grows carelessly takes it in.

Example 3

The Digit 2
Input
abcd = 0010
Output
f = 1

The cell at row ab = 00, column cd = 10 holds a 1. Two different groups of four can cover it.

Constraints and Contract

  • Keep the module name answer and the three outputs n, care and value.
  • N is a whole number from 0 to 8. CARE and VALUE hold one 4-bit group per term, in the order a b c d.

Hints

Hint 1

Go through the ten shapes one by one. Four digits light the bar. Then draw the map with its six x cells.

Hint 2

Look at the column cd = 10. It holds two 1s and two x cells. Then look at the four corners of the map.

Hint 3

An x cell that helps no group stays outside. Do not add a group only to cover x cells.

What the grader checks: The check builds the sum of products from the table. It compares it with the bar on the ten digit rows and skips the six unused codes. Then it compares the number of terms and of literals with the true minimum. An exhaustive search over the prime implicants finds that minimum. The check reads the table, not a circuit: delay and hazards are outside this problem.

12 checks on Icarus · browser samples / server checks. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain public samples only. A passing result establishes the tested cases, not a proof for all possible inputs.

See all 1 steps and the final capstone

Report a problem with this page

Your code SystemVerilogSaved locally
Ln 1, Col 1Tab indents · Ctrl/⌘ + Enter runs samples
Not run yet

The Digit 8

Input
abcd = 1000
Expected output
f = 1

The cell at row ab = 10, column cd = 00 holds a 1: every bar of the display is lit for an 8.

Run samples executes all 3 public checks. Check all tests runs 12 checks on the server.

Icarus · browser samples / server checks