fhdl: len() for Constant

This commit is contained in:
Sebastien Bourdeauducq 2012-07-13 18:16:50 +02:00
parent 8c169a99df
commit 9cdc88eadf
1 changed files with 3 additions and 0 deletions

View File

@ -134,6 +134,9 @@ class Constant(Value):
self.bv = bv or BV(bits_for(n), n < 0) self.bv = bv or BV(bits_for(n), n < 0)
self.n = n self.n = n
def __len__(self):
return self.bv.width
def __repr__(self): def __repr__(self):
return str(self.bv) + str(self.n) return str(self.bv) + str(self.n)