soc/integration/cpu_interface: do not generate constant access functions when with_ac...
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Wed, 19 Jul 2017 10:18:35 +0000 (12:18 +0200)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Wed, 19 Jul 2017 10:18:35 +0000 (12:18 +0200)
litex/soc/integration/cpu_interface.py

index ffad5c2f2aa6582e203500efe861ce9680aad36f..5245454486d705284c18021034f2543b46bda54d 100644 (file)
@@ -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