Merge pull request #1991 from motec-research/add_json_excludes

Add json excludes
This commit is contained in:
enjoy-digital 2024-06-19 09:12:22 +02:00 committed by GitHub
commit e6353c8898
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 8 deletions

View File

@ -140,27 +140,28 @@ 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, name, origin in self.jsons:
_, _, _mem_regions = export.load_csr_json(filename, name, origin)
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, name, origin in self.jsons:
_, _constants, _ = export.load_csr_json(filename, name, origin)
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, name, origin in self.jsons:
_csr_regions, _, _ = export.load_csr_json(filename, name, origin)
for filename, origin, name, _ in self.jsons:
_csr_regions, _, _ = export.load_csr_json(filename, origin, name)
csr_regions.update(_csr_regions)
return csr_regions