Upload
matius-apry-prastowo
View
221
Download
0
Embed Size (px)
Citation preview
8/7/2019 Sistem Digital V
1/55
Sistem Digital
(410206)
Materi Kuliah ke-5
BOOLEAN ALGEBRA AND LOGICSIMPLICATION
8/7/2019 Sistem Digital V
2/55
Boolean AlgebraBoolean Algebra
VERY nice machinery used to manipulate
(simplify) Boolean functions
George Boole (1815-1864): An
investigation of the laws of thought Terminology:
Literal:A variable or its complement
Product term:literals connected by Sum term:literals connected by +
8/7/2019 Sistem Digital V
3/55
Boolean Algebra PropertiesBoolean Algebra PropertiesLet X: boolean variable, 0,1: constants
1. X + 0 = X -- Zero Axiom
2. X 1 = X -- Unit Axiom3. X + 1 = 1 -- Unit Property
4. X 0 = 0 -- Zero Property
8/7/2019 Sistem Digital V
4/55
Boolean Algebra Properties (cont.)Boolean Algebra Properties (cont.)
Let X: boolean variable, 0,1: constants
5. X + X = X -- Idepotence
6. X X = X -- Idepotence7. X + X = 1 -- Complement
8. X X = 0 -- Complement
9. (X) = X -- Involution
Unchanged invalue following
multiplication byitself
8/7/2019 Sistem Digital V
5/55
The Duality PrincipleThe Duality Principle The dual of an expression is obtained by
exchanging ( and +), and (1 and 0) in it,provided that the precedence of operations isnot changed.
Cannot exchange x with x
Example: Find H(x,y,z), the dual of F(x,y,z) = xyz + xyz H = (x+y+z) (x+y+ z)
Dual does not always equal the originalexpression
If a Boolean equation/equality is valid, its dual is alsovalid
8/7/2019 Sistem Digital V
6/55
The Duality Principle (cont.)The Duality Principle (cont.)With respect to duality, Identities 1 8 have the
following relationship:
1. X + 0 = X 2. X 1 = X (dual of 1)3. X + 1 = 1 4. X 0 = 0 (dual of 3)5. X + X = X 6. X X = X (dual of 5)7. X + X = 1 8. X X = 0 (dual of 8)
8/7/2019 Sistem Digital V
7/55
More Boolean Algebra PropertiesMore Boolean Algebra PropertiesLet X,Y, and Z: boolean variables
10. X + Y = Y + X 11. X Y = Y X -- Commutative
12. X + (Y+Z) = (X+Y) + Z 13. X(YZ) = (XY)Z -- Associative
14. X(Y+Z) = XY + XZ 15. X+(YZ) = (X+Y) (X+Z)
-- Distributive16. (X + Y) = X Y 17. (X Y) = X + Y -- DeMorgans
In general,( X1 + X2 + + Xn ) = X1X2 Xn, and
( X1X2 Xn ) = X1 + X2 + + Xn
8/7/2019 Sistem Digital V
8/55
Absorption Property (Covering)Absorption Property (Covering)
1. x + xy = x
2. x(x+y) = x (dual)
Proof:
x + xy = x1 + xy= x(1+y)= x1
= xQED (2 true by duality)
8/7/2019 Sistem Digital V
9/55
Consensus TheoremConsensus Theorem
1. xy + xz + yz = xy + xz
2. (x+y)(x+z)(y+z) = (x+y)(x+z) -- (dual)
Proof:
xy + xz + yz = xy + xz + (x+x)yz= xy + xz + xyz + xyz= (xy + xyz) + (xz + xzy)
= xy + xzQED (2 true by duality).
8/7/2019 Sistem Digital V
10/55
Truth Tables (revisited)Truth Tables (revisited)
Enumerates all possible
combinations of variablevalues and the correspondingfunction value
Truth tables for some arbitraryfunctionsF1(x,y,z), F2(x,y,z), and
F3(x,y,z) are shown to the right.
101111
000011010101
010001
110110
100010
100100110000
F3F2F1zyx
8/7/2019 Sistem Digital V
11/55
Truth Tables (cont.)Truth Tables (cont.) Truth table: a unique representation of a
Boolean function If two functions have identical truth tables, the
functions are equivalent (and vice-versa).
Truth tables can be used to prove equalitytheorems. However, the size of a truth table grows
exponentially with the number of variablesinvolved, hence unwieldy. This motivates theuse of Boolean Algebra.
8/7/2019 Sistem Digital V
12/55
Boolean expressionsBoolean expressions--NOT uniqueNOT unique
Unlike truth tables, expressionsrepresenting a Boolean function areNOT unique.
Example:
F(x,y,z) = xyz + xyz + xyz G(x,y,z) = xyz + yz
The corresponding truth tables for F()and G() are to the right. They are
identical!
Thus, F() = G()
00111
1101100101
00001
00110
11010
00100
11000
GFzyx
8/7/2019 Sistem Digital V
13/55
Algebraic ManipulationAlgebraic Manipulation Boolean algebra is a useful tool for
simplifying digital circuits. Why do it? Simpler can mean cheaper,
smaller, faster.
Example: Simplify F = xyz + xyz + xz.F = xyz + xyz + xz
= xy(z+z) + xz= xy1 + xz= xy + xz
8/7/2019 Sistem Digital V
14/55
Algebraic Manipulation (cont.)Algebraic Manipulation (cont.) Example: Prove
xyz + xyz + xyz = xz + yz Proof:
xyz+ xyz+ xyz
= xyz + xyz + xyz + xyz= xz(y+y) + yz(x+x)= xz1 + yz1
= xz + yzQED.
8/7/2019 Sistem Digital V
15/55
Complement of a FunctionComplement of a Function
The complement of a function is derivedby interchanging ( and +), and (1 and 0),and complementing each variable.
Otherwise, interchange 1s to 0s in thetruth table column showing F.
The complementof a function IS NOT
THE SAME as the dualof a function.
8/7/2019 Sistem Digital V
16/55
Complementation: ExampleComplementation: Example
Find G(x,y,z), the complement ofF(x,y,z) = xyz + xyz
G = F = (xyz + xyz)
= (xyz) (xyz) DeMorgan= (x+y+z) (x+y+z) DeMorganagain
Note: The complement of a function can also bederived by finding the functions dual, and thencomplementing all of the literals
8/7/2019 Sistem Digital V
17/55
Canonical and Standard FormsCanonical and Standard Forms
We need to consider formal techniques for
the simplification of Boolean functions. Minterms and Maxterms
Sum-of-Minterms and Product-of-Maxterms
Product and Sum terms
Sum-of-Products (SOP) and Product-of-Sums
(POS)
8/7/2019 Sistem Digital V
18/55
DefinitionsDefinitions Literal:A variable or its complement
Product term:literals connected by Sum term:literals connected by +
Minterm:a product term in which all thevariables appear exactly once, eithercomplemented or uncomplemented
Maxterm:a sum term in which all the variablesappear exactly once, either complemented oruncomplemented
8/7/2019 Sistem Digital V
19/55
MintermMinterm Represents exactly one combination in the truth
table. Denoted by mj, wherejis the decimal equivalentof the minterms corresponding binarycombination (bj).
A variable in mjis complemented if its value in bjis 0, otherwise is uncomplemented.
Example: Assume 3 variables (A,B,C), andj=3.Then, bj= 011 and its corresponding minterm isdenoted by mj= ABC
8/7/2019 Sistem Digital V
20/55
MaxtermMaxterm Represents exactly one combination in the truth
table. Denoted by Mj, wherejis the decimal equivalentof the maxterms corresponding binarycombination (bj).
A variable in Mjis complemented if its value in bjis 1, otherwise is uncomplemented.
Example: Assume 3 variables (A,B,C), andj=3.Then, bj= 011 and its corresponding maxterm isdenoted by Mj= A+B+C
8/7/2019 Sistem Digital V
21/55
Truth Table notation forTruth Table notation for
Minterms andMinterms and MaxtermsMaxterms
Minterms andMaxterms areeasy to denoteusing a truth
table. Example:
Assume 3variables x,y,z(order is fixed)
x+y+z = M7xyz = m7111
x+y+z = M6xyz = m6011
x+y+z = M5
xyz = m5
101
x+y+z = M4xyz = m4001
x+y+z= M3xyz = m3110
x+y+z = M2xyz = m2010
x+y+z = M1xyz = m1100
x+y+z = M0xyz = m0000
MaxtermMintermzyx
8/7/2019 Sistem Digital V
22/55
Canonical Forms (Unique)Canonical Forms (Unique) Any Boolean function F( ) can be
expressed as a uniquesum of mintermsand a unique product of maxterms (undera fixed variable ordering).
In other words, every function F() has twocanonical forms: Canonical Sum-Of-Products (sum of
minterms) Canonical Product-Of-Sums (product ofmaxterms)
8/7/2019 Sistem Digital V
23/55
Canonical Forms (cont.)Canonical Forms (cont.)
Canonical Sum-Of-Products:
The minterms included are those mjsuchthat F( ) = 1 in rowjof the truth table for F().
Canonical Product-Of-Sums:The maxterms included are those Mjsuch
that F( ) = 0 in rowjof the truth table for F().
8/7/2019 Sistem Digital V
24/55
ExampleExample Truth table for f1(a,b,c) at right
The canonical sum-of-products form forf1 isf1(a,b,c) = m1 + m2 + m4 + m6
= abc + abc + abc + abc
The canonical product-of-sums form forf1 isf1(a,b,c) = M0 M3 M5 M7
= (a+b+c)(a+b+c)(a+b+c)(a+b+c).
Observe that: mj = Mj
0111
10110101
1001
01101010
1100
0000
f1cba
8/7/2019 Sistem Digital V
25/55
Shorthand:Shorthand: andand f1(a,b,c) = m(1,2,4,6), where indicates that
this is a sum-of-products form, and m(1,2,4,6)indicates that the minterms to be included arem1, m2, m4, and m6.
f1(a,b,c) = M(0,3,5,7), where indicates that
this is a product-of-sums form, and M(0,3,5,7)indicates that the maxterms to be included areM0, M3, M5, and M7.
Since mj = Mj for anyj, m(1,2,4,6) = M(0,3,5,7) = f1(a,b,c)
8/7/2019 Sistem Digital V
26/55
Conversion Between Canonical FormsConversion Between Canonical Forms
Replace with (or vice versa) and replace thosejs
that appeared in the original form with those that do not. Example:
f1(a,b,c) = abc + abc + abc + abc= m1 + m2 + m4 + m6
=(1,2,4,6)
=(0,3,5,7)= (a+b+c)(a+b+c)(a+b+c)(a+b+c)
8/7/2019 Sistem Digital V
27/55
Standard Forms (NOT Unique)Standard Forms (NOT Unique) Standard forms are likecanonical forms,
except that not all variables need appearin the individual product (SOP) or sum(POS) terms.
Example:f1(a,b,c) = abc + bc + acis a standardsum-of-products form
f1(a,b,c) = (a+b+c)(b+c)(a+c)is a standardproduct-of-sums form.
8/7/2019 Sistem Digital V
28/55
Conversion of SOP fromConversion of SOP from
standard to canonical formstandard to canonical form
Expand non-canonicalterms by inserting
equivalent of 1 in each missing variable x:(x + x) = 1
Remove duplicate minterms f1(a,b,c) = abc + bc + ac= abc + (a+a)bc + a(b+b)c
= abc + abc + abc + abc + abc= abc + abc + abc + abc
8/7/2019 Sistem Digital V
29/55
Conversion of POS fromConversion of POS from
standard to canonical formstandard to canonical form Expand noncanonical terms by adding 0 in terms
of missing variables (e.g., xx = 0) and using thedistributive law
Remove duplicate maxterms
f1(a,b,c) = (a+b+c)(b+c)(a+c)= (a+b+c)(aa+b+c)(a+bb+c)= (a+b+c)(a+b+c)(a+b+c)
(a+b+c)(a+b+c)= (a+b+c)(a+b+c)(a+b+c)(a+b+c)
8/7/2019 Sistem Digital V
30/55
KarnaughKarnaugh MapsMaps Karnaugh maps (K-maps) are graphical
representations of boolean functions. One map cellcorresponds to a row in the
truth table.
Also, one map cell corresponds to aminterm or a maxterm in the booleanexpression
Multiple-cell areas of the map correspondto standard terms.
8/7/2019 Sistem Digital V
31/55
8/7/2019 Sistem Digital V
32/55
TwoTwo--Variable Map (cont.)Variable Map (cont.) Any two adjacent cells in the map differ by
ONLY one variable, which appearscomplemented in one cell anduncomplemented in the other.
Example:m0 (=x1x2) is adjacent to m1 (=x1x2) and
m2 (=x1x2) but NOT m3 (=x1x2)
8/7/2019 Sistem Digital V
33/55
22--Variable MapVariable Map ---- ExampleExample f(x1,x2) = x1x2+ x1x2 + x1x2
= m0 + m1 + m2= x1 + x2
1s placed in K-map forspecified minterms m0, m1, m2
Grouping (ORing) of 1s allows
simplification What (simpler) function is
represented by each dashedrectangle?
a1 = m0 + m1 a2 = m0 + m2 Note m0 covered twice
011
110
10x1
x2
0 1
2 3
8/7/2019 Sistem Digital V
34/55
Minimization as SOP using KMinimization as SOP using K--mapmap
Enter 1s in the K-map for each product
term in the function Group adjacentK-map cells containing 1s
to obtain a product with fewer variables.
Groups must be in power of 2 (2, 4, 8, ) Handle boundary wrap for K-maps of 3
or more variables.
Realize that answer may not be unique
8/7/2019 Sistem Digital V
35/55
ThreeThree--Variable MapVariable Map
m6m7m5m41
m2m3m1m00
10110100yz
x0 1 3 2
4 5 7 6
-Note: variable ordering is (x,y,z); yz specifies
column, x specifies row.-Each cell is adjacent to threeother cells (left orright or top or bottom or edge wrap)
8/7/2019 Sistem Digital V
36/55
ThreeThree--Variable Map (cont.)Variable Map (cont.)
The types of structuresThe types of structures
that are either minterms orthat are either minterms orare generated by repeatedare generated by repeatedapplication of theapplication of theminimization theorem on aminimization theorem on a
three variable map arethree variable map areshown at right.shown at right.Groups of 1, 2, 4, 8 areGroups of 1, 2, 4, 8 arepossible.possible.
minterm
group of 2 terms
group of 4 terms
8/7/2019 Sistem Digital V
37/55
SimplificationSimplification Enter minterms of the Boolean function
into the map, then group terms Example: f(a,b,c) = ac + abc + bc
Result: f(a,b,c) = ac+ b
11
111
abc
11111
00 01 10 11
0
1
00 01 10 11
0
1
8/7/2019 Sistem Digital V
38/55
More ExamplesMore Examples
f1(x, y, z) = m(2,3,5,7)
f2(x, y, z) = m (0,1,2,3,6)
ff11(x, y, z) =(x, y, z) = xxyy ++ xzxz
ff22(x, y, z) =(x, y, z) = xx+yz+yz
10110100yz
X
1
0
1111
1
1111
8/7/2019 Sistem Digital V
39/55
FourFour--Variable MapsVariable Maps
Top cells are adjacent to bottom cells. Left-edgecells are adjacent to right-edge cells.
Note variable ordering (WXYZ).
m11m10m9m810
m14m15m13m1211
m6m7m5m401
m2m3m1m000
10110100WX
YZ
8/7/2019 Sistem Digital V
40/55
FourFour--variable Map Simplificationvariable Map Simplification One square represents a minterm of 4 literals. A rectangle of 2 adjacent squares represents a
product term of 3 literals. A rectangle of 4 squares represents a product
term of 2 literals.
A rectangle of 8 squares represents a productterm of 1 literal.
A rectangle of 16 squares produces a function
that is equal to logic 1.
8/7/2019 Sistem Digital V
41/55
ExampleExample Simplify the following Boolean function
(A,B,C,D) = m(0,1,2,4,5,7,8,9,10,12,13).
First put the function g( ) into the map, and thengroup as many 1s as possible.
cdab
111
11
111
111
g(A,B,C,D) =g(A,B,C,D) = cc+b+bdd+a+abdbd
111
11
111
111
00 01 11 10
00
01
11
10
00 01 11 10
8/7/2019 Sistem Digital V
42/55
55--Variable KVariable K--MapMap
101198
13 141512
5 674
1 230
BC
DE
26272524
30312928
22232120
18191716
BC
DE
A=0
A=1
ABCDE
ABCDE
8/7/2019 Sistem Digital V
43/55
ImplicantsImplicants andand
PrimePrime ImplicantsImplicants (PIs)(PIs)
An Implicant (P) of a function F is a product
term which implies F, i.e., F(P) = 1. An implicant (PI) of F is called a Prime
Implicant of F if any product term obtained
by deleting a literal of PI is NOT an implicantof F
Thus, a prime implicant is not contained inany larger implicant.
8/7/2019 Sistem Digital V
44/55
ExampleExample Consider function f(a,b,c,d) whose K-
map is shown at right.
abis not a prime implicant becauseit is contained in b.
acdis not a prime implicant because
it is contained in ad. b, ad, and acd are prime implicants.
111
111
111
11
b
cd abad
acd
ab
acd
8/7/2019 Sistem Digital V
45/55
Essential Prime Implicants (EPIs)
If a minterm of a function F is included in ONLY
one prime implicant p, then pis an essentialprime implicant of F.
An essential prime implicant MUST appear inall possible SOP expressions of a function
To find essential prime implicants: Generate all prime implicants of a function Select those prime implicants that contain at least one
1 that is not covered by any other prime implicant.
For the previous example, the PIs are b, ad,and acd; all of these are essential.
111
111
111
11
bad
acd
8/7/2019 Sistem Digital V
46/55
Another ExampleAnother Example Consider f2(a,b,c,d), whose K-map
is shown below. The only essential PI is bd.
111
11
111
1cd
ab
S t ti P d fS t ti P d f
8/7/2019 Sistem Digital V
47/55
Systematic Procedure forSystematic Procedure for
Simplifying Boolean FunctionsSimplifying Boolean Functions1. Generate all PIs of the function.
2. Include all essential PIs.3. For remaining minterms not included in
the essential PIs, select a set of other
PIs to cover them, with minimal overlapin the set.
4. The resulting simplified function is the
logical OR of the product terms selectedabove.
8/7/2019 Sistem Digital V
48/55
ExampleExample f(a,b,c,d) =
m(0,1,2,3,4,5,7,14,15). Five grouped terms, not all
needed.
3 shaded cells covered by onlyone term
3 EPIs, since each shaded cell is
covered by a different term. F(a,b,c,d) = ab + ac + ad + abc
11
111
1111ab
cd
8/7/2019 Sistem Digital V
49/55
Product of Sums SimplificationProduct of Sums Simplification Use sum-of-products simplification on the
zerosof the function in the K-map to getF. Find the complement of F, i.e. (F) = F
Recall that the complement of a booleanfunction can be obtained by (1) taking thedual and (2) complementing each literal.
OR, using DeMorgans Theorem.
POS E lPOS E l
8/7/2019 Sistem Digital V
50/55
POS ExamplePOS Example
0000
1100
0111
1111
abcd
F(a,b,c,d) = ab + ac + abcd
Find dual of F, dual(F) = (a+b)(a+c)(a+b+c+d)
Complement of literals in dual(F) to get FF = (a+b)(a+c)(a+b+c+d)(verify that this is the same as in slide 60)
8/7/2019 Sistem Digital V
51/55
Don't Care ConditionsDon't Care Conditions There may be a combination of input values which
will neveroccur
if they do occur, the output is of no concern. The function value for such combinations is called a
don't care.
They are usually denoted with x. Each x may bearbitrarily assigned the value 0 or 1 in animplementation.
Dont cares can be used to furthersimplify afunction
8/7/2019 Sistem Digital V
52/55
Minimization using DonMinimization using Dont Carest Cares
Treat don't cares as if they are 1s to
generate PIs. Delete PI's that cover only don't care
minterms.
Treat the covering of remaining don't careminterms as optional in the selection
process (i.e. they may be, but need not be,covered).
cd
8/7/2019 Sistem Digital V
53/55
ExampleExample Simplify the function f(a,b,c,d)
whose K-map is shown at the right.
f = acd+ab+cd+abc
or
f = acd+ab+cd+abd
The middle two terms are EPIs, whilethe first and last terms are selected tocover the minterms m1, m4, and m5.
(Theres a third solution!)
xx11
xx00
1011
1010
xx11
xx00
1011
1010
xx11
xx00
10111010
abcd
0001
11
10
00 01 11 10
cd
8/7/2019 Sistem Digital V
54/55
Another ExampleAnother Example Simplify the function
g(a,b,c,d) whose K-mapis shown at right.
g = ac+ abor
g = ac+bd
0xx0
1xx1
x0x1
001x
0xx0
1xx1
x0x1
001x
0xx01xx1
x0x1
001x
abcd
8/7/2019 Sistem Digital V
55/55
22-Oct-07 Chapter 2-i: Combinational Logic
Circuits (2.1-- 2.5)
55
Algorithmic minimizationAlgorithmic minimization What do we do for functions with more
than 4-5 variables? You can code up a minimiser
(Computer-Aided Design, CAD)
Quine-McCluskey algorithm
Iterated consensus
We wont discuss these techniques here