From a35bf29bdd1a474bee4f1c801ffd772334e79042 Mon Sep 17 00:00:00 2001 From: Matt Guthaus Date: Wed, 17 Apr 2019 13:41:17 -0700 Subject: [PATCH] Improve print output for debugging layout objects. --- compiler/base/design.py | 10 ---------- compiler/base/geometry.py | 4 ++-- compiler/base/hierarchy_design.py | 9 ++++++++- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/compiler/base/design.py b/compiler/base/design.py index 4e76b40a..aace6170 100644 --- a/compiler/base/design.py +++ b/compiler/base/design.py @@ -95,13 +95,3 @@ class design(hierarchy_design): total_module_power += inst.mod.analytical_power(corner, load) return total_module_power - def __str__(self): - """ override print function output """ - pins = ",".join(self.pins) - insts = [" {}".format(x) for x in self.insts] - objs = [" {}".format(x) for x in self.objs] - s = "********** design {0} **********\n".format(self.name) - s += "\n pins ({0})={1}\n".format(len(self.pins), pins) - s += "\n objs ({0})=\n{1}".format(len(self.objs), "\n".join(objs)) - s += "\n insts ({0})=\n{1}\n".format(len(self.insts), "\n".join(insts)) - return s diff --git a/compiler/base/geometry.py b/compiler/base/geometry.py index 838828df..1402fd5a 100644 --- a/compiler/base/geometry.py +++ b/compiler/base/geometry.py @@ -371,8 +371,8 @@ class rectangle(geometry): def __str__(self): """ override print function output """ - return "rect: @" + str(self.offset) + " " + str(self.width) + "x" + str(self.height) + " layer=" +str(self.layerNumber) + return self.__repr__() def __repr__(self): """ override print function output """ - return "( rect: @" + str(self.offset) + " " + str(self.width) + "x" + str(self.height) + " layer=" + str(self.layerNumber) + " )" + return "( rect: @" + str(self.offset) + " WxH=" + str(self.width) + "x" + str(self.height) + " layer=" + str(self.layerNumber) + " )" diff --git a/compiler/base/hierarchy_design.py b/compiler/base/hierarchy_design.py index 6a6003a2..4f72d8f6 100644 --- a/compiler/base/hierarchy_design.py +++ b/compiler/base/hierarchy_design.py @@ -100,7 +100,14 @@ class hierarchy_design(hierarchy_spice.spice, hierarchy_layout.layout): def __str__(self): """ override print function output """ - return "design: " + self.name + pins = ",".join(self.pins) + insts = [" {}".format(x) for x in self.insts] + objs = [" {}".format(x) for x in self.objs] + s = "********** design {0} **********".format(self.name) + s += "\n pins ({0})={1}\n".format(len(self.pins), pins) + s += "\n objs ({0})=\n{1}\n".format(len(self.objs), "\n".join(objs)) + s += "\n insts ({0})=\n{1}\n".format(len(self.insts), "\n".join(insts)) + return s def __repr__(self): """ override print function output """