mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
Merge pull request #967 from JosephBushagour/jbushagour_assembly_interoperability
Make "generated/soc.h" able to be included in assembly files.
This commit is contained in:
commit
fab6512928
1 changed files with 8 additions and 3 deletions
|
@ -147,7 +147,7 @@ def get_mem_header(regions):
|
||||||
def get_soc_header(constants, with_access_functions=True):
|
def get_soc_header(constants, with_access_functions=True):
|
||||||
r = generated_banner("//")
|
r = generated_banner("//")
|
||||||
r += "#ifndef __GENERATED_SOC_H\n#define __GENERATED_SOC_H\n"
|
r += "#ifndef __GENERATED_SOC_H\n#define __GENERATED_SOC_H\n"
|
||||||
|
funcs = ""
|
||||||
|
|
||||||
for name, value in constants.items():
|
for name, value in constants.items():
|
||||||
if value is None:
|
if value is None:
|
||||||
|
@ -161,8 +161,13 @@ def get_soc_header(constants, with_access_functions=True):
|
||||||
ctype = "int"
|
ctype = "int"
|
||||||
r += "#define "+name+" "+value+"\n"
|
r += "#define "+name+" "+value+"\n"
|
||||||
if with_access_functions:
|
if with_access_functions:
|
||||||
r += "static inline "+ctype+" "+name.lower()+"_read(void) {\n"
|
funcs += "static inline "+ctype+" "+name.lower()+"_read(void) {\n"
|
||||||
r += "\treturn "+value+";\n}\n"
|
funcs += "\treturn "+value+";\n}\n"
|
||||||
|
|
||||||
|
if with_access_functions:
|
||||||
|
r += "\n#ifndef __ASSEMBLER__\n"
|
||||||
|
r += funcs
|
||||||
|
r += "#endif // !__ASSEMBLER__\n"
|
||||||
|
|
||||||
r += "\n#endif\n"
|
r += "\n#endif\n"
|
||||||
return r
|
return r
|
||||||
|
|
Loading…
Reference in a new issue