A-Verilog-HDL-Test-Bench-Primer

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

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

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

资源描述

AVerilogHDLTestBenchPrimerApplicationNoteiAVerilogHDLTestBenchPrimerTableofContentsIntroduction...........................................................................................................1Overview...............................................................................................................1TheDeviceUnderTest(D.U.T.)...........................................................................1TheTestBench....................................................................................................1Instantiations.........................................................................................................2Figure1-DUTInstantiation.............................................................................................2RegandWireDeclarations...................................................................................2Figure2–RegandWireDeclarations.............................................................................3InitialandAlwaysBlocks.......................................................................................3Figure3–AnInitialBlockExample...............................................................................3Figure4–AnAlwaysBlockExample............................................................................4Initialization.....................................................................................................................4Delays...............................................................................................................................4ClocksandResets............................................................................................................4AssignStatements................................................................................................4Figure5-AnAssignExample..........................................................................................5PrintingduringSimulations...................................................................................5$display............................................................................................................................5Figure6-$displayExample.............................................................................................5$monitor...........................................................................................................................5Figure7-Using$monitor.................................................................................................5Tasks....................................................................................................................6Figure8-AnExampleofaTask–load_count................................................................6Count16SimulationExample................................................................................6Table1-SimulationSteps................................................................................................6Figure9–TheTranscriptWindowfortheCount16Simulation....................................8Figure10–TheSimulationWaveformWindowfortheCount16Simulation................8GateLevelSimulations.........................................................................................9AppendixA-Thecount16.vVerilogSourceFile............................................................9AppendixB-Thecnt16_tb.vVerilogTestBenchSourceFile......................................10ReferenceMaterials............................................................................................12Publication#:AN013-1Revision:AAmendment:0IssueDate:October1999IntroductionAsdigitalsystemsbecomemorecomplex,itbecomesincreasinglyimportanttoverifythefunctionalityofadesignbeforeimplementingitinasystem.HardwareDescriptionsLanguages(HDL’s)havebecomeextremelypopularbecausethesamelanguagecanbeusedbyengineersforbothdesigningandtestingCPLD’sandFPGA’s.ThetwomostcommonHDL’sareVerilogandVHDL.ThisdocumentfocusesonusingVerilogHDLtotestdigitalsystems,bygivingthedesignerahandfulofsimulationtechniquesthatcanbeusedonthemajorityofdigitalapplications.OverviewThisapplicationsnoteandtheincludedVerilogsourcecodedescribehowtoapplystimulustoabehavioralorgateleveldescriptionofaCPLDdesign.ThedesignershouldhaveaccesstoaVerilogsimulatorandbefamiliarwithits’basicfunctionality.Inshort,theVerilogcodeforeachoftheindividualmodulesiscompiledandthesimulationisrun.Byapplyingstimulusandsimulatingthedesign,thedesignercanbesurethecorrectfunctionalityofthedesignisachieved.Thisdesignusesaloadable4-bitcounterandtestbenchtoillustratethebasicelementsofaVerilogsimulation.Thedesignisinstantiatedinatestbench,stimulusisappliedtotheinputs,andtheoutputsaremonitoredforthedesiredresults.TheDeviceUnderTest(D.U.T.)TheDeviceUnderTestcanbeabehavioralorgatelevelrepresentationofadesign.Inthisexample,theDUTisbehavioralVerilogcodefora4-bitcounterfoundinAppendixA.ThisisalsoknownasaRegisterTransferLevelorRTLdescriptionofthedesign.IntheHDLsource,alltheinputandoutputsignalsare

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

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

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

×
保存成功