2 / 36 · Concept
Gates and truth tables
Compare the output rules of AND, OR, NOT and XOR.
Lessons are free to read. Enroll to save your learning progress.
Learning goals
- Read the truth tables of basic gates.
- Find the input combination where XOR differs from OR.
Check every input combination.
AND is 1 when both inputs are 1. OR is 1 when at least one is 1. XOR is 1 when the inputs differ. NOT inverts one input.
Two inputs have four combinations: 00, 01, 10 and 11. OR and XOR differ only at 11. A few matching examples do not establish equivalence.
Change the inputs
| a | b | a & b | a | b | a ^ b |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 |
Separate bitwise operations from logical conditions.
a & b applies AND to matching bit positions. a && b tests whether both vectors are nonzero. They may look identical for one-bit inputs but differ for vectors.
4'b0010 & 4'b0100 is 0000, but logical AND is 1 because both values are nonzero. These tables use a two-state 0/1 model, without X or Z.
Try it yourself
Find AND, OR and XOR for a=1, b=1.
Read the explanation
AND=1, OR=1 and XOR=0. XOR requires exactly one of these two inputs to be 1.