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
选择 modelsim的执行路径,如果是安装的modelsim altera版本就设置modelsim altera的路径 进入 Assignment ->setting,如下图
从左侧菜单选择 EDA Tool Setting
在EDA tools 的simulation选择ModelSim(Tool Name) Verilog HDL (Format(s)),这里选择ModelSim还是选择ModelSim -Altera 要看安装的modelsim的版本。 再点击左侧菜单 EDA Tool Setting 下的Simulation
在如下图的NativeLink setting 中选择compile test bench ,点击Test Benches
在上图中点击 Test Benches弹出以下Test Benches对话框
选择new ,填入你的test bench name及Top level module in testbench
这里simulation period 中Run simulation until all vector stimuli are used是指全程仿真End simulation at 是指指定最大的仿真时间,我们选择第一项
在Test bench and simulation files 中选择添加testbench文件,这里的testbench可以选择Quartus II自动生成的模板(.vt文件),也可以选择自己编写的testbench(可以是.v文件) 点击add
一路 ok下去如果要导入的是 Quarrtus II 的testbench模板,按照以下方式进行processing ->start -> Start Test Bench Template Writer 以下就是一个模板,在工程目录下的 sumulation ,modelsim文件夹下
- // 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
复制代码
这个是不能进行仿真的,还要对模板写完整,在此不赘述。其余步骤与添加自己编写的testbench相同 第二步:进入菜单栏 Tools -> Run Simulation Tool -> RTL Simulation 之后会自动编译自动添加信号,这时候就可以开始仿真观察波形了
|