【问题标题】:Verilog - "Illegal output or inout port connection for port"Verilog - “端口的非法输出或输入端口连接”
【发布时间】:2018-11-05 07:49:56
【问题描述】:

这是我第一次使用 Verilog 编码,也是我的第一次 StackExchange 查询!请提前原谅我在这篇文章中没有遵守的任何礼仪。

我在此处已经发布了一些类似的问题,但我无法弄清楚如何将解决方案应用于我自己的代码......

我不确定为什么在尝试运行模拟时收到上述错误,也不确定如何修复它。请指教?:)

我在下面附上了我的源代码,以及测试平台模块和我在尝试运行模拟时收到的错误。

非常感谢任何反馈!


module test1();
   reg O, P, W;  
   wire LowRate, StandardRate, PeakRate;   
outputs LowRate,StandardRate,PeakRate


   CircuitStructure 
testboi(LowRate,StandardRate,PeakRate,O,P,W);

   initial
   begin


O=0; P=0; W=0;
#10 O=0; P=0; W=0;
#10 O=0; P=0; W=1;
#10 O=0; P=1; W=0;
#10 O=0; P=1; W=1;
#10 O=1; P=0; W=0;
#10 O=1; P=0; W=1;
#10 O=1; P=1; W=0;
#10 O=1; P=1; W=1;

#10
$finish();
end
endmodule


module CircuitStructure(O, P, W, LowRate, 
StandardRate, PeakRate);

   input O, P, W;  
output LowRate, StandardRate, PeakRate;

   not
    UA1(NotP,P),
    UA2(NotO,O),
    UA3(NotW,W);

   nand
    UB1(Nand1,NotP,NotO),
    UB2(Nand2,NotW,P),
    UB3(PeakRate,Nand1,Nand2);

   and
    UC1(StandardRate,P,W);

   buf
    UD1(LowRate,O);
endmodule

模拟错误:

Loading work.test1
# Loading work.CircuitStructure
# ** Error (suppressible): (vsim-3053) 
C:/Modeltech_pe_edu_10.4a/ECE171_Project1/TestBench - Copy.v(10): Illegal         
output or inout port connection for port 'LowRate'.
#    Time: 0 ns  Iteration: 0  Instance: /test1/testboi File: 
C:/Modeltech_pe_edu_10.4a/ECE171_Project1/TestBench - Copy.v
# ** Error (suppressible): (vsim-3053) 
C:/Modeltech_pe_edu_10.4a/ECE171_Project1/TestBench - Copy.v(10): Illegal 
output or inout port connection for port 'StandardRate'.
#    Time: 0 ns  Iteration: 0  Instance: /test1/testboi File: 
C:/Modeltech_pe_edu_10.4a/ECE171_Project1/TestBench - Copy.v
# ** Error (suppressible): (vsim-3053) 
C:/Modeltech_pe_edu_10.4a/ECE171_Project1/TestBench - Copy.v(10): Illegal 
output or inout port connection for port 'PeakRate'.
#    Time: 0 ns  Iteration: 0  Instance: /test1/testboi File: 
C:/Modeltech_pe_edu_10.4a/ECE171_Project1/TestBench - Copy.v
# Error loading design

【问题讨论】:

    标签: verilog modelsim


    【解决方案1】:

    您已将模块定义为:

    module CircuitStructure(O, P, W, LowRate, StandardRate, PeakRate);
    

    但是,在定义单元测试时,您使用不同的信号顺序:

    testboi(LowRate,StandardRate,PeakRate,O,P,W);
    

    这就是为什么编译器假设您想将LowRate 信号分配给O 输入,将StandardRate 分配给P 输入等。IEEE 标准 1800-2017(第 23.3.2 章)定义了以下连接模块的方法实例:

    • 按端口顺序的位置连接,
    • 使用完全显式连接的命名端口连接,
    • 使用隐式连接 (SystemVerilog) 的命名端口连接,
    • 使用通配符端口名称 (SystemVerilog) 命名端口连接。

    使用第一个,您需要更改信号顺序:

    testboi(O,P,W,LowRate,StandardRate,PeakRate);
    

    使用第二个,您需要明确“告诉”编译器哪些信号分配给特定端口:

    testboi(.LowRate(LowRate),.StandardRate(StandardRate),.PeakRate(PeakRate),.O(O),.P(P),.W(W));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多