From 31a447154d5875deeb9af99bababa5e327833d8e Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sun, 28 Jun 2015 21:35:37 +0200 Subject: [PATCH] soc: support constants without value --- misoclib/soc/__init__.py | 2 +- misoclib/soc/cpuif.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/misoclib/soc/__init__.py b/misoclib/soc/__init__.py index 217ce137..ef7c4545 100644 --- a/misoclib/soc/__init__.py +++ b/misoclib/soc/__init__.py @@ -165,7 +165,7 @@ class SoC(Module): 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): diff --git a/misoclib/soc/cpuif.py b/misoclib/soc/cpuif.py index 626bdd60..256612f0 100644 --- a/misoclib/soc/cpuif.py +++ b/misoclib/soc/cpuif.py @@ -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 -- 2.30.2