fhdl/structure: binary constant builder

This commit is contained in:
Sebastien Bourdeauducq 2012-02-05 19:32:11 +01:00
parent 504a169afb
commit 629e771fc0
1 changed files with 3 additions and 0 deletions

View 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)