soc: support constants without value
This commit is contained in:
parent
e913fca8a0
commit
31a447154d
|
@ -165,7 +165,7 @@ class SoC(Module):
|
||||||
def get_csr_regions(self):
|
def get_csr_regions(self):
|
||||||
return self._csr_regions
|
return self._csr_regions
|
||||||
|
|
||||||
def add_constant(self, name, value):
|
def add_constant(self, name, value=None):
|
||||||
self._constants.append((name, value))
|
self._constants.append((name, value))
|
||||||
|
|
||||||
def get_constants(self):
|
def get_constants(self):
|
||||||
|
|
|
@ -92,7 +92,10 @@ def get_csr_header(regions, constants, with_access_functions=True):
|
||||||
|
|
||||||
r += "\n/* constants */\n"
|
r += "\n/* constants */\n"
|
||||||
for name, value in constants:
|
for name, value in constants:
|
||||||
r += "#define " + name + " " + str(value) + "\n"
|
r += "#define " + name
|
||||||
|
if value is not None:
|
||||||
|
r += " " + str(value)
|
||||||
|
r += "\n"
|
||||||
|
|
||||||
r += "\n#endif\n"
|
r += "\n#endif\n"
|
||||||
return r
|
return r
|
||||||
|
|
Loading…
Reference in New Issue