feat: initial support for openlane2 user projects

This commit is contained in:
Uri Shaked
2023-09-06 18:04:02 +03:00
parent da5f3cb1f8
commit fd29f74a1a
2 changed files with 13 additions and 2 deletions
+11 -1
View File
@@ -261,6 +261,9 @@ class Project():
# metrics
def get_metrics_path(self):
if self.is_user_project:
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)
+1
View File
@@ -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)