26/08/2020
Digital Electronics:
Combinational Logic
Logic Gates and Boolean
Algebra
Introduction to Logic Gates
• We will introduce Boolean algebra and
logic gates
• Logic gates are the building blocks of
digital circuits
1
26/08/2020
Logic Variables
• Different names for the same thing
– Logic variables
– Binary variables
– Boolean variables
• Can only take on 2 values, e.g.,
– TRUE or False
– ON or OFF
– 1 or 0
Logic Variables
• In electronic circuits the two values can
be represented by e.g.,
– High voltage for a 1
– Low voltage for a 0
• Note that since only 2 voltage levels are
used, the circuits have greater immunity
to electrical noise
2
26/08/2020
Uses of Simple Logic
• Example – Heating Boiler
– If chimney is not blocked and the house is cold
and the pilot light is lit, then open the main fuel
valve to start boiler.
b = chimney blocked
c = house is cold
p = pilot light lit
v = open fuel valve
– So in terms of a logical (Boolean) expression
v = (NOT b) AND c AND p
Logic Gates
• Basic logic circuits with one or more
inputs and one output are known as
gates
• Gates are used as the building blocks in
the design of more complex digital logic
circuits
3
26/08/2020
Representing Logic Functions
• There are several ways of representing
logic functions:
– Symbols to represent the gates
– Truth tables
– Boolean algebra
• We will now describe commonly used
gates
NOT Gate
Symbol Truth-table Boolean
a y a y ya
0 1
1 0
• A NOT gate is also called an ‘inverter’
• y is only TRUE if a is FALSE
• Circle (or ‘bubble’) on the output of a gate
implies that it as an inverting (or
complemented) output
4
26/08/2020
AND Gate
Symbol Truth-table Boolean
a b y y a.b
a y 0 0 0
b
0 1 0
1 0 0
1 1 1
• y is only TRUE only if a is TRUE and b is
TRUE
• In Boolean algebra AND is represented by
a dot .
OR Gate
Symbol Truth-table Boolean
a b y y ab
a y 0 0 0
b 0 1 1
1 0 1
1 1 1
• y is TRUE if a is TRUE or b is TRUE (or
both)
• In Boolean algebra OR is represented by
a plus sign
5
26/08/2020
EXCLUSIVE OR (XOR) Gate
Symbol Truth-table Boolean
a b y y ab
a y 0 0 0
b
0 1 1
1 0 1
1 1 0
• y is TRUE if a is TRUE or b is TRUE (but
not both)
• In Boolean algebra XOR is represented by
an sign
NOT AND (NAND) Gate
Symbol Truth-table Boolean
a
a b y y a.b
y 0 0 1
b 0 1 1
1 0 1
1 1 0
• y is TRUE if a is FALSE or b is FALSE (or
both)
• y is FALSE only if a is TRUE and b is
TRUE
6
26/08/2020
NOT OR (NOR) Gate
Symbol Truth-table Boolean
a
a b y y ab
y 0 0 1
b
0 1 0
1 0 0
1 1 0
• y is TRUE only if a is FALSE and b is
FALSE
• y is FALSE if a is TRUE or b is TRUE (or
both)
Boiler Example
• If chimney is not blocked and the house is
cold and the pilot light is lit, then open the
main fuel valve to start boiler.
b = chimney blocked c = house is cold
p = pilot light lit v = open fuel valve
b
c v b .c. p
p
7
26/08/2020
Boolean Algebra
• In this section we will introduce the laws
of Boolean Algebra
• We will then see how it can be used to
design combinational logic circuits
• Combinational logic circuits do not have
an internal stored state, i.e., they have
no memory. Consequently the output is
solely a function of the current inputs.
• Later, we will study circuits having a
stored internal state, i.e., sequential
logic circuits.
Boolean Algebra
OR AND
a0 a a.0 0
aa a a.a a
a 1 1 a.1 a
a a 1 a.a 0
• AND takes precedence over OR, e.g.,
a.b c.d (a.b) (c.d )
8
26/08/2020
Boolean Algebra
• Commutation
ab ba
a.b b.a
• Association
(a b) c a (b c)
(a.b).c a.(b.c)
• Distribution
a.(b c ) (a.b) (a.c)
a (b.c. ) (a b).(a c). NEW
• Absorption
a (a.c) a NEW
a.(a c) a NEW
Boolean Algebra - Examples
Show
a.(a b) a.b
a.(a b) a.a a.b 0 a.b a.b
Show
a (a .b) a b
a (a .b) (a a ).(a b) 1.(a b) a b
9
26/08/2020
Boolean Algebra
• A useful technique is to expand each
term until it includes one instance of each
variable (or its compliment). It may be
possible to simplify the expression by
cancelling terms in this expanded form
e.g., to prove the absorption rule:
a a.b a
a.b a.b a.b a.b a.b a.(b b ) a.1 a
Boolean Algebra - Example
Simplify
x. y y.z x.z x. y.z
x. y.z x. y.z x. y.z x. y.z x. y.z x. y.z x. y.z
x. y.z x. y.z x. y.z x. y.z
x. y.( z z ) y.z.( x x )
x. y.1 y.z.1
x. y y.z
10
26/08/2020
DeMorgan’s Theorem
a b c a .b .c .
a.b.c. a b c
• In a simple expression like a b c (or a.b.c)
simply change all operators from OR to
AND (or vice versa), complement each
term (put a bar over it) and then
complement the whole expression, i.e.,
a b c a .b .c .
a.b.c. a b c
DeMorgan’s Theorem
• For 2 variables we can show a b a .b
and a.b a b using a truth table.
a b a b a.b a b a.b a b
0 0 1 1 1 1 1 1
0 1 0 1 1 0 0 1
1 0 0 1 0 1 0 1
1 1 0 0 0 0 0 0
• Extending to more variables by induction
a b c (a b).c (a .b ).c a .b .c
11
26/08/2020
DeMorgan’s Examples
• Simplify a.b a.(b c) b.(b c)
a.b a.b .c b.b .c (DeMorgan)
a.b a.b .c (b.b 0)
a.b (absorbtion)
DeMorgan’s Examples
• Simplify (a.b.(c b.d ) a.b).c.d
(a.b.(c b d ) a b ).c.d (De Morgan)
(a.b.c a.b.b a.b.d a b ).c.d (distribute)
(a.b.c a.b.d a b ).c.d (a.b.b 0)
a.b.c.d a.b.d .c.d a .c.d b .c.d (distribute)
a.b.c.d a .c.d b .c.d (a.b.d .c.d 0)
(a.b a b ).c.d (distribute)
(a.b a.b).c.d (DeMorgan)
c.d (a.b a.b 1)
12
26/08/2020
DeMorgan’s in Gates
• To implement the function f a.b c.d we
can use AND and OR gates
a
b
f
c
d
• However, sometimes we only wish to
use NAND or NOR gates, since they
are usually simpler and faster
DeMorgan’s in Gates
• To do this we can use ‘bubble’ logic
Two consecutive ‘bubble’ (or
a x
complement) operations cancel,
b i.e., no effect on logic function
f
c
d y What about this gate?
DeMorgan says x y x. y
See AND gates are
now NAND gates Which is a NOT
AND (NAND) gate
So is equivalent to
13
26/08/2020
DeMorgan’s in Gates
• So the previous function can be built
using 3 NAND gates
a a
b b
f f
c c
d d
f a.b c.d
f (a.b).(c.d )
DeMorgan’s in Gates
• Similarly, applying ‘bubbles’ to the input
of an AND gate yields
x
f
y Which is a NOT OR
(NOR) gate
What about this gate?
DeMorgan says x. y x y
So is equivalent to
• Useful if trying to build using NOR gates
14