【问题标题】:modelsim verilog vsim-3365 too many portmodelsim verilog vsim-3365 端口太多
【发布时间】:2017-09-29 02:25:32
【问题描述】:
    // Dataflow description of a 4-bit comparator  
    module FourBcompare ( 
      output        A_lt_B, A_eq_B, A_gt_B, 
      input [3: 0]  A, B
    );
      assign A_lt_B = (A < B);
      assign A_gt_B = (A > B);
      assign A_eq_B = (A == B);
    endmodule

//'timescale 1 ps / 1 ps
module t_fourBcompare;

  reg   [7: 0]AB;
  wire  t_A_lt_B;
  wire  t_A_eq_B;
  wire  t_A_gt_B;
  parameter stop_time = 100;

  FourBcompare M1 (   t_A_lt_B, t_A_eq_B, t_A_gt_B ,
              AB[7],AB[6],AB[5],AB[4],
              AB[3],AB[2],AB[1],AB[0]
           );

  initial # stop_time $finish;
  initial begin                 // Stimulus generator
        AB = 8'b00000000;
    repeat (256)
   #10 AB = AB +1'b1;
  end

可以编译,但是不能在modelsim上模拟。

这是错误信息:

# Compile of FourBcompare.v was successful.
# Compile of t_fourBcompare.v was successful.
# 2 compiles, 0 failed with no errors.
vsim work.t_fourBcompare
# vsim work.t_fourBcompare 
# Start time: 01:43:58 on May 02,2017
# Loading work.t_fourBcompare
# Loading work.FourBcompare
# ** Fatal: (vsim-3365) D:/util/t_fourBcompare.v(10): Too many port connections. Expected 5, found 11.
#    Time: 0 ps  Iteration: 0  Instance: /t_fourBcompare/M1 File: D:/util/FourBcompare.v
# FATAL ERROR while loading design
# Error loading design
# End time: 01:43:58 on May 02,2017, Elapsed time: 0:00:00
# Errors: 1, Warnings: 0

【问题讨论】:

    标签: verilog modelsim digital


    【解决方案1】:

    该消息表示FourBcompare 模块有 5 个信号(2 个输入 + 3 个输出),但您尝试将 11 个信号连接到它。端口input [3:0] A 算作一个信号,而不是 4 个。

    这是消除错误的一种方法,但您必须确定它是否适合您的案例:

      FourBcompare M1 (   t_A_lt_B, t_A_eq_B, t_A_gt_B ,
                  {AB[7],AB[6],AB[5],AB[4]},
                  {AB[3],AB[2],AB[1],AB[0]}
               );
    

    我使用串联运算符{} 将各个位分组到总线中。请参阅免费的 IEEE Std 1800-2012,第 11.4.12 节串联运算符。现在,一个 4 位值 {AB[7],AB[6],AB[5],AB[4]} 连接到 4 位 A 信号。

    注意:{AB[7],AB[6],AB[5],AB[4]} 可以简化为AB[7:4]

    【讨论】:

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