Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > compare unsigned

Reply
Thread Tools

compare unsigned

 
 
Matthias Alles
Guest
Posts: n/a
 
      05-14-2004
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
 
Reply With Quote
 
 
 
 
Mike Treseler
Guest
Posts: n/a
 
      05-14-2004
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
(int) -> (unsigned) -> (int) or (unsigned) -> (int) -> (unsigned):I'll loose something? pozz C Programming 12 03-20-2011 11:32 PM
unsigned long to unsigned char ashtonn@gmail.com Python 1 06-01-2005 07:00 PM
comparing unsigned long and unsigned int sridhar C Programming 6 11-03-2004 03:52 AM
unsigned int const does not match const unsigned int Timo Freiberger C++ 3 10-30-2004 07:02 PM
Assigning unsigned long to unsigned long long George Marsaglia C Programming 1 07-08-2003 05:16 PM



Advertisments