Skip to content

Commit

Permalink
soc: support constants without value
Browse files Browse the repository at this point in the history
sbourdeauducq committed Jun 28, 2015
1 parent e913fca commit 31a4471
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion misoclib/soc/__init__.py
Original file line number Diff line number Diff line change
@@ -165,7 +165,7 @@ def add_csr_region(self, name, origin, busword, obj):
def get_csr_regions(self):
return self._csr_regions

def add_constant(self, name, value):
def add_constant(self, name, value=None):
self._constants.append((name, value))

def get_constants(self):
5 changes: 4 additions & 1 deletion misoclib/soc/cpuif.py
Original file line number Diff line number Diff line change
@@ -92,7 +92,10 @@ def get_csr_header(regions, constants, with_access_functions=True):

r += "\n/* constants */\n"
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"
return r

0 comments on commit 31a4471

Please sign in to comment.