fhdl: make constants hashable

This commit is contained in:
Sebastien Bourdeauducq 2012-11-09 20:17:43 +01:00
parent c1b8492b61
commit 26cf1b8840
1 changed files with 4 additions and 0 deletions

View File

@ -147,6 +147,10 @@ class Constant(Value):
def __eq__(self, other): def __eq__(self, other):
return self.bv == other.bv and self.n == other.n return self.bv == other.bv and self.n == other.n
def __hash__(self):
return id(self)
def binc(x, signed=False): def binc(x, signed=False):
return Constant(int(x, 2), BV(len(x), signed)) return Constant(int(x, 2), BV(len(x), signed))