Browse files

fhdl/structure: binary constant builder

  • Loading branch information...
1 parent 504a169 commit 629e771fc00911f1d1477adc40f61278cf410a1e @sbourdeauducq sbourdeauducq committed Feb 5, 2012
Showing with 3 additions and 0 deletions.
  1. +3 −0 migen/fhdl/structure.py
View
3 migen/fhdl/structure.py
@@ -127,6 +127,9 @@ def __repr__(self):
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)

0 comments on commit 629e771

Please sign in to comment.