(1)创建激励测试文件,在 Source中右击选择 Add sources
(2)如图1所示,在 Add Sources界面中选择第三项 Add or create simulationsources,单击Next按钮。
(3)如图2所示,单击 Create file按钮创建一个仿真激励文件。
(4)如图3所示,输入激励文件名称,单击OK按钮
(5)如图4所示,确认添加完成之后单击 Finish按钮,因为是激励文件不需要对外端口,所以Port部分空着即可,单击OK按钮。
图1
图2
图3
图4
(6)在 Source下双击打开空白的激励测试文件,完成对将要仿真的 module的实例化和激励代码的编写,本实验代码如程序4.3所示。
`timescale 1ns/1ns
module logic_gates_tb;
reg iA;
reg iB;
wire oAnd;
wire oOr;
wire oNot;
initial
begin
iA = 0;
# 40 iA = 1;
# 40 iA = 0;
# 40 iA = 1;
# 40 iA = 0;
end
initial
begin
iA = 0;
# 40 iB = 0;
# 40 iB = 1;
# 40 iB = 1;
# 40 iB = 0;
end
logic_gates_1
logic_gates_inst(
.iA(iA),
.iB(iB),
.oAnd(oAnd),
.oOr(oOr),
.oNot(oNot)
);
endmodule
(7)进行仿真,在如图5所示的 Vivado流程处理主界面 Flow Navigator中选择Simulation下的 Run simulation选项,并选择 Run Behavioral simulation一项,进入仿真界面。
图5
(8)仿真界面如图6所示。
图6