【问题标题】:Verilog Matrix multiplication error in synthesis综合中的 Verilog 矩阵乘法错误
【发布时间】:2016-02-24 15:58:32
【问题描述】:

我正在 Verilog 上编写 32 行乘 32 列乘法。我试图合成代码,但它给出了一个错误,说信号连接到多个驱动程序。下面的代码不完整,但给出了同样的错误。我是 Verilog 的新手,我不知道如何解决这个问题。您能否就如何解决此问题提出建议。我使用的是 Xilinx 14.5 版,FPGA 是 virtex 5。

我正在使用内置乘法器和内置加法器。 代码如下:

module matrixMult(Arow, Bcol,CLK, AxB);
    input [1023:0] Arow;
    input [1023:0] Bcol;
    input          CLK;
    output [31:0] AxB;

     wire [1023:0] Arow;
     wire [1023:0] Bcol;
     wire [1024:0] ab;
     wire [1024:0] AxB;


     // multiplication
     ip32Mult a1b1(CLK, ab[1023:992], Arow[1023:992],Bcol[1023:992]);
     ip32Mult a2b2(CLK, ab[991:960], Arow[991:960],Bcol[992:960]);

     // addition // no clock enable
     ip32Add ab1( AxB[31:0], ab[1023:992], ab[991:960]);

endmodule

错误:

ERROR:Xst:528 - Multi-source in Unit <matrixMult> on signal <ab<992>>; this signal is connected to multiple drivers.

附加信息: ip32Add 的样子

module ip32Add (
  clk, s, a, b
)/* synthesis syn_black_box syn_noprune=1 */;
  input clk;
  output [31 : 0] s;
  input [31 : 0] a;
  input [31 : 0] b;
  ....

ip32Mult 的样子:

module ip32Mult (
  clk, p, a, b
)/* synthesis syn_black_box syn_noprune=1 */;
  input clk;
  output [31 : 0] p;
  input [31 : 0] a;
  input [31 : 0] b;
  ...

【问题讨论】:

  • 我使用了内置的 ip 乘数。我应该在这里粘贴整个代码吗?挺长的。

标签: verilog xilinx hdl


【解决方案1】:

ip32Add 标头有一个clk 引脚,但 ab1 实例没有。因此,通过按顺序连接,AxB[31:0] 连接到 clkab[1023:992] 连接到输出 s。如果实例 a1b1ab[1023:992] 也连接到输出 p。因此ab[1023:992] 有两个驱动程序。可能有警告,例如 ab1,例如宽度不匹配和b 未连接。

我建议您按名称(例如:.portname(netname))而不是按顺序连接您的端口。顺序与按名称连接无关,并且更明确。如果时钟无关紧要但引脚确实存在,ab1 应该如下所示:

ip32Add ab1( .s(AxB[31:0]), .a(ab[1023:992]), .b(ab[991:960]), .clk() );

【讨论】:

    【解决方案2】:

    评论有点太长,但不能被视为完整答案。 您能否使用现代风格重新定义您的模块:

    module matrixMult(
      input [1023:0] Arow,
      input [1023:0] Bcol,
      input          CLK,
      output [31:0]  AxB );
    
    
     wire [1024:0] ab;
    

    你有这条线:

     wire AxB;
    

    不确定是否会导致它为 1 位,或者前面的语句(32 位宽)是否会获胜。

    如果问题也可以显示标题会很有帮助:

    ip32Mult
    ip32Add
    

    正如错误提示,ab 连接可能连接到两个驱动程序,而不是一个输入和一个输出。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-01-25
      • 1970-01-01
      • 2016-03-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多