Re: [myhdl-list] Bit-wise inversion issue
Brought to you by:
jandecaluwe
From: Jan D. <ja...@ja...> - 2008-03-03 17:51:59
|
Ok, let's try to reach a decision. I believe there are 2 solutions that can be defended. Possible solutions ------------------ 1) "Pure Python" Bit inversion for intbv's behaves like for Python int's. 2) "Practical Hardware" Make an exception for intbv's whose allowed values are a finite set of positive values. Let's call these p-intbv's. For a p-intbv, bits outside the bit range of an unsigned representation, are assumed to remain zero upon bit-inversion. Analysis -------- Both solutions have advantages and drawbacks. The major drawback of the "Pure Python" solution is that it may be counter-intuitive to hardware designers. Many designs mainly use p-intbvs, e.g. created by the form intbv(0)[n:]. But with this solution it would not be possible to represent the bit-inversion of a p-intbv by another p-intbv. Negative values would have to be introduced just for this purpose. The major drawback of the "Practical Hardware" solution is that the result of a bit-inversion would not just depend on the intbv value, but also on its constraints. It is the only operator for which this would be so. This is disturbing. Conclusion ---------- The drawback of the "Pure Python" solution is probably fatal for practical purposes. Therefore, I propose to keep the "Practical Hardware" solution. This is in line with the feedback from this thread thus far. Jan -- Jan Decaluwe - Resources bvba - http://www.jandecaluwe.com Kaboutermansstraat 97, B-3000 Leuven, Belgium From Python to silicon: http://myhdl.jandecaluwe.com |