integration/soc: improve presentation of SoCLocHandler's locations.
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 24 Feb 2020 12:37:38 +0000 (13:37 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 24 Feb 2020 12:37:38 +0000 (13:37 +0100)
litex/soc/integration/soc.py

index 127aecec8b340a3735716f32e19ffe81cb9d3d85..df1e1e1dcbf67ef3ea68a5400efface02c8f86a9 100755 (executable)
@@ -418,8 +418,11 @@ class SoCLocHandler(Module):
     def __str__(self):
         r = "{} Locations: ({})\n".format(self.name, len(self.locs.keys())) if len(self.locs.keys()) else ""
         locs = {k: v for k, v in sorted(self.locs.items(), key=lambda item: item[1])}
+        length = 0
         for name in locs.keys():
-           r += "- {}{}: {}\n".format(colorer(name, color="underline"), " "*(20-len(name)), colorer(self.locs[name]))
+            if len(name) > length: length = len(name)
+        for name in locs.keys():
+           r += "- {}{}: {}\n".format(colorer(name, color="underline"), " "*(length + 1 - len(name)), colorer(self.locs[name]))
         return r
 
 # SoCCSRHandler ------------------------------------------------------------------------------------