Topic 4

Logic gates

Digital circuits work with two levels: 1 (high voltage) and 0 (low voltage). A logic gate takes one or two such inputs, A and B, and gives one output Y by a fixed rule. A truth table lists the output for every input.

Three gates are basic. AND gives 1 only when both inputs are 1. OR gives 1 when at least one input is 1. NOT has one input and flips it.

Predict first

A NAND gate is an AND gate followed by a NOT gate. For which inputs is its output 0?

Pick a gate, then flip its inputs

A=1B=0Y=0
Truth table for AND
ABY
000
010
100
111

In the same way, NOR is OR followed by NOT: it gives 1 only when both inputs are 0. A small circle on a gate's output in a circuit diagram means the output is flipped.

AND: Y = A · B OR: Y = A + B NOT: Y = Ā

the bar over A means NOT; + means OR here, not addition

NAND: Y = NOT (A · B) NOR: Y = NOT (A + B)

Universal gates

NAND and NOR are called universal gates: any other gate can be built from them alone. Join both inputs of a NAND gate together and it works as a NOT gate. The same is true of NOR.