Turn a list of truth-table rows into the minterm list and the don't-care list of a four-variable function.
Hardware context: A measured four-input decoder with two unused input rows, and a legacy fault flag written as seven full product terms. Turn measured truth-table rows into minterm and don't-care lists.
A technician measured a decoder of four inputs, a, b, c and d. She wrote down every input row where the output f was 1. Two more rows never occur in the product, so the output there does not matter: they are don't-cares.
This is an Implement problem with no logic in it. Write f as two lists of row numbers: the minterms and the don't-cares. Each list is a 16-bit mask. Bit m is 1 when row m is in the list.
The row number m is the input abcd read as a binary number, with a as the most significant bit. Every row not written down gives f = 0.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
item | 8 | input of each check |
Full specification
| a b c d | f |
|---|---|
| 1 1 0 1 | 1 |
| 0 0 1 0 | 1 |
| 1 0 1 0 | x |
| 0 1 1 1 | 1 |
| 1 0 0 0 | 1 |
| 1 1 1 1 | x |
| 0 1 0 1 | 1 |
x marks a don't-care. The rows are in the order they were measured, not in counting order.
localparam logic [15:0] MINTERMS = 16'h0009; // bits 3 and 0 set
Keep the module name answer and its two outputs. Change only the two constants.
Examples
Example 1
The Two Lists Never Share a Row- Input
the two masks
- Output
lists_disjoint = yes
A row is either a minterm or a don't-care. It cannot be both.
Example 2
Five 1s in the Table, Five Minterms- Input
the minterm mask
- Output
five_minterms = yes
The table has five rows with f = 1, so the minterm mask has five bits set.
Example 3
Two x Rows, Two don't-cares- Input
the don't-care mask
- Output
two_dont_cares = yes
The table has two rows marked x. Each one sets one bit of the don't-care mask.
Constraints and Contract
- Keep the module name answer and its two outputs.
- Each mask is 16 bits. Bit m stands for row m.
Hints
Hint 1
Number each row first: abcd = 1101 is 8 + 4 + 1 = 13.
Hint 2
Only the rows with f = 1 are minterms. The rows with x go to the other list.
Hint 3
Row m sets bit m. Add 2 to the power m for each listed row, then write the sum in hexadecimal.
What the grader checks: The check compares each of the 16 bits of the minterm mask with the list from the table. It compares the don't-care mask as a whole. It tests your numbering of rows, not a circuit.
20 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 2 steps and the final capstone