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
Enum value not made sized when enum sized #1442
Comments
Original Redmine Comment $ verilator --lint-only test.v %Warning-WIDTHCONCAT: test.v:8: Unsized numbers/parameters not allowed in concatenations. %Warning-WIDTHCONCAT: Use "/* verilator lint_off WIDTHCONCAT */" and lint_on around source to disable this message. %Warning-WIDTHCONCAT: test.v:9: Unsized numbers/parameters not allowed in concatenations. %Warning-WIDTHCONCAT: test.v:10: Unsized numbers/parameters not allowed in concatenations. %Warning-WIDTHCONCAT: test.v:11: Unsized numbers/parameters not allowed in concatenations. %Warning-WIDTHCONCAT: test.v:12: Unsized numbers/parameters not allowed in concatenations. %Warning-WIDTHCONCAT: test.v:8: Unsized numbers/parameters not allowed in replications. %Error: Exiting due to 6 warning(s) %Error: Command Failed /usr/bin/verilator_bin --lint-only test.v The fix is to explictly size the enum value. But it seems like the typedef should take care of this typedef enum logic[2:0] {P=3'd0, W, E, N, S} Dirs; |
Original Redmine Comment Verilator 4.015 devel rev UNKNOWN_REV |
Original Redmine Comment I suspect you added the LEN casts to try to work around this, but note they are unnecessary to show the problem, which can simply be seen with
What is happening is the assignment of P to 0 is seen as unsized because the zero is unsized. Indeed if you use P=3'b0 it works. This is an unfortunate side effect of trying not to give WIDTH warnings when a user does "enum { P=0 }" then uses P in a context that is looking for only a few bit wide number (versus 32 bits wide). Requires some experiments as how to fix this without adding those unfortunate WIDTH warnings. |
Original Redmine Comment Fixed in git towards 4.018. I tried a few alternatives to preserve the behavior I thought was best for WIDTH warnings but ended up not finding anything that seemed consistent and didn't break this case (which seemed worse). |
Original Redmine Comment In 4.018. |
Author Name: Dan Petrisko (@dpetrisko)
Original Redmine Issue: 1442 from https://www.veripool.org
Original Assignee: Wilson Snyder (@wsnyder)
The text was updated successfully, but these errors were encountered: