基于quartus ii11.0的modelsim仿真.doc
文本预览下载声明
Quartus自从9.0版本以后就没有自带仿真工具。需要进行仿真要另外安装仿真工具。下面就以altera-modelsim6.6d 版本介绍一个简单的VHDL语言编写的程序的仿真步骤。Quartus工具为11.0版本。
1).新建一个工程。以与非门为例。
打开quartus11.0工具栏的file-new-New Quartus II Project.点击OK。
点Next
创建工程文件夹,如andnotgate。输入工程名称。
点Next
先别管它,点Next
选择芯片型号,因为是只是仿真,可以随便选。或者默认。点Next.
选择仿真工具,这里选择ModelSim-Altera.点Next.
点Finish。新建了一个工程。
2).向新建工程添加VHDL源文件
File-new-VHDL File-OK
编写源程序:
library ieee;
use ieee.std_logic_1164.all;
entity andnotgate is
port(a,b:in std_logic;
c:out std_logic
);
end entity andnotgate;
architecture rt1 of andnotgate is
begin
c=not(a and b);
end rt1;
保存源程序在新建的工程中
File-save as
保存。
编译源文件:
点击Start compilation
编译成功。
3).利用modelsim进行波形仿真
要进行仿真必须先创建一个testbench的仿真激励文件。
testbench文件的编写可以利用软件提供的模板进行修改。
生成testbench模板processing-start-start test bench template writer-OK
打开新生成的testbench模板。在新建工程里的simulation-modelsim里的后缀为.vht的文件。
修改testbench文件,主要工作是加入要输入的信号以及输出的时间。
生成的模板为
LIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY andnotgate_vhd_tst IS
END andnotgate_vhd_tst;
ARCHITECTURE andnotgate_arch OF andnotgate_vhd_tst IS
-- constants
-- signals
SIGNAL a : STD_LOGIC;
SIGNAL b : STD_LOGIC;
SIGNAL c : STD_LOGIC;
COMPONENT andnotgate
PORT (
a : IN STD_LOGIC;
b : IN STD_LOGIC;
c : OUT STD_LOGIC
);
END COMPONENT;
BEGIN
i1 : andnotgate
PORT MAP (
-- list connections between master ports and signals
a = a,
b = b,
c = c
);
init : PROCESS
-- variable declarations
BEGIN
-- code that executes only once
WAIT;
END PROCESS init;
always : PROCESS
-- optional sensitivity list
显示全部