Issue #424
Multiple problems encountered with parameter arrays
| Status: | Closed | Start date: | 12/14/2011 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | Unsupported | |||
| Target version: | - |
Description
First off, great tool! We are looking forward to putting this to use in conjunction with our SystemC testbench.
We have a design which uses Verilog arrays extensively, and while the wire and reg forms seem to work just fine, our array parameters cause Verilator to issue unexplained warnings and also crash. Here's a sample bit of code:
module testing ();
parameter [0:3][3:0] FOO = { 4'h0, 4'h1, 4'hE, 4'hF };
parameter BAR = FOO[3];
endmodule
When we process that example with Verilator (by calling verilator -sc testing.v) the result is:
%Warning-WIDTH: testing.v:3: Operator VAR 'FOO' expects 4 bits on the Initial value, but Initial value's CONCAT generates 16 bits. %Warning-WIDTH: Use "/* verilator lint_off WIDTH */" and lint_on around source to disable this message. %Error: testing.v:5: Internal: Unexpected Call %Error: Internal Error: testing.v:5: ../V3AstNodes.h:453: Unexpected Call %Error: Command Failed verilator_bin -sc testing.v
As far as we can tell, this warning is invalid. It appears that the array assignment isn't being handled correctly, and then the subsequent array access leads to an internal error (which is identical in nature to bug393).
History
Updated by Wilson Snyder over 1 year ago
- Category set to Unsupported
- Status changed from New to Feature
First, you example is wrong which leads to the WIDTH errors. I'm presuming you're writing SystemVerilog (which is when arrayed parameters came into existence), and you really wanted a '{.
So in total, the following fixes are needed.
Support '{ is bug355, though this is a much easier sub-case.
Support multidimensional parameter reading - since multidimensional normal arrays are already supported, this part should be almost trivial.
Generating unique module names for each parameterized version of the module. Maybe localparams might be sufficient for your application so this wouldn't be needed?
If you'd be willing to try to tackle some of these I can provide pointers, none should be too bad. Unfortunately elsewise it'll probably be a month or more before I can get to them, sorry, there's a backlog!
Updated by James Johnson over 1 year ago
Just to clarify, do array parameters and normal Verilog 1995 arrays use different syntax? We have used arrays of wire and reg extensively so far, and I don't believe anyone has ever used the '{} syntax in our code base.
Yes, I'd be interested in at least scoping how much work would be required to create patches for this.
I believe localparams would be sufficient for our application.
Updated by Wilson Snyder over 1 year ago
Array parameters are SystemVerilog; before SV 2005, you could never array a parameter (as opposed to giving it a bit width "parameter [3:0] = X;" which was always fine). Perhaps you're using SV and never realized it? Or this is new code which doesn't work in any simulator?
Updated by Wilson Snyder 3 months ago
- Status changed from Feature to Closed
Packed arrays on parameters as well as other things were supported in 3.845.
Also available in: Atom
![[logo]](/img/veripool_small.png)