From 493b181af1e3a3dd889b1923e9295d058cce4e45 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 21 May 2012 22:55:23 +0200 Subject: [PATCH] bank/description: pad unaligned multi-word registers at the top --- migen/bank/description.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/migen/bank/description.py b/migen/bank/description.py index 4c9b5b6d..01d59017 100644 --- a/migen/bank/description.py +++ b/migen/bank/description.py @@ -61,6 +61,13 @@ def expand_description(description, busword): for field in reg.fields: size += field.size if size > busword: + # add padding + totalsize = sum([field.size for field in reg.fields]) + padding = busword - (totalsize % busword) + if padding == busword: + padding = 0 + size += padding + top = field.size while size > busword: slice1 = busword - size + top -- 2.30.2