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
| Signal | Width | Role |
|---|---|---|
item | 8 | input of each check |
Full specification
| Gate | Inputs | Output for each input row, in counting order |
|---|---|---|
| G1 | 2 | 1110 |
| G2 | 2 | 0110 |
| G3 | 2 | 1000 |
| G4 | 2 | 1001 |
| G5 | 3 | 01101001 |
| G6 | 3 | 01111111 |
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.
| Code | 1 | 2 | 3 | 4 | 5 | 6 |
|---|---|---|---|---|---|---|
| Gate | AND | OR | NAND | NOR | XOR | XNOR |
| Constant | What to write |
|---|---|
| G1 to G6 | The code of each mystery gate. |
| XOR4_ROWS | Four bits: the output of a four-input XOR gate for the rows 0111, 1011, 1111 and 0001, left to right. |
| NAND3_COLUMN | Eight bits: the output of a three-input NAND gate for the rows 000 to 111, left to right. |
| FUNCS3 | The number of different truth tables, that is functions, that three inputs allow. |
| IMPLIES_COLUMN | Four 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