introduction to microprocessors and digital logics …shalemoh/boolean algebra an… · ·...
TRANSCRIPT
1
Introduction to Microprocessors and
Digital Logic (ME262)
Boolean Algebra and Logic Equations
Spring 2011
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
2
Outline
1. Boolean Algebra
2. Venn Diagrams
3. Karnaugh Maps (K-maps)
4. Two-variable K-maps
5. Three-variable K-maps
6. Four-variable K-maps
7. Tabular Method
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
Methods of Simplifying Logic Equations
3 Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
Simplifying Logic
Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
( , , )F X Y Z X XZ YZ X
( , , , )F X Y ZW X W XYZ WZ WX
• Two-variable logic equation
• Three-variable logic equation
• Four-variable logic equation
( , )F X Y XY X YX
• X, Y, Z, and W are binary variables defined in the set of {0, 1}
Logic equations are defined in terms of Binary variables and
Boolean algebra.
Methods of Simplifying Logic Equations
4 Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
X Y F
0 0 0
0 1 1
1 0 1
1 1 1
F (X,Y) ?
ZXYYZXZYXZYXF ),,( What is the
most simplified
form ? )6,3,2(),,( 632 mmmmZYXF
Simplifying Logic
Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
Methods of Simplifying Logic Equations
5 Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
Boolean Algebra
Venn Diagrams
Karnaugh Map (K-map)
Tabular Method
Simplifying Logic
Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
6
Comparison between governing laws in real number algebra and
Boolean algebra
Law Real Number Algebra Boolean Algebra
Associative law ) ( ) (
) ( ) (
z y x z y x
z y x z y x
) ( ) (
) ( ) (
Z Y X Z Y X
YZ X Z XY
Commutative law x y y x
x y y x
X Y Y X
YX XY
Identity Elements x x
x x
0
1
X X
X X
0
1 .
Inverse 0 ) (
1 1
-
x x
x x
Distributive law xz xy z y x ) ( ) )( ( ) (
) ( ) ( ) (
Z X Y X YZ X
XZ XY Z Y X
Indempotence law X XX
X X X
Complement element
0
1
X X
X X
Boolean Algebra Simplifying
Logic Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
7
Unity Theorem
YYXYX
YYXXY
))((
)()(
Absorption Theorem
XYYXXYXYXX
XYXXXXYX
)()(
)()(
Consensus Theorem
ZXXYYZZXXY
Boolean Algebra Equations
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
Simplifying Logic
Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
8
Example 1: Prove Unity , Absorption, and Consensus
theorems.
Boolean Algebra Equations Simplifying
Logic Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
9
Example 2: Simplify the following Boolean equations.
DACABCBCDBDADCA
Boolean Algebra Equations
1.
2.
Simplifying Logic
Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
10
Venn Diagrams
A graphical way to represent a logic equation. In order to do this, we
use:
1- A square to show the binary space
2- A circle to show a binary variable
3- The area inside the circle to represent a true value “1” and the
area outside the circle to represent a false value “0”.
AA
Simplifying Logic
Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
11
For example, the following figures show AB and AB.
AB
BA
Venn Diagrams Simplifying
Logic Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
12
There was some struggle as to how to generalize too many sets.
You can use as far as four sets by using ellipses:
Venn Diagrams
A B
C
Venn Diagram for 3 variables:
Simplifying Logic
Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
13
Example 3: What is the Venn Diagram of the following Boolean
expression?
YZXZYXZXY
Venn Diagrams Simplifying
Logic Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
14
Example 4: What is the Boolean expression of the following Venn
diagram?
Venn Diagrams Simplifying
Logic Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
15
Karnaugh Map (K-map)
A Karnaugh map (or “K-map”) is a simple graphical method
for simplifying logic equations.
The method is useful for Boolean functions that contain up to
four logical variables.
For logic equations with more than four variables a tabular
method is used.
K-map was invented by Maurice Karnaugh in 1953.
Simplifying Logic
Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
16
A A
A A
B
B
B
B
AA A A A A A A
A A
Two-variable K-map Simplifying
Logic Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
B B
17
AA
B
B
AB
00
1
0 1
x
x AB
y
w AB
z w
y AB
y AB
Two-variable K-map Simplifying
Logic Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
18
Example 5: Mark the cell(s) associated with Z=AB in a two-variable
K-map. A
B
00
1
0 1
A
B
0 0
1
0 1
1
A B Z=AB
0 0 0
0 1 0
1 0 0
1 1 1
A
B
AB
Two-variable K-map Simplifying
Logic Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
19
Rules for construction of Two-variable K-maps :
1- Circle adjacent 1’s, horizontally or vertically but not diagonally.
2- The sum of minterms inside each circle is the common variable
among the minterms
3- The logic equation is obtained by OR’ing the results of step 2 and the
minterms which are not included in any of the circles.
A B F
0 0 0
1 0 1
2 1 0
3 1 1
A
B
00
1
0 1
2
1
0
3
Two-variable K-map Simplifying
Logic Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
20
Example 6: Use a K-map to simplify the following truth tables
A B Z
0 0 1
0 1 0 1 0 0
1 1 1
AB
00
1
0 1
1
1
Z AB AB
A B Z
0 0 1
0 1 0 1 0 1
1 1 1
AB
00
1
0 1
1
1
Z B A
1
Two-variable K-map Simplifying
Logic Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
21
A
B
A
B
CC C
C
A
B B
A
CC
Three-variable K-map Simplifying
Logic Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
22
A
CB BC
A
CBCB
x CBAx
y y ABC
Three-variable K-map Simplifying
Logic Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
C C
BB
C
A
A2 3 1 0
4 5 7 6
A B C F
0 0 0 0
1 0 0 1
2 0 1 0
3 0 1 1
4 1 0 0
5 1 0 1
6 1 1 0
7 1 1 1
00
01
11
10
0
1
A BC
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
23
Example 7: Simplify the following equation using K-map
)6,3,2(),,( 632 mmmmZYXF
23
1 1
1 ZYXZYXZY
XYZXYZXY
ZYYXZYXF ),,(
YZZ
X 00 01 11 10
0
X 1
Y
Z Z
X
Y
Three-variable K-map Simplifying
Logic Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
24
Rules for construction of Three-variable K-maps :
1- Circle as many adjacent 1’s as possible in groups of (2,4,8),
horizontally or vertically but not diagonally.
2- The sum of minterms inside each circle is the common variable
among the minterms
3- The logic equation is obtained by OR’ing the results of step 2 and the
minterms which are not included in any of the circles.
Three-variable K-map Simplifying
Logic Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
25
Hints: 1’s in the same row in the first and last columns are adjacent.
For example, consider the following K-map
YZ Z Z Z
X 00 01 11 10
0 1 1 X
X 1
YY
1 1
ZXZYXF ),,(
Three-variable K-map Simplifying
Logic Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
26
D D D
C C
A
A
B
B
B
00
01
11
10
00
0
1
3
2
01
4
5
7
6
11 12 13 15 14
10 8 9 11 10
AB CD
A B C D F
0 0 0 0 0
1 0 0 0 1
2 0 0 1 0
3 0 0 1 1
4 0 1 0 0
5 0 1 0 1
6 0 1 1 0
7 0 1 1 1
8 1 0 0 0
9 1 0 0 1
10 1 0 1 0
11 1 0 1 1
12 1 1 0 0
13 1 1 0 1
14 1 1 1 0
15 1 1 1 1
Four-variable K-map Simplifying
Logic Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
27
Rules for construction of Four-variable K-maps :
1- Circle as many adjacent 1’s as possible in groups of (2,4,8,16),
horizontally or vertically but not diagonally.
2- The sum of minterms inside each circle is the common variable
among the minterms
3- The logic equation is obtained by OR’ing the results of step 2 and the
minterms which are not included in any of the circles.
Four-variable K-map Simplifying
Logic Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
28
Hints: 1’s in in the top and bottom row in the same column are
adjacent, as leftmost and rightmost columns. For example, consider the
following K-map
1
11
1
YZ Z Z Z
WX 00 01 11 10
00
X
W01
11
X
W
10 1 X
Y Y
11
1
W ZYXW ZYX
W ZYX
W ZYX
Four-variable K-map Simplifying
Logic Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
ZX
ZXWZXW
ZYXWZYXWZYXWZYXWZYXWF
),,,(
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
29
Example:
ZXZXWZXWZYXWF ),,,(
YZ Z Z Z
WX 00 01 11 10
00 X
W01
11
X
W
10 1 X
Y Y
11
1
ZX
W ZX
W
Four-variable K-map Simplifying
Logic Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
30
Four-variable K-map Simplifying
Logic Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
Example 8: (p3.10) Simplify the following logic equations by K-
maps:
)15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0(
)15,11,10,7,5,4,1,0(
)15,8,7,5,3,2,1,0(
)13,12,10,9,8,7,5,3,0(),,,(
m
m
ZWYm
mZYXWF
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
31
In order to apply tabular method, the function must be given as a sum
of minterms. Consider the following two minterms, which differ in
exactly one variable. They can be combined as
CBACDBADCBA
- 10111010101 the dash indicates a missing variable
Now, consider the two following minterms:
DBCADCBA
01011010
will not combine
will not combine
This concept can be expanded to sum of minterms by sorting the
minterms into groups according to the number of 1’s in each term. For
example:
Tabular Method (Quine-McCluskey Method) Simplifying
Logic Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
32
)14,10,9,8,7,6,5,2,1,0(),,,( mZYXWF
0
1
2
8
5
6
9
10
7
14
0000
0001
0010
1000
0101
0110
1001
1010
0111
1110
Group 0
Group 1
Group 2
Group 3
Column 1 Column 2 Column 3
0,1,8,9 000-
0,2 00-0
0,8 -000
1,5 0-01
1,9 -001
2,6 0-10
2,10 -010
8,9 100-
8,10 10-0
5,7 01-1
6,7 011-
6,14 -110
10,14 1-10
0,1 -00-
0,2,8,10 -0-0
0,8,1,9 -00-
0,8,2,10 -0-0
2,6,10,14 --10
2,10,6,14 --10
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
33
ZYZXYXXYWXZWZYWZYXWF ),,,(
Note that this equation has 6 implicants. We can use the following table to
simplify the equation further.
Implicant Covered Minterms
0-01 1,5
01-1 5,7
011- 6,7
-00- 0,1,8,9
-0-0 0,2,8,10
2,6,10,14 --10
Minterms
0 1 2 5 6 7 8 9 10 14
Three implicants can be ignored since the minterms used in them are also
used in other implicants. This can be proven using Consensus theorem,
which eliminates the redundant terms.
ZYYXXZWZYXWF ),,,(Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011
34
Study: Examples of Chapter 3 of the course package
Solve: P3.1,3.4, 3.5, 3.9, 3.11, 3.15
Example 9: (P3.13) For the following function, find all the essential
implicants using the tabular method:
YZWmZYXWF )13,11,9,5,4,0(),,,(
Tabular Method Simplifying
Logic Equations
Boolean Algebra
Venn Diagrams
K-maps
Two –variable K-maps
Three-variable K-maps
Four-variable K-maps
Tabular Method
Introduction to Microprocessors and Digital Logic (ME262), University of Waterloo, Spring 2011