0% found this document useful (0 votes)
11 views

Logic Functions and Boolean Algebra

The document introduces logic gates and Boolean algebra, which are fundamental components of digital circuits. It explains various types of logic gates (AND, OR, NOT, NAND, NOR, XOR) and their functions, as well as methods for representing logic functions, including truth tables and Karnaugh maps for simplification. Additionally, it covers Boolean algebra laws, DeMorgan's theorem, and the importance of logic minimization in circuit design.

Uploaded by

yanndjoko1
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Logic Functions and Boolean Algebra

The document introduces logic gates and Boolean algebra, which are fundamental components of digital circuits. It explains various types of logic gates (AND, OR, NOT, NAND, NOR, XOR) and their functions, as well as methods for representing logic functions, including truth tables and Karnaugh maps for simplification. Additionally, it covers Boolean algebra laws, DeMorgan's theorem, and the importance of logic minimization in circuit design.

Uploaded by

yanndjoko1
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 47

Introduction to Logic Gates

• We will introduce Boolean algebra and


logic gates
• Logic gates are the building blocks of
digital circuits
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
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
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 y=a
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
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 = a+b
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 +
EXCLUSIVE OR (XOR) Gate
Symbol Truth-table Boolean
a b y y = aÅb
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 b y y = a.b
a
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
NOT OR (NOR) Gate
Symbol Truth-table Boolean
a b y y = a+b
a
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
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
a+0= a a.0 = 0
a+a =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 )
Boolean Algebra
• Commutation
a+b =b+a
a.b = b.a
• Association
( a + b) + c = a + (b + c)
( a.b).c = a.(b.c)
• Distribution
a.(b + c + K) = (a.b) + (a.c) + K
a + (b.c. K) = (a + b).( a + c). K 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
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
DeMorgan’s Theorem
a + b + c + K = a .b .c . K
a.b.c. K = a + b + c + K
• 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 + K = a .b .c . K
a.b.c. K = a + b + c + K
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
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)
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
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
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


Logic Minimisation
• Any Boolean function can be implemented
directly using combinational logic (gates)
• However, simplifying the Boolean function will
enable the number of gates required to be
reduced. Techniques available include:
– Algebraic manipulation (as seen in examples)
– Karnaugh (K) mapping (a visual approach)
– Tabular approaches (usually implemented by
computer, e.g., Quine-McCluskey)
• K mapping is the preferred technique for up to
about 5 variables
Truth Tables
• f is defined by the following truth table
• A minterm must contain
x y z f minterms all variables (in either
0 0 0 1 x . y. z complement or
0 0 1 1 x . y. z uncomplemented form)
0 1 0 1 x. y.z
0 1 1 1 x. y.z • Note variables in a
1 0 0 0 minterm are ANDed
1 0 1 0 together (conjunction)
1 1 0 0
1 1 1 1 x. y.z • One minterm for each
term of f that is TRUE
• So x. y.z is a minterm but y.z is not
Disjunctive Normal Form
• A Boolean function expressed as the
disjunction (ORing) of its minterms is said
to be in the Disjunctive Normal Form (DNF)
f = x. y.z + x . y.z + x. y.z + x. y.z + x. y.z
• A Boolean function expressed as the
ORing of ANDed variables (not necessarily
minterms) is often said to be in Sum of
Products (SOP) form, e.g.,
f = x + y.z Note functions have the same truth tab le
Maxterms
• A maxterm of n Boolean variables is the
disjunction (ORing) of all the variables either
in complemented or uncomplemented form.
– Referring back to the truth table for f, we can
write,
f = x. y.z + x. y.z + x. y.z
Applying De Morgan (and complementing) gives
f = ( x + y + z ).( x + y + z ).( x + y + z )
So it can be seen that the maxterms of f are
effectively the minterms of f with each variable
complemented
Conjunctive Normal Form
• A Boolean function expressed as the
conjunction (ANDing) of its maxterms is said
to be in the Conjunctive Normal Form (CNF)
f = ( x + y + z ).( x + y + z ).( x + y + z )
• A Boolean function expressed as the ANDing
of ORed variables (not necessarily maxterms)
is often said to be in Product of Sums (POS)
form, e.g.,
f = ( x + y ).( x + z )
Logic Simplification
• As we have seen previously, Boolean
algebra can be used to simplify logical
expressions. This results in easier
implementation
Note: The DNF and CNF forms are not
simplified.
• However, it is often easier to use a
technique known as Karnaugh mapping
Karnaugh Maps
• Karnaugh Maps (or K-maps) are a
powerful visual tool for carrying out
simplification and manipulation of logical
expressions having up to 5 variables
• The K-map is a rectangular array of
cells
– Each possible state of the input variables
corresponds uniquely to one of the cells
– The corresponding output state is written in
each cell
K-maps example
• From truth table to K-map
x y z f z
yz
0 0 0 1 x 00 01 11 10
0 0 1 1 0 1 1 1 1
0 1 0 1 x 1 1
0 1 1 1
1 0 0 0 y
1 0 1 0
Note that the logical state of the
1 1 0 0
variables follows a Gray code, i.e.,
1 1 1 1
only one of them changes at a time
The exact assignment of variables in
terms of their position on the map is
not important
K-maps example
• Having plotted the minterms, how do we
use the map to give a simplified
expression? • Group terms
z • Having size equal to a power of
yz 2, e.g., 2, 4, 8, etc.
x
00 01 11 10
0 1 1 1 1 • Large groups best since they
x 1 1 contain fewer variables
• Groups can wrap around edges
x y.z y
and corners
So, the simplified func. is,
f = x + y.z as before
K-maps – 4 variables
• K maps from Boolean expressions
– Plot f = a .b + b.c .d c
cd
ab 00 01 11 10
00
01 1 1 1 1
b
a 11 1
10

d
• See in a 4 variable map:
– 1 variable term occupies 8 cells
– 2 variable terms occupy 4 cells
– 3 variable terms occupy 2 cells, etc.
K-maps – 4 variables
• For example, plot
f =b f = b .d
c c
cd cd
ab 00 01 11 10 ab 00 01 11 10
00 1 1 1 1 00 1 1
01 01
b b
a
11 a
11
10 1 1 1 1 10 1 1

d d
K-maps – 4 variables
• Simplify, f = a .b.d + b.c.d + a .b.c .d + c.d
c
cd
ab 00 01 11 10
00 1
01 1 1 1 1
b
11 1
a
10 1
c.d
a.b d

So, the simplified func. is,


f = a .b + c.d
POS Simplification
• Note that the previous examples have
yielded simplified expressions in the
SOP form
– Suitable for implementations using AND
followed by OR gates, or only NAND gates
(using DeMorgans to transform the result –
see previous Bubble logic slides)
• However, sometimes we may wish to
get a simplified expression in POS form
– Suitable for implementations using OR
followed by AND gates, or only NOR gates
POS Simplification
• To do this we group the zeros in the map
– i.e., we simplify the complement of the function
• Then we apply DeMorgans and
complement
• Use ‘bubble’ logic if NOR only
implementation is required
POS Example
• Simplify f = a .b + b.c .d into POS form.
c c
cd cd
ab 00 01 11 10 ab 00 01 11 10
00 00 0 0 0 0
01 1 1 1 1 Group
b 01 1 1 1 1
zeros b
11 1 11 1 0 0 0
a a
10 10 0 0 0 0

d b a.d d a.c
f = b + a.c + a.d
POS Example
• Applying DeMorgans to a
f = b + a.c + a.d c
f
gives, a
f = b.(a + c ).( a + d ) d
f = b.(a + c ).( a + d ) b
a
a
c
c
f
f
a
a
d
d
b
b
Expression in POS form
• Apply DeMorgans and take
complement, i.e., f is now in SOP form
• Fill in zeros in table, i.e., plot f
• Fill remaining cells with ones, i.e., plot f
• Simplify in usual way by grouping ones
to simplify f
Don’t Care Conditions
• Sometimes we do not care about the
output value of a combinational logic
circuit, i.e., if certain input combinations
can never occur, then these are known
as don’t care conditions.
• In any simplification they may be treated
as 0 or 1, depending upon which gives
the simplest result.
– For example, in a K-map they are entered
as Xs
Don’t Care Conditions - Example
• Simplify the function f = a .b .d + a .c.d + a.c.d
With don’t care conditions, a .b .c .d , a .b .c.d , a .b.c .d
c
cd See only need to include
ab 00 01 11 10
00 X 1 1 X Xs if they assist in making
01 X 1
b a bigger group, otherwise
11 1
a can ignore.
10 1
c.d
a.b d
f = a .b + c.d or, f = a .d + c.d
Some Definitions
• Cover – A term is said to cover a minterm if that
minterm is part of that term
• Prime Implicant – a term that cannot be further
combined
• Essential Term – a prime implicant that covers a
minterm that no other prime implicant covers
• Covering Set – a minimum set of prime
implicants which includes all essential terms plus
any other prime implicants required to cover all
minterms

You might also like