2019-04-26 21:21:50 +02:00
|
|
|
# See LICENSE for licensing information.
|
|
|
|
|
#
|
2019-06-14 17:43:41 +02:00
|
|
|
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
|
|
|
|
# of Regents for the Oklahoma Agricultural and Mechanical College
|
|
|
|
|
# (acting for and on behalf of Oklahoma State University)
|
|
|
|
|
# All rights reserved.
|
2019-04-26 21:21:50 +02:00
|
|
|
#
|
2016-11-08 18:57:35 +01:00
|
|
|
"""
|
|
|
|
|
This is a DRC/LVS interface for calibre. It implements completely
|
2019-04-27 00:43:46 +02:00
|
|
|
independently three functions: run_drc, run_lvs, run_pex, that perform these
|
2016-11-08 18:57:35 +01:00
|
|
|
functions in batch mode and will return true/false if the result
|
|
|
|
|
passes. All of the setup (the rules, temp dirs, etc.) should be
|
|
|
|
|
contained in this file. Replacing with another DRC/LVS tool involves
|
|
|
|
|
rewriting this code to work properly. Porting to a new technology in
|
|
|
|
|
Calibre means pointing the code to the proper DRC and LVS rule files.
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import os
|
2019-04-27 00:17:39 +02:00
|
|
|
import shutil
|
2016-11-08 18:57:35 +01:00
|
|
|
import re
|
|
|
|
|
import debug
|
2017-11-16 22:52:58 +01:00
|
|
|
from globals import OPTS
|
2020-06-15 22:58:26 +02:00
|
|
|
from run_script import run_script
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2018-07-11 20:59:24 +02:00
|
|
|
# Keep track of statistics
|
|
|
|
|
num_drc_runs = 0
|
|
|
|
|
num_lvs_runs = 0
|
|
|
|
|
num_pex_runs = 0
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2020-06-15 22:58:26 +02:00
|
|
|
|
2020-11-11 02:06:24 +01:00
|
|
|
def write_drc_script(cell_name, gds_name, extract, final_verification=False, output_path=None):
|
2019-04-23 00:12:59 +02:00
|
|
|
""" Write a Calibre runset file and script to run DRC """
|
2016-11-08 18:57:35 +01:00
|
|
|
# the runset file contains all the options to run calibre
|
2020-11-11 02:06:24 +01:00
|
|
|
|
|
|
|
|
if not output_path:
|
|
|
|
|
output_path = OPTS.openram_temp
|
|
|
|
|
|
2016-11-08 18:57:35 +01:00
|
|
|
from tech import drc
|
|
|
|
|
drc_rules = drc["drc_rules"]
|
|
|
|
|
|
|
|
|
|
drc_runset = {
|
|
|
|
|
'drcRulesFile': drc_rules,
|
2020-11-09 20:12:31 +01:00
|
|
|
'drcRunDir': output_path,
|
2020-07-31 12:51:34 +02:00
|
|
|
'drcLayoutPaths': gds_name,
|
2018-01-12 23:39:42 +01:00
|
|
|
'drcLayoutPrimary': cell_name,
|
2016-11-08 18:57:35 +01:00
|
|
|
'drcLayoutSystem': 'GDSII',
|
|
|
|
|
'drcResultsformat': 'ASCII',
|
2019-04-27 00:17:39 +02:00
|
|
|
'drcResultsFile': cell_name + ".drc.results",
|
|
|
|
|
'drcSummaryFile': cell_name + ".drc.summary",
|
2016-11-08 18:57:35 +01:00
|
|
|
'cmnFDILayerMapFile': drc["layer_map"],
|
|
|
|
|
'cmnFDIUseLayerMap': 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# write the runset file
|
2020-11-09 20:12:31 +01:00
|
|
|
f = open(output_path + "drc_runset", "w")
|
2018-05-29 20:54:10 +02:00
|
|
|
for k in sorted(iter(drc_runset.keys())):
|
2017-11-16 22:52:58 +01:00
|
|
|
f.write("*{0}: {1}\n".format(k, drc_runset[k]))
|
2016-11-08 18:57:35 +01:00
|
|
|
f.close()
|
|
|
|
|
|
2019-04-23 00:12:59 +02:00
|
|
|
# Create an auxiliary script to run calibre with the runset
|
2020-11-09 20:12:31 +01:00
|
|
|
run_file = output_path + "run_drc.sh"
|
2019-04-23 00:12:59 +02:00
|
|
|
f = open(run_file, "w")
|
|
|
|
|
f.write("#!/bin/sh\n")
|
2020-12-11 19:06:00 +01:00
|
|
|
cmd = "{0} -gui -drc drc_runset -batch".format(OPTS.drc_exe[1])
|
|
|
|
|
|
2019-04-23 00:12:59 +02:00
|
|
|
f.write(cmd)
|
|
|
|
|
f.write("\n")
|
|
|
|
|
f.close()
|
|
|
|
|
os.system("chmod u+x {}".format(run_file))
|
|
|
|
|
return drc_runset
|
|
|
|
|
|
2020-06-15 22:58:26 +02:00
|
|
|
|
2020-11-11 02:06:24 +01:00
|
|
|
def write_lvs_script(cell_name, gds_name, sp_name, final_verification=False, output_path=None):
|
2019-04-23 00:12:59 +02:00
|
|
|
""" Write a Calibre runset file and script to run LVS """
|
|
|
|
|
|
2020-11-11 02:06:24 +01:00
|
|
|
if not output_path:
|
|
|
|
|
output_path = OPTS.openram_temp
|
|
|
|
|
|
2019-04-23 00:12:59 +02:00
|
|
|
from tech import drc
|
|
|
|
|
lvs_rules = drc["lvs_rules"]
|
|
|
|
|
lvs_runset = {
|
|
|
|
|
'lvsRulesFile': lvs_rules,
|
2020-11-09 20:12:31 +01:00
|
|
|
'lvsRunDir': output_path,
|
2020-07-31 12:51:34 +02:00
|
|
|
'lvsLayoutPaths': gds_name,
|
2019-04-23 00:12:59 +02:00
|
|
|
'lvsLayoutPrimary': cell_name,
|
2020-07-31 12:51:34 +02:00
|
|
|
'lvsSourcePath': sp_name,
|
2019-04-23 00:12:59 +02:00
|
|
|
'lvsSourcePrimary': cell_name,
|
|
|
|
|
'lvsSourceSystem': 'SPICE',
|
2020-06-15 22:58:26 +02:00
|
|
|
'lvsSpiceFile': "{}.spice".format(cell_name),
|
2019-04-23 00:12:59 +02:00
|
|
|
'lvsPowerNames': 'vdd',
|
|
|
|
|
'lvsGroundNames': 'gnd',
|
|
|
|
|
'lvsIncludeSVRFCmds': 1,
|
|
|
|
|
'lvsIgnorePorts': 1,
|
2019-04-27 00:17:39 +02:00
|
|
|
'lvsERCDatabase': cell_name + ".erc.results",
|
|
|
|
|
'lvsERCSummaryFile': cell_name + ".erc.summary",
|
|
|
|
|
'lvsReportFile': cell_name + ".lvs.report",
|
|
|
|
|
'lvsMaskDBFile': cell_name + ".maskdb",
|
2019-04-23 00:12:59 +02:00
|
|
|
'cmnFDILayerMapFile': drc["layer_map"],
|
|
|
|
|
'cmnFDIUseLayerMap': 1,
|
|
|
|
|
'cmnTranscriptFile': './lvs.log',
|
|
|
|
|
'cmnTranscriptEchoToFile': 1,
|
2019-06-26 00:06:07 +02:00
|
|
|
'lvsRecognizeGates': 'NONE',
|
2019-04-23 00:12:59 +02:00
|
|
|
}
|
2020-12-03 19:03:47 +01:00
|
|
|
# FIXME: Remove when vdd/gnd connected
|
|
|
|
|
# 'cmnVConnectNamesState' : 'ALL', #connects all nets with the same namee
|
|
|
|
|
# FIXME: Remove when vdd/gnd connected
|
|
|
|
|
# 'lvsAbortOnSupplyError' : 0
|
2019-04-23 00:12:59 +02:00
|
|
|
|
2020-09-15 22:39:00 +02:00
|
|
|
if not final_verification or not OPTS.route_supplies:
|
2019-04-23 00:12:59 +02:00
|
|
|
lvs_runset['cmnVConnectReport']=1
|
|
|
|
|
lvs_runset['cmnVConnectNamesState']='SOME'
|
|
|
|
|
lvs_runset['cmnVConnectNames']='vdd gnd'
|
|
|
|
|
else:
|
|
|
|
|
lvs_runset['lvsAbortOnSupplyError']=1
|
2019-06-26 00:06:07 +02:00
|
|
|
|
2019-04-23 00:12:59 +02:00
|
|
|
# write the runset file
|
2020-11-09 20:12:31 +01:00
|
|
|
f = open(output_path + "lvs_runset", "w")
|
2019-04-23 00:12:59 +02:00
|
|
|
for k in sorted(iter(lvs_runset.keys())):
|
|
|
|
|
f.write("*{0}: {1}\n".format(k, lvs_runset[k]))
|
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
|
|
# Create an auxiliary script to run calibre with the runset
|
2020-11-09 20:12:31 +01:00
|
|
|
run_file = output_path + "run_lvs.sh"
|
2019-04-23 00:12:59 +02:00
|
|
|
f = open(run_file, "w")
|
|
|
|
|
f.write("#!/bin/sh\n")
|
2020-12-11 19:06:00 +01:00
|
|
|
cmd = "{0} -gui -lvs lvs_runset -batch".format(OPTS.lvs_exe[1])
|
|
|
|
|
|
2019-04-23 00:12:59 +02:00
|
|
|
f.write(cmd)
|
|
|
|
|
f.write("\n")
|
|
|
|
|
f.close()
|
|
|
|
|
os.system("chmod u+x {}".format(run_file))
|
2019-06-26 00:06:07 +02:00
|
|
|
|
2019-04-23 00:12:59 +02:00
|
|
|
return lvs_runset
|
2019-04-27 00:43:46 +02:00
|
|
|
|
2019-06-26 00:06:07 +02:00
|
|
|
|
2020-11-11 02:06:24 +01:00
|
|
|
def write_pex_script(cell_name, extract, output, final_verification=False, output_path=None):
|
2020-06-15 22:58:26 +02:00
|
|
|
""" Write a pex script that can either just extract the netlist or the netlist+parasitics """
|
2020-11-11 02:06:24 +01:00
|
|
|
|
|
|
|
|
if not output_path:
|
|
|
|
|
output_path = OPTS.openram_temp
|
|
|
|
|
|
2019-04-27 00:43:46 +02:00
|
|
|
if output == None:
|
2020-07-30 20:35:13 +02:00
|
|
|
output = cell_name + ".pex.sp"
|
2019-04-27 00:43:46 +02:00
|
|
|
|
|
|
|
|
# check if lvs report has been done
|
|
|
|
|
# if not run drc and lvs
|
2020-11-09 20:12:31 +01:00
|
|
|
if not os.path.isfile(output_path + cell_name + ".lvs.report"):
|
|
|
|
|
gds_name = output_path +"/"+ cell_name + ".gds"
|
|
|
|
|
sp_name = output_path +"/"+ cell_name + ".sp"
|
2020-11-11 02:06:24 +01:00
|
|
|
run_drc(cell_name, gds_name, sp_name)
|
2019-04-27 00:43:46 +02:00
|
|
|
run_lvs(cell_name, gds_name, sp_name)
|
|
|
|
|
|
2019-06-26 00:06:07 +02:00
|
|
|
from tech import drc
|
2019-04-27 00:43:46 +02:00
|
|
|
pex_rules = drc["xrc_rules"]
|
|
|
|
|
pex_runset = {
|
|
|
|
|
'pexRulesFile': pex_rules,
|
2020-11-09 20:12:31 +01:00
|
|
|
'pexRunDir': output_path,
|
2019-04-27 00:43:46 +02:00
|
|
|
'pexLayoutPaths': cell_name + ".gds",
|
|
|
|
|
'pexLayoutPrimary': cell_name,
|
|
|
|
|
'pexSourcePath': cell_name + ".sp",
|
|
|
|
|
'pexSourcePrimary': cell_name,
|
2020-06-15 22:58:26 +02:00
|
|
|
'pexReportFile': cell_name + ".pex.report",
|
2020-07-15 11:50:21 +02:00
|
|
|
'pexPexNetlistFile': output,
|
2019-04-27 00:43:46 +02:00
|
|
|
'pexPexReportFile': cell_name + ".pex.report",
|
|
|
|
|
'pexMaskDBFile': cell_name + ".maskdb",
|
|
|
|
|
'cmnFDIDEFLayoutPath': cell_name + ".def",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# write the runset file
|
2020-11-09 20:12:31 +01:00
|
|
|
f = open(output_path + "pex_runset", "w")
|
2019-04-27 00:43:46 +02:00
|
|
|
for k in sorted(iter(pex_runset.keys())):
|
|
|
|
|
f.write("*{0}: {1}\n".format(k, pex_runset[k]))
|
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
|
|
# Create an auxiliary script to run calibre with the runset
|
2020-11-09 20:12:31 +01:00
|
|
|
run_file = output_path + "run_pex.sh"
|
2019-04-27 00:43:46 +02:00
|
|
|
f = open(run_file, "w")
|
|
|
|
|
f.write("#!/bin/sh\n")
|
2020-12-11 19:06:00 +01:00
|
|
|
cmd = "{0} -gui -pex pex_runset -batch".format(OPTS.pex_exe[1])
|
|
|
|
|
|
2019-04-27 00:43:46 +02:00
|
|
|
f.write(cmd)
|
|
|
|
|
f.write("\n")
|
|
|
|
|
f.close()
|
|
|
|
|
os.system("chmod u+x {}".format(run_file))
|
|
|
|
|
|
|
|
|
|
return pex_runset
|
2019-06-26 00:06:07 +02:00
|
|
|
|
2020-06-15 22:58:26 +02:00
|
|
|
|
2020-11-11 02:06:24 +01:00
|
|
|
def run_drc(cell_name, gds_name, sp_name, extract=False, final_verification=False):
|
2019-04-23 00:12:59 +02:00
|
|
|
"""Run DRC check on a given top-level name which is
|
|
|
|
|
implemented in gds_name."""
|
2019-06-26 00:06:07 +02:00
|
|
|
|
2019-04-23 00:12:59 +02:00
|
|
|
global num_drc_runs
|
|
|
|
|
num_drc_runs += 1
|
|
|
|
|
|
2020-11-09 20:12:31 +01:00
|
|
|
drc_runset = write_drc_script(cell_name, gds_name, extract, final_verification, OPTS.openram_temp)
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2019-04-27 00:43:46 +02:00
|
|
|
(outfile, errfile, resultsfile) = run_script(cell_name, "drc")
|
2016-11-08 18:57:35 +01:00
|
|
|
|
|
|
|
|
# check the result for these lines in the summary:
|
|
|
|
|
# TOTAL Original Layer Geometries: 106 (157)
|
|
|
|
|
# TOTAL DRC RuleChecks Executed: 156
|
|
|
|
|
# TOTAL DRC Results Generated: 0 (0)
|
2016-11-09 21:00:16 +01:00
|
|
|
try:
|
2019-04-27 00:17:39 +02:00
|
|
|
f = open(OPTS.openram_temp + drc_runset['drcSummaryFile'], "r")
|
2016-11-09 21:00:16 +01:00
|
|
|
except:
|
2020-11-09 20:12:31 +01:00
|
|
|
debug.error("Unable to retrieve DRC results file. Is calibre set up?", 1)
|
2016-11-08 18:57:35 +01:00
|
|
|
results = f.readlines()
|
|
|
|
|
f.close()
|
|
|
|
|
# those lines should be the last 3
|
|
|
|
|
results = results[-3:]
|
2019-02-14 02:01:26 +01:00
|
|
|
geometries = int(re.split(r'\W+', results[0])[5])
|
|
|
|
|
rulechecks = int(re.split(r'\W+', results[1])[4])
|
2019-02-14 02:41:33 +01:00
|
|
|
errors = int(re.split(r'\W+', results[2])[5])
|
2016-11-08 18:57:35 +01:00
|
|
|
|
|
|
|
|
# always display this summary
|
2020-06-30 16:16:05 +02:00
|
|
|
result_str = "{0}\tGeometries: {1}\tChecks: {2}\tErrors: {3}".format(cell_name,
|
2017-11-16 22:52:58 +01:00
|
|
|
geometries,
|
|
|
|
|
rulechecks,
|
2020-06-30 16:16:05 +02:00
|
|
|
errors)
|
|
|
|
|
if errors > 0:
|
|
|
|
|
debug.warning(result_str)
|
2016-11-08 18:57:35 +01:00
|
|
|
else:
|
2020-06-30 16:16:05 +02:00
|
|
|
debug.info(1, result_str)
|
2016-11-08 18:57:35 +01:00
|
|
|
return errors
|
|
|
|
|
|
|
|
|
|
|
2018-02-05 23:52:51 +01:00
|
|
|
def run_lvs(cell_name, gds_name, sp_name, final_verification=False):
|
2016-11-08 18:57:35 +01:00
|
|
|
"""Run LVS check on a given top-level name which is
|
2018-02-05 23:52:51 +01:00
|
|
|
implemented in gds_name and sp_name. Final verification will
|
|
|
|
|
ensure that there are no remaining virtual conections. """
|
2019-06-26 00:06:07 +02:00
|
|
|
|
2018-07-11 20:59:24 +02:00
|
|
|
global num_lvs_runs
|
|
|
|
|
num_lvs_runs += 1
|
2019-06-26 00:06:07 +02:00
|
|
|
|
2020-11-09 20:12:31 +01:00
|
|
|
lvs_runset = write_lvs_script(cell_name, gds_name, sp_name, final_verification, OPTS.openram_temp)
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2019-04-27 00:43:46 +02:00
|
|
|
(outfile, errfile, resultsfile) = run_script(cell_name, "lvs")
|
2016-11-08 18:57:35 +01:00
|
|
|
|
|
|
|
|
# check the result for these lines in the summary:
|
2019-04-27 00:17:39 +02:00
|
|
|
f = open(OPTS.openram_temp + lvs_runset['lvsReportFile'], "r")
|
2016-11-08 18:57:35 +01:00
|
|
|
results = f.readlines()
|
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
|
|
# NOT COMPARED
|
|
|
|
|
# CORRECT
|
|
|
|
|
# INCORRECT
|
|
|
|
|
test = re.compile("# CORRECT #")
|
2018-05-12 01:32:00 +02:00
|
|
|
correct = list(filter(test.search, results))
|
2016-11-08 18:57:35 +01:00
|
|
|
test = re.compile("NOT COMPARED")
|
2018-05-12 01:32:00 +02:00
|
|
|
notcompared = list(filter(test.search, results))
|
2016-11-08 18:57:35 +01:00
|
|
|
test = re.compile("# INCORRECT #")
|
2018-05-12 01:32:00 +02:00
|
|
|
incorrect = list(filter(test.search, results))
|
2016-11-08 18:57:35 +01:00
|
|
|
|
|
|
|
|
# Errors begin with "Error:"
|
2019-02-14 02:01:26 +01:00
|
|
|
test = re.compile(r'\s+Error:')
|
2018-05-12 01:32:00 +02:00
|
|
|
errors = list(filter(test.search, results))
|
2016-11-08 18:57:35 +01:00
|
|
|
for e in errors:
|
|
|
|
|
debug.error(e.strip("\n"))
|
|
|
|
|
|
|
|
|
|
summary_errors = len(notcompared) + len(incorrect) + len(errors)
|
|
|
|
|
|
|
|
|
|
# also check the extraction summary file
|
2019-04-27 00:17:39 +02:00
|
|
|
f = open(OPTS.openram_temp + lvs_runset['lvsReportFile'] + ".ext", "r")
|
2016-11-08 18:57:35 +01:00
|
|
|
results = f.readlines()
|
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
|
|
test = re.compile("ERROR:")
|
2018-05-12 01:32:00 +02:00
|
|
|
exterrors = list(filter(test.search, results))
|
2016-11-08 18:57:35 +01:00
|
|
|
for e in exterrors:
|
|
|
|
|
debug.error(e.strip("\n"))
|
|
|
|
|
|
|
|
|
|
test = re.compile("WARNING:")
|
2018-05-12 01:32:00 +02:00
|
|
|
extwarnings = list(filter(test.search, results))
|
2016-11-08 18:57:35 +01:00
|
|
|
for e in extwarnings:
|
2017-09-30 01:22:13 +02:00
|
|
|
debug.warning(e.strip("\n"))
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2017-09-30 01:22:13 +02:00
|
|
|
# MRG - 9/26/17 - Change this to exclude warnings because of
|
|
|
|
|
# multiple labels on different pins in column mux.
|
|
|
|
|
ext_errors = len(exterrors)
|
2019-06-26 00:06:07 +02:00
|
|
|
ext_warnings = len(extwarnings)
|
2016-11-08 18:57:35 +01:00
|
|
|
|
|
|
|
|
# also check the output file
|
|
|
|
|
f = open(outfile, "r")
|
|
|
|
|
results = f.readlines()
|
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
|
|
# Errors begin with "ERROR:"
|
|
|
|
|
test = re.compile("ERROR:")
|
2018-05-12 01:32:00 +02:00
|
|
|
stdouterrors = list(filter(test.search, results))
|
2016-11-08 18:57:35 +01:00
|
|
|
for e in stdouterrors:
|
|
|
|
|
debug.error(e.strip("\n"))
|
|
|
|
|
|
|
|
|
|
out_errors = len(stdouterrors)
|
2017-09-30 01:22:13 +02:00
|
|
|
total_errors = summary_errors + out_errors + ext_errors
|
2018-07-18 23:28:43 +02:00
|
|
|
|
2020-06-30 16:16:05 +02:00
|
|
|
# always display this summary
|
|
|
|
|
result_str = "{0}\tSummary: {1}\tOutput: {2}\tExtraction: {3}".format(cell_name,
|
2018-07-18 23:28:43 +02:00
|
|
|
summary_errors,
|
|
|
|
|
out_errors,
|
2020-06-30 16:16:05 +02:00
|
|
|
ext_errors)
|
|
|
|
|
if total_errors > 0:
|
|
|
|
|
debug.warning(result_str)
|
2018-07-18 23:28:43 +02:00
|
|
|
else:
|
2020-06-30 16:16:05 +02:00
|
|
|
debug.info(1, result_str)
|
2019-06-26 00:06:07 +02:00
|
|
|
|
2017-09-30 01:22:13 +02:00
|
|
|
return total_errors
|
2016-11-08 18:57:35 +01:00
|
|
|
|
|
|
|
|
|
2019-02-24 19:49:35 +01:00
|
|
|
def run_pex(cell_name, gds_name, sp_name, output=None, final_verification=False):
|
2016-11-08 18:57:35 +01:00
|
|
|
"""Run pex on a given top-level name which is
|
|
|
|
|
implemented in gds_name and sp_name. """
|
2018-07-11 20:59:24 +02:00
|
|
|
|
|
|
|
|
global num_pex_runs
|
|
|
|
|
num_pex_runs += 1
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2020-11-09 20:12:31 +01:00
|
|
|
write_pex_script(cell_name, True, output, final_verification, OPTS.openram_temp)
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2019-04-27 00:43:46 +02:00
|
|
|
(outfile, errfile, resultsfile) = run_script(cell_name, "pex")
|
2019-06-26 00:06:07 +02:00
|
|
|
|
2016-11-08 18:57:35 +01:00
|
|
|
|
|
|
|
|
# also check the output file
|
|
|
|
|
f = open(outfile, "r")
|
|
|
|
|
results = f.readlines()
|
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
|
|
# Errors begin with "ERROR:"
|
|
|
|
|
test = re.compile("ERROR:")
|
2018-05-12 01:32:00 +02:00
|
|
|
stdouterrors = list(filter(test.search, results))
|
2016-11-08 18:57:35 +01:00
|
|
|
for e in stdouterrors:
|
|
|
|
|
debug.error(e.strip("\n"))
|
|
|
|
|
|
|
|
|
|
out_errors = len(stdouterrors)
|
|
|
|
|
|
|
|
|
|
assert(os.path.isfile(output))
|
2018-01-12 23:39:42 +01:00
|
|
|
correct_port(cell_name, output, sp_name)
|
2016-11-08 18:57:35 +01:00
|
|
|
|
|
|
|
|
return out_errors
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def correct_port(name, output_file_name, ref_file_name):
|
|
|
|
|
pex_file = open(output_file_name, "r")
|
|
|
|
|
contents = pex_file.read()
|
|
|
|
|
# locate the start of circuit definition line
|
|
|
|
|
match = re.search(".subckt " + str(name) + ".*", contents)
|
|
|
|
|
match_index_start = match.start()
|
|
|
|
|
pex_file.seek(match_index_start)
|
|
|
|
|
rest_text = pex_file.read()
|
|
|
|
|
# locate the end of circuit definition line
|
2019-02-14 02:01:26 +01:00
|
|
|
match = re.search(r'\* \n', rest_text)
|
2016-11-08 18:57:35 +01:00
|
|
|
match_index_end = match.start()
|
|
|
|
|
# store the unchanged part of pex file in memory
|
|
|
|
|
pex_file.seek(0)
|
|
|
|
|
part1 = pex_file.read(match_index_start)
|
|
|
|
|
pex_file.seek(match_index_start + match_index_end)
|
|
|
|
|
part2 = pex_file.read()
|
|
|
|
|
pex_file.close()
|
|
|
|
|
|
2018-01-12 23:39:42 +01:00
|
|
|
# obtain the correct definition line from the original spice file
|
2016-11-08 18:57:35 +01:00
|
|
|
sp_file = open(ref_file_name, "r")
|
|
|
|
|
contents = sp_file.read()
|
|
|
|
|
circuit_title = re.search(".SUBCKT " + str(name) + ".*\n", contents)
|
|
|
|
|
circuit_title = circuit_title.group()
|
|
|
|
|
sp_file.close()
|
|
|
|
|
|
|
|
|
|
# write the new pex file with info in the memory
|
|
|
|
|
output_file = open(output_file_name, "w")
|
|
|
|
|
output_file.write(part1)
|
|
|
|
|
output_file.write(circuit_title)
|
|
|
|
|
output_file.write(part2)
|
|
|
|
|
output_file.close()
|
2018-07-11 20:59:24 +02:00
|
|
|
|
2020-11-09 20:12:31 +01:00
|
|
|
|
2018-07-11 20:59:24 +02:00
|
|
|
def print_drc_stats():
|
2020-11-09 20:12:31 +01:00
|
|
|
debug.info(1, "DRC runs: {0}".format(num_drc_runs))
|
|
|
|
|
|
|
|
|
|
|
2018-07-11 20:59:24 +02:00
|
|
|
def print_lvs_stats():
|
2020-11-09 20:12:31 +01:00
|
|
|
debug.info(1, "LVS runs: {0}".format(num_lvs_runs))
|
|
|
|
|
|
|
|
|
|
|
2018-07-11 20:59:24 +02:00
|
|
|
def print_pex_stats():
|
2020-11-09 20:12:31 +01:00
|
|
|
debug.info(1, "PEX runs: {0}".format(num_pex_runs))
|