From: Sebastien Bourdeauducq Date: Sun, 5 Feb 2012 18:32:11 +0000 (+0100) Subject: fhdl/structure: binary constant builder X-Git-Tag: 24jan2021_ls180~2099^2~1043 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=629e771fc00911f1d1477adc40f61278cf410a1e;p=litex.git fhdl/structure: binary constant builder --- diff --git a/migen/fhdl/structure.py b/migen/fhdl/structure.py index ce17be22..8a676e94 100644 --- a/migen/fhdl/structure.py +++ b/migen/fhdl/structure.py @@ -127,6 +127,9 @@ class Constant(Value): def __eq__(self, other): return self.bv == other.bv and self.n == other.n +def binc(x, signed=False): + return Constant(int(x, 2), BV(len(x), signed)) + def _cst(x): if isinstance(x, int): return Constant(x)