You are on page 1of 42

ComputerArchitecture:PartI

FirstSemester2013
DepartmentofComputerScience
FacultyofScience
ChiangMaiUniversity

Outline
LogicGates
BooleanAlgebra
Boolean Algebra
MapSimplification

204231:ComputerOrganizationandArchitecture

Logic Gates
LogicGates
Themanipulationofbinaryinformationis
y g
g
donebylogiccircuitscalledgates.
Eachgatehasadistinctgraphicsymbolandits
operation can be described by means of an
operationcanbedescribedbymeansofan
algebraicexpression.
Theinputoutputrelationshipofthebinary
variables for each gate can be represented in
variablesforeachgatecanberepresentedin
tabularformbyatruthtable.
204231:ComputerOrganizationand
Architecture

Logic Gates
LogicGates
Eachgatehasoneortwobinaryinputvariables
designatedbyAandBandonebinaryoutput
variabledesignatedbyx.
TheANDgate
The AND gate producestheANDlogicfunction:
produces the AND logic function:
thatis,theoutputis1ifinputAandinputBare
both equal to 1; otherwise the output is 0
bothequalto1;otherwise,theoutputis0.
ThealgebraicoperationsymboloftheAND
f
functionisthesameasthemultiplicationsymbol
i i h
h
l i li i
b l
ofordinaryarithmetic.
204231:ComputerOrganizationand
Architecture

Logic Gates
LogicGates
TheORgate producestheinclusiveOR
p
p
function;thatis,theoutputis1ifinputAor
inputBorbothinputsare1;otherwise,the
output is 0
outputis0.
ThealgebraicsymboloftheORfunctionis+,
similartoarithmeticaddition.
i il t
ith ti dditi

204231:ComputerOrganizationand
Architecture

Logic Gates
LogicGates
Theinvertercircuit invertsthelogicsenseofa
y g
binarysignal.
ItproducestheNOT,orcomplement,function.
Thesmallcircleintheoutputofthegraphic
Th
ll i l i h
f h
hi
symbolofaninverterdesignatesalogic
complement.
Atrianglesymbolbyitselfdesignatesabuffer
A triangle symbol by itself designates a buffer
circuit.
204231:ComputerOrganizationand
Architecture

Logic Gates
LogicGates
TheNAND(NOTAND) functionisthe
p
complementoftheANDfunction,asindicated
bythegraphicsymbol,whichconsistsofan
AND graphic symbol followed by a small circle
ANDgraphicsymbolfollowedbyasmallcircle.
TheNORgate isthecomplementoftheOR
gateandusesanORgraphicsymbolfollowed
h
b l f ll
byasmallcircle.

204231:ComputerOrganizationand
Architecture

Logic Gates
LogicGates
TheexclusiveOR gatehasagraphicsymbol
g
p
similartotheORgateexceptforthe
additionalcurvedlineontheinputside.
Theoutputofthisgateis1ifanyinputis1but
The output of this gate is 1 if any input is 1 but
excludesthecombinationwhenbothinputs
are1.
Amorefittingnamefortheexclusive
A more fitting name for the exclusiveOR
OR
operationwouldbeanoddfunction.
204231:ComputerOrganizationand
Architecture

Logic Gates
LogicGates
TheexclusiveNOR isthecomplementofthe
exclusiveOR.
Theoutputofthisgateis1onlyifbothinputs
are equal to 1 or both inputs are equal to 0
areequalto1orbothinputsareequalto0.

204231:ComputerOrganizationand
Architecture

Boolean Algebra
BooleanAlgebra
Booleanalgebraisanalgebrathatdealswith
y
g p
binaryvariablesandlogicoperations.
ABooleanfunctioncanbeexpressed
algebraically with binary variables the logic
algebraicallywithbinaryvariables,thelogic
operationsymbols,parentheses,andequal
sign.
Foragivenvalueofthevariables,theBoolean
For a given value of the variables, the Boolean
functioncanbeeither1or0.
204231:ComputerOrganizationand
Architecture

10

Boolean Algebra
BooleanAlgebra
C
Consider,forexample,theBooleanfunction
id f
l th B l
f ti
F=x+yz
ThefunctionFisequalto1ifxis1orifbothy
andzareequalto1;Fisequalto0otherwise.
Therelationshipbetweenafunctionandits
Th
l i hi b
f
i
di
binaryvariablescanberepresentedinatruth
table.
table
Torepresentafunctioninatruthtableweneeda
list of the 2n combinationsofthenbinary
listofthe2
combinations of the n binary
variables.
204231:ComputerOrganizationand
Architecture

11

Truthtableandlogicdiagramfor
F=x+yz.

204231:ComputerOrganizationandArchitecture

12

Boolean Expression
BooleanExpression
BymanipulatingaBooleanexpression
i l i
l
i
accordingtoBooleanalgebrarules,onemay
obtainasimplerexpressionthatwillrequire
fewergates.
Forexample,
AB
AB+C
+ CD
D+AB
+ AB+C
+ CD
D=AB
AB+C
+ CD
D
NORgate>(x+y)=xy(DeMorganstheorem)
NANDgate>(xy)
NAND gate > (xy)=x
= x+y
+y (DeMorgan
(DeMorgansstheorem)
theorem)

204231:ComputerOrganizationand
Architecture

13

Two graphic symbols for NOR gate


TwographicsymbolsforNORgate

204231:ComputerOrganizationandArchitecture

14

Two graphic symbols for NAND gate


TwographicsymbolsforNANDgate

204231:ComputerOrganizationandArchitecture

15

Twologicdiagramsforthesame
Booleanfunction

204231:ComputerOrganizationandArchitecture

16

Boolean algebra manipulation


Booleanalgebramanipulation
F=ABC+ABC+AC
=AB(C+C
AB (C + C))+A
+ AC
C
=AB+AC
Notethat(C+C)=1andAB.1=AB
Thelogicdiagramofthesimplifiedexpression
The logic diagram of the simplified expression
requiresonlyfourgatesratherthanthesix
gatesusedinthecircuitofFig.(a).
t
d i th i it f Fi ( )
204231:ComputerOrganizationand
Architecture

17

Twologicdiagramsforthesame
Booleanfunction

204231:ComputerOrganizationandArchitecture

18

Thegeneralformof
DeMorganstheorem
((x1 +x2 +x3 + +xn) =x1x
2x
3x
n
((x1x2x3xn)) =x1 +x2 +x3 + +xn
ThisisdonebychangingallORoperationsto
AND operations and all AND operations to OR
ANDoperationsandallANDoperationstoOR
operationsandthencomplementingeach
individual letter variable
individuallettervariable.
Asanexample,
F=AB+CD+BD

F=(A+B)(C+D)(B+D)
204231:ComputerOrganizationandArchitecture

19

Map Simplification
MapSimplification
Theexpressionmaybesimplifiedusingthebasic
h
i
b i lifi d i
h b i
relationsofBooleanalgebra.
However,thisprocedureissometimesdifficult
becauseitlacksspecificrulesforpredictingeach
succeedingstepinthemanipulativeprocess.
Themapmethodprovidesasimple,
straightforwardprocedureforsimplifying
Booleanexpressions.
ThemapmethodisalsoknownastheKarnaugh
map orKmap.
204231:ComputerOrganizationand
Architecture

20

Map Simplification
MapSimplification
Themapisadiagrammadeupofsquares,
q
p
g
witheachsquarerepresentingoneminterm.
Thesquarescorrespondingtomintermsthat
produce 1 for the function are marked by a 1
produce1forthefunctionaremarkedbya1
andtheothersaremarkedbya0orareleft
empty.

204231:ComputerOrganizationand
Architecture

21

Mapsfortwo,three,and
fourvariablefunctions

204231:ComputerOrganizationandArchitecture

22

Mapsfortwo,three,and
fourvariablefunctions

204231:ComputerOrganizationandArchitecture

23

Mapsfortwo,three,and
fourvariablefunctions

204231:ComputerOrganizationandArchitecture

24

Map Simplification
MapSimplification
Mintermsofadjacentsquaresinthemapare
i
f dj
i h
identicalexceptforonvariable.
Accordingtothisdefinitionofadjacency,the
squaresattheextremeendsofthesame
horizontalrowarealsotobeconsidered
adjacent.
Thesameappliestothetopandbottomsquares
ofacolumn.
Asaresult,thefourcornersquaresofamap
j
mustalsobeconsideredtobeadjacent.
204231:ComputerOrganizationand
Architecture

25

Map Simplification
MapSimplification
ABooleanfunctionrepresentedbyatruth
p
p y
g
tableisplottedintothemapbyinserting1sin
thosesquaredwherethefunctionis1.
Thesquarescontaining1
The squares containing 1ssarecombinedin
are combined in
groupsofadjacentsquares.
Thesegroupsmustcontainanumberof
squares that is an integral power of 2.
squaresthatisanintegralpowerof2.

204231:ComputerOrganizationand
Architecture

26

Map Simplification
MapSimplification
Groupsofcombinedadjacentsquaresmay
q
shareoneormoresquareswithoneormore
groups.
Eachgroupofsquaresrepresentsanalgebraic
Each group of squares represents an algebraic
term,andtheORofthosetermsgivesthe
simplifiedalgebraicexpressionforthe
lf
l b
f h
function.

204231:ComputerOrganizationand
Architecture

27

Map for F(A B C) = (3 4 6 7)


MapforF(A,B,C)=(3,4,6,7)

F=BC+AC
204231:ComputerOrganizationandArchitecture

28

Map for F(A B C) = (0 2 4 5 6)


MapforF(A,B,C)=(0,2,4,5,6)

F=C +AB
204231:ComputerOrganizationandArchitecture

29

Map for F(A B C D) = (0 1 2 6 8 9 10)


MapforF(A,B,C,D)=(0,1,2,6,8,9,10)

F =B
F
BD
D +B
BC
C +A
ACD
CD
204231:ComputerOrganizationandArchitecture

30

ProductofSums Simplification
ProductofSumsSimplification
The1sinthemaprepresentthemintermsthat
produce1forthefunction.
Thesquaresnotmarkedby1representthe
minterms that produce 0 for the function.
mintermsthatproduce0forthefunction.
Ifwemarktheemptysquareswith0sand
combinethemintogroupsofadjacentsquares,
bi th
i t
f dj
t
weobtainthecomplementofthefunction,F.
TakingthecomplementofFproducesan
p
p
expressionforFinproductofsumsform.
204231:ComputerOrganizationand
Architecture

31

Map for F(A B C) = (0 1 2 5 8 9 10)


MapforF(A,B,C)=(0,1,2,5,8,9,10)

SumofProduct:F=BD+BC+ACD
204231:ComputerOrganizationandArchitecture

32

Map for F(A B C) = (0 1 2 5 8 9 10)


MapforF(A,B,C)=(0,1,2,5,8,9,10)
C
Combiningthesquareswith1sgivesthe
bi i
h
i h 1 i
h
simplifiedfunctioninsumofproductsform
F=BD+BC+ACD
Ifthesquaremarkedwith0sarecombined,we
q
obtainthesimplifiedcomplementedfunction:
FF =AB
AB +CD
CD +BD
BD
TakingthecomplementofF,weobtainthe
simplified function in productofsums
simplifiedfunctioninproduct
of sumsform
form
F=(A +B)(C +D)(B +D)
204231:ComputerOrganizationandArchitecture

33

Logic diagrams with AND and ORgates


LogicdiagramswithANDand
OR gates

204231:ComputerOrganizationandArchitecture

34

Logic diagrams with AND and ORgates


LogicdiagramswithANDand
OR gates

204231:ComputerOrganizationandArchitecture

35

Logic diagrams with NAND or NOR gates


LogicdiagramswithNANDorNORgates

204231:ComputerOrganizationandArchitecture

36

Logic diagrams with NAND or NOR gates


LogicdiagramswithNANDorNORgates

204231:ComputerOrganizationandArchitecture

37

DontCare
Don
tCareConditions
Conditions
Sincethefunctionmaybeeither0or1,wesay
thatwedontcarewhatthefunctionoutputisto
beforthisminterm.
Mintermsthatmayproduceeither0or1forthe
Minterms that may produce either 0 or 1 for the
functionaresaidtobedontcareconditionsand
are marked with an x in the map
aremarkedwithanxinthemap.
Whenchoosingadjacentsquaresforthefunction
i h
inthemap,thexsmaybeassumedtobeeither0
h
b
d b ih 0
or1,whichevergivesthesimplestexpression.
204231:ComputerOrganizationand
Architecture

38

Example of map with dontcare


Exampleofmapwithdon
tcareconditions
conditions
F(A,B,C)=(0,2,6)
d(A,B,C)
d(A, B, C) =(1,3,5)
(1, 3, 5)
ThemintermslistedwithFproducea1forthe
f
function.
i
Thedontcaremintermslistedwithdmay
y
produceeithera0ora1forthefunction.

204231:ComputerOrganizationandArchitecture

39

Example of map with dontcare


Exampleofmapwithdon
tcareconditions
conditions

204231:ComputerOrganizationandArchitecture

40

Example of map with dontcare


Exampleofmapwithdon
tcareconditions
conditions
ThesimplifiedexpressionisF=A +BC
Notethatdon
Note that dontcare
t careminterm5wasnot
minterm 5 was not
includedbecauseitdoesnotcontributetothe
simplification of the expression
simplificationoftheexpression.
ThusthisexpressionrepresenttheBoolean
functionF(A,B,C)=(0,1,2,3,6)

204231:ComputerOrganizationandArchitecture

41

Reference
M.Moris Mano,ComputerSystem
Architecture,3rd ed.NJ:PrenticeHall,1992.

204231:ComputerOrganizationandArchitecture

42