modelsim激活教程
modelsimSE6.0安装
modelsimSE6.0安装我安装的版本是Modelsim SE 6.2b ,相信其它版本也不会在安装问题上有太大的差异.如果存在,这里的方法也应该可作为一个很好的参考.1) 打开您下载到或是通过其他什么什么路径搞到的安装文件,找到Setup 文件, 双击之, 然后一路“确定” 或点“是”(选择FULL版本的较好),安装到自己选定的路径后, 它会要求你重启电脑, 这时你可以重启了.2) 重启后, 这时你就要用license 进行注册了.注册方法是这样的:注册器是一个Keygen软件来着, 你可以从网上下载到注册器(如果自己已经有的话那就自然方便了), 然后双击Keygen 这时会弹出一个对话窗口, 要求你在hostid下面的输入框里输入你的网卡号(网卡号获取方法在下面有介绍). 这时你可以在其中输入你的网卡号,也可不用理它,直接点generate, 这时你会发现生成了一个license.dat 文件,这个就是你的注册文件了.在这个文件里就有你的网卡号HOSTID后面的一串码就是你的网卡号了.3) 然后你要做的就是把这个license.dat文件复制到你的Modelsim 安装路径下的win32文件里面.(比如我的安装路径是D:\Modeltech_6.2b, 我就在D盘找个Modeltech_6.2b文件,进去后再找到win32文件,进去后把license.dat复制到这里)4) 下一步是很关键的了, 这一步你需要创建一个环境变量LM_LICENSE_FILE.创建方法如下: 在桌面左键“我的电脑” ->属性->高级->环境变量,然后在系统变量中新建一个变量,编辑用户变量中的变量名为. LM_LICENSE_FILE ,变量值即为你的license.dat的安装路径,比如我的就是D:\Modeltech_6.2b\win32\license.dat ,编辑系统变量中的变量名:CDSROOT,变量值:D:\Modeltech_6.2b\win32确定后,就可以了.5) 运行一下Modelsim,如果运行成功,没有出现什么启动不了的error 窗口,那你就大功告成了.6) 如果在第五步中,你发现老是弹出错误窗口, 显示Error: “System clock has been set back” in the MAX+PLUS II software. 这时老兄您就中彩了, 我正是为这个问题烦了好几天. 不过还好,我在网上找了到解决这个问题原因:Error: “System clock has been set back” in the MAX+PLUS IIsoftware.You receive this error message if the vendor daemon has detected one ormore system files dated in the future compared to the system clock.One possible solution is to locate the files that have an invalid date stampand to open each file and then save it so that it has the correct date/timestamp. The vendor daemon primarily looks at system files in thefollowing directories:■ C:\ (The root directory)■ The directory where your Microsoft Windows files are installed (forexample, C:\WINNT)■ Your MAX+PLUS II software directory (for exampleC:\MAXPLUS2)One way to find the affected files is to use the Windows Find utility.Search by date and specify files with a date later than today’s date. Somefiles may be hidden, so make sure that the Find utility isconfigured todisplay all files.If your MAX+PLUS II software was installed with an incorrect systemclock, you may need to perform the following steps:1. Uninstall the MAX+PLUS II software.2. Set the system clock to the current time and date.3. Restart the PC.4. Reinstall the MAX+PLUS II software in a different directory.上面说的意思是, 当你碰到这个问题时,原因是软件中的vendor daemon发现你的机子中系统文件的创建日期超前了你的电脑上的系统时钟(也就是你电脑上显示的时间).这时你的解决办法就是通过搜索文件找到这些文件,然后删掉这些文件.方法如下:进入C盘,修改文件查看方式,使你可以看到所有文件.然后点“系统任务”中的“搜索文件或文件夹”,查找所有文件和文件夹->高级选项->指定日期, 修改时间范围, 我是从当前时间搜索到2050年,通过先后选定“修改日期” “访问日期” “创建日期”,最后我搜索到了一堆2098年创建的文件和2013年创建的文件.我把这些文件统统删了. 然后卸载掉原来的Modelsim ,重启后,再次按照1 à5的步聚重新安装,这下终于搞定了.*_*以上就是我的安装过程,希望上面的东东能够给各位同仁有所帮助.*_*对了,还要介绍一下获取你的网卡号的方法:开始->所有程序->附件->命令提示符,这时就进入DOS环境下,输入ipconfig /all ,enter后就可看到一堆的输出, 仔细找一下Physical Address 后面12位码就是你的网卡号了.(也可以通过开始->运行,输入cmd, 进入DOS 环境。
ModelSim安装与使用
MODELSIM安装方法
10. 将弹出的许可证向导暂时先放一边:
MODELSIM安装方法
11. 将以下两个文件复制到ModelSim安装目 录中的Win32目录中(64bit系统此处为Win64)
MODELSIM安装方法
12. 运行其中的crack.bat文件, 结果如下图:
MODELSIM安装方法
MODELSIM使用简介
Project窗口右击加入的文件:
Compile -> Compile All 并检查Transcript窗口是否有报错.
MODELSIM使用简介
点击Library切换到编译好的Library
MODELSIM使用简介
展开创建的work, 右击顶层选择Simulate
13. 将弹出的许可证另存为上一层目录中的 LICENSE.TXT 文件
MODELSIM安装方法
14. 回到刚才放一边的许可证向导窗口,点击 Install a new license 后如下图:
MODELSIM安装方法
15. 点击Browse选择刚才保存的许可证文件, 并点击Continue:
MODELSIM安装方法
16. 建立环境变量: 右击计算机->属性->高级系统设置->高级->环境 变量->用户变量->新建一个用户变量,变量名为LM_LICENSE_FILE, 变量值为license放置的目录.
MODELSIM安装方法
17. 运行ModelSim程序, 确认是否安装正 确:
MODELSIM使用简介
点击View -> Wave打开波形窗口
Modelsim使用教程
右击,选择“Simulate without Optimization”
26
示例
功能仿真
将待测信号选中 加入波形窗口
27
示例
功能仿真
改变输出信号数制
28
示例
功能仿真
开始仿真 200ns
29
示例
功能仿真
放大、缩小波形,调整到合适波形
21
示例
编写设计代码
双击 “counter_4bit.vhd”, 编写设计代码
22
示例
编写测试代码testbench
双击 “counter_4bit_tb.vhd”, 编写设计代码
23
示例
编译代码
编译方式: 单击图标
Compile Compile All
24
示例
编译结果
25
示例
功能仿真
Modelsim 教程
电子科技大学 微电子与固体电子学院 211大楼 - 503教研室 2017 – 4 - 16
示例
更改Host ID
由于Win7 系统兼容问题,需手动更改Host ID 双击桌面 “Models更改Host ID
双击桌面 “wizard” 选择 “Install a new license”
打开方式:
双击桌面图标
开始菜单 所有程序 Modelsim SE 10.0a Modelsim
11
示例
打开后界面
12
示例
新建工程
File New Project
13
示例
新建工程 输入工程名 输入工程目录
14
示例
modelsim激活教程
有用+1
已投票
1
收藏+1
已收藏
Mentor公司的ModelSim是业界最优秀的HDL语言仿真软件,它能提供友好的仿真环境,是业界唯一的单核支持VHDL和Verilog混合仿真的仿真器。
它采用直接优化的编译技术、Tcl/Tk技术、和单一核仿真技术,编译仿真速度快,编译的代码与平台无关,便于保护IP 核,个性化的图形界面和用户接口,为用户加快调错提供强有力的手段,是FPGA/ASIC设计的首选仿真软件。
工具/原料
•PC机
•ModelSim6.4a
•破解软件modelsim_crack.exe
步骤/方法1
安装ModelSim6.4a,安装一般软件的安装步骤,一路next就行了2
下载破解软件modelsim_crack,并解压破解软件modelsim_crack.exe到任何位置
1. 3
运行破解软件modelsim_crack.exe,会在软件文件夹下生产License.txt
2. 4
把License.txt后缀名改为.dat,然后放到modelsim安装文件夹下,比如我的安装路径是D:\Program Files (x86)\modelsim\modelsim_ae
3. 5
打开pc机的高级系统设置窗口,并找到环境变量设置窗口
4. 6
添加新的用户环境变量和系统环境变量
变量名:LM_LICENSE_FILE
变量值:D:\Program Files (x86)\modelsim\modelsim_ae\License.DAT 这值是你License.DAT的存放位置
5.7 至此破解完成,运行程序即可。
ModelSim操作方法
ModelSim
在105的xterm中输入命令:vsim & 即启动ModelSim. 然后点击界面上方的File——New——Project,出现如下界面:
在Project Name中输入想要建立的工程的名字,在Project Location中输入想要建立工程的路径,其他都是默认值即可,填好后点击OK.出现如下界面:
如果想填入已经写好的代码,则点击Add Existing File,找到文件路径进行添加,设置好文件格式(.v文件选择Verilog,.txt文件选择Text),点击OK则添加完毕。
如果想要重新写代码,则点击Creat New File,写好代码后保存即可。
把文件添加到工程后,点击工具栏上方的编译按钮,如下图所示:
编译不成功则改代码中的错误,直到全部编译成功为止。
编译成功后点击编译按钮后面的Simulate按钮:
出现如下对话框,选择Work中的testbench文件,点击OK 即可进行仿真。
然后执行View——Wave,View——Objests,将Objests中想要观察的信号拖进Wave窗口,最后点击运行按钮Run-All(如下图),
等仿真完毕后按红色的小叉按钮Break来停止仿真。
此时观察Wave窗口即有仿真波形。
multisim 字符激活代码-概述说明以及解释
multisim 字符激活代码-概述说明以及解释1.引言1.1 概述概述部分:Multisim是由美国电子工程教育协会(EEA)开发的一款强大的电路模拟软件,它为工程师和学生提供了设计、分析和验证电路的能力。
作为一款广泛使用的工具,Multisim在电子工程领域发挥着重要的作用。
本文将重点讨论Multisim中的字符激活代码,它是在使用Multisim 软件时所需的注册码,用于激活软件以解锁其所有功能。
字符激活代码是确保软件正版授权的重要环节,只有经过激活的软件才能正常使用。
在这篇文章中,我们将探讨Multisim字符激活代码的生成、使用和注意事项。
首先,我们将介绍字符激活代码的生成方法,包括通过官方渠道获得激活码和利用第三方工具生成激活码的方式。
其次,我们将详细说明如何在Multisim软件中使用激活码,以及激活码的有效期和限制。
此外,我们还将提供一些关于字符激活代码的注意事项,以帮助读者在使用Multisim软件时避免出现激活问题。
我们将介绍如何正确保存和备份激活码,并注意激活码的安全保密和合法性问题。
总之,在本文中,我们将深入探讨Multisim字符激活代码的相关内容,为读者提供全面的指导和建议。
通过了解字符激活代码的生成、使用和注意事项,读者将能够更好地使用Multisim软件,并享受到其强大的电路模拟功能。
1.2 文章结构文章结构是指文章的组织框架和布局,主要包括引言、正文和结论三个部分。
这些部分在文章中的顺序和内容安排对于读者来说非常重要,因为它们能够帮助读者更好地理解和掌握文章的核心内容。
在本文中,我们将按照以下结构来组织文章:引言部分旨在引起读者的兴趣并提供文章的背景信息。
首先,我们将概述本文的主题,并介绍Multisim字符激活代码的重要性和应用领域。
接下来,我们将介绍文章的整体结构,以便读者能够更好地了解各个部分的内容和相互之间的关系。
最后,我们还将明确本文的目的,即介绍Multisim字符激活代码的相关知识,以及如何获取和使用它们。
modelsim使用教程
modelsim使用教程ModelSim是一款常用的硬件描述语言(HDL)仿真工具,本教程将向您介绍如何使用ModelSim进行仿真。
步骤1:安装ModelSim首先,您需要下载和安装ModelSim软件。
在您的电脑上找到安装程序并按照提示进行安装。
步骤2:创建工程打开ModelSim软件,点击"File"菜单中的"New",然后选择"Project"。
在弹出的对话框中,选择工程的存储位置,并为工程命名。
点击"OK"完成工程创建。
步骤3:添加设计文件在ModelSim的工程窗口中,右键点击"Design"文件夹,选择"Add Existing File"。
然后选择包含您的设计文件的目录,并将其添加到工程中。
步骤4:配置仿真设置在工程窗口中,右键点击"Design"文件夹,选择"Properties"。
在弹出的对话框中,选择"Simulation"选项卡。
在"Top level entity"字段中,选择您的设计的顶层模块。
点击"Apply"和"OK"保存设置。
步骤5:运行仿真在ModelSim的工具栏中,找到"Simulate"按钮,点击并选择"Start Simulation"。
这将打开仿真窗口。
在仿真窗口中,您可以使用不同的命令来控制和观察设计的行为。
步骤6:查看仿真结果您可以在仿真窗口中查看信号波形、调试设计并分析仿真结果。
在仿真窗口的菜单栏中,您可以找到一些常用的查看和分析工具,如波形浏览器、信号分析器等。
步骤7:结束仿真当您完成仿真时,可以选择在仿真窗口的菜单栏中找到"Simulate"按钮,并选择"End Simulation"以结束仿真。
modelsim的详细使用方法
一、简介ModelSim是一款由美国Mentor Graphics公司推出的集成电路仿真软件,广泛应用于数字电路和系统设计领域。
它提供了强大的仿真和验证功能,能够帮助工程师快速高效地进行电路设计与验证工作。
本文将详细介绍ModelSim的使用方法,以帮助读者更好地掌握这一工具的操作技巧。
二、安装与配置1. 下载ModelSim安装包,并解压到指定目录2. 打开终端,进入ModelSim安装目录,执行安装命令3. 安装完成后,配置环境变量,以便在任何目录下都能够调用ModelSim程序4. 打开ModelSim,进行软件注册和授权,确保软件可以正常运行三、工程创建与管理1. 新建工程:在ModelSim主界面点击“File” -> “New” -> “Project”,输入工程名称和存储路径,选择工程类型和目标设备,点击“OK”完成工程创建2. 添加文件:在工程目录下右键点击“Add Existing”,选择要添加的源文件,点击“OK”完成文件添加3. 管理工程:在ModelSim中可以方便地对工程进行管理,包括文件的增删改查以及工程参数的设置等四、代码编写与编辑1. 在ModelSim中支持Verilog、VHDL等多种硬件描述语言的编写和编辑2. 在ModelSim主界面点击“File” -> “New” -> “File”,选择要新建的文件类型和存储位置,输入文件名称,点击“OK”完成文件创建3. 在编辑器中进行代码编写,支持代码高亮、自动缩进、语法检查等功能4. 保存代码并进行语法检查,确保代码符合规范,没有错误五、仿真与调试1. 编译工程:在ModelSim中进行代码编译,生成仿真所需的可执行文件2. 设置仿真参数:在“Simulation”菜单下选择“S tart Simulation”,设置仿真时钟周期、输入信号等参数3. 运行仿真:点击“Run”按钮,ModelSim将开始对设计进行仿真,同时显示波形图和仿真结果4. 调试设计:在仿真过程中,可以通过波形图和仿真控制面板对设计进行调试,查找并解决可能存在的逻辑错误六、波形查看与分析1. 查看波形:在仿真过程中,ModelSim会生成相应的波形文件,用户可以通过“Wave”菜单查看波形并进行波形分析2. 波形操作:支持波形的放大、缩小、平移、选中等操作,方便用户对波形进行分析和观察3. 波形保存:用户可以将波形结果保存为图片或文本文件,以便日后查阅和分析七、性能优化与验证1. 时序优化:在设计仿真过程中,可以通过观察波形和性能分析结果,对设计进行优化,提高设计的时序性能2. 逻辑验证:通过对仿真的结果进行逻辑验证,确保设计符合预期的逻辑功能3. 时序验证:对设计的时序性能进行验证,确保信号传输和时钟同步的正确性八、项目输出与文档整理1. 输出结果:在仿真和验证完成后,可以将仿真结果、波形图和性能分析结果输出为文本文件或图片,方便后续的文档整理和报告撰写2. 结果分析:对仿真结果和验证结果进行详细的分析,确定设计的性能和功能是否符合设计要求3. 文档整理:根据仿真和验证结果,进行文档整理和报告撰写,为后续的设计和优化工作提供参考九、总结与展望ModelSim作为一款专业的集成电路仿真软件,具有着强大的功能和丰富的特性,可以帮助工程师进行电路设计与验证工作。
modelsim使用方法
modelsim使用方法ModelSim 是一种功能强大的硬件描述语言 (HDL) 模拟工具,支持VHDL和Verilog,可用于设计和验证数字系统。
本文将介绍如何使用ModelSim。
**安装 ModelSim****创建项目**在启动 ModelSim 后,首先需要创建一个新的项目。
选择 "File" 菜单,然后选择 "New" -> "Project"。
在打开的对话框中,选择项目的文件夹和项目名称,然后点击 "OK"。
**添加设计文件和测试文件**在项目中,您需要添加设计文件和测试文件。
选择 "Project" 菜单,然后选择 "Add to Project" -> "Add Files". 在打开的对话框中,选择您的设计文件 (VHDL 或 Verilog) 和测试文件,然后点击 "OK"。
**设置仿真**在编译代码之后,下一步是设置仿真选项。
选择 "Simulate" 菜单,然后选择 "Start Simulation"。
在打开的对话框中,选择您的顶层模块。
您还可以选择以 GUI 模式还是批处理模式运行仿真。
在设置仿真之前,您可以添加信号波形文件以在仿真过程中显示波形。
选择 "Simulate" -> "Wave" -> "Add Waveform". 然后,选择信号波形文件 (.do 或 .vcd),并点击 "OK"。
**运行仿真**设置仿真选项后,您可以开始执行仿真。
通过选择 "Simulate" -> "Run",可以运行单步或连续仿真。
Modelsim SE 6.5a使用指南
Modelsim SE使用指南ModelSim的功能侧重于编译、仿真,不能指定编译的器件,不具有编程下载能力。
不象Synplify 和MAX+PLUS II可以在编译前选择器件。
而且ModelSim在时序仿真时无法编辑输入波形,不象MAX+PLUS II可以自行设置输入波形,仿真后自动产生输出波形,而是需要在源文件中就确定输入,如编写测试台程序来完成初始化、模块输入的工作,或者通过外部宏文件提供激励。
这样才可以看到仿真模块的时序波形图。
ModelSim还具有分析代码的能力,可以看出不同的代码段消耗资源的情况,从而可以对代码进行改善,以提高其效率。
菜单栏标题栏下方为菜单栏。
菜单栏有八个菜单项,分别是:File(文件)、Edit(编辑)、View (视图)、Compile(编译)、Simulate(仿真)、Tools(工具)、Window(窗口)、Help(帮助)。
下面分别罗列其具体选项。
1. File(文件)菜单文件菜单通常包含了对工程及文件等的操作。
ModelSim的文件菜单包含的命令有:New(新建),Open(打开),Close(关闭),Import(导入),Save(保存),Delete(删除),Change Directory(更改路径),Transcript(对脚本进行管理),Add to Project(为工程添加文件),Recent Directories(最近几次的工作路径),Recen Projects(最近几次工程),Quit(退出)。
(1)新建文件命令(File/ New)单击File/ New命令,将会出现一个子菜单,共包含四个选项:单击Floder(新建文件夹)后,会出现对话框,提示输入新建的文件夹的名字,即可在当前目录下新建一个文件夹;单击Source(新建源文件)后,会出现源文件类型的选项(VHDL,Verilog,Other),点击可分别新建对应格式的源文件;单击Project(新建工程)后,会出现对话框,提示在Project Name 处输入新建工程的名称,在Project Location处指定新建工程的存放路径,在Default Library Name处指明默认的设计库的名称,用户设计的文件将编译到该库中;单击Library(新建一个库)后,会出现对话框,提示选择Creat a New library and a logical mapping to it(新建一个库并建立一个逻辑映象)或A map to an existing library(新建一个到已存在库的映象),在Lirary name处输入新建库的名称,在Library phycial name处输入存放库的文件名称。
Modelsim详细使用教程
Modelsim详细使用教程一、打开Medelsim双击桌面快捷方式,出现下图所示界面,如果上一次使用ModelSim建立过工程,这时候会自动打开上一次所建立的工程;二、建立工作库点击File->New->Library,输入Library Name,点击OK,就能看见新建的库。
三、建立工程点击File->New->Project,输入Project Name,在Project Location 中输入工程保存的路径,建议在Library所在文件夹中。
在Default Library Name 中为我们的设计编译到哪一个库中。
点击OK会出现下图所示的界面。
四、为工程添加文件Create New File 为工程添加新建的文件;Add Existing File为工程添加已经存在的文件;Create Simulation为工程添加仿真;Create New Folder为工程添加新的目录。
这里我们点击Create New File,来写仿真代码。
输入File Name,再输入文件类型为Verilog (默认为VHDL,Modelsim也可以仿真System Verilog代码),Top Level表示文件在刚才所设定的工程路径下。
点击OK,并点击Close关闭Add items to the Project窗口。
这时候在Workspace窗口中出现了Project选项卡,里面有8_11.v,其状态栏有一个问号,表示未编译,双击该文件,这时候出现8_11.v的编辑窗口,可以输入我们的Verilog代码。
五、编写Verilog代码写完代码后,不能马上就编译,要先File->Save保存,否则,编译无效。
然后选择Compile->Compile All。
Transcript脚本窗口出现一行绿色字体Compile of 8_11.v was successful. 说明文件编译成功,并且该文件的状态栏显示绿色的对号。
modelsim使用流程
modelsim使用流程下载温馨提示:该文档是我店铺精心编制而成,希望大家下载以后,能够帮助大家解决实际的问题。
文档下载后可定制随意修改,请根据实际需要进行相应的调整和使用,谢谢!并且,本店铺为大家提供各种各样类型的实用资料,如教育随笔、日记赏析、句子摘抄、古诗大全、经典美文、话题作文、工作总结、词语解析、文案摘录、其他资料等等,如想了解不同资料格式和写法,敬请关注!Download tips: This document is carefully compiled by theeditor. I hope that after you download them,they can help yousolve practical problems. The document can be customized andmodified after downloading,please adjust and use it according toactual needs, thank you!In addition, our shop provides you with various types ofpractical materials,such as educational essays, diaryappreciation,sentence excerpts,ancient poems,classic articles,topic composition,work summary,word parsing,copy excerpts,other materials and so on,want to know different data formats andwriting methods,please pay attention!1. 建立工程打开 Modelsim 软件。
选择“File”菜单,然后选择“New”->“Project”。
modelsim教程
ModelSim教程简介ModelSim是一种常用的硬件描述语言仿真器,它广泛应用于数字电路设计、验证和测试。
本教程将介绍ModelSim的基本知识和使用方法,帮助读者快速上手ModelSim,并顺利完成数字电路仿真和验证工作。
目录1.安装ModelSim2.创建工程3.设计代码编写4.编译和仿真5.波形查看和分析6.仿真高级特性7.总结安装 ModelSim首先,您需要下载和安装 ModelSim。
您可以从 Mentor Graphics(ModelSim的开发商)的官方网站上找到适用于您的操作系统版本的安装程序。
下载完成后,按照安装向导的提示进行安装,并确保将安装目录添加到系统的环境变量中。
创建工程在开始使用 ModelSim之前,您需要创建一个工程,用于组织和管理您的设计代码。
以下是创建ModelSim工程的基本步骤:1.打开 ModelSim,并选择“File -> New -> Project”。
2.在弹出的对话框中,选择要保存工程的目录和工程名称,并点击“Next”。
3.在下一步中,您可以选择是否添加已有文件到工程中,或者选择直接创建新的设计文件。
完成后,点击“Next”。
4.在下一步中,您可以选择激活某些特性,如代码覆盖率、时序分析等。
完成后,点击“Next”。
5.最后,点击“Finish”来完成工程的创建。
设计代码编写在 ModelSim中,您可以使用HDL(硬件描述语言)编写您的设计代码。
常用的HDL语言包括VHDL和Verilog。
以下是一个简单的VHDL代码示例:-- Counter.vhdentity Counter isport (clk :in std_logic;rst :in std_logic;count :out unsigned(7downto0));end entity Counter;architecture Behavioral of Counter issignal internal_count :unsigned(7downto0); beginprocess(clk, rst)beginif rst ='1'theninternal_count <= (others=>'0');elsif rising_edge(clk) thenif internal_count =8theninternal_count <= (others=>'0');elseinternal_count <= internal_count +1;end if;end if;end process;count <= internal_count;end architecture Behavioral;编译和仿真编译和仿真是在ModelSim中运行设计代码并生成波形的关键步骤。
modelsim详细使用教程.pdf
Modelsim 详细使用方法很多的modelsim教程中都讲得很丰富,但忽视了对整个仿真过程的清晰解读,而且都是拿counter范例举例子,有些小白就不会迁移了。
这里我们着眼于能顺利的跑通一个自己写的程序,一步一步的讲解,如果你是一个初学者,这再适合你不过了,虽然貌似字写得比较多,那是因为写得相当的详细,一看就会啦O(∩_∩)O~一、建立工程1、在建立工程(project)前,先建立一个工作库(library),一般将这个 library 命名为work。
尤其是第一次运行 modelsim 时,是没有这个“work”的。
但我们的 project一般都是在这个work下面工作的,所以有必要先建立这个work。
File →new→library点击library后会弹出一个对话框,问是否要创建work,点击OK。
就能看见work.2、 如果在 library 中有 work ,就不必执行上一步骤了,直接新建工程。
File→new →project会弹出在 Project Name 中写入工程的名字,这里我们写一个二分频器,所以命名 half_clk,然后点击 OK 。
会出现由于我们是要仿一个自己写的程序,所以这里我们选择Create New File。
在File Name中写入文件名(这里的file name和刚刚建立的project name可以一致也可以不一致)。
注意Add file as type要选择成Verilog(默认的是VHDL),然后OK。
发现屏幕中间的那个对话框没有自己消失,我们需要手动关闭它,点close。
并且在project中出现了一个half_clk.V的文件,这个就是我们刚刚新建的那个file。
这样工程就建立完毕了。
二、写代码:1、写主程序:双击 half_clk.v 文件会出现程序编辑区,在这个区间里写好自己的程序,这里我们写一个简单的二分频的代码:module half_clk_dai(clk_in,rst,clk_out );input clk_in;input rst;output clk_out;reg clk_out;always @(posedge clk_in or negedge rst)beginif(!rst)clk_out<=0;elseclk_out<=~clk_out;endendmodule写完代码后,不能马上就编译,要先保存,否则,编译无效。
ModelSim快速入门
ModelSim快速⼊门ModelSim是业界最优秀的HDL仿真⼯具,在电路设计、FPGA开发中经常使⽤。
笔者在学习FPGA中联合仿真再次⽤到ModelSim时发现课程中学到的已经遗忘过半,所以决定整理成⽂,作为⽇后参考,⽔平有限望批评指正。
ModelSim软件包含多个版本:SE、PE、LE和OEM版本,其中SE版本功能最多仿真速度最快,OEM定制版如:Altera的AE版和Xilinx的XE版功能有⼀定限制。
对于学习⽽⾔可以选择任何版本。
本⽂是第⼀篇,主要介绍了ModelSim的安装和快速⼊门。
软件以ModelSim SE-64 10.4为例,使⽤Verilog HDL语⾔,操作系统为Windows 7 sp1 Ultimate x64。
软件安装ModelSim的安装⽐较简单,1)双击打开软件:等待解压完成后显⽰欢迎界⾯,单击Next:2)选择安装路径。
这⾥注意,很多EDA⼯具安装路径不要出现中⽂和空格,单击Next:3)接受许可条款,单击Agree:4)开始安装,在此过程中会弹出是否创建快捷⽅式和加⼊环境变量对话框,Yes即可,进度条完成后:5)出现install hardware security key driver,选择No:6)安装完成。
此时启动软件会提⽰License错误。
软件激活激活程序通常会随软件⼀起打包,⽅法各不相同,通常只需⽣成License并设置环境变量指向License。
为⽀持正版在此不提供破解⽅法。
启动软件正确激活后可以启动软件,勾选don't show this dialog again并关闭欢迎界⾯后,如图:软件已经包含了⼏个库,在此我们新建⾃⼰的work库,⽤来包含所有编译的设计单元:File > new > Library: 默认使⽤work 即可:快速⼊门ModelSim可以使⽤命令⾏或图形界⾯操作,在此⽰例性的新建⼀个⼯程并完成仿真,认识软件布局和常⽤操作。
modelsim10.0安装教程
modelsim10.0安装教程1、以文本方式打开license.src,修改主机名,主机ID,mgcld.exe的路径SERVER water(主机名)00269E45821A(主机id)1717VENDOR mgcld D:\questasim_10.0c\win32(mgcld.exe的路径)**1)主机名即为自己计算机名,2)主机名与主机id提取方法,win+r→cmd→ipconfig/all→主机名和以太网物理地址即为要提取的内容。
3)mgcld.exe的路径在你modesim安装路径的win32文件夹下。
2、点击运行get_license.bat文件,等待生成新文件件License.dat。
3、将文件patch_dll.bat和MentorKG.exe放入modesim安装路径下的win32文件下。
4、点击patch_dll.bat等待生成license.txt,将license.txt另存为modesim安装路径下(记住位置,以方便配置环境变量)5、打开licensing wizard。
Win→所有程序→Modelsim SE10.0c→Licensing Wizard→installa new license.找到license.txt点continue等待验证结束关闭licensing wizard。
6、配置环境变量。
右键我的电脑→属性→高级系统设置→高级→环境变量→新建变量名:LM_LICENSE_FILE变量值:D:\modeltech_10.0c\LICENSE.TXT(LICENSE.TXT的路径)7、配置编译库。
Win→所有程序→Xilinx ISE Design Suite 13.2_1→ISE Design Tools→SimulationLibrary Compilation Wizard。
全部默认即可**注意按modesim 执行文件地址。
ModelSim入门教程
• 在出现的Add Simulation Configuration对话框的右下角打开optimization options, 打开后切换到Options选项卡页面,在optimization Level中选择Disable optimization, 如图:
25
• 点击ok后,返回Add Simulation Configuration对话框,在Optimization栏中关闭 Enable Optimiztion,再展开work目录,选中test_counter8,之后save保存,如图:
它支持verilogvhdl以及他们的混合仿真它可以将整个程序分步执行使设计者直接看到他的程序下一步要执行的语句而且在程序执行的任何步骤任何时刻都可以查看任意变量的当前值可以在dataflow窗口查看某一单元或模块的输入输出的连续变化等比quartus自带的仿真器功能强大的多是目前业界最通用的仿真器之一
10
11
3.为工程添加文件 工程建立后,选择Add Exsiting File后,根据相应提示将文件加到该Project中 这里是count4.v和其测试向量count_tp.v,源代码如下:
12
13
4.编译文件 编译(包括源代码和库文件的编译)。编译可点击ComlileComlile All来完成。
注:/electronic/76/electrical202060214186 _1.html
8
仿真
仿真分为功能仿真,门级仿真,时序仿真
功能仿真(前仿真,代码仿真)
主旨在于验证电路的功能是否符合设计要求,其特点是不考虑电路 门延迟与线延迟,主要是验证电路与理想情况是否一致。可综合FPGA代 码是用RTL级代码语言描述的,其输入为RTL级代码与Testbench.在设计 的最初阶段发现问题,可节省大量的精力
modelsim使用教程
modelsim使用教程Modelsim6.0使用教程Modelsim简介Modelsim仿真工具是Model公司开发的。
它支持Verilog、VHDL以及他们的混合仿真,它可以将整个程序分步执行,使设计者直接看到他的程序下一步要执行的语句,而且在程序执行的任何步骤任何时刻都可以查看任意变量的当前值,可以在Dataflow窗口查看某一单元或模块的输入输出的连续变化等,比Quartus自带的仿真器功能强大的多,是目前业界最通用的仿真器之一。
ModelSim分几种不同的版本:SE、PE和OEM,其中集成在Actel、Atmel、Altera、Xilinx以及Lattice等FPGA厂商设计工具中的均是其OEM版本。
比如为Altera提供的OEM版本是ModelSim-Altera,为Xilinx提供的版本为ModelSimXE.SE版本为最高级版本,在功能和性能方面比OEM版本强很多,比如仿真速度方面,还支持PC、UNIX、LIUNX混合平台.为什么要学Modelsim?1.Modelsim是专业的HDL语言仿真器,比Quartus自带的仿真器功能强大的多.2.Quartussimulator不支持Testbench,只支持波形文件.vwfvwf文件全称是矢量波形文件(VectorWaveformFile),是QuartusII中仿真输入、计算、输出数据的载体。
一般设计者建立波形文件时,需要自行建立复位、时钟信号以及控制和输入数据、输出数据信号等。
其中工作量最大的就是输入数据的波形录入。
比如要仿真仅1KB的串行输入数据量,则手工输入信号的波形要画8000个周期,不仅费时费力而且容易出错怎样入门?对于初学者,modelsim自带的教程是一个很好的选择,在Help->SEPDF Documentation->Tutorial里面.它从简单到复杂、从低级到高级详细地讲述了modelsim的各项功能的使用,简单易懂。
modelsim使用方法
Using ModelSim to Simulate LogicCircuits for Altera FPGA Devices1IntroductionThis tutorial is a basic introduction to ModelSim,a Mentor Graphics’simulation tool for logic circuits.We show how to perform functional and timing simulations of logic circuits implemented by using Quartus II CAD software.The reader is expected to have the basic knowledge of Verilog hardware description language,and the Altera Quartus II CAD software.Contents:•Introduction to simulation•What is ModelSim?•Functional simulation using ModelSim•Timing simulation using ModelSim1 Altera Corporation-University ProgramSeptember20102BackgroundDesigners of digital systems are inevitably faced with the task of testing their designs.Each design can be composed of many modules,each of which has to be tested in isolation and then integrated into a design when it operates correctly.To verify that a design operates correctly we use simulation,which is a process of testing the design by applying inputs to a circuit and observing its behavior.The output of a simulation is a set of waveforms that show how a circuit behaves based on a given sequence of inputs.The generalflow of a simulation is shown in Figure1.Figure1.The simulationflow.There are two main types of simulation:functional and timing simulation.The functional simulation tests the logical operation of a circuit without accounting for delays in the circuit.Signals are propagated through the circuit using logic and wiring delays of zero.This simulation is fast and useful for checking the fundamental correctness of the designed circuit.The second step of the simulation process is the timing simulation.It is a more complex type of simulation,where logic components and wires take some time to respond to input stimuli.In addition to testing the logical operation of the circuit,it shows the timing of signals in the circuit.This type of simulation is more realistic than the functional simulation;however,it takes longer to perform.2Altera Corporation-University ProgramSeptember2010In this tutorial,we show how to simulate circuits using ModelSim.You need Quartus II CAD software and ModelSim software,or ModelSim-Altera software that comes with Quartus II,to work through the tutorial.3Example DesignOur example design is a serial adder.It takes8-bit inputs A and B and adds them in a serial fashion when the g o input is set to1.The result of the operation is stored in a9-bit sum register.A block diagram of the circuit is shown in Figure2.It consists of three shift registers,a full adder,aflip-flop to store carry-out signal from the full adder and afinite state machine(FSM).The shift registers A andB are loaded with the values of A and B.After the st ar t signal is set high,these registers are shifted right one bit at a time.At the same time the least-significant bits of A and B are added and the result is stored into the shift register sum.Once all bits of A and B have been added,the circuit stops and displays the sum until a new addition is requested.Figure2.Block diagram of a serial-adder circuit.The Verilog code for the top-level module of this design is shown in Figure3.It consists of the instances of the shift registers,an adder and afinite state machine(FSM)to control this design.3 Altera Corporation-University ProgramSeptember20101.module serial(A,B,start,resetn,clock,sum);2.input[7:0]A,B;3.input resetn,start,clock;4.output[8:0]LEDR;5.6.//Registers7.wire[7:0]A_reg,B_reg;8.wire[8:0]sum;9.reg cin;10.11.//Wires12.wire reset,enable,load;13.wire bit_sum,bit_carry;14.15.//Confrol FSM16.FSM my_control(start,clock,resetn,reset,enable,load);17.18.//Datapath19.shift_reg reg_A(clock,1’b0,A,1’b0,enable,load,A_reg);20.shift_reg reg_B(clock,1’b0,B,1’b0,enable,load,B_reg);21.22.//a full adder23.assign bit_carry,bit_sum=A_reg[0]+B_reg[0]+cin;24.25.always@(posedge clock)26.begin27.if(enable)28.if(reset)29.cin<=1’b0;30.else31.cin<=bit_carry;32.end33.34.shift_reg reg_sum(clock,reset,9’d0,bit_sum,enable,1’b0,sum);35.defparam reg_sum.n=9;36.endmoduleFigure3.Verilog code for the top-level module of the serial adder.The Verilog code for the FSM is shown in Figure4.The FSM is a3-state Mealyfinite state machine,where thefirst and the third state waits for the st ar t input to be set to1or0,respectively.The computation of the sum of A and B4Altera Corporation-University ProgramSeptember2010happens during the second state,called WORK_STATE.The FSM completes computation when the counter reachesa value of8,indicating that inputs A and B have been added.The state diagram for the FSM is shown in Figure5.1.module FSM(start,clock,resetn,reset,enable,load);2.parameter WAIT_STATE=2’b00,WORK_STATE=2’b01,END_STATE=2’b11;3.input start,clock,resetn;4.output reset,enable,load;5.6.reg[1:0]current_state,next_state;7.reg[3:0]counter;8.9.//next state logic10.always@(*)11.begin12.case(current_state)13.WAIT_STATE:14.if(start)next_state<=WORK_STATE;15.else next_state<=W AIT_STATE;16.WORK_STATE:17.if(counter==4’d8)next_state<=END_STATE;18.else next_state<=WORK_STATE;19.END_STATE:20.if(∼start)next_state<=W AIT_STATE;21.else next_state<=END_STATE;22.default:next_state<=2’bxx;23.endcase24.end25.26.//state registers and a counter27.always@(posedge clock or negedge resetn)28.begin29.if(∼resetn)30.begin31.current_state<=W AIT_STATE;32.counter=’d0;33.end34.else35.beginFigure4.Verilog code for the FSM to control the serial adder(Part a).5 Altera Corporation-University ProgramSeptember201036.current_state<=next_state;37.if(current_state==W AIT_STATE)38.counter<=’d0;39.else if(current_state==WORK_STATE)40.counter<=counter+1’b1;41.end42.end43.//Outputs44.assign reset=(current_state==WAIT_STATE)&start;45.assign load=(current_state==W AIT_STATE)&start;46.assign enable=load|(current_state==WORK_STATE);47.endmoduleFigure4.Verilog code for the FSM to control the serial adder(Part b).Figure5.State diagram.The Verilog code for the shift register is given in Figure6.It consists of synchronous control signals to allow data to be loaded into the shift register,or reset to0.When enable input is set to1and the data is not being loaded or reset, the contents of the shift register are moved one bit to the right(towards the least-significant bit).6Altera Corporation-University ProgramSeptember20101.module shift_reg(clock,reset,data,bit_in,enable,load,q);2.parameter n=8;3.4.input clock,reset,bit_in,enable,load;5.input[n-1:0]data;6.output reg[n-1:0]q;7.8.always@(posedge clock)9.begin10.if(enable)11.if(reset)12.q<=’d0;13.else14.begin15.if(load)16.q<=data;17.else18.begin19.q[n-2:0]<=q[n-1:1];20.q[n-1]<=bit_in;21.end22.end23.end24.endmoduleFigure6.Verilog code for the shift register.The design is located in the example/functional and example/timing subdirectories provided with this tutorial.A Quartus II project for this design has been created as well.In the following sections,we use the serial adder example to demonstrate how to perform simulation using Mod-elSim.We begin by describing a procedure to perform a functional simulation,and then discuss how to perform a timing simulation.4Functional Simulation with ModelSimWe begin this tutorial by showing how to perform a functional simulation of the example design.We start by opening the ModelSim program.7 Altera Corporation-University ProgramSeptember2010Figure7.ModelSim window.The ModelSim program window,shown in Figure7,consists of four sections:the main menu at the top,a set of workspace tabs on the left,a work area on the right,and a command prompt at the bottom.The menu is used to access functions available in ModelSim.The workspace contains a list of modules and libraries of modules available to you,as well as details of the project you are working on.The work area on the right is the space where windows containing waveforms and/or textfiles will be displayed.Finally,the command prompt at the bottom shows feedback from the simulation tool and allows users to enter commands.To perform simulation with ModelSim follow a basicflow shown in Figure1.We begin by creating a project where all designfiles to be simulated are included.We compile the design and then run the simulation.Based on the results of the simulation,the design can be altered until it meets the desired specifications.4.1Creating a ProjectTo create a project in ModelSim,select New>Project...from the File menu.A create project window shown in Figure8will appear.8Altera Corporation-University ProgramSeptember2010Figure8.Creating a new project.The create project window consists of severalfields:project name,project location,default library name,and copy settingsfield.Project name is a user selected name and the location is the directory where the sourcefiles are located.For our example,we choose the project name to be serial,to match the top-level module name of our example design,and the location of the project is the example/functional subdirectory.The default library namefield specifies a name by which ModelSim catalogues designs.For example,a set offiles that describe the logical behaviour of components in an Altera Cyclone II device are stored in the cycloneii library. This allows the simulator to include a set offiles in simulation as libraries rather than individualfiles,which is particularly useful for timing simulations where device-specific data is required.For the purpose of this tutorial, specify tutorial as the library name for your project.The lastfield in the create project window is the copy settingsfield.This allows default settings to be copied from the initializationfile and applied to your project.Now,click OK to proceed to addfiles to the project using the window shown in Figure9.Altera Corporation-University Program September20109Figure9.Add afile to project window.The window in Figure9gives several options to addfiles to the project,including creating newfiles and directories, or adding existingfiles.Since thefile for this tutorial exists,click Add Existing File and select serial.vfile.Once thefile is added to the project,it will appear in the Project tab on the left-hand side of the screen,as shown in Figure10.Figure10.Workspace window after the project is created.Now that all designfiles have been included in the project,click Close to close the window in Figure9.10Altera Corporation-University ProgramSeptember20104.2Compiling a ProjectOnce the project has been created,it is necessary to compile pilation in ModelSim checks if the project files are correct and creates intermediate data that will be used during simulation.To perform compilation,select Compile All from the Compile menu.When the compilation is successful,a green check mark will appear to the right of the serial.vfile in the Project tab.4.3SimulationTo begin a simulation of the design,the software needs to be put in simulation mode.To do this,select Start Simulation...from the Simulate menu.The window in Figure11will appear.Figure11.Start simulation mode in ModelSim.The window to start simulation consists of many tabs.These include a Design tab that lists designs available for simulation,VHDL and Verilog tabs to specify language specific options,a Library tab to include any additional libraries,and timing and other options in the remaining two tabs.For the purposes of the functional simulation,we only need to look at the Design tab.In the Design tab you will see a list of libraries and modules you can simulate.In this tutorial,we want to simulate a module called serial,described in serial.vfile.To select this module,scroll down and locate the tutorial library and click on the plus(+)sign.You will see three modules available for simulation:FSM,serial,and shift_reg.Select the serial module,as shown in Figure11and click OK to begin simulation.When you click OK,ModelSim will begin loading the selected libraries and preparing to simulate the circuit.For the example in this tutorial,the preparation should complete quickly.Once ModelSim is ready to simulate your design, you will notice that several new tabs on the left-hand side of the screen and a new Objects window have appeared, as shown in Figure12.Figure12.New displays in the simulation mode.A key new tab on the left-hand side is the sim tab.It contains a hierarchical display of design units in your circuit in a form of a table.The columns of the table include the instance name,design unit and design unit type names. The rows of the table take a form of an expandable tree.The tree is rooted in the top-level entity called serial.Each module instance has a plus(+)sign next to its name to indicate it can be expanded to allow users to examine the contents of that module instance.Expanding the top-level entity in this view gives a list of modules and/or constructs within it.For example,in Figure12the top-level entity serial is shown to contain an instance of the FSM module,called my_control,three instances of a shift_reg module,four assign statements and an always block.Double-clicking on any of the constructs will cause ModelSim to open a sourcefile and locate the given construct within it.Double-clicking on a module instance will open a sourcefile and point to the description of the module in the sourcefile.In addition to showing modules and/or constructs,the sim tab can be used to locate signals for simulation.Notice that when the serial module is highlighted,a list of signals(inputs,outputs and local wires)is shown in the Objects window.The signals are displayed as a table with four columns:name,value,kind and mode.The name of a signal may be preceded by a plus(+)sign to indicate that it is a bus.The top-level entity comprises signals A,B,resetn, start,and clock as inputs,a sum output and a number of internal signals.12Altera Corporation-University ProgramWe can also locate signals inside of module instances in the design.To do this,highlight a module whose signals you wish to see in the Objects window.For example,to see the signals in the my_control instance of the FSM module, highlight the my_control instance in the sim tab.This will give a list of signals inside of the instance as shown in Figure13.Figure13.Expanded my_control instance.Using the sim tab and the Objects window we can select signals for simulation.To add a signal to simulation, right-click on the signal name in the Objects window and select Add>T o Wave>Selected items from the pop-up ing this method,add signals A,B,clock,resetn,start,sum,and current_state to the simulation.When you do so,a waveform window will appear in the work area.Once you have added these signals to the simulation, press the Undock button in the top-right corner of the waveform window to make it a separate window,as shown in Figure14.Figure14.A simulation window.Before we begin simulating the circuit,there is one more useful feature worth noting.It is the ability to combine signals and create aliases.It is useful when signals of interest are not named as well as they should be,or the given names are inconvenient for the purposes of simulation.In this example,we rename the start signal to go by highlighting the start signal and selecting Combine Signals...from the Tools menu.The window in Figure15will appear.14Altera Corporation-University Programbine signals window.In the textfield labeled Result name type go and press the OK button.This will cause a new signal to appear in the simulation window.It will be named go,but it will have an orange diamond next to its name to indicate that it is an alias.Once the go alias is created,the original start input is no longer needed in the simulation window,so removeit by highlighting it and pressing the delete key.Your simulation window should now look as in Figure16.Figure16.Simulation window with aliased signals.Now that we set up a set of signals to observe we can begin simulating the circuit.There are two ways to run a simulation in ModelSim:manually or by using scripts.A manual simulation allows users to apply inputs and advance the simulation time to see the results of the simulation in a step-by-step fashion.A scripted simulation allows the user to create a script where the sequence of input stimuli are defined in afile.ModelSim can read thefile and apply input stimuli to appropriate signals and then run the simulation from beginning to end,displaying results only when the simulation is completed.In this tutorial,we perform the simulation manually.In this simulation,we use a clock with a100ps period.At every negative edge of the clock we assign new values to circuit inputs to see how the circuit behaves.To set the clock period,right-click on the clock signal and select Clock...from the pop-up menu.In the window that appears,set the clock period to100ps and thefirst edge to be the falling edge,as shown in Figure17.Then click OK.16Altera Corporation-University ProgramFigure17.Set the clock period.We begin the simulation be resetting the circuit.To reset the circuit,set the resetn signal low by right-clicking on it and selecting the Force...option from the pop-up menu.In the window that appears,set Value to0and click OK. In a similar manner,set the value of the go signal to0.Now that the initial values for some of the signals are set,wecan perform thefirst step of the simulation.To do this,locate the toolbar buttons shown in Figure18.The toolbar buttons shown in Figure18are used to step through the simulation.The left-most button is the restartbutton,which causes the simulation window to be cleared and the simulation to be restarted.The textfield,shownwith a100ps string inside it,defines the amount of time that the simulation should run for when the Run button(tothe right of the textfield)is pressed.The remaining three buttons,Continue,Run-All and Break,can be used toresume,start and interrupt a simulation,respectively.We will not need them in this tutorial.To run a simulation for100ps,set the value in the textfield to100ps and press the Run button.After the simulationrun for100ps completes,you will see the state of the circuit as shown in Figure19.Figure19.Simulation results after100ps.In thefigure,each signal has a logic state.Thefirst two signals,A and B,are assigned a value between0and1in a blue color.This value indicates high impedance,and means that these signals are not driven to any logic state.The go and resetn signals is at a logic0value thereby resetting the circuit.The clock signal toggles state every50ps, starting with a falling edge at time0,a rising edge at time50ps and another falling edge at100ps.Now that the circuit is reset,we can begin testing to see if it operates correctly for desired inputs.To test the serial adder we will add numbers143and57,which should result in a sum of200.We can set A and B to143and57, respectively,using decimal notation.To specify a value for A in decimal,right-click on it,and choose Force... from the pop-up menu.Then,in the Valuefield put10#143.The10#prefix indicates that the value that follows is specified in decimal.Similarly,set the value of input_B to57.To see the decimal,rather than binary,values of buses in the waveform window we need to change the Radix of A and B to unsigned.To change the radix of these signals,highlight them in the simulation window and select Radix >Unsigned from the Format menu,as shown in Figure20.Change the radix of the sum signal to unsigned as well.18Altera Corporation-University ProgramFigure20.Changing the radix of A,B and sum signals.Now that inputs A and B are specified,set resetn to1to stop the circuit from resetting.Then set go to1to begin serial addition,and press the Run button to run the simulation for another100ps.The output should be as illustrated in Figure21.Notice that the values of inputs A and B are shown in decimal as is the sum.The circuit also recognizeda go signal and moved to state01to begin computing the sum of the two inputs.Figure21.Simulation results after200ps.To complete the operation,the circuit will require9clock cycles.To fast forward the simulation to see the result,specify900ps in the textfield next to the run button,and press the run button.This brings the simulation to time1100ps,at which point a result of summation is shown on the sum signal,as illustrated in Figure22.Figure22.Simulation results after1100ps.We can see that the result is correct and thefinite state machine controlling the serial adder entered state11,in which it awaits the go signal to become0.Once we set the go signal to0and advance the simulation by100ps,the circuit will enter state00and await a new set of inputs for addition.The simulation result after1200ps is shown inFigure23.Figure23.Simulation results after1200ps.At this point,we can begin the simulation for a new set of inputs as needed,repeating the steps described above.Wecan also restart the simulation by pressing the restart button to begin again from time0.By using the functional simulation we have shown that the serial.vfile contains an accurate Verilog HDL description20Altera Corporation-University Programof a serial adder.However,this simulation did not verify if the circuit implemented on an FPGA is correct.This is because we did not use a synthesized,placed and routed circuit as input to the simulator.The correctness of the implementation,including timing constraints can be verified using timing simulation.5Timing Simulation with ModelSimTiming simulation is an enhanced simulation,where the logical functionality of a design is tested in the presence of delays.Any change in logic state of a wire will take as much time as it would on a real device.This forces the inputs to the simulation be realistic not only in terms of input values and the sequence of inputs,but also the time when the inputs are applied to the circuit.For example,in the previous section we simulated the sample design and used a clock period of100ps.This clock period is shorter than the minimum clock period for this design,and hence the timing simulation would fail to produce the correct result.To obtain the correct result,we have to account for delays when running the simulation and use a clock frequency for which the circuit operates correctly.For Altera FPGA-based designs the delay information is available after the design is synthesized,placed and routed, and is generated by Quartus II CAD software.The project for this part of the tutorial has been created for you in the example/timing subdirectory.5.1Setting up a Quartus II Project for Timing Simulation with ModelSimTo perform timing simulation we need to set up Quartus II software to generate the necessary delay information for ModelSim by setting up EDA Tools for simulation in the Quartus II project.To set up EDA Tools for simulation, open the Quartus II project in example/timing subdirectory,and select Settings...from the Assignments menu.A window shown in Figure24will appear.The window in thefigure consists of a list on the left-hand side to select the settings category and a window area on the right-hand side that displays the settings for a given category.Select Simulation from the EDA Tool Settings category to see the screen shown on the right-hand side of Figure24.The right-hand side of thefigure contains the tool name at the top,EDA Netlist Writer settings in the middle,and NativeLink settings at the bottom.The tool name is a drop-down list containing the names of simulation tools for which Quartus II can produce a netlist with timing information automatically.This list contains many well-known simulation tools,including ModelSim.From the drop-down list select ModelSim-Altera.Once a simulation tool is selected,EDA Netlist Writer settings become available.These settings configure Quartus II to produce input for the simulation tool.Quartus II will use these parameters to describe an implemented design using a given HDL language,and annotate it with delay information obtained after compilation.The settings we can define are the HDL language,simulation time scale that defines time step size for the simulator to use,the location where the writer saves design and delay information,and others.For the purpose of this tutorial,only thefirst three settings are used.Set these settings to match those shown in Figure24and click OK.With the EDA Tools Settings specified,we can proceed to compile the project in Quartus II.The compilation process synthesizes,places,and routes the design,and performs timing analysis.Then it stores the compilation result in theFigure24.Quartus II EDA simulation tool settings.simulation directory for ModelSim to use.Take a moment to examine thefiles generated for simulation using a text editor.The two mainfiles are serial.vo,and serial_v.sdo.The serial.vofile is a Verilogfile for the design.Thefile looks close to the original Verilogfile,except that the design now contains a wide array of modules with a cycloneii_prefix.These modules describe resources on an Altera Cyclone II FPGA,on which the design was implemented using lookup tables,flip-flops,wires and I/O ports. The list delays for each module instance in the design is described in the serial_v.sdofile.22Altera Corporation-University Program5.2Running a Timing SimulationTo simulate the design using timing simulation we must create a ModelSim project.The steps are the same as in the previous section;however,the project is located in the example/timing/simulation/modelsim subdirectory,and the sourcefile is serial.vo.We do not need to include the serial_v.sdofile in the project,because a reference to it is included in the serial.vofile.Once you added the sourcefile to the project,compile it by selecting Compile All from the Compile menu.The next step in the simulation procedure is to place the ModelSim software in simulation mode.In the previous section,we did this by selecting Start Simulation...from the Simulate menu,and specifying the project name. To run a timing simulation there is an additional step required to include the Altera Cyclone II device library in the simulation.This library contains information about the logical operation of modules with cycloneii_prefix.To include the Cyclone II library in the project,select Start Simulation...from the Simulate menu and select the Library tab as shown in Figure25.Figure25.Including Altera Cyclone II library in ModelSim project.The Altera Cyclone II library is located in the altera/verilog/cycloneii directory in the ModelSim-Altera software. To add this library to your project,include the altera/verilog/cycloneii directory using the Add...button.Then,clickon the Design tab,select your project for simulation,and click OK.When the ModelSim software enters simulation mode,you will see a significant difference in the contents of the workspace tabs on the left-hand side of the window as compared to when you ran the functional simulation.In particular,notice the sim tab and the Objects window shown in Figure26.The list of modules in the sim tab is larger,and the objects window contains more signals.This is due to the fact that the design is constructed using components on an FPGA and is more detailed in comparison to an abstract description we used in the previous section of the tutorial.Figure26.Workspace tabs and Objects window for timing simulation.We simulate the circuit by creating a waveform that includes signals A,B,go,and resetn aliases as before.In addition,we include the clock,reg_sum|q,reg_A|q,and reg_B|q signals from the Objects window.Signals reg_A|q and reg_B|q are registers that store A and B at the positive edge of the clock.The reg_sum|q signal is a register that stores the resulting sum.Begin the simulation by resetting the circuit.To do this,set go and resetn signals to0.Also,set the clock input to have a period of20ns,whosefirst edge is a falling edge.To run the simulation,set the simulation step to20ns and press the Run button.The simulation result is shown in Figure27.24Altera Corporation-University Program。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Mentor公司的ModelSim是业界最优秀的HDL语言仿真软件,它能提供友好的仿真环境,是业界唯一的单内核支持VHDL和Verilog混合仿真的仿真器。
它采用直接优化的编译技术、T cl/Tk技术、和单一内核仿真技术,编译仿真速度快,编译的代码与平台无关,便于保护I P核,个性化的图形界面和用户接口,为用户加快调错提供强有力的手段,是FPGA/ASIC设计的首选仿真软件。
工具/原料
∙PC机
∙ModelSim6.4a
∙破解软件modelsim_crack.exe
步骤/方法1
安装ModelSim6.4a,安装一般软件的安装步骤,一路next就行了2
下载破解软件modelsim_crack,并解压破解软件modelsim_crack.exe到任何位置
1. 3
运行破解软件modelsim_crack.exe,会在软件文件夹下生产License.txt
2. 4
把License.txt后缀名改为.dat,然后放到modelsim安装文件夹下,比如我的安装路径是D:\Program Files (x86)\modelsim\modelsim_ae
3. 5
打开pc机的高级系统设置窗口,并找到环境变量设置窗口
4. 6
添加新的用户环境变量和系统环境变量
变量名:LM_LICENSE_FILE
变量值:D:\Program Files (x86)\modelsim\modelsim_ae\License.DAT 这值是你License.DAT的存放位置
5.7 至此破解完成,运行程序即可。