26
10/13/10 1 Combina-onal Logic Chapter 4 EECE 256 Dr. Sidney Fels Steven Oldridge Topics Combina-onal circuits Combina-onal analysis Design procedure simple combined to make complex adders, subtractors, converters decoders, mul-plexers comb. design with decoders and muxes 10/13/10 2 (c) S. Fels, since 2010 Combina-on Circuit Output depends only on present value of input 10/13/10 (c) S. Fels, since 2010 3 NOTE: No Memory or feedback paths

Combinaonal Logic Chapter 4 Topics

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Combinaonal Logic Chapter 4 Topics

10/13/10

1

Combina-onalLogicChapter4

EECE256Dr.SidneyFels

StevenOldridge

Topics

•  Combina-onalcircuits•  Combina-onalanalysis

•  Designprocedure– simplecombinedtomakecomplex– adders,subtractors,converters– decoders,mul-plexers•  comb.designwithdecodersandmuxes

10/13/10 2(c)S.Fels,since2010

Combina-onCircuit

•  Outputdependsonlyonpresentvalueofinput

10/13/10 (c)S.Fels,since2010 3

NOTE:NoMemoryorfeedbackpaths

Page 2: Combinaonal Logic Chapter 4 Topics

10/13/10

2

Combina-onCircuit

•  Whathappensifweaddmemory?

10/13/10 (c)S.Fels,since2010 4

Combina-onCircuit

•  Whathappensifweaddmemory?

10/13/10 (c)S.Fels,since2010 5

MemoryElements

Calleda:Sequen&alCircuit‐outputfunc-onofinputandmemory‐changesover-me

Combina-onCircuit

•  We’llfocusoncombina-onaldesignfirst– usefulfordesigninghowmemorywillchangewhenmakingsequen-alcircuits

10/13/10 (c)S.Fels,since2010 6

Page 3: Combinaonal Logic Chapter 4 Topics

10/13/10

3

Combina-onalAnalysis

•  Some-mesneedto:–  confirmcircuitdoeswhatitissupposedto–  reverseengineercircuit

•  Steps(startatinputandworktooutputs):1.  labelalloutputsthatarefn’ofinputsandderiveBoolean

expression2.  labelalloutputsthatfn’ofinputsandlabelsdoneinstep

1andderiveBooleanexpressions3.  repeatun-lalloutputshaveBooleanfn’4.  usesubs-tu-ontogetBooleanfn’basedonlyoninputs

•  fillintruthtable

10/13/10 (c)S.Fels,since2010 7

Combina-onalAnalysis

10/13/10 (c)S.Fels,since2010 8

F2=AB+AC+BCT2=ABCT1=A+B+C

Combina-onalAnalysis

10/13/10 (c)S.Fels,since2010 9

T3=T1F2’F1=T2+T3

Page 4: Combinaonal Logic Chapter 4 Topics

10/13/10

4

Combina-onalAnalysis

10/13/10 (c)S.Fels,since2010 10

F1=ABC+T1F2’;con-nuesubs-tu-ngF1=A’BC’+A’B’C+AB’C’+ABC

Combina-onalDesign

1.  Determinethenumberofinputsandoutputs2.  Assignsymbols

3.  Derivethetruthtable4.  Obtainsimplifiedfunc-onsforeachoutput

5.  Drawthelogicdiagram

10/13/10 (c)S.Fels,since2010 11

Adders

•  mostfundamentalunitincomputer•  addtwonumbers

•  let’sstartwithbinary…

10/13/10 (c)S.Fels,since2010 12

Page 5: Combinaonal Logic Chapter 4 Topics

10/13/10

5

½AdderDesign

•  Step1–#ofinputsandoutputs–  let’sstartwith½adderfirst•  i.e.let’snotworryaboutcarryinjustyet

10/13/10 (c)S.Fels,since2010 13

0 0 1 1

+ 0 1 0 1

sum 0 1 1 0

carryout 0 0 0 1

½AdderDesign

•  Step2–Assignsymbolnames

10/13/10 (c)S.Fels,since2010 14

0 0 1 1

+ 0 1 0 1

sum 0 1 1 0

carryout 0 0 0 1

ABSC

½AdderDesign

•  Step3–DeriveTruthTable

10/13/10 (c)S.Fels,since2010 15

0 0 1 1

+ 0 1 0 1

sum 0 1 1 0

carryout 0 0 0 1

ABSC

A B S C

0 0 0 0

0 1 1 0

1 0 1 0

1 1 0 1

Page 6: Combinaonal Logic Chapter 4 Topics

10/13/10

6

½AdderDesign

•  Step4–Derivesimplifiedform– usek‐maps,BooleanAlgrebra,etc.

10/13/10 (c)S.Fels,since2010 16

0 0 1 1

+ 0 1 0 1

sum 0 1 1 0

carryout 0 0 0 1

ABSC

A B S C

0 0 0 0

0 1 1 0

1 0 1 0

1 1 0 1

S=A+BC=AB

½AdderDesign

•  Step5–Drawcircuitdiagram

10/13/10 (c)S.Fels,since2010 17

0 0 1 1

+ 0 1 0 1

sum 0 1 1 0

carryout 0 0 0 1

ABSC

A B S C

0 0 0 0

0 1 1 0

1 0 1 0

1 1 0 1

S=A+BC=AB

AB

FullAdder

•  Weneedtoworryaboutpossiblecarry‐inthough

•  Sameprocedure–  input:x,y,Cin– output:SandCout– findTT

10/13/10 (c)S.Fels,since2010 18

x y Cin S Cout

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

Page 7: Combinaonal Logic Chapter 4 Topics

10/13/10

7

FullAdder

•  Weneedtoworryaboutpossiblecarry‐inthough

•  Sameprocedure–  input:x,y,Cin– output:SandCout– findTT

10/13/10 (c)S.Fels,since2010 19

x y Cin S Cout

0 0 0 0 0

0 0 1 1 0

0 1 0 1 0

0 1 1 0 1

1 0 0 1 0

1 0 1 0 1

1 1 0 0 1

1 1 1 1 1

FullAdder

•  DeriveBooleanexpressions

10/13/10 (c)S.Fels,since2010 20

x y Cin

S Cout

0 0 0 0 0

0 0 1 1 0

0 1 0 1 0

0 1 1 0 1

1 0 0 1 0

1 0 1 0 1

1 1 0 0 1

1 1 1 1 1

S=x’y’Cin+x’yCin’+xy’Cin’+xyCin

Cout=xy+xCin+yCin

yCin yCin

Cin CinS Cout

FullAdder

•  DeriveBooleanexpressions

10/13/10 (c)S.Fels,since2010 21

x y Cin

S Cout

0 0 0 0 0

0 0 1 1 0

0 1 0 1 0

0 1 1 0 1

1 0 0 1 0

1 0 1 0 1

1 1 0 0 1

1 1 1 1 1

S=x’y’Cin+x’yCin’+xy’Cin’+xyCin=(x+y)+Cin

Cout=xy+xCin+yCin=(x+y)Cin+xy

yCin yCin

Cin CinS Cout

Page 8: Combinaonal Logic Chapter 4 Topics

10/13/10

8

FullAdder

•  xxx

10/13/10 (c)S.Fels,since2010 22

½adder

½adder

xy

Cin

S

C

S

C

SCout

FA

Cascadethemfor4‐bitAdder

10/13/10 (c)S.Fels,since2010 23

Cascadethemforaparallel4‐bitAdder

10/13/10 (c)S.Fels,since2010 24

Howbigisthetruthtable?

What’stheproblemwiththiscircuit?

ripplecarryadder

Page 9: Combinaonal Logic Chapter 4 Topics

10/13/10

9

Canwefixthis?

•  weneedtocomputecarrybitsinparallelratherthancascade

•  Then,usesome½adderswithextracircuitstofixthesumdependinguponthecomputedcarries

10/13/10 (c)S.Fels,since2010 25

n‐bitCarrylook‐aheadAdder

•  Recallthatforthedesignoftheparalleladdertowork,thesignalmustpropagatethroughthegatesbeforethecorrectoutputsumisavailable.

•  Totalpropaga&on&me=propaga&ondelayofatypicalgatexthenumberofgates

•  Let’slookatS3.–  InputsA3andB3areavailableimmediately.

–  However,C3isavailableonlyagerC2isavailable.–  C2hastowaitforC1,etc.

10/13/10 (c)S.Fels,since2010 26

n‐bitCarrylook‐aheadAdder

•  ThenumberofgatelevelsforthecarrytopropagateisfoundfromtheFAcircuit

10/13/10 (c)S.Fels,since2010 27

propaga-ondelay

Page 10: Combinaonal Logic Chapter 4 Topics

10/13/10

10

n‐bitCarrylook‐aheadAdder

•  let’slookateachstagetoseehowweknowwhatthecarryis

•  Pi=Ai+Bi(carryprop)•  Gi=AiBi(carrygenerate)

•  Si=Pi+Ci•  Ci+1=Gi+PiCi

10/13/10 (c)S.Fels,since2010 28

n‐bitCarrylook‐aheadAdder

•  let’slookateachstagetoseehowweknowwhatthecarryis

•  Pi=Ai+Bi(carryprop)•  Gi=AiBi(carrygenerate)

•  Si=Pi+Ci•  Ci+1=Gi+PiCi

10/13/10 (c)S.Fels,since2010 29

Now,calculateeachstage’sCarryintermsofCin(i.e.C0)andPsorGs.

n‐bitCarrylook‐aheadAdder

•  C0=Cin•  C1=G0+P0C0•  C2=

•  C3=

10/13/10 (c)S.Fels,since2010 30

Page 11: Combinaonal Logic Chapter 4 Topics

10/13/10

11

n‐bitCarrylook‐aheadAdder

•  C0=Cin•  C1=G0+P0C0•  C2=G1+P1C1=G1+P1(G0+P0C0)

=G1+P1G0+P1P0C0•  C3=

10/13/10 (c)S.Fels,since2010 31

n‐bitCarrylook‐aheadAdder

•  C0=Cin•  C1=G0+P0C0•  C2=G1+P1C1=G1+P1(G0+P0C0)

=G1+P1G0+P1P0C0•  C3=G2+P2C2=G2+P2(G1+P1G0+P1P0C0)

=G2+P2G1+P1P2G0+P2P1P0C0

10/13/10 (c)S.Fels,since2010 32

So,allcarriesarenowcomputedinP2,GsandC0

Carrylook‐aheadcircuit

10/13/10 (c)S.Fels,since2010 33

Page 12: Combinaonal Logic Chapter 4 Topics

10/13/10

12

4bitCarrylook‐aheadAdder

•  Pi=Ai+Bi•  Gi=AiBi

•  Si=Pi+Ci

10/13/10 (c)S.Fels,since2010 34

Whatispropaga-ondelay?

BinarySubtractor

•  Howtomakeabinarysubtractor?

10/13/10 (c)S.Fels,since2010 35

BinarySubtractor

•  Howtomakeabinarysubtractor?–  remember:2’scomplementconvertssubtrac-onintoaddi-on

– so,whenwewanttosubtract,•  maketheinputa2’scomplementnumber•  andadd

– checkforoverflow– 2’scomplement?

–  invertthebits+1

10/13/10 (c)S.Fels,since2010 36

Page 13: Combinaonal Logic Chapter 4 Topics

10/13/10

13

4‐bitBinarysubtractor

10/13/10 (c)S.Fels,since2010 37

FA FA FA FA

B3 A3 B2 A2 B1 A1 B0 A0

1

D3 D2 D1 D0

Cout

A‐B

Whataboutoverflow?• ifunsigned–ifB>A;lookatCout• ifsigned–ifA+veandB–veorA–veandB+ve

‐lookatCoutandsignbit(C3)–shouldbesame

Thisisreallyaborrownow

C3 C2 C1

overflow

10/13/10 (c)S.Fels,since2010 38

0 0 1 1

‐ 1 0 1 1

3

11

‐8

unsigned

case1:A,Bunsigned:B>Aandresult<‐7

0 0 1 1

+ 0 1 0 1

1 1 0 0 0

3

2’scompof11

‐8

unsigned

overflow

10/13/10 (c)S.Fels,since2010 39

1 0 1 0

‐ 0 1 1 0

‐6

‐(+6)

‐12–but4bitsonly‐7to+7

signed

1 0 1 0

+ 1 0 1 0

‐6

+(2’Scomplementof+6)

case2‐signed:ais–ve,bis+ve;result<‐7,i.e.‐6–(+6)

Page 14: Combinaonal Logic Chapter 4 Topics

10/13/10

14

overflow

10/13/10 (c)S.Fels,since2010 40

0 1 1 0

‐ 1 0 1 0

+6

‐(‐6)

+12–but4bitsonly‐7to+7

signed

0 1 1 0

+ 0 1 1 0

+6

+(2’Scomplementof‐6)

case3‐signed:ais+ve,bis‐ve;result>+7,i.e.6–(‐6)

4‐bitBinaryadder/subtractor

•  Wecanputthistogethertomakeamorefunc-onalelement– M=modeforadd(0)orsubtract(1)

10/13/10 (c)S.Fels,since2010 41

4‐bitBinaryadder/subtractor

10/13/10 (c)S.Fels,since2010 42

Page 15: Combinaonal Logic Chapter 4 Topics

10/13/10

15

DesignofaBCDAdder

•  Addtwodecimalnumbers–  (0‐9)+(0‐9)+(1)=0‐19‐don’tforgetcarry

•  Howtobegin?–  truthtable– canweuseexis-ngcircuit•  binaryadder?

10/13/10 (c)S.Fels,since2010 43

DesignofaBCDAdder

10/13/10 (c)S.Fels,since2010 44

Ifwejustputdecimalnumbersin,italmostworks…

BCDadderTT

10/13/10 (c)S.Fels,since2010 45

Page 16: Combinaonal Logic Chapter 4 Topics

10/13/10

16

BCDadderTT

10/13/10 (c)S.Fels,since2010 46

sameasbinaryrepn

needdecimalcarry

BCDadderTT

10/13/10 (c)S.Fels,since2010 47

sameasbinaryrepn

needdecimalcarry

Z8Z4

Z8Z2

K4

C=K+Z8Z4+Z8Z2

BCDadderTT

10/13/10 (c)S.Fels,since2010 48

ifC=1;needtoadd6totheBinarysum‐soweneedanotherbinaryadder

So,wecannowdrawcircuitaswehaveCandfinalSum

Page 17: Combinaonal Logic Chapter 4 Topics

10/13/10

17

BCDadderdesign

10/13/10 (c)S.Fels,since2010 49

BCDadderdesign

10/13/10 (c)S.Fels,since2010 50

Decoders

•  Abinarycodeofnbitscanrepresent2n

dis-nctcombina-ons(orunique“cases”).

•  Decoder:acombina-onalcircuitthatconvertsnbinarylinesinto2nuniqueoutputlines

•  Example:a3‐to‐8linedecoder–  3inputsaredecodedto8outputs–

represen-ngthe8minterms

10/13/10 (c)S.Fels,since2010 51

Minterms

Page 18: Combinaonal Logic Chapter 4 Topics

10/13/10

18

Decoders

•  Abinarycodeofnbitscanrepresent2n

dis-nctcombina-ons(orunique“cases”).

•  Decoder:acombina-onalcircuitthatconvertsnbinarylinesinto2nuniqueoutputlines

•  Example:a3‐to‐8linedecoder–  3inputsaredecodedto8outputs–

represen-ngthe8minterms

10/13/10 (c)S.Fels,since2010 52

Minterms

3x8Decoder

D0

D7

xyz

Decoderdesign

10/13/10 (c)S.Fels,since2010 53

Inputs Outputs

x y z D0 D1 D2 D3 D4 D5 D6 D7

0 0 0 1 0 0 0 0 0 0 0

0 0 1 0 1 0 0 0 0 0 0

0 1 0 0 0 1 0 0 0 0 0

0 1 1 0 0 0 1 0 0 0 0

1 0 0 0 0 0 0 1 0 0 0

1 0 1 0 0 0 0 0 1 0 0

1 1 0 0 0 0 0 0 0 1 0

1 1 1 0 0 0 0 0 0 0 1

Decodertruthtable

10/13/10 (c)S.Fels,since2010 54

Inputs Outputs

x y z D0 D1 D2 D3 D4 D5 D6 D7

0 0 0 1 0 0 0 0 0 0 0

0 0 1 0 1 0 0 0 0 0 0

0 1 0 0 0 1 0 0 0 0 0

0 1 1 0 0 0 1 0 0 0 0

1 0 0 0 0 0 0 1 0 0 0

1 0 1 0 0 0 0 0 1 0 0

1 1 0 0 0 0 0 0 0 1 0

1 1 1 0 0 0 0 0 0 0 1

Page 19: Combinaonal Logic Chapter 4 Topics

10/13/10

19

DecoderwithNAND

10/13/10 (c)S.Fels,since2010 55

NANDDecoderwithenable

10/13/10 (c)S.Fels,since2010 56

Nowwecancombinethemtogetbiggerones.

CombiningDecoders

10/13/10 (c)S.Fels,since2010 574x16Decoder–checkspecswhetherinvertedornot

Page 20: Combinaonal Logic Chapter 4 Topics

10/13/10

20

BooleanFunc-onswithDecoders

•  sincewehaveallmintermsitiseasytocombinethemforourBooleanfunc-ons

•  Forexample:– S=Σ(1,2,4,7)– C=Σ(3,5,6,7)

10/13/10 (c)S.Fels,since2010 58

BooleanFunc-onwithDecoders

10/13/10 (c)S.Fels,since2010 59

Encoders

•  Inverseopera-onofadecoder–  Ithas2ninputsandgeneratesncodewords

•  Example:Designa8x3encoder

10/13/10 (c)S.Fels,since2010 60

Page 21: Combinaonal Logic Chapter 4 Topics

10/13/10

21

8x3Encoders

10/13/10 (c)S.Fels,since2010 61

X=D4+D5+D6+D7Y=D2+D3+D6+D7Z=D1+D3+D5+D7

8x3Encoders

10/13/10 (c)S.Fels,since2010 62

X=D4+D5+D6+D7Y=D2+D3+D6+D7Z=D1+D3+D5+D7

What’stheproblemhere?

PriorityEncoder

•  Fortheotherinputsuseprioritytodetermineoutput–  i.e.D3takespriorityoverD2;D2overD1etc.

10/13/10 (c)S.Fels,since2010 63

Page 22: Combinaonal Logic Chapter 4 Topics

10/13/10

22

PriorityEncoder

10/13/10 (c)S.Fels,since2010 64

PriorityEncoder

10/13/10 (c)S.Fels,since2010 65

No-ce,wecanusethedon’tcarestodesignthis.

1

PriorityEncoder

10/13/10 (c)S.Fels,since2010 66

Page 23: Combinaonal Logic Chapter 4 Topics

10/13/10

23

Mul-plexers

•  Amul-plexerselectsoneofmanyinputsanddirectsittotheoutput.

•  Theselec-onmaybecontrolledby“selectlines”

•  Normally2ninputlines:nselectlines

10/13/10 (c)S.Fels,since2010 67

Transmissionline

ch1ch2

chn

Mul-plexers•  Example:2x1mul-plexer

•  Howtodesign?–  let’sdesign4x1MUX–  coderedirectsinput

•  useANDgatewithminterm•  likedecoderwithANDgate

10/13/10 (c)S.Fels,since2010 68

4x1MUX

10/13/10 (c)S.Fels,since2010 69

Page 24: Combinaonal Logic Chapter 4 Topics

10/13/10

24

UsingMUXesforBooleanfunc-ons

•  Useamul-plexertoimplementthefollowingfunc-on:– F=x’y’z+x’yz’+xy’z+xyz

•  Idea:– no-cethatMUXisadecoder+ORgate

– usetheselectortodirectcorrectvaluetooutput

10/13/10 (c)S.Fels,since2010 70

UsingMUXesforBooleanfunc-ons

•  Example– F(x,y,z)=Σ(1,2,6,7)

10/13/10 (c)S.Fels,since2010 71

UsingMUXesforBooleanfunc-ons

•  Example– F(x,y,z)=Σ(1,2,6,7)

10/13/10 (c)S.Fels,since2010 72

Page 25: Combinaonal Logic Chapter 4 Topics

10/13/10

25

UsingMUXesforBooleanfunc-ons

10/13/10 (c)S.Fels,since2010 73

UsingMUXforBooleanFn’

•  DesignaFull‐adder– S(x,y,z)=Σ(1,2,4,7);C(x,y,z)=Σ(1,2,4,7)

10/13/10 (c)S.Fels,since2010 74

x y z S C

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

UsingMUXforBooleanFn’

•  DesignaFull‐adder– S(x,y,z)=Σ(1,2,4,7);C(x,y,z)=Σ(3,5,6,7)

10/13/10 (c)S.Fels,since2010 75

x y z S C

0 0 0 0 0

0 0 1 1 0

0 1 0 1 0

0 1 1 0 1

1 0 0 1 0

1 0 1 0 1

1 1 0 0 1

1 1 1 1 1

Page 26: Combinaonal Logic Chapter 4 Topics

10/13/10

26

UsingMUXforBooleanFn’

•  DesignaFull‐adder– S(x,y,z)=Σ(1,2,4,7);C(x,y,z)=Σ(3,5,6,7)

10/13/10 (c)S.Fels,since2010 76

x y z S C Sm Cm0 0 0 0 0 z 0

0 0 1 1 0 z 0

0 1 0 1 0 z’ z

0 1 1 0 1 z’ z

1 0 0 1 0 z’ z

1 0 1 0 1 z’ z

1 1 0 0 1 z 1

1 1 1 1 1 z 1

SCz

z’ z

z

0

z

z’

Summary

•  Combina-onalcircuits•  Combina-onalanalysis

•  Designprocedure– simplecombinedtomakecomplex– adders,subtractors,converters– decoders,mul-plexers•  comb.designwithdecodersandmuxes

10/13/10 (c)S.Fels,since2010 77