Lesson 7 – Logic Gates (AND, OR, NOT)

Learning Objectives

  • Understand that a processor is made up of millions of logic gates
  • Understand what AND, OR and NOT logic gates do
  • Know how to write a truth table for each logic gate
  • Create logic gate circuits to solve problems

Learning Outcomes

All must know that a processor is made up of millions of logic gates. With some help, create a simulation of AND OR and NOT gates using Logic Lab. Create logic gate circuits to solve most of the written problems with lots of help. (Level 4)

Most should know that a processor is made up of millions of logic gates, and understand the importance of AND OR and NOT gates. Create a simulation of AND OR and NOT gates, and use it to complete a truth table for each gate. Create logic gate circuits to solve most of the written problems with a little help. (Level 5)

Some could know that a processor is made up of millions of logic gates, and understand the importance of AND OR and NOT gates. Create a simulation of AND OR and NOT gates, and use it to complete a truth table for each gate. Explore other binary operators (XAND, XOR, NAND, NOR) and complete truth tables for them. Create logic gate circuits to solve all of the written problems. (Level 6)

Keywords

Words to learn: processor, logic gate, truth table, Boolean algebra

Starter

Why do we need to know about logic gates? Well a processor is made up of millions of transistors (which are a bit like switches). By linking millions of transistors together into logic gates processors can make decisions.

Watch this part of the Royal Institution Christmas Lectures 2009 which explains just how fast processors can be (teachers – 6m40s to 10m23s – click here).

Watch this part of the video which shows how processors use switching to perform logic calculations (teachers – 12m1s to 13m29s – click here).

Watch this part of the video which explains why processors performing fast switching has resulted in fast processors (teachers – 27m12s to 28m28s (then do practical) – click here).

Watch this part of the video which goes through the problems of heat and why this is a barrier to processors getting even faster, along with the solutions that manufacturers have come up with (teachers – 31m13s to 35m04s – click here).

Main – Truth Tables

So from the videos we know that processors are made up of millions of transistors that can perform logic calcuations. We are now going to investigate the three fundamental types of logic gate – AND, OR and NOT.

Open up the “Logic Lab” by clicking on Untitled Circuit* - Logic.ly Online Demo. Make the circuits below:

As you will see, the three different types of logic gate react in different ways if the input switches are OFF (white showing) or ON (red showing). Click here to open a worksheet – fill in each table, save the worksheet, print it (double sided) and put it into your folder when you are finished.

Using the worksheets you have now created “truth tables”. These are tables that show how a logic gate will work in every situation depending on what the inputs are.

Main – Representing logic circuits

Up until now we have used screenshots from Logic Lab to show you what a logic circuit looks like. This is OK, but it takes up a lot of space and it’s not clear which switch is which and so on. Therefore Computer Scientists came up with a standard way of writing a circuit in text.

First of all we need to name our output LED – this is usually called Output P or Output Z.

We then name each of the switches – the first switch is Input A, the second switch is Input B and so on.

So this circuit:


can be represented by

P = NOT A

this circuit:


can be represented by:

P = A AND B

and this circuit:

can be represented by:

P = A OR B

Using this worksheet, develop a solution to each of the written problems on the worksheet. Take a screenshot of the solution in Logic Lab (by pressing Print Screen), paste it into the table and crop it so it can be clearly seen.

  1. AND - True if A and B are both True
  2. OR - True if either A or B are True
  3. NOT - Inverts value: True if input is False; False if input is True

Once you are finished, print out the worksheet DOUBLE SIDED with your name and tutor group at the top and place it into your folder.

Extension Work

In Microsoft Word, create a “truth table” for three of your solutions (don’t just choose the easier ones!) – it should have a column for each input and a column for the output. Show what happens with every combination of switch.

Once you are finished, print out the worksheet DOUBLE SIDED with your name and tutor group at the top and place it into your folder.

Plenary

Have a go at this logic game – try and get the water to flow by turning on the fewest number of taps.

Levels 4 to 6 use XOR, NAND and NOR gates, which we’ve not really covered, but you can work out what they do from the list below:

  • XOR - True if either A or B are True, but False if both are True
  • NAND - AND followed by NOT: False only if A and B are both True
  • NOR - OR followed by NOT: True only if A and B are both False
  • XNOR - XOR followed by NOT: True if A and B are both True or both False