ModelSim的使用包含实例.docx
《ModelSim的使用包含实例.docx》由会员分享,可在线阅读,更多相关《ModelSim的使用包含实例.docx(33页珍藏版)》请在冰豆网上搜索。
ModelSim的使用包含实例
AboutUsingtheModelSimSoftwarewiththeQuartusIISoftware
ModelSim-AlteraDesignFlow(ForAlteraVersion)
1.SetuptheModelSim-Alteraworkingenvironment
2.SetupaprojectwiththeModelSim-Alterasoftware
3.PerformafunctionalsimulationwiththeModelSim-Alterasoftware
4.PerformatimingsimulationwiththeModelSim-Alterasoftware
ModelSimPE/SEDesignFlow(ForPE/SEVersion)
1.SetuptheModelSimworkingenvironment
2.SetupaprojectwiththeModelSimsoftware
3.CompilelibrariesanddesignfileswiththeModelSimsoftware
4.PerformafunctionalsimulationwiththeModelSimsoftware
PerformatimingsimulationwiththeModelSimsoftware
目录
ModelSim-Altera版本仿真流程3
1、建立ModelSim-Altera工作环境3
2、用ModelSim-Altera建立工程3
3、用ModelSim-Altera执行功能仿真3
4、用ModelSim-Altera执行时序仿真4
ModelSim-PE/SE版本仿真流程6
PerformingaFunctionalSimulationwiththeModelSimSoftware6
PerformingaTimingSimulationwiththeModelSimSoftware7
相关知识链接9
ModelSimPrecompiledLibraries(预编译库)9
AlteraFunctionalSimulationLibraries(功能仿真库)12
AlteraPost-FitLibraries(后适配库)21
PerformingPowerAnalysiswiththeQuartusIISoftwareandOtherEDATools30
使用QuartusII自动运行ModelSim仿真37
1、配置NativeLink37
2、运行仿真39
3、产生Testbench40
ModelSim-Altera版本仿真流程
1、建立ModelSim-Altera工作环境
1.1版本说明
ModelSim-Altera(OEM)version6.4a
QuartusIIversion9.0
该ModelSim版本支持所有QuartusII支持的Altera器件。
1.2要自动从QuartusII运行EDA设计输入、综合、仿真或者时序分析工具,您必须指定第三方EDA工具的可执行文件位置,通过单击Tools菜单上的Options供然后点击EDAToolOptions选项。
2、用ModelSim-Altera建立工程
2.1如果要执行时序仿真,需要产生Verilog(.vo)或者VHDL(.vho)输出文件。
a.选择EDAToolSettings
b.用QuartusII编译设计文件
注:
如果已经编译过设计,要重新产生.vo、.vho和.sdo(标准延迟输出文件)的话,只需要运行StartEDANetlistWritter即可。
同时也可以用于产生.vcd文件。
如果要执行功耗估算,确保在SimulatorSettings下的Settings对话框选择合适的参数。
2.2启动Modelsim软件,选择工程目录:
File—>ChangeDirectory.
注:
如果要执行功能仿真,工程目录就是包含设计文件的目录;
如果要进行时序仿真,工程目录务必设在包含.vo、.vho和.sdo的目录下。
2.3创建新的工作库:
a.File—>New—>Library,出现创建新库的对话框
b.在Create选项下,选择anewlibraryandalogicalmappingtoit.
c.在LibraryName中输入库的名称
注:
如果你想要脱离QuartusII独立运行Modelsim,库文件名必须是work;如果是由QuartusII自动运行Modelsim,则库的名称被自动名为ModelSim_work,并且位于QuartusII的过程目录下。
3、用ModelSim-Altera执行功能仿真
3.1编译Verilog或者VHDL文件和TestBench文件(如果你使用testbench的话)
a.Compilemenu,点击Compile.
b.在Library列表下选择work库
c.选择需要的Verilog或者VHDL文件
注:
如果选择.vo、.vho文件作为功能仿真的话,必须在下面操作前进行编译。
d.执行编译
e.重复上面操作,编译testbench文件
f.点击done完成。
3.2加载设计:
a.在Simulate菜单中,点击Simulate.出现Simulate对话框
b.如果要仿真VerilogHDL设计文件,指定ModelSim预编译库
i.点击Libraries标签
ii.在SearchLibraries(-L)中,点击Add选择适当的库
iii.点击OK完成
c.在Name列表中,点击+展开work库,选择要仿真的顶层文件(一般是testbench)
d.点击OK完成
3.3在ModelSim中执行功能仿真
4、用ModelSim-Altera执行时序仿真
重要提示:
强烈建议在进行RAM仿真时,将Timescale设置为飞秒ps级别!
4.1编译Verilog或者VHDL输出文件和testbench文件,方法同功能仿真。
4.2如果你的设计包含全局复位或者全局上电信号,并且还没这么做,可以在Verilog或者VDHL输出文件中建立这些信号。
方法如下:
对于Verilog,在仿真前,将下列代码加到testbench文件中:
reg;
reg;
initial
begin
=0;
#
对于VHDL,在仿真前运行下列命令:
force///00ns
force//1
force///10ns
注:
是全局复位信号名称,是全局上电信号,
4.3在Simulate菜单中,点击Simulate.出现Simulate对话框
4.4如果是仿真verilog语言,点击verilog标签,在PulseOptions中的ErrorLimit和RejectionLimit中填入0.
4.5如果仿真的是VHDL设计,指定.sdo标准延迟文件:
a.点击SDF标签,点击ADD
b.在AddSDFEntry对话框中,点击Browse,出现SelectSDFFile对话框
c.选择标准延迟输出.sdo文件
注:
如果使用的是testbench文件作为设计的激励,那么在Applytoregion框中,从顶层设计文件开始,将路径指向testbench中的instance
4.6如果仿真的是verilog设计,要指定预编译库(ModelSimprecompiledlibraries)
a.点击Library标签,在SearchLibraries(-L)中,点击Add.
b.指定目录\\altera\verilog\\,点击OK;
4.7点击Design标签,在Name列表中,点击+展开work库,并选择标准延时输出文件对应的设计实体(entity),点击OK完成。
4.8如果要仿真高速电路(包括HSSI,LVDS,PLLs等),点击Others标签,在Othervsimoptions中输入+transport_int_delays+transport_path_delays,点击OK完成;
4.9要直接从ModelSim中生成.vcd(ValueChangeDumpFile)文件用于QuartusII中PowerPlayPowerAnalyzer分析,可以在ModelSim中输入命令:
source _dump_all_vcd_nodes.tcl
4.10Tcl脚本文件指示ModelSim-Altera监视Tcl脚本文件中的输出信号并在仿真过程中写入到.vcd文件中去。
4.11在ModelSim-Altera进行时序仿真。
重要提示:
强烈建议在进行RAM仿真时,将Timescale设置为飞秒ps级别!
ModelSim-PE/SE版本仿真流程
PerformingaFunctionalSimulationwiththeModelSimSoftware
1.Ifyouhavenotalreadydoneso,setupaprojectwiththeModelSimsoftware.
2.Tomapthedesignlibrariestoyourworklibrary:
a.OntheFilemenu,pointtoNewandclickLibrary(Filemenu).TheCreateaNewLibrarydialogboxappears.
b.TypelpmintheLibraryNamebox,typethenameoftheworklibraryintheLibraryMapstobox,andthenclickOK.
c.Repeatsteps2aand2btomapaltera_mftotheworklibrary.
3.Tocompilethefunctionalsimulationlibraries,VerilogHDLorVHDLDesignFiles,andtestbenchfiles(ifyouareusingatestbench):
Important:
Ifyourdesigncontainsthealtgxbmegafunctionorthealt2gxbmegafunction,pleaserefertotheappropriatemegafunctiontopicforrequiredsettingsinformation.
a.OntheCompilemenu,clickCompile.
b.IntheLibrarylistoftheCompileHDLSourceFilesdialogbox,selecttheworklibrary.
c.IntheFilenamelist,typethedirectorypathandfilenameofthefunctionalsimulationlibrariesOrIntheFilesofTypelist,selectAllFiles(*.*),andintheLookinlistselecttheVerilogHDLorVHDLDesignFile.
d.ClickCompile.
Note:
ForVHDLdesignsthatusethe220model.vhdlibrary,turnonUseExplicitDeclarationsunderDefaultOptionsintheCompiledialogbox.
e.Repeatsteps4bto4dtocompiletheVerilogHDLorVHDLDesignFile.
f.Repeatsteps4bto4dtocompilethetestbenchfile(s).
g.ClickDone.
4.Toloadthedesign:
a.OntheSimulatemenu,clickSimulate.TheSimulatedialogboxappears.
b.IntheNamelist,clickthe+icontoexpandtheworkdirectory.
c.Selectthetop-leveldesignfiletosimulate.
d.ClickAdd.
e.ClickLoad.
5.PerformthefunctionalsimulationintheModelSimsoftware.
PerformingaTimingSimulationwiththeModelSimSoftware
1Ifyouhavenotalreadydoneso,compilelibrariesanddesignfileswiththeModelSimsoftware.
2Ifthedesigncontainsdevice-wideresetordevicepower-upsignals,andifyouhavenotalreadydoneso,setupthesignalsintheVerilogOutputFileorsetupthesignalsintheVHDLOutputFile.
3OntheSimulatemenu,clickSimulate.TheSimulatedialogboxappears.
4IfyouaresimulatingaVerilogHDLdesign,clicktheVerilogtab.UnderPulseOptions,type0intheErrorLimitandRejectionLimitboxes.
5IfyouaresimulatingaVHDLdesign,tospecifytheStandardDelayFormatOutputFile(.sdo):
a.ClicktheSDFtab.
b.ClickAdd.
c.IntheAddSDFEntrydialogbox,clickBrowse.TheSelectSDFFiledialogboxappears.
d.IntheFilesoftypelist,selectAllFiles(*.*).
e.SelecttheStandardDelayOutputFile.
f.ClickOpen.
g.ClickOK.
Note:
Ifyouareusingatestbenchfiletoprovidesimulationstimulitothedesign,intheApplytoregionbox,specifythepathtothedesigninstanceinthetestbench,startingfromthetop-leveldesignfile.
6ClicktheDesigntab.
7IntheNamelist,expandtheworkdirectoryandselectthedesignentitythatcorrespondstotheStandardDelayOutputFile.
8ClickAdd.
9Selectthetop-levelVerilogHDLorVHDLOutputFileortestbench.
10ClickAdd.
11Ifyouaresimulatinghigh-speedcircuits(includingdesignsthatuseHSSI,LVDS,orPLLs):
a.ClicktheOthertab.
b.IntheOtheroptionsboxtype:
+transport_int_delaysand+transport_path_delays.
c.ClickOK.
12ClickLoad.
13TodirecttheModelSimsoftwaretogenerateaValueChangeDumpFile(.vcd)thatyoucanthenusetoperformpoweranalysisintheQuartus IIPowerPlayPowerAnalyzer,typethefollowingcommandattheModelSimprompt:
source _dump_all_vcd_nodes.tcl
TheTclScriptFile(.tcl)directstheModelSimsoftwaretomonitorandwritetheoutputsignalscontainedintheTclScriptFiletoaValueChangeDumpFileduringsimulation.
PerformthetimingsimulationintheModelSimsoftware.
相关知识链接
ModelSimPrecompiledLibraries(预编译库)
ThefollowinglibrariesaretheprecompiledatomlibrariesfortheMentorGraphicsModelSim-AlteraOEMversionsoftware.
ForVerilogHDLorVHDLdesigns,thefollowinglibrariesarelocatedinthe\\altera\directoryforPCsandinthe//modeltech/altera/directoryforLinuxworkstations:
Library
Description
apex20k
PrecompiledatomlibraryforAPEX 20Kdesigns
apex20ke
PrecompiledatomlibraryforAPEX 20KCandAPEX 20KEdesigns
apex20ke_87
PrecompiledatomlibraryforVHDL87-compliantAPEX 20KCandAPEX 20KEdesigns
apexii
PrecompiledatomlibraryforAPEX IIdesigns
arriagx
PrecompiledatomlibraryforArria GXdesigns
arriagx_hssi
LibrarythatcontainsfunctionalsimulationmodelsforArria GXdeviceswiththealt2gxbmegafunction
arriaii_hssi
LibrarythatcontainsfunctionalsimulationmodelsforArria IIGXdeviceswithaltgxbinstantiations
arriaii_pcie_hip
LibrarythatcontainsfunctionalsimulationmodelsforPCIExpresshardIPblocks
arriaii
PrecompiledatomlibraryforArriaIIGXdesigns
cyclone
PrecompiledatomlibraryforCyclonedesigns
cycloneii
PrecompiledatomlibraryforCycloneIIdesigns
cycloneiii
PrecompiledatomlibraryforCycloneIIIdesigns
flex6000
PrecompiledatomlibraryforFLEX6000designs
flex10ke
PrecompiledatomlibraryforFLEX 10KandACEX 1Kdesigns
hardcopyii
PrecompiledatomlibraryforHardCopy IIdesigns
hcstratix
PrecompiledatomlibraryforHardCopy Stratixdesigns
max
PrecompiledatomlibraryforMAX 3