From 014d5a56a87840efcb5b2632d2f8f9b60a15e3fc Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Sat, 8 Feb 2020 21:34:26 +0100 Subject: [PATCH] soc: show sorted regions (by origin) / locs --- litex/soc/integration/soc.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/litex/soc/integration/soc.py b/litex/soc/integration/soc.py index d8c916e0d..f69e6ec17 100755 --- a/litex/soc/integration/soc.py +++ b/litex/soc/integration/soc.py @@ -282,7 +282,8 @@ class SoCBusHandler(Module): r = "{}-bit {} Bus, {}GiB Address Space.\n".format( colorer(self.data_width), colorer(self.standard), colorer(2**self.address_width/2**30)) r += "Bus Regions: ({})\n".format(len(self.regions.keys())) if len(self.regions.keys()) else "" - for name, region in self.regions.items(): + regions = {k: v for k, v in sorted(self.regions.items(), key=lambda item: item[1].origin)} + for name, region in regions.items(): r += colorer(name, color="underline") + " "*(20-len(name)) + ": " + str(region) + "\n" r += "Bus Masters: ({})\n".format(len(self.masters.keys())) if len(self.masters.keys()) else "" for name in self.masters.keys(): @@ -350,7 +351,8 @@ class SoCLocHandler(Module): # Str ------------------------------------------------------------------------------------------ def __str__(self): r = "{} Locations: ({})\n".format(self.name, len(self.locs.keys())) if len(self.locs.keys()) else "" - for name in self.locs.keys(): + locs = {k: v for k, v in sorted(self.locs.items(), key=lambda item: item[1])} + for name in locs.keys(): r += "- {}{}: {}\n".format(colorer(name, color="underline"), " "*(20-len(name)), colorer(self.locs[name])) return r