boolean algebra and logic gates chapter 2 topicscourses.ece.ubc.ca/256/lectures/2010/digital logic...
TRANSCRIPT
9/21/10
1
BooleanAlgebraandLogicGatesChapter2
EECE256Dr.SidneyFels
StevenOldridge
Topics
• DefiniGonsofBooleanAlgebra• AxiomsandTheoremsofBooleanAlgebra– twovaluedBooleanAlgebra
• BooleanFuncGons– simplificaGon
• Canonicalforms– mintermandmaxterms
• Otherlogicgates9/18/10 2(c)S.Fels,since2010
BooleanAlgebra
• AllowsustodefineandsimplifyfuncGonsofbinaryvariables
• Importantfordesignerstocreatecomplexcircuits– funcGonsofcomputer
– ASICdevices– programmablelogic– determinemachinestatetransiGons
9/18/10 (c)S.Fels,since2010 3
9/21/10
2
BooleanAlgebra
• Adherestothelawsofanalgebra– closure– associaGve– commutaGve– idenGty– inverse– distribuGve+foraddiGon(0isidenGty)formulGplicaGon(1isidenGty)
9/18/10 4(c)S.Fels,since2010
AxiomsofBooleanAlgebra
• closurefor+and• IdenGty:
x+0=x1=
• commutaGvex+y=xy=yx
• distribuGvex(y+z)=x+(yz)=
9/18/10 (c)S.Fels,since2010 5
AxiomsofBooleanAlgebra
• Complement– x+x’=1xx’=0
• twoelementsforTwo‐ValuedBooleanAlgebra0and1;0!=1AND=,OR=+,NOT=inverse‐ checkwithTruthtablesandyou’llseeitmeetsalltheaxioms
• switchingalgebra(Shannon,1928)– basisofalldigitalcomputers
• Precedence:– parentheses,NOT,AND,OR
9/18/10 (c)S.Fels,since2010 6
9/21/10
3
TheoremsandProperGesofBooleanAlgebra
9/18/10 (c)S.Fels,since2010 7
idempotent0and1ops
complementidenGty
TheoremsandProperGesofBooleanAlgebra
9/18/10 (c)S.Fels,since2010 8
Duality:interchange0for1andANDandOR
idempotent0and1ops
complementidenGty
TheoremsandProperGesofBooleanAlgebra
9/18/10 (c)S.Fels,since2010 9
Duality:interchange0for1andANDandOR
idempotent0and1ops
complementidenGty
TheoremsusedtosimplifycomplexfuncGonsofbinaryvariables
9/21/10
4
UsefulTheorems
• SimplificaGonTheorems:– XY+XY’=– X+XY=– (X+Y’)Y=
• DeMorgan’sLaw:– (X+Y)’=
• TheoremsforMulGplyingandFactoring:– (X+Y)(X’+Z)=XZ+X’Y
• Proofsbyalgebracomplicated– usetruthtablesinstead
9/18/10 (c)S.Fels,since2010 10
Somealgebraicproofs
ProvingTheoremsviaaxiomsofBooleanAlgebra:
e.g.,Prove:XY+XY’=X
e.g.,Prove:X+XY=X
e.g.,Prove:(X+Y)(X’+Z)=XZ+X’Y
9/18/10 (c)S.Fels,since2010 11
SomealgebraicproofsProvingTheoremsviaaxiomsofBooleanAlgebra:
e.g.,Prove:XY+XY’=XLHS=X(Y+Y’)distribuGve =X(1)complement =X=RHSidenGty
e.g.,Prove:X+XY=X LHS=X(1+Y)distribuGve =X(1) idenGty =X=RHS
9/18/10 (c)S.Fels,since2010 12
9/21/10
5
Somealgebraicproofs
e.g.,Prove:(X+Y)(X’+Z)=XZ+X’Y LHS=(X+Y)X’+(X+Y)ZdistribuGve
=XX’+YX’+XZ+YZdistribuGve
=0+X’Y+XZ+YZcomplement,associaGve,distribuGve
=X’Y(Z+Z’)+XZ(Y+Y’)+YZ(X+X’)idenGty/complement
=X’YZ+X’YZ’+XYZ+XY’Z+XYZ+X’YZdistribuGve,associaGve
=XZ(Y+Y’)+X’Y(Z+Z’)idempotent,associaGve,distribuGve
=XZ+X’Y=RHScomplement
9/18/10 (c)S.Fels,since2010 13
Someproofsusingtruthtables
9/18/10 (c)S.Fels,since2010 14
DeMorgan’sLaw
(X+Y)’=X’Y’
(XY)’=X’+Y’
X Y X’ Y’ (X+Y) (X+Y)’ X’*Y’
0 0 1 1
0 1 1 0
1 0 0 1
1 1 0 0
X Y X’ Y’ (X*Y) (X*Y)’ X’+Y’
0 0 1 1
0 1 1 0
1 0 0 1
1 1 0 0
Someproofsusingtruthtables
9/18/10 (c)S.Fels,since2010 15
DeMorgan’sLaw
(X+Y)’=X’Y’
(XY)’=X’+Y’
X Y X’ Y’ (X+Y) (X+Y)’ X’*Y’
0 0 1 1 0 1 1
0 1 1 0 1 0 0
1 0 0 1 1 0 0
1 1 0 0 1 0 0
X Y X’ Y’ (X*Y) (X*Y)’ X’+Y’
0 0 1 1 0 1 1
0 1 1 0 0 1 1
1 0 0 1 0 1 1
1 1 0 0 1 0 0
9/21/10
6
DeMorgan’sThereom
Example:Z=A’B’C+A’BC+AB’C+ABC’
Z’=(A+B+C’)(A+B’+C’)(A’…..
9/18/10 (c)S.Fels,since2010 16
BooleanFuncGons
• Now,wehaveeverythingtomakeBooleanFuncGons– F=f(x,y,z…)wherex,y,zetc.arebinaryvalues(0,1)withBooleanoperators
– circuitscanimplementthefuncGon– algebrausedtosimplifythefuncGontomakeiteasiertoimplement
9/18/10 (c)S.Fels,since2010 17
Example• F1=x+y’z
9/18/10 (c)S.Fels,since2010 18
x y z y’z x+y’z
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
9/21/10
7
Example• F1=x+y’z
9/18/10 (c)S.Fels,since2010 19
x y z y’z x+y’z
0 0 0 0 0
0 0 1 1 1
0 1 0 0 0
0 1 1 0 0
1 0 0 0 1
1 0 1 1 1
1 1 0 0 1
1 1 1 0 1
SimplificaGonallowsfordifferentimplementaGons
• F=AB+C(D+E)=requires3levelsofgates
9/18/10 (c)S.Fels,since2010 20
2‐levelimplementaGon
• F=AB+C(D+E)=AB+CD+CE
9/18/10 (c)S.Fels,since2010 21
9/21/10
8
CanonicalForms
• ExpressallBooleanfuncGonsasoneoftwocanonicalforms– enumeratesallcombinaGonsofvariablesaseither• SumofProducts,i.e.,m1+m2+m3…etc• ProductofSums,i.e.,M1M2M3…etc
– eachvariableappearsinnormalform(x)oritscomplement(x’)
– ifitisaproductitiscalledaMINTERM– ifisisasumitiscalledaMAXTERM– nvariables‐>2nMINTERMSorMAXTERMS
9/18/10 (c)S.Fels,since2010 22
CanonicalForms
9/18/10 (c)S.Fels,since2010 23
CanonicalFormExample
9/18/10 (c)S.Fels,since2010 24
9/21/10
9
CanonicalFormExample
9/18/10 (c)S.Fels,since2010 25
m1
m4
m7
m3
m5
m6
m7
CanonicalFormExample:SumofProducts(Minterms)
• SowecanreadoffofTTdirectly• SumofproductsissumofMinterms
F1=m1+m4+m7 =x’y’z+xy’z’+xyz
F2 =m3+m5+m6+m7 =x’yz+xy’z+xyz’+xyz
9/18/10 (c)S.Fels,since2010 26
€
mi∑
CanonicalFormExample
9/18/10 (c)S.Fels,since2010 27
M0
M2
M5
M6
M3
M0
M1
M4
M2
9/21/10
10
CanonicalFormExample:ProductofSums(Maxterms)
• SowecanreadoffofTTdirectly• ProductofsumsisproductofMaxterms
F1=M0M2M3M5M6=(x+y+z)(x+y’+z)(x+y’+z’)(x’+y+z’)(x’+y’+z)
F2=M0M1M2M4=(x+y+z)(x+y+z’)(x+y’+z)(x’+y+z)
9/18/10 (c)S.Fels,since2010 28
€
Mi∏
ConverGngbetweenthem
• YoucanusecomplementanddeMorgan’stheorem– ifF=m1+m3+m5i.e.Σ(1,3,5)then– F’=m0+m2+m4+m6+m7• F=(m0+m2+m4+m6+m7)’
– useDeMorgan’snowtogetProductofSum• F=Π(0,2,4,6,7)
• RemembertoincludeallMinterms/Maxterms– nvariables,2nterms
9/18/10 (c)S.Fels,since2010 29
Standardform• SumofProductswithone,two,threeormorevariablesinproduct
form– F1=y’+xy+x’yz’
• ProductofSumwithone,two,threeormorevariablesinsumform– F2=x(y’+z)(x’+y+z’)
• NoGce:canonicalandstandardformare2‐levelimplementaGons– butmayhavemanyinputsforgate
• calledfan‐in;limitedbypinsonICandmanufacturing
9/18/10 (c)S.Fels,since2010 30
9/21/10
11
OtherlogicaloperaGons
• for2inputgates,youcanhave16differentlogicoperaGons22
nwheren=2
9/20/10 (c)S.Fels,since2010 31
OtherlogicaloperaGons
9/20/10 (c)S.Fels,since2010 32
DigitalLogicGates
9/20/10 (c)S.Fels,since2010 33
9/21/10
12
ExtendingtomulGpleinputs
• worksfinefor– AND,OR;noproblem–commuteandassociate– NAND,NOR–commutebutdon’tassociate• so,becarefulwhenusingthemcascaded• instead:
– definemulG‐inputNANDasmulG‐inputANDthatisinvertedattheend» xNANDyNANDz=(xyz)’
– definemulG‐inputNORasmulG‐inputORthatisinvertedattheend» xNORyNORZ=(x+y+z)’
9/20/10 (c)S.Fels,since2010 34
ExtendingtomulGpleinputs
9/20/10 (c)S.Fels,since2010 35
ExtendingtomulGpleinputs
9/21/10 (c)S.Fels,since2010 36
9/21/10
13
Summary
• two‐valuedBooleanalgebrasupports– switchinglogic– simplificaGonpostulatesandtheorems– digitallogicgates
• TruthtablescanbeusedtodefinefuncGon• CanonicalandstandardformsmakeiteasytocreatefuncGonsthatcanbeimplemented
• finitenumberof2inputgates– easytoimplementlargercomplexfuncGons
• 2inputgatescanbeextendedtomulGpleinputs
9/21/10 (c)S.Fels,since2010 37
9/21/10 (c)S.Fels,since2010 38