OR Gate
The OR gate outputs 1 when at least one input is 1, implementing inclusive logical disjunction.
What it does
The OR gate implements inclusive disjunction. Its output is 1 if any input is 1, and 0 only when every input is 0. In words, at least one condition must hold.
Truth table
| A | B | A OR B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
Algebraic form
OR is written as addition: A plus B, or A or B. It satisfies A OR 0 = A and the saturating identity A OR 1 = 1. Like AND it is commutative and associative. Note that this is inclusive OR; the exclusive variant is the XOR gate.
Relationship to AND
By De Morgan's laws, an OR of inputs equals a NAND-style combination: A OR B is the same as NOT(NOT A AND NOT B). This duality lets designers convert OR logic into AND logic and vice versa.
In code
out = a | b # bitwise OR
out = a or b # logical OR
Where it appears
- Combining alarm or fault flags: assert a summary line if any source fires.
- Setting bits: a OR a mask forces chosen bit positions to 1.
- Merging conditions where any one of several triggers is enough.
- Building wider selection logic together with AND and NOT.
With AND and NOT, OR completes a functionally complete set, so any logic function can be built from these three.