From 629e771fc00911f1d1477adc40f61278cf410a1e Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sun, 5 Feb 2012 19:32:11 +0100 Subject: [PATCH] fhdl/structure: binary constant builder --- migen/fhdl/structure.py | 3 +++ 1 file changed, 3 insertions(+) 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) -- 2.30.2