unsigned to integer conversion

Discussion in 'VHDL' started by john, Feb 23, 2007.

  1. john

    john Guest

    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, Feb 23, 2007
    #1
    1. Advertising

  2. john

    Ben Jones Guest

    "john" <> wrote in message
    news:...
    > 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-
    Ben Jones, Feb 23, 2007
    #2
    1. Advertising

  3. Ben Jones a écrit :
    > "john" <> wrote in message
    > news:...
    >> 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
    Nicolas Matringe, Feb 23, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Timo Freiberger
    Replies:
    3
    Views:
    933
    Bob Hairgrove
    Oct 30, 2004
  2. George Marsaglia

    Assigning unsigned long to unsigned long long

    George Marsaglia, Jul 8, 2003, in forum: C Programming
    Replies:
    1
    Views:
    661
    Eric Sosman
    Jul 8, 2003
  3. Replies:
    14
    Views:
    2,078
    CBFalconer
    Jun 18, 2005
  4. CFAN
    Replies:
    6
    Views:
    809
    Tor Rustad
    Apr 4, 2007
  5. pozz
    Replies:
    12
    Views:
    726
    Tim Rentsch
    Mar 20, 2011
Loading...

Share This Page