Upload
gladys-booth
View
223
Download
6
Embed Size (px)
Citation preview
ENG241 Digital Design
Week #2 Combinational Logic Circuits
Resources
Chapter #2, Mano Sections2.1 Logic Gates2.2 Boolean Algebra2.3 Min Terms & Max Terms2.4 Logic Optimization
2
Week #2 Topics
Binary Logic and Gates Boolean Functions Boolean Algebra (Truth Tables) Basic Identities Standard Forms (Minterms, Maxterms) Circuit Optimization (K-Maps) Map Manipulations (Prime Implicants)
3
Binary Logic
Binary variables Can be 0 or 1 (T or F, low or high) Variables named with single letters in
examples Really use words when designing circuits
Basic Functions AND OR NOT
4
5
Logic Signals
Binary ‘0’ is representedby a “low” voltage(range of voltages)
Binary ‘1’ is representedby a “high” voltage(range of voltages)
The “voltage ranges” guardagainst noise
of binary signalsExample
NOT Operator
Unary Operator Symbol is bar
Z = X Truth table -> Inversion
6
Inverter Gate
7
AND Gate
Symbol is dot Z = X.Y
Or no symbol Z = XY
Truth table -> Z is 1 only if
Both X and Y are 1
8
Switches in series => AND
9
Switching Circuits (AND Gate)
AND
AND Gate: Symbol
AND Gate: Timing
Timing Diagrams
10
OR Gate
Symbol is + Not addition Z = X + Y
Truth table -> Z is 1 if either 1
Switches in parallel => OR
11
12
Switching Circuits (OR Gate)
OR
OR Gate: Symbol
OR Gate: Timing
Timing Diagrams
13
14
Binary Logic
Truth Tables, Boolean Expressions, and Logic Gates
x y z
0 0 0
0 1 0
1 0 0
1 1 1
x y z
0 0 0
0 1 1
1 0 1
1 1 1
x z
0 1
1 0
AND OR NOT
xy z x
y z
z = x • y = x y z = x + y z = x = x’
x z
More Inputs
Work same way What’s output?
15
NAND Gates
Very common for discrete logic
16
NOR Gates
NOT OR Also common YX F
X Y Z
0 0
0 1
1 0
1 1
1
0
0
0
17
Logic Diagram Boolean Expression
Logic Diagram
18
ZY XF .
What is the Boolean expression?
Boolean Expression Logic Diagram
Consider function
XZZYX YZ X F
How many gates do we need to implement this function?
19
Boolean Operator Precedence
The order of evaluation in a Boolean expression is:
Consequence: Parentheses appear around OR expressions
Example: F = A(B + C)(C + D)
1. Parentheses 2. Not
3. And 4. Or
20
Mechanically Go From Truth Table to Function
Steps of design:1. Start with Problem Statement2. Obtain Truth Table3. Obtain a algebraic boolean function4. Draw the circuit diagram
Design Steps (Simple Example)
Specification: Design a circuit that has 3 inputs x, y, z
and a single output F. F is true when the three inputs are the same and false otherwise.
22
Design Steps (Simple Example)
Step #1, since we have three inputs then the Truth Table has to have 8 entries (23)
X Y Z F
0 0 0 1
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 0
1 1 1 1
23
Design Steps (Simple Example)
Step #2, Pick the entries in the truth table where F is equal 1.
Give Expression:
X Y Z F
0 0 0 1
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 0
1 1 1 1ZYXZYX F
24
Design Steps (Simple Example)
Step #3, Draw a logic diagram that represents the boolean functions.
X Y Z F
0 0 0 1
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 0
1 1 1 1
ZYXZYX F
25
Representation: Truth Table
2n rowswhere n # ofvariables
ZYXZYXZYXZY XZ YX F
26
Give Boolean Expression?
Not Simplified!
Boolean Functions: Complexity
There can be different representations for a boolean function
Usually we want the simplest (Why?) Fewer gates (Less Area, Less Power
Consumption, Faster!)
We can use identities to reduce complexity of Boolean expressions.
27
Boolean Algebra & Identities
There is only one way that a Boolean function can be represented in a truth table.
However, when the function is in algebraic form, it can be expressed in a variety of ways.
Boolean algebra is a useful tool for simplifying digital circuits.
Use identities to manipulate functions
28
Table of Identities
29
Dual of an Expression
The dual of an expression is obtained by:
1. Changing AND to OR and OR to AND throughout
2. Changing 1’s to 0’s and 0’s to 1’s
For example The dual of X+0 is:
• X.1, The dual of X.0 is:
• X+130
Duals
Left and right columns are duals
31
Single Variable Identities
32
Commutative
Order independent
33
Associative
Independent of order in which we group
So can also be written asand ZYX
34
Distributive
Identity 15 is the dual of identity 14.
Identity 14 is well known from ordinary algebra!
35
DeMorgan’s Theorem
Used a lot NOR equals invert AND
NAND equals invert OR
36
Proof?
Truth Tables for DeMorgan’s
37
Useful Theorems
ninimizatioMyyyx =××
( ) tionSimplifica yxyxyxyx ×=+×+=×+
Absorption xyxxxyxx
Consensuszyxzyzyx ×+×=×+×+×( ) ( ) ( ) ( ) ( )zyxzyzyx +×+=+×+×+
+x
x x
x x
x x
38
Example 1: Boolean Algebraic Proof
A + A·B = A (Absorption Theorem)
Proof Steps Justification (identity or theorem)
A + A·B
= A · 1 + A · B X = X · 1 = A · ( 1 + B) X · Y + X · Z = X ·(Y + Z)
= A · 1 1 + X = 1
= A X · 1 = X
39
Cont .. Boolean Algebraic Proof
Our primary reason for doing proofs is to learn:
Careful and efficient use of the identities and theorems of Boolean algebra, and
How to choose the appropriate identity or theorem to apply to make forward progress, irrespective of the application.
40
Algebraic Manipulation
XZZYX YZ X F
When a Boolean equation is implemented with logic gates,
i. Each term requires a gate,
ii. Each variable designates an input to the gate.
We define a literal as a single variable within a term that may or may not be complemented.
The expression above has THREE terms and EIGHT literals.
41
Algebraic Manipulation
Consider function
XZZYX YZ X F
How many gates do we need to implement this function?
42
Simplify Function
XZZYX YZ X F
XZZ Z YX F )(
XZYX F 1
XZYX F
Apply
Apply
Apply
End Result?
43
Fewer Gates
XZYX F
1. Fewer Gates!
2. Fewer Inputs per gate!
44
The Duality Principle
YXYXX
• Recall how to obtain the dual of an expression!
• The duality principle states that a Boolean equation remains valid if we take the dual of the expression on both sides of the equal sign.
XYYXX )(
45
1. Complement of a Function
X Y Z F F0 0 0 0 1
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 0 1
1 0 1 0 1
1 1 0 0 1
1 1 1 0 1
ZYXZYXZYXZYXZYXZYXF
ZYXZYXF
The complement representation for a function F, (F’), is obtained from an interchange of 1’s to 0’s and 0’s to 1’s for the values of F in the truth table.
46
2. Cont ..Complement of a Function
The complement of a function can be derived algebraically by applying DeMorgan’s theorem.
ZYXZYXF ZYXZYXF )(.)( ZYXZYXF
))(( ZYXZYXF
47
3. Cont ..Complement of a Function
Yet another way of deriving the complement of a function is to: Take the dual of the function equation Complement each literal.
)()( ZYXZYXF ZYXZYXF )).(( ZYXZYXDual
)).(( ZYXZYXF
48
ENG241 Digital Design
Cont ..Week #2 Combinational Logic Circuits
Resources
Chapter #2, Mano Sections 2.3 Standard Forms 2.4 Circuit Optimization (K-Maps)
50
Week #2, #3 Topics
Standard Forms (Minterms, Maxterms) Circuit Optimization (K-Maps) Map Manipulations (Prime Implicants)
51
From Truth Table to Function
Consider a truth table Can implement F by
taking OR of all terms that are 1
ZYXZYXZYXZY XZ YX F
Z YX F
52
XZY optimizedF )(
MinTerm
Product Term
Standard Forms
Assume we have a circuit with 3 variables X, Y, Z
Definitions: Product Term – a subset of the variables
appear XY, XZ, XZ’, XYZ Min Term – is a product term in which all
variables appear once (XYZ, X’YZ, X’Y’Z’)
53
Number of Minterms
For n variables, there will be 2n minterms
Like binary numbers from 0 to 2n-1
54
Definition: Minterm
Is a Product Term in which ALL variables appear once (complemented or not)
55
Sum of Minterms (SOM)
OR all of the minterms of truth table row with a 1
ZXYZYXYZXZYXF
ZYXZYXZYXZYX F
In this case m1 + m3 + m4 + m6
In this case m0+m2+m5+m7
56
m0
m1
m2
m3m4
m5
m6
m7
Alternative Representation
ZYXZYXZYXZYXF ........
ZYXZYXZYXZYX F ........
In this case m1 + m3 + m4 + m6
In this case m0+m2+m5+m7
)7,5,2,0(),,( mZYXF
)6,4,3,1(),,( mZYX F
57
Summary of Properties of Minterms
There are 2n minterms for a Boolean function with n variables
Any Boolean function can be expressed as a logical sum of minterms
The complement of a function contains those minterms not included in the original function.
A function that includes all the 2n minterms is equal to logic 1.
58
Sum of Products (SOP)
The sum-of-minterms form is a standard algebraic expression that is obtained directly from a truth table.
The expression obtained contains the maximum number of literals in each term.
Simplification of the sum-of-minterms expression is called sum-of-products.
59
SOM vs. SOP
ZYXZYXZYXZYX F
Sum of minterms
After Simplification we get the Sum of products
ZXZX F ..
60
Sum of Products Implementation
Sum of products
XYZYXYF
We refer to this implementation as a two-level circuit
61
2-level Implementation
Sum of products has 2 levels of gates
Is there a 3-level rep of this circuit?
62
2-level vs. 3-level Implementation
AB + CD + CE can be
Also expressed as
AB + C(D+E)
What’s best? • Hard to answer!!• More gate delays?• But maybe we only have 2-input gates
63
Definition: Maxterm
Is a Sum Term in which all variables appear once (complemented or not)
64
Minterm related to Maxterm
Minterm and maxterm with same subscripts are complements
Example (Use Demorgans theory)
33 MZYXYZXm
Mjm j
65
YZXm 3
Product of Maxterms
6431 MMMMF
))(( ZYXZYXF
))(( ZYXZYX
We can also express F as AND of all rows that should evaluate to 0
)6,4,3,1(),,( MZYXF
66
M0
M1
M2
M3
M4
M5
M6
M7
Two-Level Circuit Optimization
The complexity of the digital logic gates that implement a Boolean function is directly related to the algebraic expression from which the function is implemented!!
Boolean expressions may be simplified by algebraic manipulation (i.e. identities) but it is awkward and not straight forward!
67
Karnaugh Maps
Graphical depiction of truth table A box for each minterm
So 2 variables, 4 boxes 3 variable, 8 boxes And so on
Useful for simplification By inspection Algebraic manipulation harder
68
Examples
YXXYYXYXF
69
There are implied 0s in other boxes Figure (b) F = m1 + m2 + m3
Simplification
)( YYXYX
XYYXYXF
)1(XYX
YX
70
Three-Variable Map
Eight minterms Look at encoding of columns and rows
71
Simplification
Adjacent squares (horizontally or vertically) are minterms that vary by single variable
Draw rectangles on map to simplify function
Illustration next
72
How to obtain a simplified expression?
Combine as many 1’s as possible from the map to form rectangle
Only adjacent 1’s can be combined vertically or horizontally but not diagonally.
The number of 1’s that can be combined is a power of 2, (20=1, 21=2, 22=4, 23=8), …
73
Example
ZYXZYXYZXZYXF
X Y Z F
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 0
1 1 1 0YXYXF
74
Example
ZYXZYXYXF
YXYXF
75
X
YZ00 1101 10
0
1
ZYXZYXZYXYZXF
11
1 1
Adjacency is Cylindrical
Note that wraps from left edge to right edge.
Z
76
Another Minimization Example
Each of the two adjacent pairs of entries can be simplified by eliminating the changing bit. x is eliminated in
column 2 y is eliminated in the
other pair. F = y’z + x’z’
77
Covering 4 Squares
is
ZYXZYXZYXZYXF
ZXZXF ZF
78
Another Example
In general, as more squares are combined, we obtain a product term with fewer literals.
Overlap is allowed.
79
4-variable map
At limit of K-map
80
Also Wraps (toroidal topology)
81
Simplifying a 4-Variable Function
)14,13,12,9,8,6,5,4,2,1,0(),,,( mZYXWF
1 1 1
1 1 1
1 1 1
1 1
WXYZ
00
01
11
10
00 01 11 10
Y
W Z
X Z
82
Don’t Care
So far we have dealt with functions that were always either 0 or 1
Sometimes we have some conditions where we don’t care what result is
Example: dealing with BCD Only care about first 10
83
Mark With an `X’
In a K-map, mark don’t care with an ‘X’
Simpler implementations Can select an X either as 1 or 0 Example:
84
)5,2,0(),15,11,7,3,1(),,,( dmDCBAF
Example
or
What would we have if Xs were 0?85
)5,2,0(),15,11,7,3,1(),,,( dmDCBAF
Prime Implicants
Each element in the K-Map is an implicant. A prime implicant is a product term obtained by
combining the maximum possible number of adjacent squares in the map. A single 1 on a map represents a prime implicant
if it is not adjacent to any other 1. Two adjacent 1’s form a prime implicant, provided
they are not within a group of four adjacent squares.
Four adjacent 1’s form a prime implicant if they are not within a group of eight adjacent squares, and so on.
If a minterm in a square is covered by only one prime implicant, that prime implicant is said to be essential. They are found by looking at each square marked
with a 1 and checking the number of prime implicants that cover it. Those with only one prime implicant are essential.
86
Implicant/Prime Implicant/EssentialConsider: { , , , , , }onf b d abc bd acd abc bcd
• Each Element of fon is an Implicant• Prime Implicants are:
{ , , , , }b d abc bd acd abc
• abc is a Prime Implicant but NOT anEssential Prime Implicant
• bcd is an Implicant but NOT aPrime Implicant
• bd is an Essential Prime Implicant
87
Finding Simplified Expressions
The procedure for finding simplified expressions is
1. Determine all essential prime implicants.2. The final expression is formed from the logical sum of:
I. The essential prime implicants, with II. Other prime implicants needed to cover the remaining
minterms
There may be more than one simplified expression.
88
Prime Implicants: Example
Two essential prime implicants (caused by m0 and m5) This gives us two terms: x’z’ and xz
Finding prime implicants for the remainders results in four expressions: F = xz + x’z’ + yz + wz F = xz + x’z’ + yz + wx’ F = xz + x’z’ + x’y + wz F = xz + x’z’ + x’y + wx’
89
H.-H. S. Lee
Essential Prime Implicants
0 2 4 6 7 8 10
11
12
13
14
16
18
19
29
30
(6,7) X X
(10,11) X X
(12,13) X X
(18,19) X X
(13,29) X X
(14,30) X X
(0,2,16,18) X X X X
(0,2,4,6,8,10,12,14)
X X X X X X X X
30) 29, 19, 18, 16, 14, 13, 12, 11, 10, 8, 7, 6, 4, 2, m(0,E)D,C,B,F(A,
Prime Implicants
91
Consensus Theorem
The third term is redundant Can just drop
What does it mean? For third term to be true, Y & Z both 1 Then one of the first two terms must be
1!
ZXXYYZZXXY
92
Proof of Consensus Theorem
)( XXYZZXXY
YZXXYZZXXY
YZXZXXYZXY
YZZXXY
)1()1( YZXZXY
ZXXY
93
Three Variable Maps
Three variable maps exhibit the following characteristics:
1. One box represents minterm with 3 literals
2. Rectangle of 2 boxes -> 2 literals3. Rectangle of 4 boxes -> 1 literal4. Rectangle of 8 boxes -> Logic 1 (on 3-
variable map)
94
Slight Variation
Overlap is OK. No need to use full m5-- waste of input
95
Another Example
Four adjacent corners can be combined to form the two literal term x’z’.
Four adjacent squares can be combined to form the two literal term x’y.
The remaining 1 is combined with a single adjacent 1 to obtain the three literal term w’y’z’.
F = x’z’ + x’y + w’y’z’96