From 56c284e9bce508d040074d4524e77042957e665d Mon Sep 17 00:00:00 2001 From: Andrew Dennison Date: Tue, 4 Jun 2024 10:41:53 +1000 Subject: [PATCH] soc/integraion/builder: exclude some constants in add_json() Interrupt numbers from a downstream soc are not relevant in the main SOC so exclude them by default. --- litex/soc/integration/builder.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/litex/soc/integration/builder.py b/litex/soc/integration/builder.py index bbc22cc34..027862e8f 100644 --- a/litex/soc/integration/builder.py +++ b/litex/soc/integration/builder.py @@ -140,26 +140,27 @@ class Builder: def add_software_library(self, name): self.software_libraries.append(name) - def add_json(self, filename, origin=0, name=""): - self.jsons.append((filename, origin, name)) + def add_json(self, filename, origin=0, name="", exclude_constants=["_INTERRUPT"]): + self.jsons.append((filename, origin, name, exclude_constants)) def _get_json_mem_regions(self): mem_regions = {} - for filename, origin, name in self.jsons: + for filename, origin, name, _ in self.jsons: _, _, _mem_regions = export.load_csr_json(filename, origin, name) mem_regions.update(_mem_regions) return mem_regions def _get_json_constants(self): constants = {} - for filename, origin, name in self.jsons: + for filename, origin, name, exclude in self.jsons: _, _constants, _ = export.load_csr_json(filename, origin, name) + _constants = {k: v for k, v in _constants.items() if not any(ex in k for ex in exclude)} constants.update(_constants) return constants def _get_json_csr_regions(self): csr_regions = {} - for filename, origin, name in self.jsons: + for filename, origin, name, _ in self.jsons: _csr_regions, _, _ = export.load_csr_json(filename, origin, name) csr_regions.update(_csr_regions) return csr_regions