fhdl: make constants hashable
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Fri, 9 Nov 2012 19:17:43 +0000 (20:17 +0100)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Fri, 9 Nov 2012 19:17:43 +0000 (20:17 +0100)
migen/fhdl/structure.py

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