Logic gates and circuits

Computer Science · GCSE · The School

From switches to symbols

A LOGIC GATE is a tiny physical circuit, built from transistors, that takes one or two electrical signals and produces one output. HIGH voltage represents 1 (true); LOW represents 0 (false). Every gate has a standard SYMBOL, drawn the same way on every exam board's paper, so a circuit can be read without knowing how the transistors inside actually work.

Six gates, six rules

AND is drawn like a capital D: a flat back and a rounded front, and outputs 1 only when both inputs are 1. OR is drawn as a curved-backed shape tapering to a point, like a shield, and outputs 1 when at least one input is 1. NOT is a triangle with a small circle — a "bubble" — on its output tip, and flips a single input. NAND is the AND shape with a bubble added on the output: 1 except when both inputs are 1. NOR is the OR shape with a bubble added on the output: 1 only when both inputs are 0. XOR is the OR shape with an extra curved line just behind the input side, and outputs 1 only when the inputs DIFFER — unlike OR, two 1s give 0.

A circuit reads left to right

Inputs enter on the left, gates sit in the middle, the output leaves on the right. A line connects two components and carries one signal. When a gate's output feeds directly into the next gate's input, work out the first gate's answer before the second — exactly like doing brackets first in arithmetic.

Tracing (A AND B) OR C

Inputs A=1, B=0, C=1. First the AND gate: A AND B = 1 AND 0 = 0. That 0 becomes one input to the OR gate, alongside C. OR gate: 0 OR 1 = 1. The whole circuit outputs 1. Change nothing but C to 0 and the OR gate becomes 0 OR 0 = 0 — one changed input, traced through two gates, one changed answer.

A half adder: gates doing arithmetic

A HALF ADDER adds two single binary digits. An XOR gate gives the SUM: 1 XOR 1 = 0, matching 1+1=10 in binary where the units digit is 0. An AND gate gives the CARRY: 1 AND 1 = 1, the digit carried into the next column. Two gates, wired to the same two inputs, perform binary addition.

The same logic, built in silicon

The AND you traced by hand is the same AND etched, billions of times over, into a processor. A modern CPU contains billions of gates, combined into adders, comparators and the control logic that runs the fetch-decode-execute cycle. Boolean logic on paper and a working computer are the same idea at two different sizes.

The School — all subjects · Knowledge map