Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 53

Digital Electronics & Logic

Design ( 210243)

Unit II –
Combinational Logic Design
Logic Function Simplification
Logic Function Simplification
 Why simplify?
 Simpler expression uses less logic gates
 Thus: cheaper, less power, faster (sometimes)
 Simplification techniques:
 Algebraic Simplification
 Simplify Boolean functions by means of basic identities and theorems
 Requires skill and it lacks specific rules to predict each succeeding step in
the minimization process
 Karnaugh Maps - A graphical technique for simplifying an expression
 Advantages
 A more orderly process with well-defined steps compared with the trial-

and-error process sometimes used in algebraic simplification


 Always able to produce a minimum expression

Disadvantage: Limited to 5 or 6 variables


 Quine-McCluskey
 Suitable for automation

 Can handle many variables (but computationally intensive) 2


Description of K-map and
Terminology
 A K-map is a matrix consisting of rows and
columns that represent the output values of a
Boolean function
 Objective: Fewest possible product terms and
literals.
 Diagrammatic technique based on a special
form of Venn diagram
 K-map can be of two forms
 Sum-of-Product (SOP) Form
 Product-of-Sum (POS) Form 3
Minterms
 A minterm is a special product of literals, in which
each input variable appears exactly once
 A function with n variables has 2n minterms (since
each variable can appear complemented or not)
 A three-variable function, such as f(x,y,z), has 23 = 8
minterms namely:
x’y’z’ x’y’z x’yz’ x’yz
xy’z’ xy’z xyz’ xyz

4
Minterms (Cont.)
 Each minterm is true for exactly one
combination of inputs:
Minterm Is true when… Shorthand
x’y’z’ x=0, y=0, z=0 m0
x’y’z x=0, y=0, z=1 m1
x’yz’ x=0, y=1, z=0 m2
x’yz x=0, y=1, z=1 m3
xy’z’ x=1, y=0, z=0 m4
xy’z x=1, y=0, z=1 m5
xyz’ x=1, y=1, z=0 m6
xyz x=1, y=1, z=1 m7

5
Sum of Minterms Form
 Every function can be written as a sum of minterms, which
is a special kind of sum of products form
 The sum of minterms form for any function is unique
 If you have a truth table for a function, you can write a
sum of minterms expression just by picking out the rows of
the table where the function output is 1
x y z f(x,y,z) f’(x,y,z)  f = x’y’z’ + x’y’z + x’yz’ + x’yz + xyz’
0 0 0 1 0 = m0 + m1 + m2 + m3 + m6
0 0 1 1 0 = m(0,1,2,3,6)
0 1 0 1 0  f’ = xy’z’ + xy’z + xyz
0 1 1 1 0
= m4 + m 5 + m 7
1 0 0 0 1
= m(4,5,7)
1 0 1 0 1
1 1 0 1 0
 f’ contains all the minterms not in f
1 1 1 0 1 6
Re-arranging the Truth Table
 A two-variable function has four possible minterms. We can re-
arrange these minterms into a Karnaugh map
x y minterm Y
0 0 x’y’ 0 1
0 1 x’y 0 x’y’ x’y
X
1 0 xy’ 1 xy’ xy
1 1 xy
 Now we can easily see which minterms contain common literals
 Minterms on the left and right sides contain y’ and y respectively
 Minterms in the top and bottom rows contain x’ and x respectively
Y

0 1 Y’ Y
0 x’y’ x’y X’ x’y’ x’y
X
1 xy’ xy X xy’ xy
7
Re-arranging the Truth Table
(Cont.)
 For a three-variable expression with inputs x, y, z,
the arrangement of minterms is more tricky:

YZ YZ
00 01 11 10 00 01 11 10
0 x’y’z’ x’y’z x’yz x’yz’ 0 m0 m1 m3 m2
X X
1 xy’z’ xy’z xyz xyz’ 1 m4 m5 m7 m6

8
3 Variables K-Maps
 There are 8 minterms for 3 variables (a, b, c). Therefore, there
are 8 cells in a 3 variable
b
K-map b
bc bc
a
00 01 11 10 a 00 01 11 10
0 a'b'c' a'b'c a'bc a'bc' 0 m0 m1 m3 m2
OR
a 1 ab'c' ab'c abc abc' a 1 m4 m5 m7 m6

c c

Note Gray code sequence

 Above arrangement ensures that minterms of adjacent cells


differ by just one variable both horizontally and vertically (so
that the unifying theorem may apply: a + a' = 1)
9
3 Variables K-Maps (Cont.)
 There is wrap-around in the K-map:
 a'b'c' (m0) is adjacent to a'bc' (m2)
 ab'c' (m4) is adjacent to abc' (m6)
bc
a
00 01 11 10
0 m0 m1 m3 m2

1 m4 m5 m7 m6

 Each cell in a 3-variable K-map has 3 adjacent neighbours. In


general, each cell in an n-variable K-map has n adjacent
neighbours

10
Remark for 3 Variables K-Maps
 It is possible to arrange the 8 minterms for 3
variables (a, b, c) in this way!
a
a
a a
b 0 1
c
b 0 1
c
a'b'c' ab'c'
00 00 m m
0 4

01 a'b'c ab'c 01 m m
c OR 1 5
c
11 m m
11 a'bc abc
3 7
b b
10
10
m m
a'bc' abc' 2 6

11
4 Variable K-maps
 There are 16 cells in a 4-variable (w, x, y, z)
K-map
y
yz
wx 00 01 11 10
00 m0 m1 m3 m2

m4 m5 m7 m6
01
x
m12 m13 m15 m14
11
w
m8 m9 m11 m10
10
z

12
4 Variable K-maps (Cont.)
 There are 2 wrap-arounds: a horizontal wrap-around
and a vertical wrap-around
 Every cell thus has 4 neighbours. For example, the
cell corresponding to minterm m0 has neighbours
m1, m2, m4 and m8
yz y
wx

m0 m1 m3 m2

m4 m5 m7 m6
x
m12 m13 m15 m14
w
m8 m9 m11 m10

13
Adjacencies
 Adjacencies on three and four-variable maps

14
Why the Funny Ordering?
 With this ordering, any group of 2, 4 or 8 adjacent squares on
the map contains common variables that can be factored out
Y x’y’z + x’yz
x’y’z’ x’y’z x’yz x’yz’ = x’z(y’ + y)
X xy’z’ xy’z xyz xyz’ = x’z  1
Z = x’z
 "Adjacency" includes wrapping around the left and right sides:
Y x’y’z’ + xy’z’ + x’yz’ +
xyz’
x’y’z’ x’y’z x’yz x’yz’
= z’(x’y’ + xy’ + x’y + xy)
X xy’z’ xy’z xyz xyz’
= z’(y’(x’ + x) + y(x’ + x))
Z = z’(y’+y)
 We’ll use this property of adjacent squares
= z’ to do our
simplifications
15
Simplification using K-map
 In a K-map, each cell containing a '1' corresponds to a minterm
of a given function F
 Based on the Unifying Theorem:
A+A=1
 Pairs of adjacent 1's
 Remember that adjacent squares differ by only one variable
 Hence the combination of 2 adjacent squares has the form
P ( A + A)
 This can be simplified (from before) to just P
 Each group of adjacent cells containing ‘1’ then corresponds to
a simpler product term of F
 Grouping 2 adjacent squares eliminates 1 variable, grouping 4
squares eliminates 2 variables, grouping 8 squares eliminates 3
variables, and so on. In general,
grouping 2n squares eliminates n variables

16
Remarks about Groups
 Groups of minterms must be:
(1) Rectangular, and
(2) Have size in powers of 2’s (i.e. 1, 2, 4, 8, 16 etc.)
Otherwise they are invalid groups. Some examples of
invalid groups are:

1 1 1 1

1 1 1 1

1 1 1

1 1 1 1 1

17
PIs AND EPIs (1/3)
 To find the simplest (minimal) SOP expression from a K-
map, you need to obtain:
 Minimum number of literals per product term; and
 Minimum number of product terms.
 Achieved through K-map using
 Bigger groupings of minterms (prime implicants) where possible;
and
 No redundant groupings (look for essential prime implicants)
 Implicant: a product term that could be used to cover
minterms of the function.
PIs AND EPIs (2/3)
 Prime implicant (PI): a product term obtained by
combining the maximum possible number of minterms
from adjacent squares in the map. (That is, it is the
biggest grouping possible.)
 Always look for prime implicants in a K-map.

1 1 1 1 1 1


1


1 1 1 1 1
PIs AND EPIs (3/3)
 No redundant groups:
1 1 1 1

 
1 1 1 1

1 1 1 1

1 1 1 1

Essential prime implicants

 Essential prime implicant (EPI): a prime implicant that


includes at least one minterm that is not covered by any
other prime implicant.
Looping
 Looping is a process of grouping the squares which contain 1s.
The output expression can be simplified by properly combining
those squares in the K map that contain 1s
C changes across
outer boundary
CD
00 01 11 10
AB
00 1 1
B changes
01 1 1

11 1 1
B changes
10 1 1

C changes

X 21
Examples of Looping Pairs of
Adjacent 1s
 In example (c) the top row and bottom row of squares are
considered to be adjacent in a K map
 Similarly in example (d) the leftmost column and the rightmost
column of squares are also considered to be adjacent in a K map

 Looping a pair of
adjacent 1s in a K map
eliminates the variable
that appears in
complemented and
uncomplemented form

22
Examples of Looping Groups of
Fours 1s (Quads)

 Looping a quad of
adjacent 1s
eliminates the two
variables that
appears in both
complemented and
uncomplemented
form

23
Examples of Looping Groups of
Eight 1s (Octets)
 Looping an octet of
adjacent 1s
eliminates the three
variables that
appears in both
complemented and
uncomplemented
form

24
Complete Simplification Process
1. Construct the K map and place 1s and 0s in the squares
according to the truth table
2. Looping the isolated 1s which are not adjacent to any other 1s
(single loops)
3. Looping any pair which contains a 1 adjacent to only one other 1
(double loops)
4. Loop any group of eight even if it contains one or more 1s that
have already been grouped
5. Looping any group of four that contains one or more 1s that
have not already been grouped, making sure to use the
minimum number of groups
6. Group any pairs necessary to include any 1s that have not yet
been grouped, making sure to use the minimum number of
groups
7. Form the OR sum of all the terms generated by each group

25
K-Map Simplification of SOP
Expression - Example 1
 Determine the product terms for the Karnaugh map in Figure
below and write the resulting minimum SOP expression for X

 Step 1: Assume all minterms are filled in the K-map as


shown above. 0s are placed in the other squares
 Step 2: Square 4 is the only square containing a 1 that is
not adjacent to any other 1. It is looped and is referred
to as loop 4
26
Example 1 (Cont.)
 Step 3: Square 15 is adjacent only to square 11. This pair is
looped and referred to as loop 11, 15
 Step 4: There are no octets (group of 8)
 Step 5: Square 6, 7, 10, and 11 form a quad (group of 4). This
quad is looped (loop 6, 7, 10, 11). Note that square 11 is used
again, even though it was part of loop 11, 15
 Step 6: All 1s have already been looped
 Step 7: Each loop generates a term in the expression for X.
Loop 4 is simply ABC D . Loop 11, 15 is ACD (the variable B
variable is eliminated). Loop 6, 7, 10, 11 is BD (A and C are
eliminated)

27
K-Map Simplification of SOP
Expression - Example 2
 Determine the product terms for the Karnaugh map in Figure
below and write the resulting minimum SOP expression for X

 Step 1: Assume all minterms are filled in the K-map as


shown above. 0s are placed in the other squares
 Step 2: There are no isolated 1s
 Step 3: The 1 in square 3 is adjacent only to the 1 in
square 7. Looping this pair (3, 7) produces the term ACD
28
Example 2 (Cont.)
 Step 4: There are no octets (group of 8)
 Step 5: There are two quads (group of 4). Square 5, 6, 7, and 8
from one quad. Looping this quad produces the term AB . The
second quad is made up of squares 5, 6, 9, and 10. This quad is
looped because it contains two squares that have not been loop
previously. Looping this quad produces BC
 Step 6: All 1s have already been looped
 Step 7: The terms generated by the three loops are ORed
together to obtain the expression for X

29
K-Map Simplification of SOP
Expression - Example 3
 Determine the product terms for the Karnaugh map in Figure
below and write the resulting minimum SOP expression for X

 Step 1: Assume all minterms are filled in the K-map as


shown above. 0s are placed in the other squares
 Step 2: There are no isolated 1s

30
Example 3 (Cont.)
 Step 3:The 1 in square 2 is adjacent only to the 1 in
square 6. This pair is looped to produce ACD.
Similarly, square 9 is adjacent only to square 10.
Looping this pair produces ABC. Likewise, loop 7, 8 and
loop 11, 15 produce the terms and
ABC , ACD
respectively
 Step 4: There are no octets (group of 8)
 Step 5: There is one quad (group of 4) formed by
squares 6, 7, 10 and 11. This quad, however is not
looped because all the 1s in the quad have been
included in other loops
 Step 6: All 1s have already been looped
 Step 7: The expression for X is shown in the figure

31
The Same K-Map with Two
Equally Good Solutions
 Consider the K map in Figure

 For this map, there are two possible loopings, which require
only four looped pairs. Figure (a) shows one solution and Figure
(b) shows the other. Both expressions are of the same
complexity, and so neither is better than the other

32
Converting to Minterms Form
 The K-map of a function is easily drawn when
the function is given in standard sum-of-
products, or sum-of-minterms form
 What if the function is not in sum-of-
minterms?
 Convert it to sum-of-products (SOP) form
 Expand the SOP expression into sum-of-minterms
expression, or fill in the K-map directly based on
the SOP expression

33
y = A BC D + C D + A BC + D

Example
 Use a K map to simplify y = C ( A B D + D) + A BC + D
 Solution:
 Step 1: Multiply out the first term to get
y = ABC D + C D + ABC + D
 Step 2: For the ABC D term, simply put a 1 in the ABC D square
of the K map. For the C D term, place a 1 in all squares with C D
in their labels, that is, ABCD, ABCD, ABC D, ABCD . For the A BC
term, place a 1 in all squares that haveA BCan in their labels,
ABis,
that C D, ABCD . ForDthe term, place a 1 in all squares
that haveD a in their labels, that is all squares in the leftmost
and rightmost columns

34
Example (Cont.)
 The K map is now filled and can looped for simplification


For proper looping produces y = AB + C + D

35
Don’t-Care Conditions
x y z f(x,y,z)
 You don’t always need all 2n
input combinations in an n- 0 0 0 0
variable function 0 0 1 1
 If you can guarantee that 0 1 0 X
certain input combinations
never occur. For example, when 0 1 1 0
dealing with Binary-coded 1 0 0 0
decimal (BCD), the inputs for
1010 - 1111 (10-15) will never 1 0 1 1
occur 1 1 0 X
 When a certain input(s) will 1 1 1 1
occur, but we don’t care what
the output will be in response
to them as we are not going to
 Don’t-care conditions can be used
use them in our circuit to help simplify Boolean
expression further in K-maps
 We mark don’t-care outputs in  They could be chosen to be either
truth tables and K-maps with Xs '1' or '0', depending on which
value will help the minimization

36
Example of Don’t Care Condition
Simplification
 Don't-care conditions should be changed to either 0 or 1 to
produce K-map looping that yields the simplest expression

37
Don’t Care Condition Example 1
C

 For comparison: AB
CD
00 01 11 10
 WITHOUT Don’t-cares: 00 1 1
P = A'B'C'D’ + A'B'CD + A'BC'D 01 1 1
+ A'BCD' + AB'C'D 11
B

A
10 1
 Note: Cells with ‘0’ are not D

shown for clarity C


CD
AB 00 01 11 10
00 1 1
 WITH Don’t-cares:
01 1 1
P = A'B'C'D' + B'CD + BC'D B
11 X X X X
+ BCD' + AD A
10 1 X X

38
Example 2
 Simplify the Boolean function represented by the following truth table.
Note don’t care conditions are marked as X’s in the truth table

 Solution: Firstly, we can extract the minterms


and write the standard SOP form of the
function:
F(W,X,Y,Z) =  m(1,3,7,11,15)

The don’t care conditions are expressed as:


d(W,X,Y,Z) =  d(0,2,5)

Thus the entire function may be expressed as:

F(W,X,Y,Z) =  m(1,3,7,11,15) +  d(0,2,5)

39
Example 2 (Cont.)
1. Place 1’s in the squares for minterms (1,3,7,11,15)
2. Place X’s in the squares for don’t cares (0,2,5)
3. Place 0’s in the remaining squares (4,6,8,9,10,12,13,14)
4. Group the adjacent 1’s (including any applicable X’s) into the
largest 2n groupings. One minimum solution uses the X in the
second row to yield the term W Z . The other grouping of 4
yields the term YZ
WZ
Thus, the solution is:
YZ F = W Z + YZ

40
K-Map using Product-of-Sum
(POS) Form
 Recall an expression in standard POS form would look like
( A + B + C )( A + B + C )( A + B + C )
 The output values placed in each cell are derived from the
"maxterm" of a Boolean function
 A maxterm is a sum term that contains all of the function’s
variables exactly once, either complemented or not complemented

 Note: If variable input is 0, then it is


written as it is else the complement
of that variable is written
 Thus for the above example: the
binary values for each term are:
A+ B +C 000
A+ B +C 010
A+ B +C 110
41
Product of Sums
 Finding a minimum product of sums expression
requires no new theory. The following approach is
the simplest:
1. Map the complement of the function (replace all 0’s by 1’s,
all 1’s by 0’s and leave X’s (don’t care) unchanged)
 Any “don’t care” conditions may be assumed to be zero where
convenient
 If there is already a map for the function, instead of the
replacement of 1’s and 0’s, we could simply look for
rectangles of 0’s on the map
2. Find the minimum sum of products expression for the
complement of the function
3. Use DeMorgan’s theorem to complement that expression,
producing a product of sums expression

42
Getting POS Expression from K-
Map Example
 Example:
(a) Use K-Map to find a minimum product of sums expression for
the given function F(A,B,C,D) = m(0,1,2,3,5,7,8,9,10,11)
(b) Implement the minimized function by using only-NOR gates

 Solutions: (a) We first draw the K-map, then group the 0s


together and we get:
A  This gives the SOP of F to be:
AB
CD 00 01 11 10 F = AB + B D
 To get POS of F, we have:
00 1 0 0 1
F = AB + B D
01 1 1 0 1
D
1 1 0 1 = AB • B D DeMorgan
11
C
1 0 0 1
= (A + B)(B + D) DeMorgan
10

43
Example (Cont.)
 (b) As F = (A + B)(B + D)
= (A + B)(B + D)

 = (A + B) + (B + D)
DeMorgan
 Thus, we have the circuit has shown below

A
A
A + B

B
B F
B+D
D

44
Checkerboard Pattern in K-Map
 When we rearrange the Exclusive-OR truth table to a K-Map as
shown below, we would observe Karnaugh map displays a
checkerboard pattern (every other square) of 0s and 1s and we
cannot form any groups on the map
 On a Karnaugh map diagonally adjacent terms can be simplified
by using either XOR or XNOR functions as functional elements

Truth table of K-Map for 2 variables K-Map for 3 variables


EX-OR gate

K-Map for 4 variables


45
Odd and Even Functions
 For more than 2 inputs, XOR is called an odd function
 It is equal to 1 if the input variables have an odd number of 1’s
 Similarly, for more than 2 inputs, XNOR is called an even function
 It is equal to 1 if the input variables have an even number of 1’s
 As shown in the K-map, A ⊕ B ⊕ C = 1, if and only if
the number of 1’s in the input combination is odd
 As Since XOR gates are only designed with 2 inputs,
the 3-input XOR function is implemented by means
of two 2-input XOR gates, as shown in figure

46
Odd and Even Function Examples

47
MORE EXAMPLES (1/6)
 Example #2:
F(A,B,C,D) = ABC + B'CD' + AD + B'C'D'

A
AB
CD 00 01 11 10

00 1 1
Fill in the 1’s.
01 1 1
D
11 1 1
C
10 1 1 1

B
MORE EXAMPLES (2/6)
 Example #2:
F(A,B,C,D) = ABC + B'CD' + AD + B'C'D'
A
AB
CD 00 01 11 10

00 1 1

01 1 1

1
D
Find all PIs:
11 1
C
10 1 1 1

So the answer is: F(A,B,C,D) =


MORE EXAMPLES (3/6)
 Example #3 (with don’t-cares):
F(A,B,C,D) = m(2,8,10,15) + d(0,1,3,7)

A
AB
CD 00 01 11 10

00 X 1
Fill in the 1’s and X’s.
01 X
D
11 X X 1
C
10 1 1

B
MORE EXAMPLES (4/6)
 Example #3 (with don’t-cares):
F(A,B,C,D) = m(2,8,10,15) + d(0,1,3,7)
A
AB
CD 00 01 11 10 Do we need to have an
00 X 1 additional term A'B' to
01 X cover the 2 remaining X’s?
D
11 X X 1
C
10 1 1

Answer: F(A,B,C,D) =
MORE EXAMPLES (5/6)
 Find the simplest POS expression for example #2:
F(A,B,C,D) = ABC + B'CD' + AD + B'C'D'
 Draw the K-map of the complement of F, that is, F'.

A
AB
CD 00 01 11 10
From K-map,
00 1 1

01 1 1
F' =
D
11 1 1 Using DeMorgan’s theorem,
C
10 1 F=
B
MORE EXAMPLES (6/6)
 Find the simplest POS expression for example #3:
F(A,B,C,D) = m(2,8,10,15) + d(0,1,3,7)
 Draw the K-map of the complement of F, that is, F'.
F'(A,B,C,D) = m(4,5,6,9,11,12,13,14) +
d(0,1,3,7)
A
AB
CD 00 01 11 10 From K-map,
00 X 1 1
F'=
01 X 1 1 1

X X 1
D
Using DeMorgan’s theorem,
11
C
10 1 1 F=
B

You might also like