Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warnings and support of array concatenation #1627

Open
veripoolbot opened this issue Dec 6, 2019 · 2 comments
Open

Warnings and support of array concatenation #1627

veripoolbot opened this issue Dec 6, 2019 · 2 comments

Comments

@veripoolbot
Copy link
Contributor

@veripoolbot veripoolbot commented Dec 6, 2019


Author Name: Driss Hafdi
Original Redmine Issue: 1627 from https://www.veripool.org


Verilator provides a very misleading warning when using unsized numbers/parameters in a concatenation/replication. In this example (also found in this diff: drissos@27adb28), verilator generates this warning:

 %Warning-WIDTHCONCAT: t/t_typedef_logic_in_concat.v:12: Unsized numbers/parameters not allowed in replications.
                                                     : ... In instance t
 typedef logic [15:0] count_t;
         ^~~~~
                     ... Use "/* verilator lint_off WIDTHCONCAT */" and lint_on around source to disable this message.

It is true that $bits() returns an unsized number and the warning should rightfully point to it, as opposed to the declaration of the input to the $bits() call. The warning should look like this:

 %Warning-WIDTHCONCAT: t/t_typedef_logic_in_concat.v:15: Unsized numbers/parameters not allowed in replications.
                                                       : ... In instance t
   localparam bit_int_t [1:0] count_bits = {2{$bits(count_t)}};
                                               ^~~~~
                       ... Use "/* verilator lint_off WIDTHCONCAT */" and lint_on around source to disable this message.
 %Error: Exiting due to 1 warning(s)
@veripoolbot
Copy link
Contributor Author

@veripoolbot veripoolbot commented Dec 6, 2019


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-12-06T22:58:12Z


$bits is not unsized, the spec says it's 32 bits, and that's also the size of bit_int_t.

I think Verilator is confused because this is an unpacked array concatentation (IEEE 10.10.1), which are not supported. I believe the correct thing is either an unsupported message, or fix this to work correctly.

@veripoolbot
Copy link
Contributor Author

@veripoolbot veripoolbot commented Dec 7, 2019


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-12-07T20:53:41Z


  1. Pushed to fixed original warning to properly point to $bits.

  2. Pushed addition of unsupported warning on unpacked concatenations.

  3. This example really was a packed concat which should be warning free. At present there is no way to indicate a number is e.g. 4 to 32 bits but sized. Needs work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.