mirror of https://github.com/VLSIDA/OpenRAM.git
Initial DRC with Magic is done.
This commit is contained in:
parent
7a172873a3
commit
1b30eb4b64
|
|
@ -109,7 +109,6 @@ def get_tool(tool_type, preferences):
|
|||
one selected and its full path.
|
||||
"""
|
||||
debug.info(2,"Finding {} tool...".format(tool_type))
|
||||
global OPTS
|
||||
|
||||
for name in preferences:
|
||||
exe_name = find_exe(name)
|
||||
|
|
@ -129,6 +128,8 @@ def read_config(config_file):
|
|||
config file is just a Python file that defines some config
|
||||
options.
|
||||
"""
|
||||
global OPTS
|
||||
|
||||
# Create a full path relative to current dir unless it is already an abs path
|
||||
if not os.path.isabs(config_file):
|
||||
config_file = os.getcwd() + "/" + config_file
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ class options(optparse.Values):
|
|||
# Should we print out the banner at startup
|
||||
print_banner = True
|
||||
# The DRC/LVS/PEX executable being used which is derived from the user PATH.
|
||||
drc_exe = ""
|
||||
lvs_exe = ""
|
||||
pex_exe = ""
|
||||
drc_exe = None
|
||||
lvs_exe = None
|
||||
pex_exe = None
|
||||
# The spice executable being used which is derived from the user PATH.
|
||||
spice_exe = ""
|
||||
# Run with extracted parasitics
|
||||
|
|
|
|||
|
|
@ -16,43 +16,43 @@ debug.info(2,"Initializing verify...")
|
|||
|
||||
if not OPTS.check_lvsdrc:
|
||||
debug.info(1,"LVS/DRC/PEX disabled.")
|
||||
drc_exe = None
|
||||
lvs_exe = None
|
||||
pex_exe = None
|
||||
OPTS.drc_exe = None
|
||||
OPTS.lvs_exe = None
|
||||
OPTS.pex_exe = None
|
||||
else:
|
||||
drc_exe = get_tool("DRC",["calibre","assura","magic"])
|
||||
lvs_exe = get_tool("LVS",["calibre","assura","netgen"])
|
||||
pex_exe = get_tool("PEX",["calibre","magic"])
|
||||
OPTS.drc_exe = get_tool("DRC",["calibre","assura","magic"])
|
||||
OPTS.lvs_exe = get_tool("LVS",["calibre","assura","netgen"])
|
||||
OPTS.pex_exe = get_tool("PEX",["calibre","magic"])
|
||||
|
||||
|
||||
if drc_exe == None:
|
||||
if OPTS.drc_exe == None:
|
||||
pass
|
||||
elif "calibre" in drc_exe:
|
||||
elif "calibre" in OPTS.drc_exe:
|
||||
from calibre import run_drc
|
||||
elif "assura" in drc_exe:
|
||||
elif "assura" in OPTS.drc_exe:
|
||||
from assura import run_drc
|
||||
elif "magic" in drc_exe:
|
||||
elif "magic" in OPTS.drc_exe:
|
||||
from magic import run_drc
|
||||
else:
|
||||
debug.warning("Did not find a supported DRC tool.")
|
||||
|
||||
if lvs_exe == None:
|
||||
if OPTS.lvs_exe == None:
|
||||
pass
|
||||
elif "calibre" in lvs_exe:
|
||||
elif "calibre" in OPTS.lvs_exe:
|
||||
from calibre import run_lvs
|
||||
elif "assura" in lvs_exe:
|
||||
elif "assura" in OPTS.lvs_exe:
|
||||
from assura import run_lvs
|
||||
elif "netgen" in lvs_exe:
|
||||
elif "netgen" in OPTS.lvs_exe:
|
||||
from magic import run_lvs
|
||||
else:
|
||||
debug.warning("Did not find a supported LVS tool.")
|
||||
|
||||
|
||||
if pex_exe == None:
|
||||
if OPTS.pex_exe == None:
|
||||
pass
|
||||
elif "calibre" in pex_exe:
|
||||
elif "calibre" in OPTS.pex_exe:
|
||||
from calibre import run_pex
|
||||
elif "magic" in pex_exe:
|
||||
elif "magic" in OPTS.pex_exe:
|
||||
from magic import run_pex
|
||||
else:
|
||||
debug.warning("Did not find a supported PEX tool.")
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ from globals import OPTS
|
|||
import subprocess
|
||||
|
||||
|
||||
def run_drc(name, gds_name):
|
||||
def run_drc(cell_name, gds_name):
|
||||
"""Run DRC check on a given top-level name which is
|
||||
implemented in gds_name."""
|
||||
|
||||
|
|
@ -78,11 +78,11 @@ def run_drc(name, gds_name):
|
|||
'drcRulesFile': drc_rules,
|
||||
'drcRunDir': OPTS.openram_temp,
|
||||
'drcLayoutPaths': gds_name,
|
||||
'drcLayoutPrimary': name,
|
||||
'drcLayoutPrimary': cell_name,
|
||||
'drcLayoutSystem': 'GDSII',
|
||||
'drcResultsformat': 'ASCII',
|
||||
'drcResultsFile': OPTS.openram_temp + name + ".drc.results",
|
||||
'drcSummaryFile': OPTS.openram_temp + name + ".drc.summary",
|
||||
'drcResultsFile': OPTS.openram_temp + cell_name + ".drc.results",
|
||||
'drcSummaryFile': OPTS.openram_temp + cell_name + ".drc.summary",
|
||||
'cmnFDILayerMapFile': drc["layer_map"],
|
||||
'cmnFDIUseLayerMap': 1
|
||||
}
|
||||
|
|
@ -96,12 +96,13 @@ def run_drc(name, gds_name):
|
|||
# run drc
|
||||
cwd = os.getcwd()
|
||||
os.chdir(OPTS.openram_temp)
|
||||
errfile = "{0}{1}.drc.err".format(OPTS.openram_temp, name)
|
||||
outfile = "{0}{1}.drc.out".format(OPTS.openram_temp, name)
|
||||
errfile = "{0}{1}.drc.err".format(OPTS.openram_temp, cell_name)
|
||||
outfile = "{0}{1}.drc.out".format(OPTS.openram_temp, cell_name)
|
||||
|
||||
cmd = "calibre -gui -drc {0}drc_runset -batch 2> {1} 1> {2}".format(OPTS.openram_temp,
|
||||
errfile,
|
||||
outfile)
|
||||
cmd = "{0} -gui -drc {1}drc_runset -batch 2> {2} 1> {3}".format(OPTS.drc_exe[1],
|
||||
OPTS.openram_temp,
|
||||
errfile,
|
||||
outfile)
|
||||
debug.info(1, cmd)
|
||||
os.system(cmd)
|
||||
os.chdir(cwd)
|
||||
|
|
@ -124,19 +125,19 @@ def run_drc(name, gds_name):
|
|||
|
||||
# always display this summary
|
||||
if errors > 0:
|
||||
debug.error("{0}\tGeometries: {1}\tChecks: {2}\tErrors: {3}".format(name,
|
||||
debug.error("{0}\tGeometries: {1}\tChecks: {2}\tErrors: {3}".format(cell_name,
|
||||
geometries,
|
||||
rulechecks,
|
||||
errors))
|
||||
else:
|
||||
debug.info(1, "{0}\tGeometries: {1}\tChecks: {2}\tErrors: {3}".format(name,
|
||||
debug.info(1, "{0}\tGeometries: {1}\tChecks: {2}\tErrors: {3}".format(cell_name,
|
||||
geometries,
|
||||
rulechecks,
|
||||
errors))
|
||||
return errors
|
||||
|
||||
|
||||
def run_lvs(name, gds_name, sp_name):
|
||||
def run_lvs(cell_name, gds_name, sp_name):
|
||||
"""Run LVS check on a given top-level name which is
|
||||
implemented in gds_name and sp_name. """
|
||||
from tech import drc
|
||||
|
|
@ -145,9 +146,9 @@ def run_lvs(name, gds_name, sp_name):
|
|||
'lvsRulesFile': lvs_rules,
|
||||
'lvsRunDir': OPTS.openram_temp,
|
||||
'lvsLayoutPaths': gds_name,
|
||||
'lvsLayoutPrimary': name,
|
||||
'lvsLayoutPrimary': cell_name,
|
||||
'lvsSourcePath': sp_name,
|
||||
'lvsSourcePrimary': name,
|
||||
'lvsSourcePrimary': cell_name,
|
||||
'lvsSourceSystem': 'SPICE',
|
||||
'lvsSpiceFile': OPTS.openram_temp + "extracted.sp",
|
||||
'lvsPowerNames': 'vdd',
|
||||
|
|
@ -155,10 +156,10 @@ def run_lvs(name, gds_name, sp_name):
|
|||
'lvsIncludeSVRFCmds': 1,
|
||||
'lvsSVRFCmds': '{VIRTUAL CONNECT NAME VDD? GND? ?}',
|
||||
'lvsIgnorePorts': 1,
|
||||
'lvsERCDatabase': OPTS.openram_temp + name + ".erc.results",
|
||||
'lvsERCSummaryFile': OPTS.openram_temp + name + ".erc.summary",
|
||||
'lvsReportFile': OPTS.openram_temp + name + ".lvs.report",
|
||||
'lvsMaskDBFile': OPTS.openram_temp + name + ".maskdb",
|
||||
'lvsERCDatabase': OPTS.openram_temp + cell_name + ".erc.results",
|
||||
'lvsERCSummaryFile': OPTS.openram_temp + cell_name + ".erc.summary",
|
||||
'lvsReportFile': OPTS.openram_temp + cell_name + ".lvs.report",
|
||||
'lvsMaskDBFile': OPTS.openram_temp + cell_name + ".maskdb",
|
||||
'cmnFDILayerMapFile': drc["layer_map"],
|
||||
'cmnFDIUseLayerMap': 1,
|
||||
'cmnVConnectNames': 'vdd, gnd',
|
||||
|
|
@ -174,12 +175,13 @@ def run_lvs(name, gds_name, sp_name):
|
|||
# run LVS
|
||||
cwd = os.getcwd()
|
||||
os.chdir(OPTS.openram_temp)
|
||||
errfile = "{0}{1}.lvs.err".format(OPTS.openram_temp, name)
|
||||
outfile = "{0}{1}.lvs.out".format(OPTS.openram_temp, name)
|
||||
errfile = "{0}{1}.lvs.err".format(OPTS.openram_temp, cell_name)
|
||||
outfile = "{0}{1}.lvs.out".format(OPTS.openram_temp, cell_name)
|
||||
|
||||
cmd = "calibre -gui -lvs {0}lvs_runset -batch 2> {1} 1> {2}".format(OPTS.openram_temp,
|
||||
errfile,
|
||||
outfile)
|
||||
cmd = "{0} -gui -lvs {1}lvs_runset -batch 2> {2} 1> {3}".format(OPTS.lvs_exe[1],
|
||||
OPTS.openram_temp,
|
||||
errfile,
|
||||
outfile)
|
||||
debug.info(1, cmd)
|
||||
os.system(cmd)
|
||||
os.chdir(cwd)
|
||||
|
|
@ -244,7 +246,7 @@ def run_lvs(name, gds_name, sp_name):
|
|||
return total_errors
|
||||
|
||||
|
||||
def run_pex(name, gds_name, sp_name, output=None):
|
||||
def run_pex(cell_name, gds_name, sp_name, output=None):
|
||||
"""Run pex on a given top-level name which is
|
||||
implemented in gds_name and sp_name. """
|
||||
from tech import drc
|
||||
|
|
@ -253,24 +255,24 @@ def run_pex(name, gds_name, sp_name, output=None):
|
|||
|
||||
# check if lvs report has been done
|
||||
# if not run drc and lvs
|
||||
if not os.path.isfile(name + ".lvs.report"):
|
||||
run_drc(name, gds_name)
|
||||
run_lvs(name, gds_name, sp_name)
|
||||
if not os.path.isfile(cell_name + ".lvs.report"):
|
||||
run_drc(cell_name, gds_name)
|
||||
run_lvs(cell_name, gds_name, sp_name)
|
||||
|
||||
pex_rules = drc["xrc_rules"]
|
||||
pex_runset = {
|
||||
'pexRulesFile': pex_rules,
|
||||
'pexRunDir': OPTS.openram_temp,
|
||||
'pexLayoutPaths': gds_name,
|
||||
'pexLayoutPrimary': name,
|
||||
'pexLayoutPrimary': cell_name,
|
||||
#'pexSourcePath' : OPTS.openram_temp+"extracted.sp",
|
||||
'pexSourcePath': sp_name,
|
||||
'pexSourcePrimary': name,
|
||||
'pexReportFile': name + ".lvs.report",
|
||||
'pexSourcePrimary': cell_name,
|
||||
'pexReportFile': cell_name + ".lvs.report",
|
||||
'pexPexNetlistFile': output,
|
||||
'pexPexReportFile': name + ".pex.report",
|
||||
'pexMaskDBFile': name + ".maskdb",
|
||||
'cmnFDIDEFLayoutPath': name + ".def",
|
||||
'pexPexReportFile': cell_name + ".pex.report",
|
||||
'pexMaskDBFile': cell_name + ".maskdb",
|
||||
'cmnFDIDEFLayoutPath': cell_name + ".def",
|
||||
}
|
||||
|
||||
# write the runset file
|
||||
|
|
@ -282,12 +284,13 @@ def run_pex(name, gds_name, sp_name, output=None):
|
|||
# run pex
|
||||
cwd = os.getcwd()
|
||||
os.chdir(OPTS.openram_temp)
|
||||
errfile = "{0}{1}.pex.err".format(OPTS.openram_temp, name)
|
||||
outfile = "{0}{1}.pex.out".format(OPTS.openram_temp, name)
|
||||
errfile = "{0}{1}.pex.err".format(OPTS.openram_temp, cell_name)
|
||||
outfile = "{0}{1}.pex.out".format(OPTS.openram_temp, cell_name)
|
||||
|
||||
cmd = "calibre -gui -pex {0}pex_runset -batch 2> {1} 1> {2}".format(OPTS.openram_temp,
|
||||
errfile,
|
||||
outfile)
|
||||
cmd = "{0} -gui -pex {1}pex_runset -batch 2> {2} 1> {3}".format(OPTS.pex_exe[1],
|
||||
OPTS.openram_temp,
|
||||
errfile,
|
||||
outfile)
|
||||
debug.info(2, cmd)
|
||||
os.system(cmd)
|
||||
os.chdir(cwd)
|
||||
|
|
@ -306,7 +309,7 @@ def run_pex(name, gds_name, sp_name, output=None):
|
|||
out_errors = len(stdouterrors)
|
||||
|
||||
assert(os.path.isfile(output))
|
||||
correct_port(name, output, sp_name)
|
||||
correct_port(cell_name, output, sp_name)
|
||||
|
||||
return out_errors
|
||||
|
||||
|
|
@ -329,7 +332,7 @@ def correct_port(name, output_file_name, ref_file_name):
|
|||
part2 = pex_file.read()
|
||||
pex_file.close()
|
||||
|
||||
# obatin the correct definition line from the original spice file
|
||||
# obtain the correct definition line from the original spice file
|
||||
sp_file = open(ref_file_name, "r")
|
||||
contents = sp_file.read()
|
||||
circuit_title = re.search(".SUBCKT " + str(name) + ".*\n", contents)
|
||||
|
|
|
|||
|
|
@ -60,28 +60,28 @@ from globals import OPTS
|
|||
import subprocess
|
||||
|
||||
|
||||
def run_drc(name, gds_name):
|
||||
"""Run DRC check on a given top-level name which is
|
||||
implemented in gds_name."""
|
||||
|
||||
def run_drc(cell_name, gds_name):
|
||||
"""Run DRC check on a cell which is implemented in gds_name."""
|
||||
global OPTS
|
||||
|
||||
# the runset file contains all the options to run drc
|
||||
from tech import drc
|
||||
drc_rules = drc["drc_rules"]
|
||||
|
||||
top_cell_name = re.sub(r'\.gds$', "", gds_name)
|
||||
run_file = OPTS.openram_temp + "run_drc.sh"
|
||||
f = open(run_file, "w")
|
||||
f.write("#!/bin/sh\n")
|
||||
f.write("{} -dnull -noconsole << EOF\n".format(OPTS.drc_exe))
|
||||
f.write("{} -dnull -noconsole << EOF\n".format(OPTS.drc_exe[1]))
|
||||
f.write("tech load SCN3ME_SUBM.30\n")
|
||||
f.write("gds rescale false\n")
|
||||
f.write("gds polygon subcell true\n")
|
||||
f.write("gds warning default\n")
|
||||
f.write("gds read {}\n".format(gds_name))
|
||||
f.write("load {}\n".format(top_cell_name))
|
||||
f.write("load {}\n".format(cell_name))
|
||||
f.write("drc check\n")
|
||||
f.write("drc catchup\n")
|
||||
f.write("drc count total\n")
|
||||
f.write("drc count\n")
|
||||
f.write("drc why\n")
|
||||
f.write("quit -noprompt\n")
|
||||
f.write("EOF\n")
|
||||
|
||||
|
|
@ -91,8 +91,8 @@ def run_drc(name, gds_name):
|
|||
# run drc
|
||||
cwd = os.getcwd()
|
||||
os.chdir(OPTS.openram_temp)
|
||||
errfile = "{0}{1}.drc.err".format(OPTS.openram_temp, name)
|
||||
outfile = "{0}{1}.drc.out".format(OPTS.openram_temp, name)
|
||||
errfile = "{0}{1}.drc.err".format(OPTS.openram_temp, cell_name)
|
||||
outfile = "{0}{1}.drc.out".format(OPTS.openram_temp, cell_name)
|
||||
|
||||
cmd = "{0}run_drc.sh 2> {1} 1> {2}".format(OPTS.openram_temp,
|
||||
errfile,
|
||||
|
|
@ -101,36 +101,32 @@ def run_drc(name, gds_name):
|
|||
os.system(cmd)
|
||||
os.chdir(cwd)
|
||||
|
||||
debug.warning("DRC using magic not implemented.")
|
||||
return 1
|
||||
|
||||
# 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)
|
||||
# Check the result for these lines in the summary:
|
||||
# Total DRC errors found: 0
|
||||
# The count is shown in this format:
|
||||
# Cell replica_cell_6t has 3 error tiles.
|
||||
# Cell tri_gate_array has 8 error tiles.
|
||||
# etc.
|
||||
try:
|
||||
f = open(drc_runset['drcSummaryFile'], "r")
|
||||
f = open(outfile, "r")
|
||||
except:
|
||||
debug.error("Unable to retrieve DRC results file. Is magic set up?",1)
|
||||
results = f.readlines()
|
||||
f.close()
|
||||
# those lines should be the last 3
|
||||
results = results[-3:]
|
||||
geometries = int(re.split("\W+", results[0])[5])
|
||||
rulechecks = int(re.split("\W+", results[1])[4])
|
||||
errors = int(re.split("\W+", results[2])[5])
|
||||
for line in results:
|
||||
if "Total DRC errors found:" in line:
|
||||
errors = int(re.split(":\W+", line)[1])
|
||||
break
|
||||
|
||||
# always display this summary
|
||||
if errors > 0:
|
||||
debug.error("{0}\tGeometries: {1}\tChecks: {2}\tErrors: {3}".format(name,
|
||||
geometries,
|
||||
rulechecks,
|
||||
errors))
|
||||
for line in results:
|
||||
if "error tiles" in line:
|
||||
print line.rstrip("\n")
|
||||
debug.error("{0}\tErrors: {1}".format(cell_name, errors))
|
||||
else:
|
||||
debug.info(1, "{0}\tGeometries: {1}\tChecks: {2}\tErrors: {3}".format(name,
|
||||
geometries,
|
||||
rulechecks,
|
||||
errors))
|
||||
debug.info(1, "{0}\tErrors: {1}".format(cell_name, errors))
|
||||
|
||||
return errors
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue