Forum Discussion
Altera_Forum
Honored Contributor
18 years agoTo add to what Frank said, if you are doing arithmetic, it is quicker (simulation-wise) to use INTEGER types, rather than vectors of bits. Other things that you get from this are errors if you use restricted ranges of integer and it goes outside of the range. This does mean that if you want modulo-n rollover in a counter or similar, you have to code it explicitly:
if (counter + 1 > t_counter'high) then counter := 0; else counter := counter +1; end if; If t_counter'high is a power of 2, then the "counter+1>" comparison will usually optimise out in synthesis. Cheers, Martin