soc_core: add sort of CSR regions by origin (allow csr.h/csr.csv to be ordered by origin)

This commit is contained in:
Florent Kermarrec 2019-12-12 11:27:56 +01:00
parent 061d593de3
commit b1a1e5e227
1 changed files with 3 additions and 0 deletions

View File

@ -487,6 +487,9 @@ class SoCCore(Module):
(self.soc_mem_map["csr"] + 0x800*mapaddr), (self.soc_mem_map["csr"] + 0x800*mapaddr),
self.csr_data_width, memory) self.csr_data_width, memory)
# Sort CSR regions by origin
self.csr_regions = {k: v for k, v in sorted(self.csr_regions.items(), key=lambda item: item[1].origin)}
# Add CSRs / Config items to constants # Add CSRs / Config items to constants
for name, constant in self.csrbankarray.constants: for name, constant in self.csrbankarray.constants:
self.add_constant(name.upper() + "_" + constant.name.upper(), self.add_constant(name.upper() + "_" + constant.name.upper(),