我在使用ModelSim Student Edition 10.2c运行Verilog项目时遇到了问题。编译没有错误,但是我在运行时出现以下错误:Verilog运行时错误和ModelSim
# 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 ( 输出一章, 输出REG b, output reg 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
在此先感谢。
发布您正在编译的代码。 – Russell
感谢您的建议,我只是添加了所有的源代码。 – CodeKingPlusPlus
您可以尝试将文件设置为顶级文件 –