Re: Error in Intbv class?
Christopher Felton <[email protected]> Fri, 4 Mar 2016 06:21:04 -0600
| Newsgroups | gmane.comp.python.myhdl |
|---|---|
| Message-ID | <[email protected]> |
On 3/3/2016 1:19 PM, Forumulator Bing wrote:
> True, because the value wrapped by the class is still a standard
> unconstrained int. Thus, accessing something like:
>
>>> a=intbv(5)[4:] a[6]
> false
>
> Where as it should raise an out of bounds exception.Can someone
> comment on this so that I could possibly try to fix this.
I don't know if this was an original design decision
to allow the out of index range access to occur? It does
return the correct value for the position if you imagine
it was sign-extended.
>>> a = intbv(0)[8:]
>>> b = intbv(-1, min=-1000, max=1000)
>>> print("{:1d} and {:1d}".format(a[1000000], b[1000000]))
0 and 1
But with that said, it seems like we are missing an
opportunity to flag errors, especially since one off
errors are so common.
You might need to wait for Jan D. to comment or someone
else that might know the history (or someone with strong
feelings one way or the other :)
Regards,
Chris
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140