From: Sebastien Bourdeauducq Date: Tue, 10 Jan 2012 16:10:03 +0000 (+0100) Subject: record: return offset X-Git-Tag: 24jan2021_ls180~2099^2~1083 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c93eb5f48243734a8f28ed735f02a1fdc8732e4e;p=litex.git record: return offset --- diff --git a/migen/corelogic/record.py b/migen/corelogic/record.py index e2722a9a..2bbe47cf 100644 --- a/migen/corelogic/record.py +++ b/migen/corelogic/record.py @@ -67,7 +67,7 @@ class Record: tpl2 = other.flatten() return len(tpl1) == len(tpl2) - def flatten(self, align=False, offset=0): + def flatten(self, align=False, offset=0, return_offset=False): l = [] for key, alignment in self.field_order: if align: @@ -86,7 +86,10 @@ class Record: for x in added: offset += x.bv.width l += added - return l + if return_offset: + return (l, offset) + else: + return l def __repr__(self): return repr(self.layout())