Upload
phungnhan
View
230
Download
2
Embed Size (px)
Citation preview
Lecture Notes Prepared by Amir G. Aghdam
1
COEN 312 DIGITAL SYSTEMS DESIGN - LECTURE NOTES
Concordia University
Chapter 3: Gate-Level Minimization
NOTE: For more examples and detailed description of the material in the lecture notes, please refer to the main textbook: Digital Design 3rd Edition, By Morris Mano, Publisher Prentice Hall, 4th Edition All examples used in the lecture notes are from the above reference. The Map Method
- Minimization of Boolean expressions using the properties of Boolean algebra is not
easy in general because it does not have any specific rules.
- There is a straightforward procedure for minimizing Boolean functions which is
called Karnaugh map or K-map or simply the map method.
- The K-map method produces the simplified expression in a standard form: sum of
products or product of sums.
- K-map for the Boolean expressions with two variables is as follows:
- For example, consider the function yxmF .31 == .
- The corresponding K-map is as follows:
x y Minterms
0 0 m0
0 1 m1
1 0 m2
1 1 m3
y’ y
0 1
x’ 0 x’.y’ x’.y
x 1 x.y’ x.y
m0 m1
m2 m3
y’ y
0 1
x’ 0 0 0
x 1 0 1
x y
x y
Lecture Notes Prepared by Amir G. Aghdam
2
- This function cannot be simplified as it has the simplest form.
- As another example, consider the function yxyxyxmmmyxF .'.'.),( 3212 ++=++= .
- Using the properties of Boolean algebra, this function can be simplified as
yxF +=2 .
- This can also be seen from K-map as follows:
- The function is equal to one in the second row ( x ) and the second column ( y ).
- K-map for the Boolean expressions with three variables is as follows: - Any two adjacent squares in the map differ by only one variable, which is primed in
one square and unprimed in the other.
- This implies that the sum of two minterms in adjacent squares can be simplified to a
single AND term.
- Two adjacent squares can be simplified to a term of two literals.
y’ y
0 1
x’ 0 0 1
x 1 1 1
x’. y’.z’
x. y’.z’
x’. y’.z
x. y’.z
x’. y.z
x. y.z
x’. y.z’
x. y.z’
yz x
x’
x
0
1
00 01 11 10
z’ z’ z
y’ y
m0
m4
m1
m5
m3
m7
m2
m6
Lecture Notes Prepared by Amir G. Aghdam
3
- Four adjacent squares can be simplified to a term of one literla.
- Each grouping represents one term in the simplified expression.
- Groupings can be made on 2, 4, or 8 adjacent squares (not 3, 5, 6, 7).
- Three adjacent squares can be grouped as two groups of two adjacent squares.
Example
- Simplify the following Boolean function:
zyxzyxzyxzyxzyxF '..''...'.'.'.)5,4,3,2(),,( +++== ∑
- The map shows that the function can be simplified as '.'. yxyxF += .
- The rightmost and leftmost columns are also adjacent because their minterms differ
by one variable.
- One can consider the map as a 3-dimensional surface where the right and left edges
touch each other.
Example
- Simplify the following Boolean function:
0
1
0
1
1
0
1
0
yz x
x’
x
0
1
00 01 11 10
z’ z’ z
y’ y
Lecture Notes Prepared by Amir G. Aghdam
4
∑= )7,6,4,3(),,( zyxF
- The map shows that the function can be simplified as '.. zxzyF += .
Example
- Simplify the Boolean function
∑= )6,5,4,2,0(),,( zyxF
- The map shows that the function can be simplified as '.' yxzF += .
0
1
0
0
1
1
0
1
yz x
x’
x
0
1
00 01 11 10
z’ z’ z
y’ y
1
1
0
1
0
0
1
1
yz x
x’
x
0
1
00 01 11 10
z’ z’ z
y’ y
Lecture Notes Prepared by Amir G. Aghdam
5
Example
- Consider the following Boolean function:
CBCBABACAF .'..'.'. +++=
- Find an expression for F as sum of minterms, and then find an expression with
minimum number of terms.
- It can be seen from the map that the minterms 75321 ,,,, mmmmm are equal to 1.
- ∑= )7,5,3,2,1(),,( CBAF
- The map shows that the function can be simplified as BACF '.+= .
Four-Variable Map
0
0
1
1
1
1
1
0
BC A
A’
A
0
1
00 01 11 10
C’ C’ C
B’ B
Lecture Notes Prepared by Amir G. Aghdam
6
- In writing the elements of the above map in terms of w, x, y, z, it is better to start with
writing w’ in the first two rows and w in the last two rows, then writing x in the
middle rows and x’ in the first and last row, then y, y’, z and z’ in the corresponding
columns.
- The method for simplifying the Boolean function using the four-variable map is
similar to the three-variable map. The only difference is that the first row and last row
are also considered adjacent.
Example
- Simplify the following Boolean function
∑= )14,13,12,9,8,6,5,4,2,1,0(),,,( zyxwF
m0
m4
m1
m5
m3
m7
m2
m6
m12
m8
m13
m9
m15
m11
m14
m10
w’
w
w’.x’.y’.z’
w’.x.y’.z’
w’.x’.y’.z
w’.x.y’.z
w’.x’.y.z
w’.x.y.z
w’.x’.y.z’
w’.x.y.z’
yz wx
00
01
00 01 11 10
z’ z’ z
y’ y
w.x.y’.z’
w.x’.y’.z’
w.x.y’.z
w.x’.y’.z
w.x.y.z
w.x’.y.z
w.x.y.z’
w.x’.y.z’
11
10
x’
x’
x
Lecture Notes Prepared by Amir G. Aghdam
7
- The map shows that the function can be simplified as '.''.' zxzwyF ++= .
- The number of groupings is equal to the number of terms in the simplified expression.
- It is preferable to group as many squares as possible because it reduces the number of
literals in each term.
- For example, although the left middle rows and left top rows have been grouped with
the eight left squares, we grouped them again with the corresponding right columns to
make a bigger group which means a smaller number of literals in the corresponding
terms.
Example
- Simplify the following Boolean function
''..'..'.'.'.''.'. CBADCBADCBCBAF +++=
1
1
1
1
0
0
1
1
yz wx
00
01
00 01 11 10
z’ z’ z
y’ y
1
1
1
1
0
0
1
0
11
10
x’
x’
x
w’
w
Lecture Notes Prepared by Amir G. Aghdam
8
- The map shows that the function can be simplified as '.'.''.''. DCACBDBF ++= .
Example
- Simplify the following Boolean function:
∑= )15,13,11,10,9,8,7,5,3,2,0(),,,( DCBAF
- This function has several minterms and they can be grouped in different ways as
follows:
1
0
1
0
0
0
1
1
CD AB
00
01
00 01 11 10
D’ D’ D
C’ C
0
1
0
1
0
0
0
1
11
10
B’
B’
B
A’
A
Lecture Notes Prepared by Amir G. Aghdam
9
- Simplified function: DCBADBDBF .'.''.. +++=
- Simplified function: CBBADBDBF '.'.''.. +++=
1
0
0
1
1
1
1
0
CD AB
00
01
00 01 11 10
D’ D’ D
C’ C
0
1
1
1
1
1
0
1
11
10
B’
B’
B
A’
A
B’
1
0
0
1
1
1
1
0
CD AB
00
01
00 01 11 10
D’ D’ D
C’ C
0
1
1
1
1
1
0
1
11
10 B’
B
A’
A
Lecture Notes Prepared by Amir G. Aghdam
10
- Simplified function: DACBDBDBF .'.''.. +++=
- Simplified function: DCDADBDBF ..''.. +++=
1
0
0
1
1
1
1
0
CD AB
00
01
00 01 11 10
D’ D’ D
C’ C
0
1
1
1
1
1
0
1
11
10
B’
B’
B
A’
A
1
0
0
1
1
1
1
0
CD AB
00
01
00 01 11 10
D’ D’ D
C’ C
0
1
1
1
1
1
0
1
11
10
B’
B’
B
A’
A
Lecture Notes Prepared by Amir G. Aghdam
11
- The four simplified expressions are not similar but the corresponding Boolean
functions are equivalent.
- Each simplified expression has 4 product terms and 8 literals.
- When several groupings are available, one should be careful to avoid redundant
terms.
- For example, the functions
'...''..1 BADCDADBDBF ++++=
CBDCDADBDBF '...''..2 ++++=
CBDABADBDBF '..'.''..3 ++++=
CBDCBADBDBF '..'.''..4 ++++=
CBBADCDADBDBF '.'...''..5 +++++=
all have redundant terms as some groupings contain the squares that all of them have
already been covered by other groupings.
- Two of the groupings (corresponding to ''.,. DBDB ) appear in all four cases as they
contain a minterm ( 0m and 5m ) that is not covered by any other groups.
Definition:
- A product term obtained by combining the maximum possible number of adjacent
squares in the map is called a prime implicant.
- A prime implicant is called essential if at least one of the minterms covered by it is
not covered by any other prime implicant.
- When simplifying a function that has some non-essential prime implicants, one must
be careful not to include redundant terms.
Five-Variable Map
- The five-variable map consists of 2 four-variable maps as shown below.
Lecture Notes Prepared by Amir G. Aghdam
12
- The method for simplifying five-variable maps is similar to four-variable maps and
the only difference is that each square in the left half of the map (m0 to m15) is also
adjacent to the corresponding square in the right half of the map (m16 to m31) as they
differ by only one variable A.
- For example, m2 is adjacent to m18 (in general, mi is adjacent to mi+16, for i=1, 2,…,
15).
- Note that the squares in the right edge of the left-half map are not adjacent to the
squares in the left edge of the right-half map.
Example
- Simplify the following Boolean function
m0
m4
m1
m3
m7
m2
m6
DE BC
00
01
00 01 11 10
E’ E’ E
D’ D
m12
m8
m13
m9
m15
m11
m14
m10
11
10
B’
B
m5
A’
m16
m20
m17
m19
m23
m18
m22
00 01 11 10
E’ E’ E
D’ D
m28
m24
m29
m25
m31
m27
m30
m26
C’
C’
C
m21
A
Lecture Notes Prepared by Amir G. Aghdam
13
∑= )31,29,25,23,21,13,9,6,4,2,0(),,,,( EDCBAF
- The map shows that the function can be simplified as ECAEDBEBAF ..'..''.'. ++=
(the grouping of adjacent squares of left-half map and right-half map is indicated by
double lines).
Product of Sums Simplification
- To minimize a function in the form of product of sums, one can minimize the
complement of the function in the form of sum of products and use DeMorgan’s
theorem.
1
1
0
0
0
1
1
DE BC
00
01
00 01 11 10
E’ E’ E
D’ D
0
0
1
1
0
0
0
0
11
10
B’
B
0
A’
0
0
0
0
1
0
0
00 01 11 10
E’ E’ E
D’ D
0
0
1
1
1
0
0
0
C’
C’
C
1
A
Lecture Notes Prepared by Amir G. Aghdam
14
Example
- Simplify the following Boolean function first in sum of products and then in product
of sums.
∑= )10,9,8,5,2,1,0(),,,( DCBAF
- Using the following K-map for F , we will have DCACBDBF '.'.''.''. ++=
- To simplify F as product of sums, we will use the following map for the
complement of F which is equal to ∑= )15,14,13,12,11,7,6,4,3(),,,(' DCBAF .
- The simplified function for 'F in sum of products will be equal to
'...' DBDCBAF ++= .
- Using DeMorgan’s theorem, we will have )').('').(''( DBDCBAF +++= which is
expressed as product of sums.
1
0
1
1
0
0
1
0
CD AB
00
01
00 01 11 10
D’ D’ D
C’ C
0
1
0
1
0
0
0
1
11
10
B’
B’
B
A’
A
Lecture Notes Prepared by Amir G. Aghdam
15
- The simplified expression in the sum of products form is implemented as follows:
- The implementation of the simplified expression in the product of sums form, on the
other hand, is as follows:
1
0
1
0
0
1
0
CD AB
00
01
00 01 11 10
D’ D’ D
C’ C
1
0
1
0
1
1
1
0
11
10 B’
B
A’
A
1
B’
B’ D’
C’
A’ D
F
Lecture Notes Prepared by Amir G. Aghdam
16
- Both expressions are in standard forms and the implementation of a function in a
standard form is always a two-level implementation.
- To enter a function expressed in product of sums in the map, use DeMorgan’s
theorem to express the complement of the function, enter the complement function in
the map and then replace all 0’s with 1’s and all 1’s with 0’s.
Example
- Find the K-map corresponding to the Boolean function )).('''( DBCBAF +++= .
- Using DeMorgan’s theorem, we will have ''...' DBCBAF += with the following map:
A’ B’
C’ D’
D
F
0
0
1
0
0
0
1
0
CD AB
00
01
00 01 11 10
D’ D’ D
C’ C
0
1
0
1
0
1
1
11
10
B’
B’
B
A’
A
0
Lecture Notes Prepared by Amir G. Aghdam
17
- The map for F can then be obtained by inverting the values of the above map as
follows:
Don’t-Care Conditions
- Sometimes it is not important to assign 0 or 1 to some minterms.
- For example, when we use four-bit binary code for the decimal numbers, there will be
six extra combinations that are unspecified.
- The unspecified minterms of a function are called don’t-care conditions and are
denoted by an X in the K-map.
- We can use either 0 or 1 for a don’t-care condition depending on which one gives the
simplest expression for the corresponding Boolean function.
Example
- It is desired to simplify the following Boolean function
1
1
0
1
1
1
0
1
CD AB
00
01
00 01 11 10
D’ D’ D
C’ C
1
0
1
0
1
0
0
11
10
B’
B’
B
A’
A
1
Lecture Notes Prepared by Amir G. Aghdam
18
∑= )15,11,7,3,1(),,,( zyxwF
with the following don’t-care conditions
∑= )5,2,0(),,,( zyxwd
- The groupings in the K-map of this function can be done in two different ways by
assigning different values to the don’t-care conditions as follows
0
1
1
X
1
X
0
1
X
0
yz wx
00
01
00 01 11 10
z’ z’ z
y’ y
0
0
0
1
0
0
11
10
x’
x’
x
w’
w
Lecture Notes Prepared by Amir G. Aghdam
19
- Simplified function: ''.. xwzyF +=
- Simplified function: zwzyF '.. +=
- The only difference between the two simplified expressions is in the value of F for
the don’t-care minterms.
- To find the K-map of the complement of F , one should change 0’s to 1’s and 1’s to
0’s in the K-map of F and all don’t-care terms of F will be don’t-care terms of 'F
too.
NAND and NOR Implementation
- NAND and NOR gates are easier to fabricate and are the basic gates used in all IC
digital logic families.
- The NAND gate and NOR gate are called universal gates because any digital system
can be implemented with each one of them.
- We will first consider NAND circuits.
- The AND and OR operations can be achieved through a NAND gate as follows:
0
1
1
X
1
X
0
1
X
0
yz wx
00
01
00 01 11 10
z’ z’ z
y’ y
0
0
0
1
0
0
11
10
x’
x’
x
w’
w
Lecture Notes Prepared by Amir G. Aghdam
20
- The complement operation is obtained simply from a one-input NAND gate (it can
also be obtained from a two input NAND gate by connecting both inputs to the
variable to be complemented, or by connecting one of the inputs to 1).
- To implement a standard form Boolean expression with NAND gate, we will use the
following invert-OR gate
- The previous symbol for NAND gate is in fact an AND-invert symbol (each bubble
denotes a complementation).
- One can use a two-level implementation with AND and OR gates and change it to an
implementation with NAND gates in a very simple way.
- For example consider the Boolean function DCBAF .. += .
- The implementation of this function with NAND gates can be obtained from the
implementation with AND and OR gates as follows:
x y x.y
x
y
x+y
x’+y’+z’=(x.y.z)’ x yz
Lecture Notes Prepared by Amir G. Aghdam
21
- The equivalency of these circuits can also be easily verified using DeMorgan’s
theorem.
Example
- Simplify the following Boolean function and implement it with NAND gates:
∑= )7,5,4,3,2,1(),,( zyxF
- Using the K-map, the function can be simplified as zyxyxF ++= '.'.
A B
C D
F
A B
C D
F
A B
C D
F
0
1
1
1
1
1
1
0
yz x
x’
x
0
1
00 01 11 10
z’ z’ z
y’ y
Lecture Notes Prepared by Amir G. Aghdam
22
- The implementation with NAND gates can be obtained as follows:
- Multilevel NAND circuits can be implemented by converting the AND-OR gate
implementation to an all NAND one using a similar procedure as two-level
implementations.
- For example, consider the Boolean function '.)..( CBBDCAF ++=
- The implementation of this Boolean function by using NAND gates is shown below
x y’
x’ y
z
F
x y’
x’ y
z’
F
x y’
x’ y
z
F
Lecture Notes Prepared by Amir G. Aghdam
23
- If the function F did not have the term B.C’, we would have a three-level AND-OR
gate implementation, which would result in the following NAND gate
implementation:
- We can also obtain the NAND gate implementation from a function in product of
sums as follows:
C D
B
A B C’
F
C D
B’
A B C’
F
C D
B’
A F
Lecture Notes Prepared by Amir G. Aghdam
24
- Similarly, all logic operations can be achieved through NOR operation which is the
dual of NAND operation.
- The AND and OR operations can be achieved through a NOR gate as follows:
- The complement operation is obtained simply from a one-input NOR gate (it can also
be obtained from a two input NOR gate by connecting both inputs to the variable to
be complemented, or by connecting one of the inputs to 0).
x y x+y
x
y
x.y
A B
C D
E
F
A’ B’
C’ D’
E
F
Lecture Notes Prepared by Amir G. Aghdam
25
- To implement a standard form Boolean expression with NOR gates, we will use the
following invert-AND gate
- The previous symbol for a NOR gate is in fact an OR-invert symbol (each bubble
denotes a complementation).
- Conversion of AND-OR gate implementation to NOR gate implementation can be
done in a way similar to the case with NAND gates and the only difference is that for
NOR gate implementation the function should be simplified in product of sums (not
sum of products).
- As an example, consider the Boolean function EDCBAF ).).(( ++=
- The implementation of this function with NOR gates can be obtained from the
implementation with AND and OR gates as follows:
x’.y’.z’=(x+y+z)’ x yz
A B
C D
E
F
A B
C D
E
F
A B
C D
E’
F
Lecture Notes Prepared by Amir G. Aghdam
26
- Consider now the following multi-level AND-OR gate implementation:
- We can convert this to a NOR gate implementation as follows:
Exclusive-OR Function
- Exclusive-OR gate is not a universal gate as only a limited number of Boolean
functions can be expressed in terms of exclusive-OR operation.
- Exclusive-OR operation is commonly used in design of digital systems, specially in
arithmetic operations and error-detection and correction circuits.
- Exclusive-OR operation yxyxyx '.'. +=⊕ can be implemented using different gates
as follows:
C’ D’
B
A’ F
C D
B
A F
yx⊕
x
y
Lecture Notes Prepared by Amir G. Aghdam
27
- In the second circuit we have: )')')'..()'.()'..((( yxyyxxF = which can be
simplified to yxyxF '.'. += by using the properties of Boolean algebra and
DeMorgan’s theorem.
- The truth table for the exclusive-OR operation with three or more input variables can
be obtained using associative property of the exclusive-OR operation.
- It can be shown that in general the exclusive-OR function is equal to 1 if an odd
number of input variables are equal to 1 and that is why the exclusive-OR operation is
sometimes referred to as an odd function.
- As an example, consider the four-variable exclusive-OR operation as follows:
∑=⇒
+++++=+⊕+=
⊕⊕⊕=
)14,13,11,8,7,4,2,1(),,,()'.'.).(''..()''..).('.'.(
)'.'.()'.'.(
DCBAFDCDCBABADCDCBABA
DCDCBABADCBAF
- It can be seen from the following K-map that the function is equal to 1 if an odd
number of input variables are equal to 1.
yx⊕
x
y
Lecture Notes Prepared by Amir G. Aghdam
28
- The exclusive-NOR function which is the complement of exclusive-OR is equal to 1
if an even number of input variables are equal to 1.
- In transmission of binary information, usually an extra bit is included with the binary
message to make the number of 1’s either odd or even and it is called the parity bit.
- The parity bit in the received message is checked and if it is not consistent with the
number of 1’s in the message, an error will be detected (only an odd number of errors
will be detected using one parity bit).
- The truth table for a 3-bit even parity generator is given as follows:
1
1
0
0
0
0
1
1
1
0
CD AB
00
01
00 01 11 10
D’ D’ D
C’ C
0
1
0
1
1
0
11
10
B’
B’
B
A’
A
Lecture Notes Prepared by Amir G. Aghdam
29
- The truth table for a 4-bit even parity checker is given as follows:
Three-Bit Message Parity Bit
x y z P
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
1
1
0
1
0
0
1
Lecture Notes Prepared by Amir G. Aghdam
30
- Parity error check bit C is equal to 1 if the number of 1’s in the received message is
odd which means there is an error in the received bits.
- The logic circuit for a 3-bit even parity generator and a 4-bit even parity checker
corresponding to the above tables are given below:
Four Bits Received Parity Error Check
x y z P C
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
1
1
0
1
0
0
1
1
1
1
1
1
1
1
1
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
1
0
0
1
0
1
1
0
x y
z
P
x y
z C
P
Lecture Notes Prepared by Amir G. Aghdam
31
A B
C
x
y
e
- So far we have assumed that the output of a gate responds to any changes in the input
terminals immediately but in practice each gate has a small delay.
- Timing analysis of a logic circuit can be done if the time delay for each gate is
known.
- For example, consider the following logic circuit. Assume that the AND, OR, and
NOT gates have a time delay of 30, 20, and 10 ns, respectively, and that the input
variables A, B, and C change from 0, 0, 0 to 1, 1, 1 at t=0.
- Since 30, 20, and 10 are all divisible by 10, we will find the status of the gate outputs
in 10ns steps as follows (to complete the table, at each time find the value of y first,
the value of x next, and the value of e after that by looking back at the related
variables):
Time Units
(ns) A B C y e x
Initial Change
-30
-20
-10
0
10
20
30
40
50
0
0
0
1
1
1
1
1
1
0
0
0
1
1
1
1
1
1
0
0
0
1
1
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
0
0
1
Lecture Notes Prepared by Amir G. Aghdam
32
- For timing analysis, it is easier to obtain the output of faster gates (the gates with
smaller delay) first and the output of slower gates after that, as follows:
a) The value of y at each time is determined by looking at the status of the variable C
10ns prior to that time.
b) The value of x at each time is determined by looking at the status of the variables
e and y 20ns prior to that time.
c) The value of e at each time is determined by looking at the status of the variables
A and B 30ns prior to that time.
- Timing diagram of this circuit is as follows:
Reference:
[1] Digital Design 3rd Edition, By Morris Mano, Publisher Prentice Hall, 4th Edition.
x
e
y
C
B
A
0ns 10ns 20ns 30ns 40ns 50ns