integration/export: Also fix MockCSRRegion base definition.

This commit is contained in:
Florent Kermarrec 2024-03-27 17:09:33 +01:00
parent e74b7f7ebe
commit 60920f3c7d
1 changed files with 4 additions and 3 deletions

View File

@ -266,8 +266,9 @@ def get_csr_header(regions, constants, csr_base=None, with_csr_base_define=True,
r += "#endif\n"
for name, region in regions.items():
origin = region.origin - _csr_base
base_define = not isinstance(region, MockCSRRegion)
r += "\n/* "+name+" */\n"
r += f"#define CSR_{name.upper()}_BASE {_get_csr_addr(csr_base, origin, with_csr_base_define)}\n"
r += f"#define CSR_{name.upper()}_BASE {_get_csr_addr(csr_base, origin, base_define)}\n"
if not isinstance(region.obj, Memory):
for csr in region.obj:
nr = (csr.size + region.busword - 1)//region.busword
@ -279,7 +280,7 @@ def get_csr_header(regions, constants, csr_base=None, with_csr_base_define=True,
alignment = alignment,
read_only = getattr(csr, "read_only", False),
csr_base = csr_base,
with_csr_base_define = with_csr_base_define and (not isinstance(region, MockCSRRegion)),
with_csr_base_define = base_define,
with_access_functions = with_access_functions,
)
origin += alignment//8*nr