Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - unsigned to integer conversion

 
Thread Tools Search this Thread
Old 02-23-2007, 05:55 PM   #1
Default unsigned to integer conversion


Hello,

i have a 48 bit unisgned numbers and need to convert them to integer.
I used to_integer functioin but getting the eroor that this function
only works with numbers less than 32 bit. can anyone suggest another
function or technique.

John



john
  Reply With Quote
Old 02-23-2007, 06:10 PM   #2
Ben Jones
 
Posts: n/a
Default Re: unsigned to integer conversion


"john" <> wrote in message
news: ps.com...
> Hello,
>
> i have a 48 bit unisgned numbers and need to convert them to integer.
> I used to_integer functioin but getting the eroor that this function
> only works with numbers less than 32 bit. can anyone suggest another
> function or technique.


An integer in VHDL is only 32 bits wide. In fact, it's not even that wide,
since the most-negative value (-2**31) is not part of the defined range for
integers.

If you need to manipulate numbers that are wider than 31 bits, you cannot
use VHDL's built-in integer type. Sorry.

-Ben-


  Reply With Quote
Old 02-23-2007, 08:30 PM   #3
Nicolas Matringe
 
Posts: n/a
Default Re: unsigned to integer conversion

Ben Jones a écrit :
> "john" <> wrote in message
> news: ps.com...
>> Hello,
>>
>> i have a 48 bit unisgned numbers and need to convert them to integer.
>> I used to_integer functioin but getting the eroor that this function
>> only works with numbers less than 32 bit. can anyone suggest another
>> function or technique.

>
> An integer in VHDL is only 32 bits wide. In fact, it's not even that wide,
> since the most-negative value (-2**31) is not part of the defined range for
> integers.
>
> If you need to manipulate numbers that are wider than 31 bits, you cannot
> use VHDL's built-in integer type. Sorry.


You could try by splitting your unsigned vector and converting each
slice to integer. You'll probably need to define an array of integers
type to keep your slices together in a single object (signal or variable)
I did it once for a 96 bits wide memory model (storing integers is less
memory consuming than storing vectors)

Nicolas
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump