IGCSE COMPUTER
SCIENCE
Theory of Computer Science – Logic Gates and Logic
Circuits
Outlines
■ Logic Gates
■ Truth Tables
■ Logic Circuits and Conversions
– Converting Expression to Circuit
– Converting Circuit to Expression
■ Logic Circuits in Real World
– NAND Gate
– DeMorgan’s Theorem
Logic Gates
■ Fundamental building block of a digital circuit
■ Used in computer memory, ALU, CPU, peripherals, … in fact almost all components
■ A logic gate has one or two inputs and one output
■ Input and output can either be true (1) or false (0)
■ Fundamental gates:
– AND
– OR
– NOT
■ Extended gates, constructed using fundamental gates:
– NAND
– NOR
– XOR
Logic Gates – AND gate
■ Two inputs: A and B
■ Output: X
■ X is true only when both input A and
B are true
■ X is false if any or both A and B are
false
■ Expressed in Boolean algebra as:
■ or
Logic Gates – OR gate
■ Two inputs: A and B
■ Output: X
■ X is true when one or both input A
and B are true
■ X is false if both A and B are false
■ Expressed in Boolean algebra as:
Logic Gates – NOT gate
■ Single input: A
■ Output: X
■ X is true when A is false
■ X is false when A is true
■ Expressed in Boolean algebra as:
Logic Gates – NAND gate
■ NAND refers to NOT AND
■ Two inputs: A and B
■ Output: X
■ X is true only when any or both input
A and B are false
■ X is false if both A and B are true
■ Expressed in Boolean algebra as:
■ or
Logic Gates – NOR gate
■ NOR refers to NOT OR
■ Two inputs: A and B
■ Output: X
■ X is true only when both input A and
B are false
■ X is false if any or both A and B are
true
■ Expressed in Boolean algebra as:
Logic Gates – XOR gate
■ XOR refers to Exclusive OR
■ Two inputs: A and B
■ Output: X
■ X is true only either A or B is true
■ X is false if both A and B are true
■ X is false if both A and B are false
■ Expressed in Boolean algebra as:
Truth Tables
■ A truth table represents ALL possible input states and output states of a Logic gate or a
combination of logic gates in a table.
■ The number of states is equal to . Where is the number of input variables.
■ Header of the table contains variable names and logical operation performed on these
variables.
■ For example can be represented as:
A B C
0 0 0 1 0 0
0 0 1 0 0 0
. . . . . .
Logic Circuits and Conversions
Logic Circuits in Real World
■ NAND gate is fundamental building block, which can be used to create AND, OR and
NOT gates
■ AND gate can be created using two NAND gates
■ OR gate can be created using three NAND gates
Logic Circuits in Real World
■ NOT gate can be created using only one NAND
DeMorgan’s Theorem
The DeMorgan’s theorem states:
With the help of this theorem, 3 logical gates can be reduced to 1 gate. Thus simplifying the
circuits.
Logic Gates and Circuits exercise
■ Construct truth tables of the following:
– XOR Gate
■ Draw logical circuit diagrams of the
following:
■ Write logical expression of and of given
logical circuits.
Challenge
Use a switch board to construct “AND” and “OR” gates to glow a bulb.
Construct truth table and circuit diagram of an imaginary XNAND gate and check if it is
similar to some other extended gate.