integration/export: Fix MockCSRRegion base definition.

MockCSR are not related to csr_base
This commit is contained in:
Andrew Dennison 2024-04-02 10:42:44 +11:00
parent 485341a1cf
commit dad04eedef
1 changed files with 3 additions and 2 deletions

View File

@ -236,8 +236,9 @@ def _generate_csr_definitions_c(reg_name, reg_base, nwords, csr_base, with_csr_b
def _generate_csr_region_definitions_c(name, region, origin, alignment, csr_base, with_csr_base_define):
base_define = with_csr_base_define and not isinstance(region, MockCSRRegion)
base = csr_base if not isinstance(region, MockCSRRegion) else 0
region_defs = f"\n/* {name.upper()} Registers */\n"
region_defs += f"#define CSR_{name.upper()}_BASE {_get_csr_addr(csr_base, origin, base_define)}\n"
region_defs += f"#define CSR_{name.upper()}_BASE {_get_csr_addr(base, origin, base_define)}\n"
if not isinstance(region.obj, Memory):
for csr in region.obj:
@ -246,7 +247,7 @@ def _generate_csr_region_definitions_c(name, region, origin, alignment, csr_base
reg_name = name + "_" + csr.name,
reg_base = origin,
nwords = nr,
csr_base = csr_base,
csr_base = base,
with_csr_base_define = base_define,
)
origin += alignment // 8 * nr