[myhdl-list] intbv.signed()
Brought to you by:
jandecaluwe
From: Günter D. <dan...@we...> - 2008-07-25 06:47:46
|
Hi, I was gonna try out implementing the signed() function to intbv. My first question is whether it should be a function or a property? What would be the decision about what to take. For example with the min and max values they are implemented as property. As there are no parameters needed, could the signed by also implemented as property? My next question is what signed() will return. Just the value as integer or will it be an intbv instance with the range set based on the _nrbits, but as +/- range? So for example if I do this: a = intbv(0)[8:] a[:] = 0x19 b = a[4:].signed() The slice by itself will return a new intbv with min=0, max=16, _nrbits=4. From that I would think that the .signed() would change the range to min=-4, max=4. From the above example, the slice would return the value 0x9, which the signed() would converted to -7. Am I considering that right? Cheers, Guenter |