From 26cf1b8840ef3dbb02115bce230304f37acba823 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 9 Nov 2012 20:17:43 +0100 Subject: [PATCH] fhdl: make constants hashable --- migen/fhdl/structure.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/migen/fhdl/structure.py b/migen/fhdl/structure.py index f0ab2de87..2249b466f 100644 --- a/migen/fhdl/structure.py +++ b/migen/fhdl/structure.py @@ -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))