17
1

Lecture 8 - Timing Constraints - Imperial College London 8 - Timing Constraints.pdf · FRAME to indicate where the first bit starts. In this example, the sender is triggered on the

Embed Size (px)

Citation preview

1

2

Inthislecture,wewillfirstexaminepracticaldigitalsignals.Thenwewilldiscussthetimingconstraintsindigitalsystems.Theimportantconceptsarerelatedtosetup andhold times ofregistersandhowthese,togetherwithdelaytimeofcombinationalcircuit,determinehowfastadigitalsystemcouldrunat.

3

ShownhereisadigitalsignalproducedbyanARMmicrocontrollerasmeasuredwithadigitaloscilloscope.ThisARMmicrocontrollerusesthe3.3Vlogicstandard,thesameasweusewiththeDE1-SOCboardinExperimentVERI.Thewaveformhasbothovershootsandundershootsimmediatelyaftertherisingandfallingtransitions.Partoftheovershootsareduetothescopeprobe(andtheinductanceinthegroundlead).However,evenon-chipdigitalsignalshavesomedegreeofovershoots.Furthermore,therecouldalsobespurioussignals(i.e.noise)coupledontoanydigitalsignals.Fortunately,digitalsignalsarecharacterisedaslow(‘0’)orhigh(‘1’)bythresholdvoltages.Shownontherightarethedigitalthresholdsdefinedfor5VTTLlogicand3.3Vlogic.Letusconsiderthehighlogiclevelfor3.3Vlogic.Twothresholdvoltagesaredefined:Voh=outputhighthresholdvoltage– alllogiccircuitswithahighoutputwilldriveacircuitnodeat2.4Vorhigher.Vih=inputhighthresholdvoltage– alllogiccircuitswillregardaninputvoltageashigh(‘1’)ifitis2Vorhigher.ThedifferenceVoh– Vih=0.4Visthemarginoferrorbetweenthedrivingcircuitandtheinputcircuit.Itiscalledthenoisemargin.Itistheamountofovershoot,undershootornoisethatcouldbetoleratedonadigitalsignalwirewithoutitbeinginterpretedwronglybythecircuit.Notethat3.3Vlogicisactuallycompatiblewith5VTTLlogic(i.e.theyhavethesamethresholdvoltages).Most3.3Vinputpinsare5Vtolerant,meaningthatitcanwithstandasignalupto5Vwithoutdamagingtheinternalcircuit.

4

Registers(D-FFs)areusedeverywhereindigitalcircuits.Usingregistershastheadvantageof:1)synchronisingallactivitiestoaclocksignal;2)isolate differentpartofthedigitalsystemsbetweenregisters(becausetheregistersblockthesignaluntilthenextactiveedgeoftheclock;3)makestimingconsiderationmucheasiertohandle.Inthecircuitshownhere,theD-flipflopistriggeredontherisingedgeoftheclock.ThevalueinDATAissampledandstored,andkeepasoutputQ.However,forreliableoperations,DATAMUSTBESTABLEsometimebeforetherisingedgeofCLOCK.ThistimeisknownassetuptimetS.ThistimeisneededbecausethereisinternalpropagationoftheDATAsignalwhichmustbetakenintoaccount.Asaresult,fortheD-flipfloptowork,suchinternaldelayisspecifiedastheflipflopsetuptimerequirement.Similarly,DATAMUSTBESTABLEandholdsitsvaluesometimeaftertherisingedgeofCLOCK.ThistimeisknownasholdtimetH.Whathappensifdatachangeswithinthesetup/holdtimewindow?TheQoutputbecomesunknown(couldbe‘1’ or‘0’,oratavoltagelevelthatisbetweenthetwo).EventuallyQwillgoto‘0’ or‘1’,butthetimeittakestoreachthestableQvalueisrandom!Suchastateoftheflipflopisknownasa“metastable” state.

5

Thewaveformsshownhereillustrateswhathappenswhensetuptimeviolationoccurs.TheDataOutsignalbecomesindeterminateforaperiodoftimebeforesettlingdowntoeither0or1.Whywouldthiscausecircuittofail.ThismetastablelogicsignalcouldbecapturedbytwodifferentD-FFs,onecouldresolveitsoutputAto‘1’,andanothercouldresolveitsoutputBto‘0’.Thereforethesamelogicsignalcouldbeinterpretedbythecircuitastwodifferentlogicvalues.MetastabilityisaproblemthatariseswhenanexternalinputNOTsynchronisedtothesystemclockisfedintooursynchronouscircuit.Sincetheinputsignalcouldchangeanytimerelativethetheclockedge,metastabilitywilloccur.Itcouldalsohappenswhenasignalcrossesfromoneclockdomain(Clock1)toanotherclockdomain(Clock2).Toavoidthemetastablesignalcausingerrorinthedigitalsystem,onecoulduseasynchronizationchainasshownbelow.

P could go metastable

Q is synchronised to Clock 2

Setup time of D-FF could be violated

6

Wehavepreviouslydiscussedthedelayincurredbydigitalgates.Evenwires(orPCBtracks)alsohasdelay.Foragivenwire,thereisacharacteristicinductanceLoandcharacteristiccapacitanceCo perunitlength.ThespeedofpropagationofadigitalsignalalongsuchawireisroughlythesquarerootofLoCo.Anotherway,toexpressthespeedofsignalpropagationalongawireoracoaxialcableisintermsofspeedoflight,c=30cm/ns).Thepropagationspeeddependsonthegeometryofthewireandtherelativepermittivityer ofthewire’sinsulation(orthePCBmaterial).Forcoaxcable,thespeedisaround67%ofthatofspeedoflight.Signaltravelsslightlyslower(57%ofspeedoflight)ontracksonPCBwithagroundplane(aPCBthathasanearthedsurfaceononeside).

Agoodruleofthumbisthatadigitalsignaltakesaround1nstotraveladistanceof15cmonaPCB.

7

LetusconsidertwosystemsAandB,andwewanttosenddigitaldatabetweenthem.Theobviousmethodistosendthedigitaldataonebitatatime.Suchserialcommunicationmethodhasmanyadvantages:1)Itisverysimpletodo;2)itonlyneedsveryfewwireslinkingbetweenthetwosystems.Ifthecommunicationisgovernedbyaclocksignal,itisasynchronousbit-serialtransmissionsystem.Hereweneedaclocksignalandadatasignal.Sinceinmostcases,weareinterestedindatathataremorethanonebit(forexample,youmaybeinterestedinablockofdataoccupying,say,134bits).Thisblockofdataisknownasa“frame”.Toidentifywhenaframeofdatastarts,wemayneedanothersignalFRAMEtoindicatewherethefirstbitstarts.

Inthisexample,thesenderistriggeredonthefallingedgeoftheclock,andthereceiver(atB)istriggeredontherisingedgeoftheclock.

8

HereisthetimingdiagramforthedatatravellingfromAtoBviaasynchronousseriallink.CAistheclocksignaltomoduleA.ItalsosupplyCB,butCBisdelayedbytC duetothepropagationfromAtoB.DAchangestP afterthefallingedgeoftheclock.ThepropagationdelayofthedatasignalistD.

9

Inordertoguaranteereliableworkingoftheserialinterfacecircuit,therisingedgeofCBmustbecomestableoutsidethesetuptimewindow(showninlightblue).

10

Inordertoconsiderthetimingconstraintsforthiscircuit,weonlyneedtofocusonthereceivingFFB.Weaskthequestions:1.WhenDBissampledontherisingedgeofCB,isDBstableornot?Theanswertothisquestionproducesthesetuptimerequirementconstraint.HereweconsiderwhatcausesDBtochange(thefallingedgeofCA),andhowlongittakesforthischangetopropagatetoDB(tP +tD).Thenweaddthesetuptimetothis(becauseCBMUSTBESTABLEtS beforetheclockedge).ThismustthenbeshorterthanthetimeawhichDBissampledbyCB.Thatis,thismustoccurontherisingedgeofCB(whichis½T+tC).

2.AfterDBiscapturedbytheFF,willDBholdsitsvaluelongenough?Wenowexamineaftersampling,whenwillDBchangenext.ThisoccursatT+(tP +tD),andproducestheholdtimeconstraint.

11

Letusplugsomenumbersintothesystemhere.NotethattimingconstraintssuchastP maybespecifiedasarangeofvalues.Inthiscase0<tP <10ns.Youmustchoosethemaximumvalue(worstcase)forparametersonleftsideof<,andminimumvalueontherightsideof<.

Herewecancalculatetheminimumperiod(andhencethemaximumfrequency)thatthecircuitcanoperatereliabilitywithoutviolatingeitherthesetuptimeortheholdtimeconstraints.

12

Whendoyouneedtoconsidertheseinequalities?Wheneveryouconsidersequentialcircuitswherethedataand/orclocksignalsarederivedfromthesamesource.

13

NowletusconsidertheVerilogspecificationfora16-bitup-counter.TheredarrowshereindicatesthedelaypathsfromtherisingedgeoftheclocktotheQoutput,thenthroughthelogicblockD=Q+1andyoumustalsoaddinthesetuptimeoftheflipflop.NotehowthiscounterisspecifiedinVerilog.

14

IfyouimplementthisontheCycloneIIIFPGA,youcanusethetiminganalyser,knownasTimeQuest,inQuartustoworkoutthetimingconstraintsforyou.Thisreportsthatthemaximumoperatingfrequencyofthecounteris498.5MHz.However,duetothelimitationsofthepins,themaximumobservablefrequencyis250MHz.Thisisbecausethepinsandpadsofthechipisratherslowerthantheinternallogic.(Thisyear,wewillbeusingCycloneVFPGAandthemaximumfrequencywillbedifferent.)

15

Forthiscircuit,italsoreportsthetimingslack.Wearerunningtheclockat20nsperiodor50MHz.Thenthesetuptimeslackis17.721ns.ThatisDsettlestoitsfinalvalue17.721nsearlierthanitisrequired.Slacktimeisameasureofthemarginyouhavebeforethecircuitstopsworkingreliability.(ValueswillbedifferentforCycloneVthisyear.)

16

Holdtimeslackisreportedheretobe0.57ns.

17