compare unsigned

M

Matthias Alles

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
 
M

Mike Treseler

Matthias said:
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
 

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,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top