From: Sebastien Bourdeauducq Date: Fri, 13 Jul 2012 16:16:50 +0000 (+0200) Subject: fhdl: len() for Constant X-Git-Tag: 24jan2021_ls180~2099^2~860 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9cdc88eadff3581b4685f99edc5f901f6cf15f77;p=litex.git fhdl: len() for Constant --- diff --git a/migen/fhdl/structure.py b/migen/fhdl/structure.py index 332f5bf9..a0a8da50 100644 --- a/migen/fhdl/structure.py +++ b/migen/fhdl/structure.py @@ -134,6 +134,9 @@ class Constant(Value): self.bv = bv or BV(bits_for(n), n < 0) self.n = n + def __len__(self): + return self.bv.width + def __repr__(self): return str(self.bv) + str(self.n)