From: Sebastien Bourdeauducq Date: Fri, 9 Nov 2012 19:17:43 +0000 (+0100) Subject: fhdl: make constants hashable X-Git-Tag: 24jan2021_ls180~2099^2~807 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=26cf1b8840ef3dbb02115bce230304f37acba823;p=litex.git fhdl: make constants hashable --- diff --git a/migen/fhdl/structure.py b/migen/fhdl/structure.py index f0ab2de8..2249b466 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))