steveicarus / iverilog

Icarus Verilog
https://steveicarus.github.io/iverilog/
GNU General Public License v2.0
2.81k stars 522 forks source link

Unpacked localparam array support #1149

Open lefp opened 2 months ago

lefp commented 2 months ago

As far as I can tell, IEEE 1800-2012 supports unpacked arrays as localparams, and the syntax used in the following example.

However, the following fails to compile:

module Asdf ();

    localparam int i[3] = { 1, 2, 3 };

endmodule
> iverilog -g2012 Asdf.sv
Asdf.sv:3: error: localparam must have a value.
Asdf.sv:3: syntax error
Asdf.sv:3: error: Invalid module item.

Related issues and work

There is an issue #562 about array assignment in general, which was partially addressed by #953. That seems to have solved assignment to variables, but it doesn't work for localparams.

Unpacked and multidimensional localparam support was also mentioned in discussion in #570, but since that issue was focused on function-based assignment, I have opened this one as a separate issue.