Digital logic
Truth table
Also called: logic table · all input combinations · Boolean function
Definition
A truth table lists the output of a logic function for every possible combination of its inputs; n inputs need 2^n rows.
Picture it
It is the complete specification of a combinational circuit: if two circuits have the same truth table they do the same job, however different they look. Write the inputs in binary counting order so no row is missed.
The maths
rows = 2^n for n inputs
| Quantity | Unit | Symbol |
|---|---|---|
| ratio | dimensionless | 1 |
Worked example
An alarm should sound (Y = 1) when the door is open (D) AND the system is armed (A), OR when the panic button (P) is pressed. How many rows does the table need, and in how many is Y = 1?
- 3 inputs → 2^3 = 8 rows
- P = 1 in 4 rows, all Y = 1
- P = 0: Y = 1 only when D = 1 and A = 1, 1 more row
- Total 5
Answer8 rows, with Y = 1 in 5 of them.
✓ The 2 numbers in this answer are recomputed from scratch by an automated test.
logic tester
Logic gate tester
Y = A ⊕ B
| A | B | Y |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 ◀ now |
| 1 | 1 | 0 |
Ideal gates: no propagation delay. 1 = true = high, 0 = false = low.
Common misconceptions
- Misconception: Skipping rows by hand is common; counting in binary guarantees every row appears once.
- Misconception: A truth table cannot describe memory; flip-flops need a state table.