Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

redundant digits in numeric literal

4,656 views
Skip to first unread message

RICHARDCHI-PENG LIN

unread,
Sep 6, 2003, 6:48:35 PM9/6/03
to
Hello,

I ran ModelSim on my adder_tb.v testbench file. The following snippet of code gave me a warning:

in0=8'h1F4. The warning is: redundant digits in numeric literal. In the simulation, instead of having the value of 500(decimal) as intended, in0 has the value of 244(decimal) which is 1F(hex). Why does this happen?

Also, other numbers have the same warning. However, I tried in0=8'32 and that seemed to work fine.

Thanks,
Richard (rc...@uclink4.berkeley.edu)

Greg Gibeling

unread,
Sep 9, 2003, 11:26:26 AM9/9/03
to
Actually you only needs to use 9'h1F4. Since 500 fits easily in 9 bits
that's all you need. The fact that you are using 3 hex digits is
irrelavent, when the value is converted to binary it will only take up
9bits. Its the binary representation that determines the necessary
bitwidth, not counting system you specify the number in.

-Greg G.


0 new messages