Review Notes : Chapter 2 - Electrical and Computer Engineering

Boolean Algebra
Introduction
Logical arguments are valid (or not) by virtue of their
form, not content
Example
All men are mortal
(premise 1)
Harry is a man
(premise 2)
------------------------------------------Harry is mortal
(conclusion)
This regularity allows implementation of logic by computers,
which have no capacity to understand meaning
Boolean Algebra
Logical variables
P, Q, YourMamma, Waverly
take values 0 or 1 only
Logical operators
OR operator
AND operator
P1
P2
P1 + P2
P1
P2
P1  P2
0
0
1
1
0
1
0
1
0
1
1
1
0
0
1
1
0
1
0
1
0
0
0
1
NOT operator
P
P’
0
1
1
0
Boolean Algebra
Truth tables
Arbitrary functions can be composed from these elementary
operators acting on variables
Example
P1
P2
P3
(P1 + P2)
(P1 + P2)  P3
[(P1 + P2)  P3]΄
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
0
1
1
1
1
1
1
0
0
0
1
0
1
0
1
1
1
1
0
1
0
1
0
Properties of truth tables
1) If there are n variables, there will be 2n rows
2) Rows are listed in counting order
3) Intermediate results may be shown in inserted columns
Boolean Algebra
Other logical operators
OR, AND, and NOT operators are sufficient to represent any logical
function; however, other operators will prove useful in digital design
NAND and NOR
P
Q
P NAND Q
P
Q
P NOR Q
0
0
1
1
0
1
0
1
1
1
1
0
0
0
1
1
0
1
0
1
1
0
0
0
P1
P2
P1 XOR P2
0
0
1
1
0
1
0
1
0
1
1
0
XOR
Boolean Algebra
Tautology, Equivalence, and Logical Laws
A tautology is a function that is always true
Example
P
0
1
P΄
1
0
P + P΄
1
1
Equivalence operator
P1
P2
P1 ≡ P2
0
0
1
1
0
1
0
1
1
0
0
1
Boolean Algebra
Tautology, Equivalence, and Logical Laws (cont.)
If an equivalence is a tautology, then the two expressions are
interchangeable. Why? Because a function is completely defined by its truth
values.
Example
P1
0
0
1
1
P2
0
1
0
1
(P1 + P2)΄
1
0
0
0
(P1΄  P2΄)
1
0
0
0
This is one form of DeMorgan’s Law
(P1 + P2)΄ ≡ (P1΄  P2΄)
1
1
1
1
Boolean Algebra
Simplification
Goal: Reduce size of a function
Method 1: Successive application of equivalence theorems
Sample theorems
theorem
(T1) X + 0 ≡ X
(T2) X + 1 ≡ 1
(T3) X + X ≡ X
(T4) X + X΄ ≡ 1
(T5) (X΄)΄ ≡ X
(T6) X + Y ≡Y + X
(T7) (X + Y)΄ ≡ (X΄ ∙ Y΄)
(T8) (X + Y) + Z ≡ X + (Y + Z)
(T9) XY + XZ ≡ X(Y + Z)
(T10) X + XY≡ X
dual
(T1)d X ∙ 1 ≡ X
(T2)d X ∙ 0 ≡ 0
(T3)d XX ≡ X
(T4)d XX’ ≡ 0
(T6)d XY ≡ YX
(T7)d (XY)΄ ≡ (X΄ + Y΄)
(T8)d (XY) Z X(YZ)
(T9)d (X + Y) (X + Z) ≡ X + YZ
(T10)d X(X + Y) ≡ X
Boolean Algebra
Simplification (method 1)
Fact about the theorems
1) 0 and 1 are constants that always take these values
2) AND can be implicit (as with multiplication in numerical algebra)
3) All equivalences can be proven with a truth table
4) Every theorem is accompanied by its dual obtained by switching all
0’s and 1’s and all ∙’s and +’s. When these switches are made, a
new valid theorem is obtained.
5) Every symbol in every identity can be systematically replaced by
arbitrary expressions.
6) A number of theorems are identical to those of numerical algebra
(e.g., (T8) and (T9), but not (T9)d)
Boolean Algebra
Simplification (method 1)
Example 1
step
1. PQ + PQ΄
2. P(Q + Q΄)
3. P(1)
4. P
justification
given
(T9)
(T4)
(T1)d
Example 2
step
1. P1P2 + P1΄P3 + P2P3
2. P1P2 + P1΄P2 + P2P3(1)
3. P1P2 + P1’P3 + P2P3(P1 + P1΄)
4. P1P2 + P1΄P3 + P1P2P3 + P1΄P2P3
5. P1P2 + P1P2P3 + P1΄P3 + P1΄P2P3
6. P1P2(1 + P3) + P1’P3(1 + P2)
7. P1P2(1) + P1΄P3(1)
8. P1P2 + P1΄P3
justification
given
(T1)d
(T4)
(T9), (T6)d
(T6)
(T9), two applications
(T2)
(T1)
Note: This simplification involves expansion before contraction
Boolean Algebra
Simplification (method 2)
Motivation
Simplification with equivalence theorems is unsystematic
(witness the 2nd example)
Alternative
Reduce function to sum of minterms (SOP) or product of maxterms
(POS), then simplify on a Karnaugh map
Boolean Algebra
Simplification (method 2)
Minterms and Maxterms
minterm
maxterm
product of variables with variable negated if corresponding
value is 0
sum of variables with variable negated if corresponding
value is 1
Minterms and maxterms for 4 variable functions
#
W
X
Y
Z
minterm
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
W΄X΄Y΄Z΄
W΄X΄Y΄Z
W΄X΄YZ΄
W΄X΄YZ
W΄XY΄Z΄
W΄XY΄Z
W΄XYZ΄
W΄XYZ
WX΄Y΄Z΄
WX΄Y΄Z
WX΄YZ΄
WX΄YZ
WXY΄Z΄
WXY΄Z
WXYZ΄
WXYZ
maxterm
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΄
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΄
Boolean Algebra
Simplification (method 2)
Theorem
Every function can be rewritten as
1) Sum of the minterms where the function is 1 (SOP), or
2) Product of the maxterms where the function is 0 (POS)
Example
F = Y΄(X + W) + Z΄
SOP:
F=
F=
POS:
W΄X΄Y΄Z΄ + W΄X΄YZ΄ + W΄XY΄Z΄ + W΄XY΄Z +
W΄XYZ΄ + WX΄Y΄Z΄ + WX΄Y΄Z΄’ +
WX΄YZ΄ + WXY΄Z’ + WXY΄Z + WXYZ΄, or
SWXYZ(0,2,4,5,6,8,9,10,12,13,14).
F=
(W + X + Y + Z΄)(W + X + Y΄ + Z΄)(W + X΄+Y’+ Z΄)
(W΄ + X + Y΄ + Z΄) (W΄+ X΄ + Y΄ + Z΄), or
F=
PWXYZ(1,3,7,11,15).
#
W
X
Y
Z
F = Y΄ (X + W) + Z΄
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
1
0
1
0
1
1
1
0
1
1
1
0
1
1
1
0
Boolean Algebra
Simplification (method 2, aside)
How many operators are necessary?
AND, OR and NOT can be used to represent any SOP
and therefore any function
But, an SOP with only positive literals can be rendered with only NAND’s by
replacing all operators with NAND
Example
AB + CD ≡ (A NAND B) NAND (C NAND D)
And, can achieve NOT as follows:
P’ ≡ P NAND P
Therefore, NAND suffices to represent any function.
Example
AC’ + A’B + BC ≡ (A NAND (C NAND C)) NAND ((A NAND A) NAND B) NAND (B NAND C)
Boolean Algebra
Simplification (method 2)
Karnaugh maps
Procedure
1) Enter the minterms for the function on the map.
2) Determine all the prime implicants of the function.
3) Determine the smallest subset of these prime implicants that
cover all the prime implicants.
4) Name these implicants and construct the final expression.
Boolean Algebra
Simplification (method 2)
Karnaugh maps
Step 1:Enter terms
F = W΄XYZ + WXY΄ + WXY + X΄YZ + W΄X΄Y΄Z΄
= SWXYZ(0,7,8,9,12,13,14,15)
WX
00
YZ
0
00
01
4
11
12
1
1
5
13
7
15
1
2
6
1
9
1
11
10
8
1
01
3
10
1
11
1
14
10
1
Note: Gray code ordering on map
Boolean Algebra
Simplification (method 2)
Karnaugh maps
Step 2: Determine prime implicants (PI’s)
What is a PI?
i. Consists of 2n minterms, where n is an integer
ii. It forms a continuous rectangle over the 3D torus formed by
joining the ends of the map
1
9
iii. It is not subsumed by a larger PI
5
3
7
0
4
2
6
8
12
10
14
13
11
15
Boolean Algebra
Simplification (method 2)
Karnaugh maps
Step 2: Determine prime implicants (PI’s)
Example
WX
00
YZ
00
3
01
1
01
1
11
11
10
1
1
1
1
2
1
1
10
4
1
Boolean Algebra
Simplification (method 2)
Karnaugh maps
Step 3: Find minimal set of PI’s
i. Find all essential prime implicants (those that contain a minterm not
covered by any other PI)
ii. Cover rest of minterms with other PI’s
Example
WX
00
YZ
00
3
01
1
01
1
11
11
10
1
1
1
1
2
1
1
10
4
1
All are necessary (all have distinguished minterms)
Boolean Algebra
Simplification (method 2)
Karnaugh maps
Step 4: Name the PI’s in the minimal set
Rule: The name of the PI will correspond to a product of the variables that don’t
change, with the variable negated if it always 0, and not negated otherwise.
Example (PI 1)
WXY΄Z΄ + WXY΄Z + WXYZ΄ + WXY΄Z΄
≡ WX(Y΄Z΄ + Y΄Z + YZ΄ + Y΄Z΄)
≡ WX(Y΄(Z΄ + Z) + Y(Z΄ + Z)
≡ WX(Y΄(1) + Y(1))
≡ WX(Y΄(1) + Y(1))
≡ WX(Y΄ + Y)
≡ WX(1)
≡ WX
WX
00
YZ
00
3
01
1
01
1
11
11
10
1
1
1
1
2
1
1
10
4
1
Boolean Algebra
Simplification (method 2)
Karnaugh maps
Step 4: Name the PI’s in the minimal set
.
Full set of PI’s for this example:
WX + WY΄ + X΄Y΄Z΄ + XYZ
WX
00
YZ
00
3
01
1
01
1
11
Comparison with original expression
W΄XYZ + WXY΄ + WXY + X΄YZ + W΄X΄Y΄Z
(5 product terms reduced to 4, 17 literals to 10)
11
10
1
1
1
1
2
1
1
10
4
1
Boolean Algebra
Simplification (method 2)
Karnaugh maps
Another example
SWXYZ(0,1,2,3,4,5,6,14,15)
00
YZ
0
00
1
01
1
1
3
4
5
1
1
7
11
12
2
01
00
1
1
01
1
1
11
11
1
10
1
11
10
1
1
14
1
2
WX
00
YZ
9
15
6
1
10
8
13
1
11
10
01
10
1
1
1
5
1
3
PI’s
4
W΄X΄ comprising minterms 0,1,2,3
W΄Y΄ comprising minterms 0,1,4,5
W΄Z΄ comprising minterms 0,2,4,6
XYZ΄ comprising minterms 6,14  not essential
WXY comprising minterms 14,15
Essential PI’s cover all minterms
W΄X΄ + W΄Y΄ + W΄Z΄ + WXY
Boolean Algebra
Simplification (method 2)
Karnaugh maps, POS minimization
SWXYZ(0,1,2,3,4,5,6,14,15)
PI’s
WX
00
YZ
01
00
1
1
01
1
1
11
1
10
1
11
10
1
2
1
1
3
1
1
W΄ + X, comprising maxterms 8,9,10,11
W΄ + Y, comprising maxterms 8,9,12,13
W + X΄ + Y΄ + Z΄, comprising maxterm 7
Essential PI’s cover all minterms
(W΄ + X)(W΄ + Y)(W + X΄ + Y΄ + Z΄)  slightly better than SOP minimization
Boolean Algebra
Simplification (method 2)
Karnaugh maps, a hard example
p
WX
00
YZ
01
0
4
1
5
00
10
8
13
9
1
01
1
1
3
1
7
11
15
11
1
2
10
11
12
6
1
1
14
10
1
SOP and POS minimization does not work
But, if target representation is changed, a single term results!
(W XOR X) XOR (Y XOR Z)
Furthermore, a small counting machine covers minterms regardless of
number of variables
MORAL: Finding the optimal circuit is non-trivial.
This makes Digital Design an art as well as an engineering task.
Boolean Algebra
Simplification (method 2)
Karnaugh maps
Summary of minimization
original
expression
truth table
minterms on
Karnaugh
minimal
set of PI's
minimized
SOP
minimized
POS
minimum of
minimums
Boolean Algebra
Summary of topics
Functions
Truth tables
Tautologies and equivalence
Simplification with equivalence
Simplification with Karnaugh maps
minterms and maxterms
Prime Implicants
SOP and POS minimization
Simplification depends on representation (the art of design)