Title: CMPUT329 - Fall 2003
1CMPUT329 - Fall 2003
- Topic 4 Cost of Logic Circuits and Karnaugh
Maps - José Nelson Amaral
2Reading Assignment
Chapter 4 Section 4.3.4, 4.3.5, 4.3.6, 4.3.7,
4.3.8
3Cost of Implementing a Logic Circuit
The cost of implementing a logic circuit is
related to the number of gates used and with the
number of inputs in each gate.
A literal is a boolean variable or its complement.
4Cost of Implementing a Logic Circuit
5Cost of a Logic CircuitExamples
What is the cost of the following boolean
equations?
f1(w,x,y,z) wxyz wxyz
C(f1) 44210
6Karnaugh Maps
M. Karnaugh, The Map Method for Synthesis of
Combinatorial Logic Circuits, Transactions of
the American Institute of Electrical
Engineers, Communications and Electronics,
Vol. 72, pp. 593-599, November 1953. and
A Karnaugh Map is a graphical tool to assist on
the minimization of logic equations. Similar to
a truth table, a Karnaugh Map specifies a value
for each combination of inputs.
7Anatomy of Karnaugh Maps
8Anatomy of Karnaugh Maps
A Karnaugh Map for four variables.
ABCD
A
B
9Application of Karnaugh Maps The One-bit Adder
How to use a Karnaugh Map instead of
the Algebraic simplification?
10Application of Karnaugh Maps The One-bit Adder
0
0
0
1
Now we have to cover all the 1s in the Karnaugh
Map using the largest rectangles and as few
rectangles as we can.
0
1
1
1
Karnaugh Map for Cout
11Application of Karnaugh Maps The One-bit Adder
Now we have to cover all the 1s in the Karnaugh
Map using the largest rectangles and as few
rectangles as we can.
0
0
0
1
Cout
Karnaugh Map for Cout
12Application of Karnaugh Maps The One-bit Adder
Now we have to cover all the 1s in the Karnaugh
Map using the largest rectangles and as few
rectangles as we can.
0
0
0
1
Cout AB
Karnaugh Map for Cout
13Application of Karnaugh Maps The One-bit Adder
Now we have to cover all the 1s in the Karnaugh
Map using the largest rectangles and as few
rectangles as we can.
0
0
0
1
Cout AB ACin
Karnaugh Map for Cout
14Application of Karnaugh Maps The One-bit Adder
Now we have to cover all the 1s in the Karnaugh
Map using the largest rectangles and as few
rectangles as we can.
0
0
0
1
Cout AB ACin BCin
Karnaugh Map for Cout
15Application of Karnaugh Maps The One-bit Adder
0
1
1
0
1
0
1
0
S
Karnaugh Map for S
16Application of Karnaugh Maps The One-bit Adder
0
1
1
0
1
0
1
0
S ABCin
Karnaugh Map for S
17Application of Karnaugh Maps The One-bit Adder
0
1
1
0
1
0
1
0
S ABCin ABCin
Karnaugh Map for S
18Application of Karnaugh Maps The One-bit Adder
0
1
1
0
1
0
1
0
S ABCin ABCin ABCin
Karnaugh Map for S
19Application of Karnaugh Maps The One-bit Adder
0
1
1
0
1
0
1
0
S ABCin ABCin ABCin ABCin
Karnaugh Map for S
20Prime Implicants
Any single 1 or group of 1s in the Karnaugh map
of a function F is an implicant of F.
A product term is called a prime implicant of F
if it cannot be combined with another term to
eliminate a variable.
Implicant Not an Implicant Implicant Prime
Implicant Prime Implicant
21Essential Prime Implicants
A product term is an essential prime implicant of
F if there is a minterm that is only covered by
that prime implicant.
The minimal sum-of-products form of F must
include all the essential prime implicants of F.
Theorem If a minterm mj of F and all its
adjacent minterms are covered by a single term
pi, then pi is an essential prime implicant of F.
22Example
Express the complement f(w,x,y,z) of the
following expression as a sum of minterms
f(w,x,y,z) wx(yz yz)
23Example
Express the complement f(w,x,y,z) of the
following expression as a sum of minterms
f(w,x,y,z) wx(yz yz)
w
wxyz wxyz
y
24Example
Express the complement f(w,x,y,z) of the
following expression as a sum of minterms
f(w,x,y,z) wx(yz yz)
w
wxyz wxyz
y
25Example
Express the complement f(w,x,y,z) of the
following expression as a sum of minterms
f(w,x,y,z) wx(yz yz)
w
wxyz wxyz
This is the Karnaugh Map for f(w,x,y,z).
1
How do we build the Karnaugh Map for f(w,x,y,z)?
1
y
26Example
If we reverse the value in each position of the
Karnaugh map of f(w,x,y,z), we obtain the
Karnaugh map for f(w,x,y,z).
27Example
If we reverse the value in each position of the
Karnaugh map of f(w,x,y,z), we obtain the
Karnaugh map for f(w,x,y,z).
Now we can write the minimized form for
f(w,x,y,z) from its Karnaugh map.
w
1
f(w,x,y,z) x
y
28Example
If we reverse the value in each position of the
Karnaugh map of f(w,x,y,z), we obtain the
Karnaugh map for f(w,x,y,z).
Now we can write the minimized form for
f(w,x,y,z) from its Karnaugh map.
w
1
f(w,x,y,z) x w
y
29Example
If we reverse the value in each position of the
Karnaugh map of f(w,x,y,z), we obtain the
Karnaugh map for f(w,x,y,z).
Now we can write the minimized form for
f(w,x,y,z) from its Karnaugh map.
w
1
f(w,x,y,z) x w yz
y
30Example
If we reverse the value in each position of the
Karnaugh map of f(w,x,y,z), we obtain the
Karnaugh map for f(w,x,y,z).
Now we can write the minimized form for
f(w,x,y,z) from its Karnaugh map.
w
1
f(w,x,y,z) x w yz yz
y
31Examples
In Topic 2 we used the following algebraic
transformations to prove the consensus
theorem. Could we use Karnaugh maps to obtain
such a proof?
32Examples
First we need to build the Karnaugh map for
the expression
XY XZ YZ
Now we need to write the simplified
expression from the Karnaugh map.
XY XZ
33Minimum Sum-of-products
The minimum sum-of-products of a function F
is formed by some, but not necessarily all, of
the prime implicants of the function.
Write all the prime implicants for the function g
expressed as this Karnaugh Map.
A
1
1
Example
AB AD BD AC
1
1
1
1
1
1
1
B
34Minimum Sum-of-products
The minimum sum-of-products of a function F
is formed by some, but not necessarily all, of
the prime implicants of the function.
Now write the minimum sum-of-products of g.
A
1
1
Example
AB AD BD AC
1
1
1
1
1
1
1
B
35Karnaugh Maps of Product-of-sums
Find the minimum sum-of-minterms form for
the following function
F (b c d)(a b d)(a b d)(a b
c)
36Karnaugh Maps of Product-of-sums
F (b c d)(a b d)(a b d)(a b
c)
F bcd abd abd abc
Now we can easily build the Karnaugh map for F.
a
b
37Karnaugh Maps of Product-of-sums
F (b c d)(a b d)(a b d)(a b
c)
F bcd abd abd abc
Now we can easily build the Karnaugh map for F.
a
b
38Karnaugh Maps of Product-of-sums
F (b c d)(a b d)(a b d)(a b
c)
F bcd abd abd abc
Now we can easily build the Karnaugh map for F.
a
1
1
b
39Karnaugh Maps of Product-of-sums
F (b c d)(a b d)(a b d)(a b
c)
F bcd abd abd abc
Now we can easily build the Karnaugh map for F.
a
1
1
1
b
40Karnaugh Maps of Product-of-sums
F (b c d)(a b d)(a b d)(a b
c)
F bcd abd abd abc
Now we can easily build the Karnaugh map for F.
a
1
1
1
1
1
b
41Karnaugh Maps of Product-of-sums
F (b c d)(a b d)(a b d)(a b
c)
F bcd abd abd abc
Now we can easily build the Karnaugh map for F.
a
a
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
b
b
F
F
42Karnaugh Maps of Product-of-sums
F (b c d)(a b d)(a b d)(a b
c)
F bcd abd abd abc
What is the set of prime implicants of F?
a
1
1
1
1
1
1
1
1
1
b
F
43Karnaugh Maps of Product-of-sums
F (b c d)(a b d)(a b d)(a b
c)
F bcd abd abd abc
What is the set of prime implicants of F?
a
bd
acb
1
1
1
1
1
1
1
1
1
b
F
44Karnaugh Maps of Product-of-sums
F (b c d)(a b d)(a b d)(a b
c)
F bcd abd abd abc
What is the set of prime implicants of F?
a
bd
acb
1
1
1
acd
1
1
1
1
1
1
b
F
45Karnaugh Maps of Product-of-sums
F (b c d)(a b d)(a b d)(a b
c)
F bcd abd abd abc
What is the set of prime implicants of F?
a
bd
acb
1
1
1
acd
1
1
abd
1
1
1
1
b
F
46Karnaugh Maps of Product-of-sums
F (b c d)(a b d)(a b d)(a b
c)
F bcd abd abd abc
What is the set of prime implicants of F?
a
bd
acb
1
1
1
acd
1
1
abd
bcd
1
1
1
1
b
F
47Karnaugh Maps of Product-of-sums
F (b c d)(a b d)(a b d)(a b
c)
F bcd abd abd abc
What is the set of prime implicants of F?
a
bd
acb
1
1
1
acd
1
1
abd
bcd
1
1
abc
1
1
b
F
48Karnaugh Maps of Product-of-sums
F (b c d)(a b d)(a b d)(a b
c)
F bcd abd abd abc
What is the set of prime implicants of F?
a
bd
Which prime implicants are essential for F?
acb
1
1
1
acd
1
1
abd
bcd
1
1
abc
acd
1
1
b
F
49Karnaugh Maps of Product-of-sums
F (b c d)(a b d)(a b d)(a b
c)
F bcd abd abd abc
What is the set of prime implicants of F?
a
bd
Which prime implicants are essential for F?
acb
1
1
1
acd
1
1
abd
Only bd is essential.
bcd
1
1
abc
acd
1
1
Does the set of all essential prime
implicants completely define F?
b
F
50Karnaugh Maps of Product-of-sums
F (b c d)(a b d)(a b d)(a b
c)
F bcd abd abd abc
Now we can write the minimized form for F.
a
1
1
1
1
1
1
1
1
1
b
F
51Karnaugh Maps of Product-of-sums
F (b c d)(a b d)(a b d)(a b
c)
F bcd abd abd abc
Now we can write the minimized form for F.
a
1
1
1
1
1
F bd acd
1
1
1
1
b
F
52Karnaugh Maps of Product-of-sums
F (b c d)(a b d)(a b d)(a b
c)
F bcd abd abd abc
Now we can write the minimized form for F.
a
1
1
1
1
1
F bd acd bcd
1
1
1
1
b
F
53Karnaugh Maps of Product-of-sums
F (b c d)(a b d)(a b d)(a b
c)
F bcd abd abd abc
Now we can write the minimized form for F.
a
1
1
1
1
1
F bd acd bcd acd
1
1
1
1
b
F
54Incompletely Specified Functions
A
N1
N2
B
F
C
Assumption N1 never produces the combinations
ABC 001 and ABC 110.
Question What value should F produce for the
combinations ABC 001 and ABC
110?
We dont care!!!
55Incompletely Specified Functions (Cont.)
How can we use the fact that we dont care
about the value produced by F when ABC 001 or
ABC 110 to simplify the circuit N2?
AC(B B) (A A)BC
AC1 1BC
AC BC
56Incompletely Specified Functions (Cont.)
However, if we assume that F(0,0,1) 1 and
F(1,1,0) 1, we obtain instead the equation
F(A,B,C) ABC ABC ABC ABC ABC
ABC
AB(C C) AB(C C) AB(C C)
AB 1 AB 1 AB 1
AB AB AB
AB AB AB AB
A(B B) (A A)B
A1 1B
A B
Compare this with the other solution F(A,B,C)
AC BC. Which one is cheaper to implement?
57Incompletely Specified Functions
Dont care values are easily used to
simplify incompletely specified functions.
58Another Example
Write the minimized sum-of-product expression for
F given in this Karnaugh map.
59Another Example
Write the minimized sum-of-product expression for
F given in this Karnaugh map.
F cd bcd
60Another Example
Write the minimized sum-of-product expression for
F given in this Karnaugh map.
F cd bcd abc
615-Variable Karnaugh Maps
F
C
625-Variable Karnaugh Maps
F BD
B
1
1
1
1
1
1
1
C
C
A
635-Variable Karnaugh Maps
F BD CDE
B
1
1
1
1
1
1
1
C
C
A
645-Variable Karnaugh Maps
F BD CDE ABDE
B
1
1
1
1
1
1
1
C
C
A
655-Variable Karnaugh Maps
F BD CDE ABDE ACDE
B
1
1
1
1
1
1
1
C
C
A
665-Variable Karnaugh Maps
F BD CDE ABDE ACDE ACDE
B
1
1
1
1
1
1
1
C
C
A
676-Variable Karnaugh Map
1
X
1
1
1
X
X
X
1
1
1
1
X
1
X
1
1
1
1
X
X
1
1
1
1
1
X
X
1
1
X
X
686-Variable Karnaugh Map
1
X
1
1
1
X
X
X
1
1
1
1
X
1
g CE
X
1
1
1
1
X
X
1
1
1
1
1
X
X
1
1
X
X
696-Variable Karnaugh Map
1
X
1
1
1
X
X
X
1
1
1
1
X
1
g CE ACE
X
1
1
1
1
X
X
1
1
1
1
1
X
X
1
1
X
X
706-Variable Karnaugh Map
1
X
1
1
1
X
X
X
1
1
1
1
X
1
g CE ACE DEF
X
1
1
1
1
X
X
1
1
1
1
1
X
X
1
1
X
X
71ExampleBCD to Braille Convertion
72ExampleBCD to Braille Convertion
A
X
X
X
X
X
X
B
W ?
73ExampleBCD to Braille Convertion
A
1
X
1
1
1
X
1
X
1
X
1
1
X
X
B
W ?
74ExampleBCD to Braille Convertion
A
1
X
1
1
1
X
1
X
1
X
1
1
X
X
B
W B C AD AD
75ExampleBCD to Braille Convertion
W B C AD AD
A
X
X
X
X
X
X
B
X ?
76ExampleBCD to Braille Convertion
W B C AD AD
A
1
1
X
X
1
1
X
1
X
1
X
X
B
X ?
77ExampleBCD to Braille Convertion
W B C AD AD
A
1
1
X
X
1
1
X
1
X
1
X
X
B
X ACD CD AD BC
78ExampleBCD to Braille Convertion
W B C AD AD
X ACD CD AD BC
A
X
X
X
X
X
X
B
Y ?
79ExampleBCD to Braille Convertion
W B C AD AD
X ACD CD AD BC
A
1
1
X
1
1
X
X
1
X
X
X
B
Y ?
80ExampleBCD to Braille Convertion
W B C AD AD
X CD CD AD BC
A
1
1
X
1
1
X
X
1
X
X
X
B
Y ACD AD BD
81ExampleBCD to Braille Convertion
W B C AD AD
X ACD CD AD BC
Y ACD AD BD
A
1
X
1
X
1
X
1
X
1
1
X
X
B
Z AD BC BD
82ExampleBCD to Braille Convertion
How can we use these standard sum-of-product equat
ions to implement a multiple-output NAND network?
We use the DeMorgan Law X AB CD ((AB
CD)) ((AB)(CD))
83ExampleBCD to Braille Convertion
How do we implement this conversor in a PAL14H4?
84A
B
C
D
W
X
Y
Z
PAL14H4
85W B C AD AD
A
B
C
D
W
X
Y
Z
PAL14H4
86X ACD CD AD BC
A
B
C
D
W
X
Y
Z
PAL14H4
87Y ACD AD BD
A
B
C
D
W
X
Y
Z
PAL14H4
88Z AD BC BD
A
B
C
D
W
X
Y
Z
PAL14H4