【问题标题】:Verilog runtime error and ModelSimVerilog 运行时错误和 ModelSim
【发布时间】:2013-11-24 23:35:30
【问题描述】:

我在使用 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 的新手,我不知道这意味着什么。我认为这是我犯的一个简单错误,但我似乎无法解决它,也没有通过谷歌找到解决方案。有人知道我可以做些什么来让我的项目成功吗?

编辑:我认为这与无法包含定义 ANDORNOT 的文件有关。 google了一下,发现modelsim.ini这个文件必须放在项目目录下。但是,我把modelsim.ini放在了正确的目录下,还是不行。

编辑:我现在已经为我的项目发布了所有三个源文件(这只是测试一个组合电路......)这是我的电路1_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, 输出 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

提前致谢。

【问题讨论】:

    标签: verilog instantiation modelsim


    【解决方案1】:

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

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

    见:http://www.asic-world.com/verilog/gate1.html

    【讨论】:

      【解决方案2】:

      您的 circuit1_assign 正在实例化称为 OR、NOT、AND 的其他模块。这些工具正在寻找这些模块,但找不到它们,因此会引发错误。如果您想使用这些模块,您需要自己创建它们。否则,您可以使用 Verilog 中的分配语句来实现您的目标。您可以将 circuit1_assign 更改为此:

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

      【讨论】:

      • ANDORNOT 不包含在某些标准标头中?
      • @CodeKingPlusPlus 不是您编写它们的方式。我在上面的答案中使用它们的方式是您正在寻找的按位与,或,而不是功能。这些符号内置于 Verilog 中。您编写它的方式意味着您不想使用任何内置结构,而是告诉工具去寻找一些名为 AND、OR 和 NOT 的第 3 方模块。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-10
      • 1970-01-01
      • 2015-08-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多