From 0c7e0bf02571230aa48e75d99ee1ccc73ccf59bc Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Mon, 24 Feb 2020 13:37:38 +0100 Subject: [PATCH] integration/soc: improve presentation of SoCLocHandler's locations. --- litex/soc/integration/soc.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/litex/soc/integration/soc.py b/litex/soc/integration/soc.py index 127aecec8..df1e1e1dc 100755 --- a/litex/soc/integration/soc.py +++ b/litex/soc/integration/soc.py @@ -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 ------------------------------------------------------------------------------------