From c93eb5f48243734a8f28ed735f02a1fdc8732e4e Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 10 Jan 2012 17:10:03 +0100 Subject: [PATCH] record: return offset --- migen/corelogic/record.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/migen/corelogic/record.py b/migen/corelogic/record.py index e2722a9ab..2bbe47cf8 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())