Skip to content
Tactiverge

Digital logic

OR gate

Also called: OR · disjunction · A + B · either input

Definition

An OR gate outputs 1 when at least one of its inputs is 1.

Picture it

Two switches in parallel: either one lights the lamp. Emergency stops from several places are OR logic: any one of them stops the machine. Bitwise OR sets chosen bits without touching the others.

The maths

Y = A + B
A B | Y: 00|0 01|1 10|1 11|1
SI units used in this entry
QuantityUnitSymbol
ratiodimensionless1

Worked example

A register holds 0b0001 0010. Firmware ORs it with 0b1000 0000 to set the top bit. What is the new value in decimal?

  1. 0001 0010 OR 1000 0000 = 1001 0010
  2. 128 + 16 + 2 = 146

Answer1001 0010 = 146.

✓ The number in this answer is recomputed from scratch by an automated test.

logic tester

Logic gate tester

Y = 1

Y = A ⊕ B

Truth table for XOR; the current row is marked.
ABY
000
011
101 ◀ now
110
XOR with A = 1, B = 0 gives Y = 1.

Ideal gates: no propagation delay. 1 = true = high, 0 = false = low.

Common misconceptions

  • Misconception: The + in Boolean algebra means OR, so 1 + 1 = 1, not 2.
  • Misconception: Everyday 'or' often means exclusive or; the OR gate is inclusive.