- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Actually this is a question about VHDL. I need a counter which is loaded with two different initial values T1 or T2 in different cases and then counts down to 0. How do I specify the range of the counter in declaration? constant T1 : integer := AA; constant T2 : integer := BB; signal cnt : integer range 0 to ??; (here I need an expression to find the larger number of AA and BB) Is it possible to do it in VHDL?Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
function find_larger(a, b : integer) return integer is
begin
if a >= b then return a
else return b;
end if;
end function find_larger;
....
signal cnt : integer range 0 to find_larger(T1, T2);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The IEEE library has a MAX function for the same purpose.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page