Re: [myhdl-list] Error in Intbv class?
Brought to you by:
jandecaluwe
From: Christopher F. <chr...@gm...> - 2016-03-04 12:21:32
|
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 |