From: Florent Kermarrec Date: Wed, 27 May 2020 17:59:54 +0000 (+0200) Subject: soc/integration/export: add optional csr_base parameter. X-Git-Tag: 24jan2021_ls180~273 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fd7ec50e4384c52ea9d0c9cb681bf7dd6e85db59;p=litex.git soc/integration/export: add optional csr_base parameter. --- diff --git a/litex/soc/integration/export.py b/litex/soc/integration/export.py index adb6244a..ed827ed5 100644 --- a/litex/soc/integration/export.py +++ b/litex/soc/integration/export.py @@ -190,7 +190,7 @@ def _get_rw_functions_c(reg_name, reg_base, nwords, busword, alignment, read_onl return r -def get_csr_header(regions, constants, with_access_functions=True): +def get_csr_header(regions, constants, csr_base=None, with_access_functions=True): alignment = constants.get("CONFIG_CSR_ALIGNMENT", 32) r = generated_banner("//") if with_access_functions: # FIXME @@ -202,7 +202,7 @@ def get_csr_header(regions, constants, with_access_functions=True): r += "#ifndef CSR_ACCESSORS_DEFINED\n" r += "#include \n" r += "#endif /* ! CSR_ACCESSORS_DEFINED */\n" - csr_base = regions[next(iter(regions))].origin + csr_base = csr_base if csr_base is not None else regions[next(iter(regions))].origin r += "#ifndef CSR_BASE\n" r += "#define CSR_BASE {}L\n".format(hex(csr_base)) r += "#endif\n"