Upload
others
View
10
Download
0
Embed Size (px)
Citation preview
MoreonSequentialLogic
CS64:ComputerOrganizationandDesignLogicLecture#15Winter2019
ZiadMatni,Ph.D.
Dept.ofComputerScience,UCSB
Administrative
• Lab#7– DuenextweekonWednesday3/6– PapercopytosubmitinHFH2ndFloor(CS64box)
2/28/19 Matni,CS64,Wi19 3
Administrative
• TheLast3WeeksofCS64:
2/28/19 Matni,CS64,Wi19 4
Date L# Topic Lab LabDue
2/26 14 CombinatorialLogic,SequentialLogic1 7(CL+SL) Wed.3/6
2/28 15 SequentialLogic23/5 16 FSM1
8(FSM) Wed.3/133/7 17 FSM23/12 18 DigitalLogicReview
9(Ethics) Fri.3/153/14 19 CSEthics&Impact
FinalExamReview
LectureOutline
• MoreonSequentialLogic
• Classexercises
2/28/19 Matni,CS64,Wi19 5
TheGatedDLatch• ThegatedD-Latchisverycommonlyusedinelectroniccircuits
incomputerhardware,especiallyasaregisterbecauseit’sacircuitthatholdsmemory!
WhateverdatayoupresenttotheinputD,
theD-Latchwillholdthatvalue(aslongasinputEis0)
YoucanpresentthisvaluetooutputQassoonasinputEis1.
2/28/19 Matni,CS64,Wi19 6
DE
EnablingtheLatchSynchronously:TheClockedDLatch
• IfyouapplyasynchronousclockoninputE,yougetaclockedDlatch.
• Aclockisaninputthatcyclesfrom1to0,thenbackto1againinasettimeperiod– e.g.:ifaclockinputcyclesthis
inaperiodof1ms,wecallita1MHzclock(1Hz=1/1second)
• Note1:WhenCLKis0,bothSandRinputstothelatchare0too,sotheQoutputholdsitsvaluewhateveritis(Q=Q0)
2/28/19 Matni,CS64,Wi19 7
D
CLK
SR
• Note2:WhenCLKis1:ifD=1,thenQ=1,ifD=0,thenQ=0
ClockedDLatchasDigitalSampler
• Thisclockedlatchcanbeusedasa“programmable”memorydevicethat“samples”aninputonaregularbasis
2/28/19 Matni,CS64,Wi19 8
DCLK
TheClockedDLatchByAnyOtherName…
• Observinginputandoutput“waveforms”
2/28/19 Matni,CS64,Wi19 9
DCLK
SR
DClockedLatch
DCLK
2/28/19 Matni,CS64,Wi19 10
DClockedLatch
DCLK
TheJoysofSampling…
• Samplingdatainaperiodicwayisadvantageous– Icanstartdesigningmorecomplexcircuitsthatcanhelpmedosynchronouslogicalfunctions• Synchronous:in-time
• VeryusefulinpipeliningdesignsusedinCPUs– Pipelining:atechniquethatallowsCPUstoexecuteinstructionsmoreefficiently–inparallel
2/28/19 Matni,CS64,Wi19 11
Instructionfetch,decode,execute,memoryaccess,registerwrite
TheMostEfficientWaytoSampleInputs
• Insteadofsamplingtheinputtothelatchusingaleveloftheclock…– Thatis,whentheclockis“1”(or“0”)
• …sampletheinputattheedgeoftheclock– Thatis,whentheclockistransitioningfrom0à1,calledarisingorpositiveedge(oritcouldbedonefrom1à0, thefallingedgea.k.anegativeedge)
– Why??
2/28/19 Matni,CS64,Wi19 12
TheD-FF
• Whentheinputclockedgeisrising,theinput(D)iscapturedandplacedontheoutput(Q)– Risingedgea.k.apositiveedgeFF– SomeFFarenegativeedgeFF(captureonthefallingedge)
2/28/19 Matni,CS64,Wi19 13
2/28/19 Matni,CS64,Wi19 14
D-FF
D
>CLK
Latchesvs.FFs• Latchescapturedataonanentire1or0oftheclock• FFscapturedataontheedgeoftheclock
– Thisexampleshowsthepositive(0à1)edgeused
Latchout
FFout
2/28/19 Matni,CS64,Wi19 15
FFsgiveoutless“glitchy”outputs
AnImprovementontheLatch:TheDFlip-Flop
Don’tworryaboutthecircuitimplementationdetails,butunderstandtheuse!TheDFlip-Floponlychangestheoutput(Q)intotheinput(D)atthepositiveedge(the0à1transition)oftheclock
2/28/19 Matni,CS64,Wi19 16
DFlip-Flop(D-FF)
D>CLK
DGatedLatch
DCLK
Asopposedto:
Notethe(slight)differenceinthe2symbols…
PopularUsesforD-FFs
• Counter
• Serial-to-Parallelconverter
2/28/19 Matni,CS64,Wi19 17
Again,don’tworryaboutthecircuitimplementationdetails,butunderstandtheuses!
ClassExercise1
2/28/19 Matni,CS64,Wi19 18
ClassExercise2
2/28/19 Matni,CS64,Wi19 19
D QClk Q
A
B
C FClk
GivenwaveformsforA,B,C,andClk(seeblackboard),determinetheoutputwaveformforF
ClassExercise3
• Let’sdesigna3-bitcounterusingD-FFsandlogicgates.
• What’sneeded:– Thiscounts000à001à010à…à111à000
• i.e.from0to7andthenloopsagainto0,etc…
• Todescribethisbehavior,let’sstartwithaT.T.– We’llutilizeK-Maps,ifneededtofigureoutwhatthe“nextstates”looklikebasedon“currentstates”
– We’lltranslatethatintoadigitalcircuitdesign
2/28/19 Matni,CS64,Wi19 20
2/28/19 Matni,CS64,Wi19 21
YOURTO-DOs
• Lab7– DuebackonWednesday– Papercopy–notelectronic– DropoffintheCS64BOXinHFH2ndFloor
2/28/19 Matni,CS64,Wi19 22
2/28/19 Matni,CS64,Wi19 23