soc_core: add sort of CSR regions by origin (allow csr.h/csr.csv to be ordered by...
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Thu, 12 Dec 2019 10:27:56 +0000 (11:27 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Thu, 12 Dec 2019 10:27:56 +0000 (11:27 +0100)
litex/soc/integration/soc_core.py

index 7f674b51a598954eb28987eff4684c1a1a87924b..76da0e480851a9cee7c1d11690480b548323d3ca 100644 (file)
@@ -487,6 +487,9 @@ class SoCCore(Module):
                 (self.soc_mem_map["csr"] + 0x800*mapaddr),
                 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
         for name, constant in self.csrbankarray.constants:
             self.add_constant(name.upper() + "_" + constant.name.upper(),