EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
Modelsim之从Quartus II 启动仿真 Modelsim之从Quartus II 启动仿真 仿真流程如下 (1)预先设置 (2)启动功能仿真 (3)自动创建仿真工程,自动加载.v和.vt文件,自动编译.v和.vt 文件 (4)自动启动仿真 (5)自动添加仿真信号 (6)自动显示仿真波形 更改.v和.vt 文件后,要想更新仿真波形流程如下: (1)手动编译.v和.vt文件 (2)启动仿真 (3)添加仿真信号 (4)进行仿真观察波形 下面是对已有的Quartus II工程进行仿真 第一步:预先设置。首先是预先设置编译信息,打开Quartus II , 进入Tools -> options 点击左侧菜单 EDA Tool Options * J p3 X' v( W. V5 {+ ~
选择 modelsim的执行路径,如果是安装的modelsim altera版本就设置modelsim altera的路径 进入 Assignment ->setting,如下图
* w" s1 ]9 a! `0 E' s$ z![]() ! Y- ]; k. F% }4 }# S O
从左侧菜单选择 EDA Tool Setting ![]()
, q5 U: o! L. I, o& T. i4 \在EDA tools 的simulation选择ModelSim(Tool Name) Verilog HDL (Format(s)),这里选择ModelSim还是选择ModelSim -Altera 要看安装的modelsim的版本。 再点击左侧菜单 EDA Tool Setting 下的Simulation![]() % W/ I$ G; f- }
在如下图的NativeLink setting 中选择compile test bench ,点击Test Benches![]()
, i4 z; g5 O- E6 ]在上图中点击 Test Benches弹出以下Test Benches对话框
, E4 d9 A9 w& Z. p. u![]() 1 J7 E6 C. z }
选择new ,填入你的test bench name及Top level module in testbench
4 S7 K* n6 g6 G" d! Z7 J2 L* U![]()
+ S2 v$ A1 K! h/ J: Q这里simulation period 中Run simulation until all vector stimuli are used是指全程仿真End simulation at 是指指定最大的仿真时间,我们选择第一项 ![]()
& X& r& ?# @# ~; h- L在Test bench and simulation files 中选择添加testbench文件,这里的testbench可以选择Quartus II自动生成的模板(.vt文件),也可以选择自己编写的testbench(可以是.v文件) 点击add ![]() # i3 b4 i. i: y0 ~3 p
一路 ok下去如果要导入的是 Quarrtus II 的testbench模板,按照以下方式进行processing ->start -> Start Test Bench Template Writer 以下就是一个模板,在工程目录下的 sumulation ,modelsim文件夹下
. ?* b2 X6 o% r3 S- // Copyright (C) 1991-2013 Altera Corporation
- // Your use of Altera Corporation's design tools, logic functions
- // and other software and tools, and its AMPP partner logic
- // functions, and any output files from any of the foregoing
- // (including device programming or simulation files), and any
- // associated documentation or information are expressly subject
- // to the terms and conditions of the Altera Program License
- // Subscription Agreement, Altera MegaCore Function License
- // Agreement, or other applicable license agreement, including,
- // without limitation, that your use is for the sole purpose of
- // programming logic devices manufactured by Altera and sold by
- // Altera or its authorized distributors. Please refer to the
- // applicable agreement for further details.
- // *****************************************************************************
- // This file contains a Verilog test bench template that is freely editable to
- // suit user's needs .Comments are provided in each section to help the user
- // fill out necessary details.
- // *****************************************************************************
- // Generated on "05/25/2014 16:14:44"
- // Verilog Test Bench template for design : ask
- //
- // Simulation tool : ModelSim (Verilog)
- //
- `timescale 1 ps/ 1 ps
- module ask_vlg_tst();
- // constants
- // general purpose registers
- reg eachvec;
- // test vector input registers
- reg clk;
- reg data_in;
- reg rst_n;
- // wires
- wire ask_code_out;
- // assign statements (if any)
- ask i1 (
- // port map - connection between master ports and signals/registers
- .ask_code_out(ask_code_out),
- .clk(clk),
- .data_in(data_in),
- .rst_n(rst_n)
- );
- initial
- begin
- // code that executes only once
- // insert code here --> begin
-
- // --> end
- $display("Running testbench");
- end
- always
- // optional sensitivity list
- // @(event1 or event2 or .... eventn)
- begin
- // code executes for every event on sensitivity list
- // insert code here --> begin
-
- @eachvec;
- // --> end
- end
- endmodule) T5 Q& x1 v5 H3 {2 b+ Z
. ^, N+ W: [; }7 I2 s4 b# @$ J' {
% \! u$ U2 y" g* C: |, O: d! D, F# x% U( X3 R0 O4 [) T
这个是不能进行仿真的,还要对模板写完整,在此不赘述。其余步骤与添加自己编写的testbench相同 第二步:进入菜单栏 Tools -> Run Simulation Tool -> RTL Simulation 之后会自动编译自动添加信号,这时候就可以开始仿真观察波形了
+ @: `8 z# x j& B |