One popular simulator (and some other verilog reading tools) give me a warning about the following binary number: "redundant digits given in binary number".
Making this report a warning is not trivial. The parser process the size and bits separately. It then combines them into a sized number, but at this point it no longer has the base information (it is just a bit pattern) so you cannot distinguish extra bits in a binary context from legitimate extra bits in an octal, decimal or hex constant e.g.(3'h7 is 'sd3 and 'b0111 combined to produce 3'b111). There is a check to verify that bits are trimmed without loosing any precision (only trim x, z or 0 depending on the situation). I would suggest that this be closed since it is unlikely it will ever be implemented.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
After some more thought I came up with a solution that implements this for binary, octal and hex constants. Don't even bother asking to have this extended to support decimal constants. The fundamental issue is that there is no easy and accurate way to find the number of digits a decimal constant represents. The patch should apply to the latest development release.
File Added: 0001-Check-for-extra-digits-in-sized-binary-octal-and-he.patch
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=1651735
Originator: NO
Making this report a warning is not trivial. The parser process the size and bits separately. It then combines them into a sized number, but at this point it no longer has the base information (it is just a bit pattern) so you cannot distinguish extra bits in a binary context from legitimate extra bits in an octal, decimal or hex constant e.g.(3'h7 is 'sd3 and 'b0111 combined to produce 3'b111). There is a check to verify that bits are trimmed without loosing any precision (only trim x, z or 0 depending on the situation). I would suggest that this be closed since it is unlikely it will ever be implemented.
Logged In: YES
user_id=1651735
Originator: NO
After some more thought I came up with a solution that implements this for binary, octal and hex constants. Don't even bother asking to have this extended to support decimal constants. The fundamental issue is that there is no easy and accurate way to find the number of digits a decimal constant represents. The patch should apply to the latest development release.
File Added: 0001-Check-for-extra-digits-in-sized-binary-octal-and-he.patch
Patch file