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 2 K* Q. Y2 g3 V. k
选择 modelsim的执行路径,如果是安装的modelsim altera版本就设置modelsim altera的路径 进入 Assignment ->setting,如下图, Q9 m0 Q8 S4 ^% W2 Y
![]() . h* R: d$ c5 N: p6 J# l7 ^: N
从左侧菜单选择 EDA Tool Setting ![]() 8 ?+ ~5 ^6 R2 L/ R5 f7 H
在EDA tools 的simulation选择ModelSim(Tool Name) Verilog HDL (Format(s)),这里选择ModelSim还是选择ModelSim -Altera 要看安装的modelsim的版本。 再点击左侧菜单 EDA Tool Setting 下的Simulation![]()
u5 U+ _5 I, G7 z3 W) L在如下图的NativeLink setting 中选择compile test bench ,点击Test Benches![]()
% x. h# p$ C- Z1 R ]& D1 X- Q在上图中点击 Test Benches弹出以下Test Benches对话框7 o& k0 v4 ^. d \! W/ t' Y
![]() 2 T# [5 [( A, S
选择new ,填入你的test bench name及Top level module in testbench+ g& p X" a' _/ V: R; ^( `7 s8 C
![]()
4 Z6 U& x/ a e) }1 p- a这里simulation period 中Run simulation until all vector stimuli are used是指全程仿真End simulation at 是指指定最大的仿真时间,我们选择第一项 ![]() ( [: O& C) a. I$ @4 a( e
在Test bench and simulation files 中选择添加testbench文件,这里的testbench可以选择Quartus II自动生成的模板(.vt文件),也可以选择自己编写的testbench(可以是.v文件) 点击add ![]()
2 `" I; a; W& z& k+ N1 o一路 ok下去如果要导入的是 Quarrtus II 的testbench模板,按照以下方式进行processing ->start -> Start Test Bench Template Writer 以下就是一个模板,在工程目录下的 sumulation ,modelsim文件夹下
& C4 m' G& R7 l/ n& K1 l- // 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( O5 s }1 m6 P" t/ B8 D" i
: o6 M: Y0 M$ @* {3 e) q1 F2 B$ E. K: p
/ {; P, B; K1 R3 i6 h8 K这个是不能进行仿真的,还要对模板写完整,在此不赘述。其余步骤与添加自己编写的testbench相同 第二步:进入菜单栏 Tools -> Run Simulation Tool -> RTL Simulation 之后会自动编译自动添加信号,这时候就可以开始仿真观察波形了 8 C$ c, {+ Q) j i( N( _
|