compare unsigned

Discussion in 'VHDL' started by Matthias Alles, May 14, 2004.

  1. Hello,

    I have a VHDL-beginner question:

    How do I compare an unsigned signal to a value, when I don´t know the
    width of this unsigned(the width depends on a parameter)?

    At the moment I do it like this:

    if to_integer(my_unsigned_value) = 1 then ...

    But I have know idea, what the synthesis makes out of this construct (I
    guess a comparator with 32 bits).

    Can anyone help?

    Thanks,
    Matthias
    Matthias Alles, May 14, 2004
    #1
    1. Advertising

  2. Matthias Alles wrote:

    > At the moment I do it like this:
    >
    > if to_integer(my_unsigned_value) = 1 then ...


    if my_unsigned_value = 1 then ...

    will also work for numeric_std.

    > But I have know idea, what the synthesis makes out of this construct (I
    > guess a comparator with 32 bits).


    Synthesis will use the correct width.
    Try it yourself and see.

    -- Mike Treseler
    Mike Treseler, May 14, 2004
    #2
    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:
    941
    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:
    672
    Eric Sosman
    Jul 8, 2003
  3. Replies:
    1
    Views:
    450
    Diez B. Roggisch
    Jun 1, 2005
  4. jamx
    Replies:
    11
    Views:
    833
    Barry Schwarz
    Mar 12, 2006
  5. pozz
    Replies:
    12
    Views:
    733
    Tim Rentsch
    Mar 20, 2011
Loading...

Share This Page