10 Boolean logic
In this chapter, you will learn about:
★ the identification, definition, symbols and functions of the standard logic gates:
NOT, AND, OR, NAND, NOR and XOR
★ how to use logic gates to create logic circuits from:
– a given problem
– a logic expression
– a truth table
★ how to complete truth tables from:
– a given problem
– a logic expression
– a logic circuit
★ how to write a logic expression from:
– a given problem
– a logic circuit
– a truth table.
10.1 Standard logic gate symbols
Electronic circuits in computers, solid state drives and controlling devices
are made up of thousands of logic gates. Logic gates take binary inputs
and produce a binary output. Several logic gates combined together form a
logic circuit and these circuits are designed to carry out a specific function.
The checking of the output from a logic gate or logic circuit is done using a
truth table.
This chapter will consider the function and role of logic gates, logic
circuits and truth tables. Also a number of possible applications of logic
circuits will be considered. A reference to Boolean algebra will be made
throughout the chapter; but this is really outside the scope of this text book.
However, Boolean algebra will be seen on many logic gate websites and
is included here for completeness, since many students may prefer this
notation to logic statements.
356
10.1 Standard logic gate symbols
10.1.1 Logic gate symbols
Six different logic gates will be considered in this chapter:
NOT gate AND gate
OR gate NAND gate
NOR gate XOR gate
▲ Figure 10.1 Logic gate symbols
Truth tables
Truth tables are used to trace the output from a logic gate or logic circuit. The
NOT gate is the only logic gate with one input; the other five gates have two
inputs (see Figure 10.1).
Although each logic gate can only have one or two inputs, the number of
inputs to a logic circuit can be more than 2; for example, three inputs give a
possible 23 (=8) binary combinations. And for four inputs, the number of possible
binary combinations is 24 (=16). It is clear that the number of possible binary
combinations is a multiple of the number 2 in every case. The possible inputs in
a truth table can be summarised as shown in Table 10.1.
▼ Table 10.1 All possible inputs for truth tables with two, three and four inputs
Inputs Inputs Inputs
A B A B C A B C D
0 0 0 0 0 0 0 0 0
0 1 0 0 1 0 0 0 1
1 0 0 1 0 0 0 1 0
1 1 0 1 1 0 0 1 1
1 0 0 0 1 0 0
1 0 1 0 1 0 1
1 1 0 0 1 1 0
1 1 1 0 1 1 1
1 0 0 0
1 0 0 1
1 0 1 0
1 0 1 1
1 1 0 0
1 1 0 1
1 1 1 0
1 1 1 1
357
10 BOOLEAN LOGIC
As we can see, a truth table will also list the output for every possible
combination of inputs.
10.2 The function of the six logic gates
10.2.1 NOT gate
Description: Truth table: How to write this:
A X
▼ Table 10.2
▲ Figure 10.2 The output, X, is 1 if: Input Output X = NOT A (logic notation)
A X —
the input, A, is 0 X = A (Boolean algebra)
0 1
1 0
Note the use of Boolean algebra to
represent logic gates. This is optional at
IGCSE but many students may prefer to
10.2.2 AND gate use this notation (see NOTE later).
Description: Truth table: How to write this:
A
X
B ▼ Table 10.3
▲ Figure 10.3 Inputs Outputs
The output, X, is 1 if: A B X X = A AND B (logic notation)
0 0 0
both inputs, A and B, are 1 X = A . B (Boolean algebra)
0 1 0
1 0 0
1 1 1
10.2.3 OR gate
Description: Truth table: How to write this:
A
X
B ▼ Table 10.4
▲ Figure 10.4 Inputs Output
The output, X, is 1 if: A B X X = A OR B (logic notation)
either input, A or B, or 0 0 0
both, are 1 0 1 1 X = A + B (Boolean algebra)
1 0 1
1 1 1
358
10.2 The function of the six logic gates
10.2.4 NAND gate (NOT AND)
A Description: Truth table: How to write this:
X
B
▼ Table 10.5
▲ Figure 10.5
Inputs Output
The output, X, is 1 if: A B X
X = A NAND B (logic notation)
input A AND 0 0 1
X = A . B (Boolean algebra)
input B are NOT both 1 0 1 1
1 0 1
1 1 0
10.2.5 NOR gate (NOT OR)
A Description: Truth table: How to write this:
X
B
▼ Table 10.6
▲ Figure 10.6
Inputs Output
X = A NOR B (logic notation)
The output, X, is 1 if: A B X
neither input A nor 0 0 1
X = A + B (Boolean algebra)
input B is 1 0 1 0
1 0 0
1 1 0
10.2.6 XOR gate
Description: Truth table: How to write this:
A
X
B ▼ Table 10.7
X = A XOR B (logic notation)
The output, X, is 1 if:
▲ Figure 10.7 Inputs Output
(input A is 1 AND input
A B X X = (A . B) + (A . B) (Boolean
B is 0)
0 0 0 algebra)
or
0 1 1
(input A is 0 AND input
1 0 1 NOTE: this is sometimes written as:
B is 1)
(A + B) . (A . B)
1 1 0
Activity 10.1
Show why X = (A AND NOT B) OR (NOT A AND B)
and
Y = (A OR B) AND (NOT (A AND B)) both represent the same logic gate.
359