Simulation and Synthesis Techniques for Asynchrono

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

ExpertVerilog,SystemVerilog&SynthesisTrainingSimulationandSynthesisTechniquesforAsynchronousFIFODesignCliffordE.Cummings,SunburstDesign,Inc.cliffc@sunburst-design.comABSTRACTFIFOsareoftenusedtosafelypassdatafromoneclockdomaintoanotherasynchronousclockdomain.UsingaFIFOtopassdatafromoneclockdomaintoanotherclockdomainrequiresmulti-asynchronousclockdesigntechniques.TherearemanywaystodesignaFIFOwrong.TherearemanywaystodesignaFIFOrightbutstillmakeitdifficulttoproperlysynthesizeandanalyzethedesign.Thispaperwilldetailonemethodthatisusedtodesign,synthesizeandanalyzeasafeFIFObetweendifferentclockdomainsusingGraycodepointersthataresynchronizedintoadifferentclockdomainbeforetestingforFIFOfullorFIFOemptyconditions.Thefullycoded,synthesizedandanalyzedRTLVerilogmodel(FIFOStyle#1)isincluded.Post-SNUGEditorialCommentAsecondFIFOpaperbythesameauthorwasvoted“BestPaper-1stPlace”bySNUGattendees,islistedasreference[3]andisalsoavailablefordownload.SNUGSanJose2002SimulationandSynthesisTechniquesforRev1.2AsynchronousFIFODesign21.0IntroductionAnasynchronousFIFOreferstoaFIFOdesignwheredatavaluesarewrittentoaFIFObufferfromoneclockdomainandthedatavaluesarereadfromthesameFIFObufferfromanotherclockdomain,wherethetwoclockdomainsareasynchronoustoeachother.AsynchronousFIFOsareusedtosafelypassdatafromoneclockdomaintoanotherclockdomain.TherearemanywaystodoasynchronousFIFOdesign,includingmanywrongways.MostincorrectlyimplementedFIFOdesignsstillfunctionproperly90%ofthetime.Mostalmost-correctFIFOdesignsfunctionproperly99%+ofthetime.Unfortunately,FIFOsthatworkproperly99%+ofthetimehavedesignflawsthatareusuallythemostdifficulttodetectanddebug(ifyouareluckyenoughtonoticethebugbeforeshippingtheproduct),orthemostcostlytodiagnoseandrecall(ifthebugisnotdiscovereduntiltheproductisinthehandsofadissatisfiedcustomer).ThispaperdiscussesoneFIFOdesignstyleandimportantdetailsthatmustbeconsideredwhendoingasynchronousFIFOdesign.Therestofthepapersimplyreferstoan“asynchronousFIFO”asjust“FIFO.”2.0PassingmultipleasynchronoussignalsAttemptingtosynchronizemultiplechangingsignalsfromoneclockdomainintoanewclockdomainandinsuringthatallchangingsignalsaresynchronizedtothesameclockcycleinthenewclockdomainhasbeenshowntobeproblematic[1].FIFOsareusedindesignstosafelypassmulti-bitdatawordsfromoneclockdomaintoanother.DatawordsareplacedintoaFIFObuffermemoryarraybycontrolsignalsinoneclockdomain,andthedatawordsareremovedfromanotherportofthesameFIFObuffermemoryarraybycontrolsignalsfromasecondclockdomain.Conceptually,thetaskofdesigningaFIFOwiththeseassumptionsseemstobeeasy.ThedifficultyassociatedwithdoingFIFOdesignisrelatedtogeneratingtheFIFOpointersandfindingareliablewaytodeterminefullandemptystatusontheFIFO.2.1SynchronousFIFOpointersForsynchronousFIFOdesign(aFIFOwherewritesto,andreadsfromtheFIFObufferareconductedinthesameclockdomain),oneimplementationcountsthenumberofwritesto,andreadsfromtheFIFObuffertoincrement(onFIFOwritebutnoread),decrement(onFIFOreadbutnowrite)orhold(nowritesandreads,orsimultaneouswriteandreadoperation)thecurrentfillvalueoftheFIFObuffer.TheFIFOisfullwhentheFIFOcounterreachesapredeterminedfullvalueandtheFIFOisemptywhentheFIFOcounteriszero.Unfortunately,forasynchronousFIFOdesign,theincrement-decrementFIFOfillcountercannotbeused,becausetwodifferentandasynchronousclockswouldberequiredtocontrolthecounter.TodeterminefullandemptystatusforanasynchronousFIFOdesign,thewriteandreadpointerswillhavetobecompared.2.2AsynchronousFIFOpointersInordertounderstandFIFOdesign,oneneedstounderstandhowtheFIFOpointerswork.Thewritepointeralwayspointstothenextwordtobewritten;therefore,onreset,bothpointersaresettozero,whichalsohappenstobethenextFIFOwordlocationtobewritten.OnaFIFO-writeoperation,thememorylocationthatispointedtobythewritepointeriswritten,andthenthewritepointerisincrementedtopointtothenextlocationtobewritten.Similarly,thereadpointeralwayspointstothecurrentFIFOwordtoberead.Againonreset,bothpointersareresettozero,theFIFOisemptyandthereadpointerispointingtoinvaliddata(becausetheFIFOisemptyandtheemptyflagisasserted).AssoonasthefirstdatawordiswrittentotheFIFO,thewritepointerincrements,theemptyflagiscleared,andthereadpointerthatisstilladdressingthecontentsofthefirstFIFOmemoryword,immediatelydrivesthatfirstvalidwordontotheFIFOdataoutputport,tobereadbythereceiverlogic.ThefactthatthereadpointerisalwayspointingtothenextFIFOwordtobereadmeansthatthereceiverlogicdoesnothavetousetwoclockperiodstoreadthedataword.IfthereceiverfirsthadtoincrementthereadpointerbeforereadingaFIFOdataSNUGSanJose2002SimulationandSynthesisTechniquesforRev1.2AsynchronousFIFODesign3word,thereceiverwouldclockoncetooutputthedatawordfromtheFIFO,andclockasecondtimetocapturethedatawordintothereceiver.Thatwouldbeneedlesslyinefficient.TheFIFOisemptywhenthereadandwritepointersarebothequal.Thisconditionhappenswhenbothpointersareresettozeroduringaresetoperation,orwhenthereadpointercatchesuptothewritepointer,havingreadthelastwordfromtheFIFO.AFIFOisfullwhenthepointersareagainequal,thatis,whenthewritepointerhaswrappedaroundandcaugh

1 / 23
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功