From d05d170b75e31b97517a5c0dc7c8aaccc152f9a9 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Wed, 19 Jul 2017 12:18:35 +0200 Subject: [PATCH] soc/integration/cpu_interface: do not generate constant access functions when with_access_functions is set to False --- litex/soc/integration/cpu_interface.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/litex/soc/integration/cpu_interface.py b/litex/soc/integration/cpu_interface.py index ffad5c2f2..524545448 100644 --- a/litex/soc/integration/cpu_interface.py +++ b/litex/soc/integration/cpu_interface.py @@ -144,9 +144,10 @@ def get_csr_header(regions, constants, with_access_functions=True): else: value = str(value) ctype = "int" - r += "#define "+name+" "+value+"\n" - r += "static inline "+ctype+" "+name.lower()+"_read(void) {\n" - r += "\treturn "+value+";\n}\n" + r += "#define "+name+" "+value+"\n" + if with_access_functions: + r += "static inline "+ctype+" "+name.lower()+"_read(void) {\n" + r += "\treturn "+value+";\n}\n" r += "\n#endif\n" return r