corelogic/record: add to_signal convenience function

This commit is contained in:
Sebastien Bourdeauducq 2012-02-11 20:55:23 +01:00
parent e62ac1d3a1
commit 28b0c340af
1 changed files with 9 additions and 0 deletions

View File

@ -94,5 +94,14 @@ class Record:
else:
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):
return repr(self.layout())