Verilog 运行时错误和 ModelSim

标签 verilog instantiation modelsim

我在使用 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 被定义。谷歌搜索后,我发现文件 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

提前致谢。

最佳答案

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

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

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

关于Verilog 运行时错误和 ModelSim,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20182536/

相关文章:

reactjs - 如何以编程方式创建 react 组件的实例?

system-verilog - 在 System Verilog 中检测时间刻度

modelsim - 如何让 Modelsim 警告我有关 'X' 信号的信息?

verilog - 这段代码中的程序 block 如何控制时钟输出?

xml - VLSI:寄存器自动化

c - 从汇编器到 C 编译器

java - 如何允许第三方扩展我的 java 库中的类

c++ - 编译器在模板类中实例化函数,甚至不调用它

vhdl - 在 Modelsim 的 SystemVerilog Testbench 中使用 VHDL 记录

c - 与 Verilog 仿真实时通信