Menu

#15 add warning for redundant bits

closed
nobody
None
5
2007-10-11
2007-04-10
thiede
No

One popular simulator (and some other verilog reading tools) give me a warning about the following binary number: "redundant digits given in binary number".

module test();
wire [2:0] add_size = 3'b0001;
endmodule

Discussion

  • thiede

    thiede - 2007-04-10
     
  • Cary R.

    Cary R. - 2007-10-01

    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.

     
  • Cary R.

    Cary R. - 2007-10-11
    • milestone: --> devel_(Next_Release)
    • status: open --> closed
     
  • Cary R.

    Cary R. - 2007-10-11

    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

     

Log in to post a comment.

MongoDB Logo MongoDB