From 28b0c340afef4b83c6da87774df62c385b559320 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sat, 11 Feb 2012 20:55:23 +0100 Subject: [PATCH] corelogic/record: add to_signal convenience function --- migen/corelogic/record.py | 9 +++++++++ 1 file changed, 9 insertions(+) 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()) -- 2.30.2