From: Sebastien Bourdeauducq Date: Mon, 21 May 2012 20:55:23 +0000 (+0200) Subject: bank/description: pad unaligned multi-word registers at the top X-Git-Tag: 24jan2021_ls180~2099^2~944 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=493b181af1e3a3dd889b1923e9295d058cce4e45;p=litex.git bank/description: pad unaligned multi-word registers at the top --- 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