G2.2.2 Name the Mystery Gates

EasyImplementIcarus · browser samples / server checksReview the topic

Name six gates from their truth tables, write two multi-input columns, and answer two questions on the 16 functions of two inputs.

Hardware context: A three-input voter for a sensor that is read on three wires, and six unlabelled gate chips. Name six gates from their output columns and predict two more columns.

An old board has six gate chips with the labels worn off. A technician measured each one: every input row, and the output for it. Your job is to name the gates.

This is an Implement problem with no logic in it. Your answer is ten constants. Six are codes for the names of the gates. Two are output columns of gates with more inputs. Two are about the functions of two and three inputs.

Signals in the Timeline

SignalWidthRole
item8input of each check
Full specification
GateInputsOutput for each input row, in counting order
G121110
G220110
G321000
G421001
G5301101001
G6301111111

Counting order means 00, 01, 10, 11 for two inputs and 000 to 111 for three inputs. The leftmost digit of each column belongs to the row of all 0s.

Code123456
GateANDORNANDNORXORXNOR
ConstantWhat to write
G1 to G6The code of each mystery gate.
XOR4_ROWSFour bits: the output of a four-input XOR gate for the rows 0111, 1011, 1111 and 0001, left to right.
NAND3_COLUMNEight bits: the output of a three-input NAND gate for the rows 000 to 111, left to right.
FUNCS3The number of different truth tables, that is functions, that three inputs allow.
IMPLIES_COLUMNFour bits: the function "a implies b" for the rows 00, 01, 10, 11. It is 0 only when a is 1 and b is 0.

Examples

Example 1

A Code Must Name a Gate
Input
G1 to G6 are from 1 to 6
Output
codes_in_range = yes

The codes run from 1 for AND to 6 for XNOR. Any other number names no gate.

Example 2

Four Different Columns, Four Different Gates
Input
G1, G2, G3 and G4 all differ
Output
all_different = yes

The columns of G1, G2, G3 and G4 all differ. Two gates with different truth tables cannot have the same name.

Example 3

Counting Functions Gives a Power of Two
Input
FUNCS3
Output
power_of_two = yes

Each output cell is 0 or 1, so the number of columns is 2 multiplied by itself once per row.

Constraints and Contract

  • Keep the module name answer and its ten outputs.
  • Each gate code is a number from 1 to 6.

Hints

Hint 1

Start with the rows of all 0s and all 1s. AND, OR, NAND and NOR each have one row that differs from all the others.

Hint 2

A gate whose output is 1 when the two inputs differ is XOR. The opposite column is XNOR.

Hint 3

With more than two inputs, XOR counts the 1s. An odd count gives 1 and an even count gives 0.

Hint 4

A function is one output column. Count the rows of a three-input table first, then the ways to fill a column of that length.

What the grader checks: The check compares ten constants with values computed from the definitions of the gates and from counting. It tests your reading of truth tables. It does not run a gate of yours.

13 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

Report a problem with this page

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

A Code Must Name a Gate

Input
G1 to G6 are from 1 to 6
Expected output
codes_in_range = yes

The codes run from 1 for AND to 6 for XNOR. Any other number names no gate.

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

Icarus · browser samples / server checks