fhdl/structure: make all values hashable
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Tue, 6 Nov 2012 12:51:51 +0000 (13:51 +0100)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Tue, 6 Nov 2012 12:51:51 +0000 (13:51 +0100)
migen/fhdl/structure.py

index fa97b793d4ef428e55dfaff2671a220eadd527d2..f0ab2de87040d8424425025d65b7cfeec4f3b73a 100644 (file)
@@ -109,6 +109,9 @@ class Value:
        
        def eq(self, r):
                return _Assign(self, r)
+       
+       def __hash__(self):
+               return id(self)
 
 class _Operator(Value):
        def __init__(self, op, operands):
@@ -168,9 +171,6 @@ class Signal(Value):
        def __len__(self):
                return self.bv.width
 
-       def __hash__(self):
-               return id(self)
-       
        def __repr__(self):
                return "<Signal " + (self.backtrace[-1][0] or "anonymous") + " at " + hex(id(self)) + ">"