在 verilog 中声明一个二维数组给我一个错误 illegal redeclaration of the variable

Declaring a 2-D array in verilog gives me a error illegal redeclaration of the variable

我正尝试在 verilog 中初始化一个二维数组,如下面的代码片段所示。

parameter N=4;
 reg [N-1:0] number_c[2**N-1:0];
 reg [N-1:0] result_c;

编译后出现以下错误

ERROR:HDLCompilers:27 - "Combinational_output.v" line 24 Illegal redeclaration of 'number_c' ERROR:HDLCompilers:27 - "Combinational_output.v" line 25 Illegal redeclaration of 'result_c'

我的模块看起来像这样

module Combinational_outputss(output number_c,output result_c
);

您正在混合使用 ANSI 和 non-ANSI 端口样式。请参阅 IEEE 标准 1800-2012,第 23.2.3 节 参数化模块 。这使用 ANSI 样式:

module Combinational_outputss #(parameter N=4)
(
    output reg [N-1:0] number_c[2**N-1:0],
    output reg [N-1:0] result_c
);