mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
fhdl/structure: binary constant builder
This commit is contained in:
parent
504a169afb
commit
629e771fc0
1 changed files with 3 additions and 0 deletions
|
@ -127,6 +127,9 @@ class Constant(Value):
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return self.bv == other.bv and self.n == other.n
|
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):
|
def _cst(x):
|
||||||
if isinstance(x, int):
|
if isinstance(x, int):
|
||||||
return Constant(x)
|
return Constant(x)
|
||||||
|
|
Loading…
Reference in a new issue