mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
corelogic/record: add to_signal convenience function
This commit is contained in:
parent
e62ac1d3a1
commit
28b0c340af
1 changed files with 9 additions and 0 deletions
|
@ -94,5 +94,14 @@ class Record:
|
||||||
else:
|
else:
|
||||||
return l
|
return l
|
||||||
|
|
||||||
|
def to_signal(self, assignment_list, sig_out, align=False):
|
||||||
|
flattened, length = self.flatten(align, return_offset=True)
|
||||||
|
raw = Signal(BV(length))
|
||||||
|
if sig_out:
|
||||||
|
assignment_list.append(raw.eq(Cat(*flattened)))
|
||||||
|
else:
|
||||||
|
assignment_list.append(Cat(*flattened).eq(raw))
|
||||||
|
return raw
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return repr(self.layout())
|
return repr(self.layout())
|
||||||
|
|
Loading…
Reference in a new issue