Digital logic
NAND and NOR (universal gates)
Also called: NAND · NOR · universal gate · functional completeness
Definition
NAND outputs 0 only when all inputs are 1; NOR outputs 1 only when all inputs are 0. Either one alone can build every other logic function.
Picture it
Tie a NAND's inputs together and it becomes NOT. Follow a NAND with that NOT and you have AND. Chip makers like NAND because it is cheap and fast in CMOS, so real circuits are often seas of NAND gates.
The maths
NAND: Y = NOT (A · B) NOR: Y = NOT (A + B) NOT A = A NAND A
| Quantity | Unit | Symbol |
|---|---|---|
| ratio | dimensionless | 1 |
Worked example
How many 2-input NAND gates does it take to make an AND gate, and an OR gate?
- AND = NOT(NAND(A, B)): 1 NAND, then 1 NAND as NOT → 2
- OR = NAND(NOT A, NOT B) by De Morgan: 2 NANDs as NOTs + 1 → 3
Answer2 for AND, 3 for OR.
✓ The 2 numbers in this answer are recomputed from scratch by an automated test.
logic tester
Logic gate tester
Y = 1
Y = A ⊕ B
| A | B | Y |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 ◀ now |
| 1 | 1 | 0 |
XOR with A = 1, B = 0 gives Y = 1.
Ideal gates: no propagation delay. 1 = true = high, 0 = false = low.
Common misconceptions
- Misconception: Universal does not mean efficient for everything; XOR from NANDs takes 4 gates.
- Misconception: NAND is not 'NOT AND applied to each input'; it inverts the AND of all inputs.