1
0
mirror of https://github.com/myhdl/myhdl.git synced 2025-01-24 21:52:56 +08:00

len delegated to val

This commit is contained in:
jand 2003-07-25 05:19:24 +00:00
parent bff52943d6
commit 3dad456b3f

View File

@ -198,11 +198,12 @@ class Signal(object):
def _printVcdVec(self):
print >> sim._tf, "b%s %s" % (bin(self._val, self._nrbits), self._code)
# hashing not supported
### operators for which delegation to current value is appropriate ###
# hashing (?)
def __hash__(self):
return hash(self._val)
### operators for which delegation to current value is appropriate ###
def __nonzero__(self):
if self._val:
@ -210,9 +211,9 @@ class Signal(object):
else:
return 0
# length defined as bit width
# length
def __len__(self):
return self._nrbits
return len(self._val)
# indexing and slicing methods