[myhdl-list] intbv improvement?
Brought to you by:
jandecaluwe
|
From: Neal B. <ndb...@gm...> - 2009-03-04 19:52:02
|
I would find this addition to the intbv constructor helpful:
class intbv(object):
__slots__ = ('_val', '_min', '_max', '_nrbits')
def __init__(self, val=None, min=None, max=None, _nrbits=0,
is_signed=False):
if _nrbits:
if (is_signed):
self._min = -1 << (_nrbits-1)
self._max = ~(-1 << (_nrbits-1))
else:
self._min = 0
self._max = 2**_nrbits
|