Year 8 · Autumn 1
Computer Systems · Lesson 4 of 5
Logic gates AND, OR, NOT and truth tables
UnpluggedTopic 9 Logic gates
Year 8 · Computer Systems · Lesson 4 of 5
You will learn to
- Explain the rules for the AND, OR and NOT gates.
- Complete a truth table for each gate, with every row of inputs.
- Work out how many rows a truth table needs: 2 inputs give 4 rows, 3 inputs give 8.
- Use the gates toy to build a two-gate circuit and predict its output.
Year 8 · Computer Systems · Lesson 4 of 5
Success criteria
You have got it when you can say:
- I can say the output of AND, OR and NOT for any inputs.
- I can complete three truth tables with no missing rows.
- I can predict the output of a two-gate circuit before I test it.
Year 8 · Computer Systems · Lesson 4 of 5
Retrieval starter
Questions from before. Write your answers, then show them.
- Last lesson
Which register holds the address of the next instruction?
A ACCB MDRC PC
C. PC
- Earlier this unit
The stored-program idea means…
A Programs are kept in the same memory as data, as bitsB Each program needs its own computerC Programs are stored on paper
A. Programs are kept in the same memory as data, as bits
- Last year
A photo is licensed CC BY-NC. Can a company use it in a paid advert?
A Yes, if they credit the creatorB No: NC means non-commercial
B. No: NC means non-commercial
Year 8 · Computer Systems · Lesson 4 of 5
Key words (1 of 2)
- truth table
- Lists every input combination and its output.
- half adder
- An XOR gate plus an AND gate: adds two bits.
- Boolean
- A value that is only True or False.
- Logic gate
- A tiny circuit that takes bits in and gives one bit out by a fixed rule.
Year 8 · Computer Systems · Lesson 4 of 5
Key words (2 of 2)
- Boolean expression
- A rule written with AND, OR and NOT that gives True or False, like A AND NOT B.
- Transistor
- An electronic switch with no moving parts.
The explanation · step 1 of 3 · part 1 of 2
The basic gates
A truth table lists every input and its output. 2 inputs = 2² = 4 rows.
| A | B | A AND B | A OR B | A XOR B |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 |
The explanation · step 1 of 3 · part 2 of 2
The basic gates (continued)
- NOT flips the bit: 0 → 1, 1 → 0.
- AND: 1 only if both are 1.
- OR: 1 if at least one is 1.
- XOR: 1 if they're different. AQA uses it; OCR sticks to AND, OR, NOT.
'You can go out if homework is done AND your room is tidy.' 'Juice OR milk' (having both still counts as true).
The explanation · step 1 of 3
The maths: Logic gates as arithmetic
The explanation · step 2 of 3
Combining gates
Gates feed into each other. 3 inputs = 2³ = 8 rows. Work out the middle columns first.
A car alarm sounds if (alarm set) AND (door open OR window broken): ALARM = S AND (D OR W).
To write input columns without missing a row, count 0 to 7 in binary: 000, 001, 010 … 111.
The explanation · step 2 of 3
The maths: Rows in a truth table
The explanation · step 3 of 3 · part 1 of 2
How gates do arithmetic
| A | B | Sum | Carry |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
- The carry column is the AND table.
- The sum column is the XOR table.
The explanation · step 3 of 3 · part 2 of 2
How gates do arithmetic (continued)
1 XOR + 1 AND gate = a half adder. Chain them and you can add bytes. That's all addition is inside the ALU.
Year 8 · Computer Systems · Lesson 4 of 5
Try it: Play with logic gates
Year 8 · Computer Systems · Lesson 4 of 5
Quick quiz · 1 of 3
What is inside a logic gate on a real chip?
- A Transistors
- B A tiny program
- C Magnets
A. Transistors
Gates are built from transistors: electronic switches. A CMOS NAND gate uses 4.
Year 8 · Computer Systems · Lesson 4 of 5
Quick quiz · 2 of 3
A AND B, with A = 1 and B = 0, gives…
- A 0
- B 1
A. 0
AND needs both inputs to be 1.
Year 8 · Computer Systems · Lesson 4 of 5
Quick quiz · 3 of 3
A OR B, with A = 0 and B = 1, gives…
- A 1
- B 0
A. 1
OR needs at least one 1.
Year 8 · Computer Systems · Lesson 4 of 5
Exit ticket
Answer on paper before you go. Then check.
How many rows in a truth table with 3 inputs?
A 3B 6C 8
C. 8 2³ = 2 × 2 × 2 = 8.
Which gate gives 1 only when its two inputs are different?
A XORB ORC NAND
A. XOR XOR = exclusive OR. 0,1 and 1,0 give 1; 0,0 and 1,1 give 0.