diff --git a/project.py b/project.py index 5379d3e..bcb65b6 100644 --- a/project.py +++ b/project.py @@ -261,7 +261,10 @@ class Project(): # metrics def get_metrics_path(self): if self.is_user_project: - return os.path.join(self.local_dir, 'runs/wokwi/reports/metrics.csv') + if self.args.openlane2: + return os.path.join(self.local_dir, 'runs/wokwi/final/metrics.csv') + else: + return os.path.join(self.local_dir, 'runs/wokwi/reports/metrics.csv') else: return os.path.join(self.local_dir, 'metrics.csv') @@ -474,6 +477,8 @@ class Project(): # SVG and PNG renders of the GDS def create_svg(self): gds = glob.glob(os.path.join(self.local_dir, 'runs/wokwi/results/final/gds/*gds')) + if self.args.openlane2: + gds = glob.glob(os.path.join(self.local_dir, 'runs/wokwi/final/gds/*gds')) library = gdstk.read_gds(gds[0]) top_cells = library.top_level() top_cells[0].write_svg('gds_render.svg') @@ -483,7 +488,10 @@ class Project(): def print_warnings(self): warnings = [] - with open(os.path.join(self.local_dir, 'runs/wokwi/logs/synthesis/1-synthesis.log')) as f: + synth_log = 'runs/wokwi/logs/synthesis/1-synthesis.log' + if self.args.openlane2: + synth_log = 'runs/wokwi/02-yosys-synthesis/yosys-synthesis.log' + with open(os.path.join(self.local_dir, synth_log)) as f: for line in f.readlines(): if line.startswith('Warning:'): # bogus warning https://github.com/YosysHQ/yosys/commit/bfacaddca8a2e113e4bc3d6177612ccdba1555c8 @@ -573,6 +581,8 @@ class Project(): cell_count = {} total = 0 gl_files = glob.glob(os.path.join(self.local_dir, 'runs/wokwi/results/final/verilog/gl/*.nl.v')) + if self.args.openlane2: + gl_files = glob.glob(os.path.join(self.local_dir, 'runs/wokwi/final/nl/*.nl.v')) with open(gl_files[0]) as fh: for line in fh.readlines(): m = re.search(r'sky130_(\S+)__(\S+)_(\d+)', line) diff --git a/tt_tool.py b/tt_tool.py index 7a56427..e021da7 100755 --- a/tt_tool.py +++ b/tt_tool.py @@ -9,6 +9,7 @@ if __name__ == '__main__': parser.add_argument('--project-dir', help="location of the project", default='.') parser.add_argument('--yaml', help="the project's yaml configuration file", default='info.yaml') parser.add_argument('--debug', help="debug logging", action="store_const", dest="loglevel", const=logging.DEBUG, default=logging.INFO) + parser.add_argument('--openlane2', help="use openlane 2", action="store_const", const=True, default=False) # reports & summaries parser.add_argument('--print-cell-summary', help="print summary", action="store_const", const=True, default=False)