Verilog运行时错误和ModelSim

Verilog运行时错误和ModelSim,verilog,instantiation,modelsim,Verilog,Instantiation,Modelsim,我在运行ModelSim学生版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' fa

我在运行ModelSim学生版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新手,我不知道这意味着什么。我认为这是我犯的一个简单的错误,但我似乎无法解决它,也没有通过谷歌找到解决方案。有人知道我能做些什么,这样我的项目才能成功吗


编辑:我认为这与无法包含定义了
的文件有关。在谷歌搜索之后,我发现文件
modelsim.ini
必须放在项目目录中。但是,我已经将
modelsim.ini
放在了正确的目录中,但它仍然不起作用

编辑:我现在发布了我的项目的所有三个源文件(这只是测试一个组合电路…),下面是我的circuit1\u 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 ( 输出寄存器a, 输出寄存器b, 输出寄存器c );

以下是我的测试台代码:

`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

提前感谢。

您的circuit1\u分配正在实例化其他名为OR、NOT和的模块。这些工具正在寻找这些模块,但找不到它们,因此抛出了一个错误。如果你想使用这些模块,你需要自己创建它们。否则,您可以使用Verilog中的assign语句来实现您的目标。您可以更改circuit1\u分配给此:

assign w1 = x | y;
assign w2 = ~z;  //I think this is right?  
assign f  = w1 & w2;

您是否尝试过使用小写门(
等)

在verilog中的每个门级建模示例中,我都看到这些原语是小写的,而不是大写的


请参阅:

发布您试图编译的代码。感谢您的建议,我刚刚添加了所有源代码。您可以尝试将该文件设置为顶级文件
,并且
不包含在某些标准头中?@codekingplus不是您编写它们的方式。在上面的答案中,我使用的是位智能and、or和,而不是您正在寻找的功能。这些符号内置于Verilog中。您编写它的方式意味着您不想使用任何内置结构,而是告诉工具去寻找一些称为AND、OR和not的第三方模块。
assign w1 = x | y;
assign w2 = ~z;  //I think this is right?  
assign f  = w1 & w2;