integration/soc: improve presentation of SoCLocHandler's locations.

This commit is contained in:
Florent Kermarrec 2020-02-24 13:37:38 +01:00
parent 0042a02807
commit 0c7e0bf025
1 changed files with 4 additions and 1 deletions

View File

@ -418,8 +418,11 @@ class SoCLocHandler(Module):
def __str__(self): def __str__(self):
r = "{} Locations: ({})\n".format(self.name, len(self.locs.keys())) if len(self.locs.keys()) else "" 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])} locs = {k: v for k, v in sorted(self.locs.items(), key=lambda item: item[1])}
length = 0
for name in locs.keys(): 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 return r
# SoCCSRHandler ------------------------------------------------------------------------------------ # SoCCSRHandler ------------------------------------------------------------------------------------