Re: [myhdl-list] intbv with min -1, max 1 has 2 bits?
Brought to you by:
jandecaluwe
From: Günter D. <dan...@we...> - 2008-06-13 09:12:11
|
Jan Decaluwe wrote: > Günter Dannoritzer wrote: ... >> I might be oblivious and the reason is obvious, but I don't see it at >> the moment. Anyone can explain why I need a leading zero bit and cannot >> create a 1 bit intbv? > > 1) why a leading zero bit > Well, for a number that can be both positive or negative you need to > have room for a sign bit, right? that's what the leading zero bit does. > > 2) why not a 1 bit signed intbv > That seems to be a bug. The one bit can function as a sign bit in > this (corner) case. I guess the test should really be: > > ... > elif max <= 1: # not 0 > _nrbits = len(bin(min)) > ... Thanks for the explanation. > > > A sidenote: To get insight in this, I used the brand new web interface > to the brand new mercurial repository at: > > http://myhdl.sourceforge.net/hg/myhdl > > If you go to _intbv.py through "files", and then "annotate", you see the changeset > when these lines were introduced. Click on it and then go to "changeset" to review > that changeset. Great isn't it :-) That feature is really great. What I haven't understood yet is, does sourceforge now support hg repositories or does hg export the repository as a bunch of html pages, so you can basically host that repository on any basic html page without extra software? Is there a way to check the source out with hg? Guenter |