From: Gabriel L. Somlo Date: Wed, 29 May 2019 14:07:43 +0000 (-0400) Subject: soc/integration/cpu_interface: improve code legibility X-Git-Tag: 24jan2021_ls180~1193^2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=273a3ea15df5a81b306755adff7e1cac08c165c7;p=litex.git soc/integration/cpu_interface: improve code legibility Factor out code appearing in both branches of an if/else. --- diff --git a/litex/soc/integration/cpu_interface.py b/litex/soc/integration/cpu_interface.py index c80dbccd..d20f06eb 100644 --- a/litex/soc/integration/cpu_interface.py +++ b/litex/soc/integration/cpu_interface.py @@ -140,12 +140,9 @@ def get_csr_header(regions, constants, with_access_functions=True, with_shadow_b for name, origin, busword, obj in regions: if not with_shadow_base: origin &= (~shadow_base) - if isinstance(obj, Memory): - r += "\n/* "+name+" */\n" - r += "#define CSR_"+name.upper()+"_BASE "+hex(origin)+"L\n" - else: - r += "\n/* "+name+" */\n" - r += "#define CSR_"+name.upper()+"_BASE "+hex(origin)+"L\n" + r += "\n/* "+name+" */\n" + r += "#define CSR_"+name.upper()+"_BASE "+hex(origin)+"L\n" + if not isinstance(obj, Memory): for csr in obj: nr = (csr.size + busword - 1)//busword r += _get_rw_functions_c(name + "_" + csr.name, origin, nr, busword, isinstance(csr, CSRStatus), with_access_functions)