Logic gates
Computer ScienceΒ· Unit 3: Hardware, Topic 1Β· 15 min read
1. Standard Logic Gate Typesβ β ββββ± 4 min
Logic gates are the basic building blocks of all digital computer hardware. Each gate takes binary inputs (0 = off/false, 1 = on/true) and produces a single binary output based on a fixed Boolean rule.
Logic gate
A digital circuit that performs a single Boolean logical operation on one or more binary inputs to produce one output
Example:
A 2-input AND gate only outputs 1 when both of its inputs are 1
1-input gate: NOT (inverter): outputs the opposite value of the input
2-input gates: AND, OR, NAND, NOR, XOR, XNOR: all take two inputs and produce one output based on their rule
Write the full truth table for a 2-input NAND gate, and state the output when A = 1, B = 1
- 1
List all four possible input combinations for two 1-bit inputs, then calculate output for each, since NAND = NOT (A AND B):
- 2
A B Output = NOT (A AND B) 0 0 1 0 1 1 1 0 1 1 1 0 - 3
From the table, when A = 1 and B = 1, the output of the NAND gate is 0.
Exam tip:
CIE often asks to identify gates from their diagrams β memorise the unique shape for each of the 7 standard gate types.
2. Truth Tables for Combined Logic Circuitsβ β β βββ± 5 min
Most practical logic circuits combine multiple gates together. To find the output of a combined circuit for all input combinations, calculate the output of each intermediate gate step-by-step to build the full truth table.
A circuit has two inputs A and B: NOT A feeds one input of an OR gate, and B feeds the other input. Find the output when A=1, B=0, and write the full truth table.
- 1
Define intermediate output , and final output . Add an intermediate column for X to the truth table:
- 2
A B X = NOT A Y = X OR B 0 0 1 1 0 1 1 1 1 0 0 0 1 1 0 1 - 3
When A=1 and B=0, intermediate X = 0, so Y = 0 OR 0 = 0, which matches the full truth table above.
3. Universal Gates (NAND and NOR)β β β βββ± 3 min
NAND and NOR gates are classified as universal gates because any other logic gate can be constructed using only NAND gates or only NOR gates. This simplifies manufacturing, as entire chips can be built from a single type of gate.
Universal gate
A gate type that can be used to construct any Boolean logic gate without requiring any other gate types
Example:
Any logic circuit can be built using only NAND gates, no other gate types are needed
Show how to construct a NOT gate using only a single 2-input NAND gate
- 1
Connect the single input A of the NOT gate to both input pins of the 2-input NAND gate.
- 2
Calculate the output of the NAND gate:
- 3
Since , this simplifies to , which is exactly the behaviour of a NOT gate.
Exam tip:
If asked to construct a NOT gate from a NAND or NOR, always remember to connect the input to both pins of the 2-input gate.
4. Common Applications of Logic Gatesβ β β β ββ± 3 min
Different gate types have specific common uses in digital computer hardware:
NOT gates: Used as signal inverters to flip binary values in clock and control circuits
XOR gates: Used as the basic building block of half adders for binary addition, and for parity checking
NAND gates: Used to build latch circuits for static RAM (SRAM) memory modules
NOR gates: Used to build flash memory cell circuits and basic flip-flops
Check your understanding of core gate behaviour:
Which gate outputs 1 only when its two inputs are different?
AND
XOR
NOR
XNOR
Reveal answer
XOR βCorrect! XOR stands for exclusive OR, which outputs 1 only when its two input values differ.
5. Common Pitfalls
Wrong move:
Mixing up NAND and NOR gate truth tables or symbols
Why:
NAND is NOT AND (output 0 only when all inputs 1), while NOR is NOT OR (output 0 when any input is 1)
Correct move:
Memorise: NAND outputs 1 for all combinations except 1 AND 1, NOR outputs 1 only when all inputs are 0
Wrong move:
Skipping intermediate columns when building truth tables for multi-gate circuits
Why:
Calculating outputs in your head leads to preventable simple arithmetic errors that cost marks
Correct move:
Always add a separate column for every intermediate gate output, even for small circuits
Wrong move:
Confusing XOR and XNOR truth tables
Why:
Students often mix up which gate outputs 1 for same vs different inputs
Correct move:
Remember XNOR is the negation of XOR: XOR = 1 when different, XNOR = 1 when same
Wrong move:
Thinking only NAND is a universal gate
Why:
Many students forget that both NAND and NOR are universal gates
Correct move:
Both NAND and NOR are acceptable answers for a universal gate question unless specified otherwise
6. Quick Reference Cheatsheet
Gate Type | Inputs | Output Rule | Output when all inputs = 1 |
|---|---|---|---|
NOT | 1 | Opposite of input | 0 |
AND | 2 | 1 only if all inputs 1 | 1 |
NAND | 2 | 0 only if all inputs 1 | 0 |
OR | 2 | 1 if any input 1 | 1 |
NOR | 2 | 1 only if all inputs 0 | 0 |
XOR | 2 | 1 if inputs are different | 0 |
XNOR | 2 | 1 if inputs are same | 1 |
When this came up on past exams
AI-estimated based on syllabus patterns β cross-check with official past papers for accuracy. Use only as revision-focus signals.
- 2022 Β· 12
2-mark truth table construction
- 2023 Β· 11
4-mark combined circuit drawing
- 2024 Β· 13
3-mark gate identification
Going deeper
What's Next
Logic gates are the fundamental building block of all digital hardware you will study in this unit. Mastering gate behaviour and truth tables prepares you to work with more complex combinational and sequential circuits, including adders, flip-flops and memory circuits, which are frequently tested in CIE 9618 Paper 1. It also provides the foundation for learning Boolean simplification techniques, which are used to reduce the size and cost of digital circuits. You are now ready to explore more advanced logic concepts and applications.
