综合中的 Verilog 矩阵乘法错误

Verilog Matrix multiplication error in synthesis

我正在 Verilog 上编写 32 行乘以 32 列的乘法。我试图合成代码,但它给出了一个错误,说信号连接到多个驱动程序。下面的代码不完整,但给出了同样的错误。我是 Verilog 的新手,我不知道如何解决这个问题。你能就如何解决这个问题提出建议吗?我使用的是 Xillinx 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;
  ...

对于评论来说有点太长了,但不能被视为完整的答案。 你能用现代风格重新定义你的模块吗:

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


 wire [1024:0] ab;

你有这条线:

 wire AxB;

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

如果问题也能显示 headers for :

会很有帮助
ip32Mult
ip32Add

由于错误表明 ab 连接可能连接到两个驱动器而不是输入和输出。

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

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

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