Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VHDL questions!

Status
Not open for further replies.

asc01001

Programmer
Nov 24, 2004
2
0
0
SE
Hi!

How can I in VHDL write
if(a >= 0 and a <= 5) -- if a is between 0 and 5..???????
What type does "a" have to be to be able to do this???
 
Umm this might help

port(
A :in integer range 0 to 5;
);

If you cant get it from there let me know and ill tell you how....
 
Hello asc01001-

Are you looking for specific syntax or methods of testing?

If a is defined as an integer range, then you can test for this with an "if" statement (as you have indicated, although for clarity, I'd add an extra set of parenthesis).

Depending on the synthesis tool, this may or may not work with std_logic_vector.

I generally don't do a lot from the simulation side of things, but this may work with a floating point number as well - but not in synthesis.

Hope this helps...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top