From: Sebastien Bourdeauducq Date: Sat, 11 Feb 2012 19:55:23 +0000 (+0100) Subject: corelogic/record: add to_signal convenience function X-Git-Tag: 24jan2021_ls180~2099^2~1032 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=28b0c340afef4b83c6da87774df62c385b559320;p=litex.git corelogic/record: add to_signal convenience function --- diff --git a/migen/corelogic/record.py b/migen/corelogic/record.py index 4bb1a20a..ffebb928 100644 --- a/migen/corelogic/record.py +++ b/migen/corelogic/record.py @@ -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())