Re: [myhdl-list] intb min, max confusion
Brought to you by:
jandecaluwe
From: Christopher F. <chr...@gm...> - 2012-10-04 10:26:27
|
> > > On Thu, Oct 4, 2012 at 1:43 AM, Angel Ezquerra <ang...@gm...> wrote: > I think the comparison to range is not totally accurate. The docstring > of the range function is as follows: > > range([start,] stop[, step]) -> list of integers > > That is, there is no "max" parameter, but a "stop" parameter. > I'm not saying the current behavior should be changed, just that > perhaps the parameter name is a bit misleading. > > Cheers, > > Angel Ok, /range/ might not have been the best example. More information on intbv can be found in the manual. http://www.myhdl.org/doc/current/manual/intro.html#bit-oriented-operations http://www.myhdl.org/doc/current/manual/reference.html#myhdl.intbv Regards, Chris > > > On Thu, Oct 4, 2012 at 4:48 AM, Christopher Felton > <chr...@gm...> wrote: >> You would simply use MAXV = 2**NBITS. This is common in >> Python (there is a term for it). Example if you use "range(3)" >> the list you get is 0,1,2. It doesn't include the 3 only up to. >> The intbv works the same, max=N, the max value will be >> N-1. Even though a 3bit value was created "len(x) == 3" the max >> value was specified and is checked during simulation. >> >> Hope that helps, >> Chris >> >> >> On Wed, Oct 3, 2012 at 6:53 PM, garyr <ga...@fi...> wrote: >>> >>> It appears to me that the max limit on an intbv value should be > (greater >>> than) rather than >= (greater than or equal). In the following code, isn't >>> 3 >>> a valid value for a 3-bit signal? >>> <snip> |