Numeric_std unsigned issues?

Joined
Mar 28, 2011
Messages
3
Reaction score
0
I'm trying to convert a decimal number that is greater than 2^31 to a 32 bit unsigned number.

mem_i <= to_unsigned(2952790016, 32);

I have numeric_std included. It throws the error on compile:
Error: ./src/test_tb.vhd(147): near "2952790016": (vcom-119) Integer value exceeds INTEGER'high.
# ** Warning: [14] ./src/test_tb.vhd(147): (vcom-1144) Value -1342177280 is out of std.standard.natural range 0 to 2147483647.

Firstly, why is this looking at INTEGER'high? Shouldn't a to_unsigned() be looking at a NATURAL? Secondly, isn't the natural range up to 2^32-1 (4294967295)?

Any explanation about integers, naturals, and type conversions would be appreciated.
 
Joined
Jan 29, 2009
Messages
152
Reaction score
0
I'm pretty sure this error occurs while parsing the integer value 2952790016 - before passing it to the to_unsigned function.
(Because the Integer type is defined to be a signed 32-bit value)

I think you'll have to hardcode it as X"B0000000".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,016
Latest member
TatianaCha

Latest Threads

Top