fhdl/structure: binary constant builder
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Sun, 5 Feb 2012 18:32:11 +0000 (19:32 +0100)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Sun, 5 Feb 2012 18:32:11 +0000 (19:32 +0100)
migen/fhdl/structure.py

index ce17be2216d2f494570e7f0e213f0707cb69e0de..8a676e94163c6d483c6f1ab94e80494864480a77 100644 (file)
@@ -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)