Skip to content

Commit 31a4471

Browse files
committedJun 28, 2015
soc: support constants without value
1 parent e913fca commit 31a4471

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed
 

Diff for: ‎misoclib/soc/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def add_csr_region(self, name, origin, busword, obj):
165165
def get_csr_regions(self):
166166
return self._csr_regions
167167

168-
def add_constant(self, name, value):
168+
def add_constant(self, name, value=None):
169169
self._constants.append((name, value))
170170

171171
def get_constants(self):

Diff for: ‎misoclib/soc/cpuif.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ def get_csr_header(regions, constants, with_access_functions=True):
9292

9393
r += "\n/* constants */\n"
9494
for name, value in constants:
95-
r += "#define " + name + " " + str(value) + "\n"
95+
r += "#define " + name
96+
if value is not None:
97+
r += " " + str(value)
98+
r += "\n"
9699

97100
r += "\n#endif\n"
98101
return r

0 commit comments

Comments
 (0)
Please sign in to comment.