我在使用 ModelSim Student Edition 10.2c 运行 Verilog 项目时遇到问题。一切都没有错误地编译,但是我在运行时收到以下错误:
# vsim -gui work.testbench
# Loading work.testbench
# Loading work.circuit1_assign
# ** Error: (vsim-3033) C:/Modeltech_pe_edu_10.2c/examples/circuit1_assign.v(14): Instantiation of 'OR' failed. The design unit was not found.
#
# Region: /testbench/c
# Searched libraries:
# C:/Modeltech_pe_edu_10.2c/examples/hw4
# ** Error: (vsim-3033) C:/Modeltech_pe_edu_10.2c/examples/circuit1_assign.v(16): Instantiation of 'NOT' failed. The design unit was not found.
#
# Region: /testbench/c
# Searched libraries:
# C:/Modeltech_pe_edu_10.2c/examples/hw4
# ** Error: (vsim-3033) C:/Modeltech_pe_edu_10.2c/examples/circuit1_assign.v(18): Instantiation of 'AND' failed. The design unit was not found.
#
# Region: /testbench/c
# Searched libraries:
# C:/Modeltech_pe_edu_10.2c/examples/hw4
# Loading work.t1
# Error loading design
因为我是 Verilog 的新手,我不知道这意味着什么。我认为这是我犯的一个简单错误,但我似乎无法解决它,也没有通过谷歌找到解决方案。有谁知道我该怎么做才能使我的项目正常运行?
编辑:我认为这与无法包含 AND
、OR
和 NOT的文件有关
被定义。谷歌搜索后,我发现文件 modelsim.ini
必须放在项目目录中。但是,我已将 modelsim.ini
放在正确的目录中,但它仍然不起作用。
编辑:我现在已经发布了我项目的所有三个源文件(这只是测试组合电路...)这是我的 circuit1_assign.v 代码:
module circuit1_assign
(
input x,
input y,
input z,
output f
);
wire w1, w2;
OR o1 (.i0(x), .i1(y), .o(w1));
NOT n1 (.i2(z), .o(w2));
AND a1 (.i3(w1), .i4(w2), .o(f));
endmodule
下面是测试代码:
`时间尺度 1ns/1ps
模块 t1 ( 输出注册一个, 输出寄存器 b, 输出寄存器 c );
initial
begin
a = 0; //Do all combinations of possible input values
b = 0;
c = 0;
#10 a = 0;
#10 b = 0;
#10 c = 1;
#10 a = 0;
#10 b = 1;
#10 c = 0;
#10 a = 0;
#10 b = 1;
#10 c = 1;
#10 a = 1;
#10 b = 0;
#10 c = 0;
#10 a = 1;
#10 b = 0;
#10 c = 1;
#10 a = 1;
#10 b = 1;
#10 c = 0;
#10 a = 1;
#10 b = 1;
#10 c = 1;
#10 $finish;
end
endmodule
这是我的测试平台代码:
`timescale 1ns/1ps
module testbench();
wire l, m, n, o;
circuit1_assign c
(
.x (l),
.y (m),
.z (n),
.f (o)
);
t1 t
(
.a (l),
.b (m),
.c (n)
);
initial
begin
$monitor ($time,,"l=%b, m=%b, n=%b, o=%b",
l, m, n, o);
end
endmodule
提前致谢。
最佳答案
您是否尝试过使用小写门(and
、or
等)?
在 verilog 门级建模的每个示例中,我都看到这些原语是小写的,而不是大写的。
关于Verilog 运行时错误和 ModelSim,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20182536/