mirror of https://github.com/VLSIDA/OpenRAM.git
Output DRC and LVS run files to output directory.
This commit is contained in:
parent
66633a843b
commit
10542d6cc3
|
|
@ -6,6 +6,7 @@
|
|||
# All rights reserved.
|
||||
#
|
||||
import datetime
|
||||
import os
|
||||
import debug
|
||||
from globals import OPTS, print_time
|
||||
|
||||
|
|
@ -84,6 +85,12 @@ class sram():
|
|||
gdsname = OPTS.output_path + self.s.name + ".gds"
|
||||
debug.print_raw("GDS: Writing to {0}".format(gdsname))
|
||||
self.gds_write(gdsname)
|
||||
from verify import write_drc_script
|
||||
write_drc_script(cell_name=self.s.name,
|
||||
gds_name=os.path.basename(gdsname),
|
||||
extract=True,
|
||||
final_verification=True,
|
||||
output_path=OPTS.output_path)
|
||||
print_time("GDS", datetime.datetime.now(), start_time)
|
||||
|
||||
# Create a LEF physical model
|
||||
|
|
@ -105,6 +112,13 @@ class sram():
|
|||
lvsname = OPTS.output_path + self.s.name + ".lvs.sp"
|
||||
debug.print_raw("LVS: Writing to {0}".format(lvsname))
|
||||
self.lvs_write(lvsname)
|
||||
if not OPTS.netlist_only:
|
||||
from verify import write_lvs_script
|
||||
write_lvs_script(cell_name=self.s.name,
|
||||
gds_name=os.path.basename(gdsname),
|
||||
sp_name=os.path.basename(lvsname),
|
||||
final_verification=True,
|
||||
output_path=OPTS.output_path)
|
||||
print_time("LVS writing", datetime.datetime.now(), start_time)
|
||||
|
||||
# Save the extracted spice file
|
||||
|
|
@ -121,6 +135,8 @@ class sram():
|
|||
# Use generated spice file for characterization
|
||||
sp_file = spname
|
||||
|
||||
# Save a functional simulation file
|
||||
|
||||
# Characterize the design
|
||||
start_time = datetime.datetime.now()
|
||||
from characterizer import lib
|
||||
|
|
|
|||
|
|
@ -42,34 +42,34 @@ else:
|
|||
if not OPTS.drc_exe:
|
||||
from .none import run_drc, print_drc_stats
|
||||
elif "calibre"==OPTS.drc_exe[0]:
|
||||
from .calibre import run_drc, print_drc_stats
|
||||
from .calibre import run_drc, print_drc_stats, write_drc_script
|
||||
elif "assura"==OPTS.drc_exe[0]:
|
||||
from .assura import run_drc, print_drc_stats
|
||||
from .assura import run_drc, print_drc_stats, write_drc_script
|
||||
elif "magic"==OPTS.drc_exe[0]:
|
||||
from .magic import run_drc, print_drc_stats
|
||||
from .magic import run_drc, print_drc_stats, write_drc_script
|
||||
else:
|
||||
debug.error("Did not find a supported DRC tool."
|
||||
+ "Disable DRC/LVS with check_lvsdrc=False to ignore.", 2)
|
||||
|
||||
if not OPTS.lvs_exe:
|
||||
from .none import run_lvs, print_lvs_stats
|
||||
from .none import run_lvs, print_lvs_stats, write_lvs_script
|
||||
elif "calibre"==OPTS.lvs_exe[0]:
|
||||
from .calibre import run_lvs, print_lvs_stats
|
||||
from .calibre import run_lvs, print_lvs_stats, write_lvs_script
|
||||
elif "assura"==OPTS.lvs_exe[0]:
|
||||
from .assura import run_lvs, print_lvs_stats
|
||||
from .assura import run_lvs, print_lvs_stats, write_lvs_script
|
||||
elif "netgen"==OPTS.lvs_exe[0]:
|
||||
from .magic import run_lvs, print_lvs_stats
|
||||
from .magic import run_lvs, print_lvs_stats, write_lvs_script
|
||||
else:
|
||||
debug.warning("Did not find a supported LVS tool."
|
||||
+ "Disable DRC/LVS with check_lvsdrc=False to ignore.", 2)
|
||||
|
||||
|
||||
if not OPTS.pex_exe:
|
||||
from .none import run_pex,print_pex_stats
|
||||
from .none import run_pex, print_pex_stats
|
||||
elif "calibre"==OPTS.pex_exe[0]:
|
||||
from .calibre import run_pex,print_pex_stats
|
||||
from .calibre import run_pex, print_pex_stats
|
||||
elif "magic"==OPTS.pex_exe[0]:
|
||||
from .magic import run_pex,print_pex_stats
|
||||
from .magic import run_pex, print_pex_stats
|
||||
else:
|
||||
debug.warning("Did not find a supported PEX tool."
|
||||
+ "Disable DRC/LVS with check_lvsdrc=False to ignore.", 2)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ inserted in the runset.
|
|||
|
||||
import os
|
||||
import re
|
||||
import time
|
||||
from run_script import *
|
||||
import debug
|
||||
from globals import OPTS
|
||||
|
||||
|
|
@ -37,16 +37,11 @@ num_drc_runs = 0
|
|||
num_lvs_runs = 0
|
||||
num_pex_runs = 0
|
||||
|
||||
def run_drc(name, gds_name, final_verification=False):
|
||||
"""Run DRC check on a given top-level name which is
|
||||
implemented in gds_name."""
|
||||
|
||||
global num_drc_runs
|
||||
num_drc_runs += 1
|
||||
|
||||
def write_drc_script(cell_name, gds_name, extract, final_verification, output_path):
|
||||
from tech import drc
|
||||
drc_rules = drc["drc_rules"]
|
||||
drc_runset = OPTS.openram_temp + name + ".rsf"
|
||||
drc_runset = output_path + cell_name + ".rsf"
|
||||
drc_log_file = "{0}{1}.log".format(OPTS.openram_temp, name)
|
||||
|
||||
# write the runset file
|
||||
|
|
@ -64,8 +59,8 @@ def run_drc(name, gds_name, final_verification=False):
|
|||
f.write("\n")
|
||||
f.write("avParameters(\n")
|
||||
f.write(" ?inputLayout ( \"gds2\" \"{}\" )\n".format(gds_name))
|
||||
f.write(" ?cellName \"{}\"\n".format(name))
|
||||
f.write(" ?workingDirectory \"{}\"\n".format(OPTS.openram_temp))
|
||||
f.write(" ?cellName \"{}\"\n".format(cell_name))
|
||||
f.write(" ?workingDirectory \"{}\"\n".format(output_path))
|
||||
f.write(" ?rulesFile \"{}\"\n".format(drc_rules))
|
||||
f.write(" ?set ( \"GridCheck\" )\n")
|
||||
f.write(" ?avrpt t\n")
|
||||
|
|
@ -73,26 +68,37 @@ def run_drc(name, gds_name, final_verification=False):
|
|||
f.close()
|
||||
|
||||
# run drc
|
||||
cwd = os.getcwd()
|
||||
os.chdir(OPTS.openram_temp)
|
||||
cmd = "assura {0} 2> {1} 1> {2}".format(drc_runset, drc_log_file, drc_log_file)
|
||||
debug.info(1, cmd)
|
||||
os.system(cmd)
|
||||
os.chdir(cwd)
|
||||
run_file = output_path + "/run_drc.sh"
|
||||
f = open(run_file, "w")
|
||||
f.write("#!/bin/sh\n")
|
||||
f.write("assura {0} 2> {1} 1> {2}\n".format(drc_runset, drc_log_file, drc_log_file))
|
||||
f.close()
|
||||
|
||||
|
||||
def run_drc(name, gds_name, final_verification=False):
|
||||
"""Run DRC check on a given top-level name which is
|
||||
implemented in gds_name."""
|
||||
|
||||
global num_drc_runs
|
||||
num_drc_runs += 1
|
||||
|
||||
write_drc_script(name, gds_name, True, final_verification, OPTS.openram_temp)
|
||||
|
||||
(outfile, errfile, resultsfile) = run_script(name, "drc")
|
||||
|
||||
# count and report errors
|
||||
errors = 0
|
||||
try:
|
||||
f = open(OPTS.openram_temp+name+".err", "r")
|
||||
f = open(OPTS.openram_temp + name +".err", "r")
|
||||
except:
|
||||
debug.error("Unable to retrieve DRC results file.",1)
|
||||
debug.error("Unable to retrieve DRC results file.", 1)
|
||||
results = f.readlines()
|
||||
f.close()
|
||||
for line in results:
|
||||
if re.match("Rule No.", line):
|
||||
if re.search("# INFO:", line) == None:
|
||||
errors = errors + 1
|
||||
debug.info(1, line)
|
||||
errors = errors + 1
|
||||
debug.info(1, line)
|
||||
|
||||
if errors > 0:
|
||||
debug.error("Errors: {}".format(errors))
|
||||
|
|
@ -100,23 +106,18 @@ def run_drc(name, gds_name, final_verification=False):
|
|||
return errors
|
||||
|
||||
|
||||
def run_lvs(name, gds_name, sp_name, final_verification=False):
|
||||
"""Run LVS check on a given top-level name which is
|
||||
implemented in gds_name and sp_name. """
|
||||
|
||||
global num_lvs_runs
|
||||
num_lvs_runs += 1
|
||||
def write_lvs_script(cell_name, gds_name, sp_name, final_verification, output_path):
|
||||
|
||||
from tech import drc
|
||||
lvs_rules = drc["lvs_rules"]
|
||||
lvs_runset = OPTS.openram_temp + name + ".rsf"
|
||||
lvs_runset = output_path + name + ".rsf"
|
||||
# The LVS compare rules must be defined in the tech file for Assura.
|
||||
lvs_compare = drc["lvs_compare"]
|
||||
# Define the must-connect names for disconnected LVS nets for Assura
|
||||
lvs_bindings = drc["lvs_bindings"]
|
||||
lvs_log_file = "{0}{1}.log".format(OPTS.openram_temp, name)
|
||||
lvs_log_file = "{0}{1}.log".format(output_path, name)
|
||||
# Needed when FET models are sub-circuits
|
||||
if drc.has_key("lvs_subcircuits"):
|
||||
if "lvs_subcircuits" in drc:
|
||||
lvs_sub_file = drc["lvs_subcircuits"]
|
||||
else:
|
||||
lvs_sub_file = ""
|
||||
|
|
@ -128,7 +129,7 @@ def run_lvs(name, gds_name, sp_name, final_verification=False):
|
|||
f.write("avParameters(\n")
|
||||
f.write(" ?inputLayout ( \"gds2\" \"{}\" )\n".format(gds_name))
|
||||
f.write(" ?cellName \"{}\"\n".format(name))
|
||||
f.write(" ?workingDirectory \"{}\"\n".format(OPTS.openram_temp))
|
||||
f.write(" ?workingDirectory \"{}\"\n".format(output_path))
|
||||
f.write(" ?rulesFile \"{}\"\n".format(lvs_rules))
|
||||
f.write(" ?autoGrid nil\n")
|
||||
f.write(" ?avrpt t\n")
|
||||
|
|
@ -160,27 +161,38 @@ def run_lvs(name, gds_name, sp_name, final_verification=False):
|
|||
f.write("avLVS()\n")
|
||||
f.close()
|
||||
|
||||
# run lvs
|
||||
cwd = os.getcwd()
|
||||
os.chdir(OPTS.openram_temp)
|
||||
cmd = "assura {0} 2> {1} 1> {2}".format(lvs_runset, lvs_log_file, lvs_log_file)
|
||||
debug.info(1, cmd)
|
||||
os.system(cmd)
|
||||
os.chdir(cwd)
|
||||
# run drc
|
||||
run_file = output_path + "/run_vls.sh"
|
||||
f = open(run_file, "w")
|
||||
f.write("#!/bin/sh\n")
|
||||
f.write("assura {0} 2> {1} 1> {2}\n".format(lvs_runset, lvs_log_file, lvs_log_file))
|
||||
f.close()
|
||||
|
||||
|
||||
def run_lvs(name, gds_name, sp_name, final_verification=False):
|
||||
"""Run LVS check on a given top-level name which is
|
||||
implemented in gds_name and sp_name. """
|
||||
|
||||
global num_lvs_runs
|
||||
num_lvs_runs += 1
|
||||
|
||||
write_lvs_script(name, gds_name, sp_name, final_verification, OPTS.openram_temp)
|
||||
|
||||
(outfile, errfile, resultsfile) = run_script(name, "drc")
|
||||
|
||||
errors = 0
|
||||
try:
|
||||
f = open(OPTS.openram_temp+name+".csm", "r")
|
||||
f = open(OPTS.openram_temp + name + ".csm", "r")
|
||||
except:
|
||||
debug.error("Unable to retrieve LVS results file.",1)
|
||||
debug.error("Unable to retrieve LVS results file.", 1)
|
||||
results = f.readlines()
|
||||
f.close()
|
||||
for line in results:
|
||||
if re.search("errors", line):
|
||||
errors = errors + 1
|
||||
debug.info(1, line)
|
||||
errors = errors + 1
|
||||
debug.info(1, line)
|
||||
elif re.search("Schematic and Layout", line):
|
||||
debug.info(1, line)
|
||||
debug.info(1, line)
|
||||
|
||||
return errors
|
||||
|
||||
|
|
@ -188,14 +200,19 @@ def run_lvs(name, gds_name, sp_name, final_verification=False):
|
|||
def run_pex(name, gds_name, sp_name, output=None, final_verification=False):
|
||||
"""Run pex on a given top-level name which is
|
||||
implemented in gds_name and sp_name. """
|
||||
debug.error("PEX extraction not implemented with Assura.",-1)
|
||||
debug.error("PEX extraction not implemented with Assura.", -1)
|
||||
|
||||
global num_pex_runs
|
||||
num_pex_runs += 1
|
||||
|
||||
|
||||
def print_drc_stats():
|
||||
debug.info(1,"DRC runs: {0}".format(num_drc_runs))
|
||||
debug.info(1, "DRC runs: {0}".format(num_drc_runs))
|
||||
|
||||
|
||||
def print_lvs_stats():
|
||||
debug.info(1,"LVS runs: {0}".format(num_lvs_runs))
|
||||
debug.info(1, "LVS runs: {0}".format(num_lvs_runs))
|
||||
|
||||
|
||||
def print_pex_stats():
|
||||
debug.info(1,"PEX runs: {0}".format(num_pex_runs))
|
||||
debug.info(1, "PEX runs: {0}".format(num_pex_runs))
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ num_lvs_runs = 0
|
|||
num_pex_runs = 0
|
||||
|
||||
|
||||
def write_calibre_drc_script(cell_name, extract, final_verification, gds_name):
|
||||
def write_drc_script(cell_name, gds_name, extract, final_verification, output_path):
|
||||
""" Write a Calibre runset file and script to run DRC """
|
||||
# the runset file contains all the options to run calibre
|
||||
from tech import drc
|
||||
|
|
@ -38,7 +38,7 @@ def write_calibre_drc_script(cell_name, extract, final_verification, gds_name):
|
|||
|
||||
drc_runset = {
|
||||
'drcRulesFile': drc_rules,
|
||||
'drcRunDir': OPTS.openram_temp,
|
||||
'drcRunDir': output_path,
|
||||
'drcLayoutPaths': gds_name,
|
||||
'drcLayoutPrimary': cell_name,
|
||||
'drcLayoutSystem': 'GDSII',
|
||||
|
|
@ -50,17 +50,17 @@ def write_calibre_drc_script(cell_name, extract, final_verification, gds_name):
|
|||
}
|
||||
|
||||
# write the runset file
|
||||
f = open(OPTS.openram_temp + "drc_runset", "w")
|
||||
f = open(output_path + "drc_runset", "w")
|
||||
for k in sorted(iter(drc_runset.keys())):
|
||||
f.write("*{0}: {1}\n".format(k, drc_runset[k]))
|
||||
f.close()
|
||||
|
||||
# Create an auxiliary script to run calibre with the runset
|
||||
run_file = OPTS.openram_temp + "run_drc.sh"
|
||||
run_file = output_path + "run_drc.sh"
|
||||
f = open(run_file, "w")
|
||||
f.write("#!/bin/sh\n")
|
||||
cmd = "{0} -gui -drc {1}drc_runset -batch".format(OPTS.drc_exe[1],
|
||||
OPTS.openram_temp)
|
||||
output_path)
|
||||
f.write(cmd)
|
||||
f.write("\n")
|
||||
f.close()
|
||||
|
|
@ -68,14 +68,14 @@ def write_calibre_drc_script(cell_name, extract, final_verification, gds_name):
|
|||
return drc_runset
|
||||
|
||||
|
||||
def write_calibre_lvs_script(cell_name, final_verification, gds_name, sp_name):
|
||||
def write_lvs_script(cell_name, gds_name, sp_name, final_verification, output_path):
|
||||
""" Write a Calibre runset file and script to run LVS """
|
||||
|
||||
from tech import drc
|
||||
lvs_rules = drc["lvs_rules"]
|
||||
lvs_runset = {
|
||||
'lvsRulesFile': lvs_rules,
|
||||
'lvsRunDir': OPTS.openram_temp,
|
||||
'lvsRunDir': output_path,
|
||||
'lvsLayoutPaths': gds_name,
|
||||
'lvsLayoutPrimary': cell_name,
|
||||
'lvsSourcePath': sp_name,
|
||||
|
|
@ -111,19 +111,19 @@ def write_calibre_lvs_script(cell_name, final_verification, gds_name, sp_name):
|
|||
|
||||
|
||||
# write the runset file
|
||||
f = open(OPTS.openram_temp + "lvs_runset", "w")
|
||||
f = open(output_path + "lvs_runset", "w")
|
||||
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
|
||||
run_file = OPTS.openram_temp + "run_lvs.sh"
|
||||
run_file = output_path + "run_lvs.sh"
|
||||
f = open(run_file, "w")
|
||||
f.write("#!/bin/sh\n")
|
||||
PDK_DIR=os.environ.get("PDK_DIR")
|
||||
f.write("export PDK_DIR={}\n".format(PDK_DIR))
|
||||
cmd = "{0} -gui -lvs {1}lvs_runset -batch".format(OPTS.lvs_exe[1],
|
||||
OPTS.openram_temp)
|
||||
output_path)
|
||||
f.write(cmd)
|
||||
f.write("\n")
|
||||
f.close()
|
||||
|
|
@ -132,16 +132,16 @@ def write_calibre_lvs_script(cell_name, final_verification, gds_name, sp_name):
|
|||
return lvs_runset
|
||||
|
||||
|
||||
def write_calibre_pex_script(cell_name, extract, output, final_verification):
|
||||
def write_pex_script(cell_name, extract, output, final_verification, output_path):
|
||||
""" Write a pex script that can either just extract the netlist or the netlist+parasitics """
|
||||
if output == None:
|
||||
output = cell_name + ".pex.sp"
|
||||
|
||||
# check if lvs report has been done
|
||||
# if not run drc and lvs
|
||||
if not os.path.isfile(OPTS.openram_temp + cell_name + ".lvs.report"):
|
||||
gds_name = OPTS.openram_temp +"/"+ cell_name + ".gds"
|
||||
sp_name = OPTS.openram_temp +"/"+ cell_name + ".sp"
|
||||
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"
|
||||
run_drc(cell_name, gds_name)
|
||||
run_lvs(cell_name, gds_name, sp_name)
|
||||
|
||||
|
|
@ -149,7 +149,7 @@ def write_calibre_pex_script(cell_name, extract, output, final_verification):
|
|||
pex_rules = drc["xrc_rules"]
|
||||
pex_runset = {
|
||||
'pexRulesFile': pex_rules,
|
||||
'pexRunDir': OPTS.openram_temp,
|
||||
'pexRunDir': output_path,
|
||||
'pexLayoutPaths': cell_name + ".gds",
|
||||
'pexLayoutPrimary': cell_name,
|
||||
'pexSourcePath': cell_name + ".sp",
|
||||
|
|
@ -162,13 +162,13 @@ def write_calibre_pex_script(cell_name, extract, output, final_verification):
|
|||
}
|
||||
|
||||
# write the runset file
|
||||
f = open(OPTS.openram_temp + "pex_runset", "w")
|
||||
f = open(output_path + "pex_runset", "w")
|
||||
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
|
||||
run_file = OPTS.openram_temp + "run_pex.sh"
|
||||
run_file = output_path + "run_pex.sh"
|
||||
f = open(run_file, "w")
|
||||
f.write("#!/bin/sh\n")
|
||||
cmd = "{0} -gui -pex {1}pex_runset -batch".format(OPTS.pex_exe[1],
|
||||
|
|
@ -198,7 +198,7 @@ def run_drc(cell_name, gds_name, extract=False, final_verification=False):
|
|||
if not os.path.isfile(OPTS.openram_temp + os.path.basename(gds_name)):
|
||||
shutil.copy(gds_name, OPTS.openram_temp)
|
||||
|
||||
drc_runset = write_calibre_drc_script(cell_name, extract, final_verification, gds_name)
|
||||
drc_runset = write_drc_script(cell_name, gds_name, extract, final_verification, OPTS.openram_temp)
|
||||
|
||||
if not os.path.isfile(OPTS.openram_temp + os.path.basename(gds_name)):
|
||||
shutil.copy(gds_name, OPTS.openram_temp + os.path.basename(gds_name))
|
||||
|
|
@ -212,7 +212,7 @@ def run_drc(cell_name, gds_name, extract=False, final_verification=False):
|
|||
try:
|
||||
f = open(OPTS.openram_temp + drc_runset['drcSummaryFile'], "r")
|
||||
except:
|
||||
debug.error("Unable to retrieve DRC results file. Is calibre set up?",1)
|
||||
debug.error("Unable to retrieve DRC results file. Is calibre set up?", 1)
|
||||
results = f.readlines()
|
||||
f.close()
|
||||
# those lines should be the last 3
|
||||
|
|
@ -241,7 +241,7 @@ def run_lvs(cell_name, gds_name, sp_name, final_verification=False):
|
|||
global num_lvs_runs
|
||||
num_lvs_runs += 1
|
||||
|
||||
lvs_runset = write_calibre_lvs_script(cell_name, final_verification, gds_name, sp_name)
|
||||
lvs_runset = write_lvs_script(cell_name, gds_name, sp_name, final_verification, OPTS.openram_temp)
|
||||
|
||||
# Copy file to local dir if it isn't already
|
||||
if not os.path.isfile(OPTS.openram_temp + os.path.basename(gds_name)):
|
||||
|
|
@ -328,7 +328,7 @@ def run_pex(cell_name, gds_name, sp_name, output=None, final_verification=False)
|
|||
global num_pex_runs
|
||||
num_pex_runs += 1
|
||||
|
||||
write_calibre_pex_script(cell_name, True, output, final_verification)
|
||||
write_pex_script(cell_name, True, output, final_verification, OPTS.openram_temp)
|
||||
|
||||
# Copy file to local dir if it isn't already
|
||||
if not os.path.isfile(OPTS.openram_temp + os.path.basename(gds_name)):
|
||||
|
|
@ -390,9 +390,14 @@ def correct_port(name, output_file_name, ref_file_name):
|
|||
output_file.write(part2)
|
||||
output_file.close()
|
||||
|
||||
|
||||
def print_drc_stats():
|
||||
debug.info(1,"DRC runs: {0}".format(num_drc_runs))
|
||||
debug.info(1, "DRC runs: {0}".format(num_drc_runs))
|
||||
|
||||
|
||||
def print_lvs_stats():
|
||||
debug.info(1,"LVS runs: {0}".format(num_lvs_runs))
|
||||
debug.info(1, "LVS runs: {0}".format(num_lvs_runs))
|
||||
|
||||
|
||||
def print_pex_stats():
|
||||
debug.info(1,"PEX runs: {0}".format(num_pex_runs))
|
||||
debug.info(1, "PEX runs: {0}".format(num_pex_runs))
|
||||
|
|
|
|||
|
|
@ -66,12 +66,19 @@ def filter_gds(cell_name, input_gds, output_gds):
|
|||
(outfile, errfile, resultsfile) = run_script(cell_name, "filter")
|
||||
|
||||
|
||||
def write_magic_script(cell_name, extract=False, final_verification=False):
|
||||
def write_drc_script(cell_name, gds_name, extract, final_verification, output_path):
|
||||
""" Write a magic script to perform DRC and optionally extraction. """
|
||||
|
||||
global OPTS
|
||||
|
||||
run_file = OPTS.openram_temp + "run_drc.sh"
|
||||
# Copy .magicrc file into the directory
|
||||
magic_file = OPTS.openram_tech + "tech/.magicrc"
|
||||
if os.path.exists(magic_file):
|
||||
shutil.copy(magic_file, output_path)
|
||||
else:
|
||||
debug.warning("Could not locate .magicrc file: {}".format(magic_file))
|
||||
|
||||
run_file = output_path + "run_drc.sh"
|
||||
f = open(run_file, "w")
|
||||
f.write("#!/bin/sh\n")
|
||||
f.write("{} -dnull -noconsole << EOF\n".format(OPTS.drc_exe[1]))
|
||||
|
|
@ -79,7 +86,7 @@ def write_magic_script(cell_name, extract=False, final_verification=False):
|
|||
f.write("gds warning default\n")
|
||||
f.write("gds flatten true\n")
|
||||
f.write("gds readonly true\n")
|
||||
f.write("gds read {}.gds\n".format(cell_name))
|
||||
f.write("gds read {}\n".format(gds_name))
|
||||
f.write("load {}\n".format(cell_name))
|
||||
# Flatten the cell to get rid of DRCs spanning multiple layers
|
||||
# (e.g. with routes)
|
||||
|
|
@ -131,32 +138,6 @@ def write_magic_script(cell_name, extract=False, final_verification=False):
|
|||
os.system("chmod u+x {}".format(run_file))
|
||||
|
||||
|
||||
def write_netgen_script(cell_name):
|
||||
""" Write a netgen script to perform LVS. """
|
||||
|
||||
global OPTS
|
||||
|
||||
setup_file = "setup.tcl"
|
||||
full_setup_file = OPTS.openram_tech + "tech/" + setup_file
|
||||
if os.path.exists(full_setup_file):
|
||||
# Copy setup.tcl file into temp dir
|
||||
shutil.copy(full_setup_file, OPTS.openram_temp)
|
||||
else:
|
||||
setup_file = 'nosetup'
|
||||
|
||||
run_file = OPTS.openram_temp + "run_lvs.sh"
|
||||
f = open(run_file, "w")
|
||||
f.write("#!/bin/sh\n")
|
||||
f.write("{} -noconsole << EOF\n".format(OPTS.lvs_exe[1]))
|
||||
f.write("readnet spice {0}.spice\n".format(cell_name))
|
||||
f.write("readnet spice {0}.sp\n".format(cell_name))
|
||||
f.write("lvs {{{0}.spice {0}}} {{{0}.sp {0}}} {1} {0}.lvs.report -json\n".format(cell_name, setup_file))
|
||||
f.write("quit\n")
|
||||
f.write("EOF\n")
|
||||
f.close()
|
||||
os.system("chmod u+x {}".format(run_file))
|
||||
|
||||
|
||||
def run_drc(cell_name, gds_name, extract=True, final_verification=False):
|
||||
"""Run DRC check on a cell which is implemented in gds_name."""
|
||||
|
||||
|
|
@ -167,14 +148,7 @@ def run_drc(cell_name, gds_name, extract=True, final_verification=False):
|
|||
if os.path.dirname(gds_name)!=OPTS.openram_temp.rstrip('/'):
|
||||
shutil.copy(gds_name, OPTS.openram_temp)
|
||||
|
||||
# Copy .magicrc file into temp dir
|
||||
magic_file = OPTS.openram_tech + "tech/.magicrc"
|
||||
if os.path.exists(magic_file):
|
||||
shutil.copy(magic_file, OPTS.openram_temp)
|
||||
else:
|
||||
debug.warning("Could not locate .magicrc file: {}".format(magic_file))
|
||||
|
||||
write_magic_script(cell_name, extract, final_verification)
|
||||
write_drc_script(cell_name, gds_name, extract, final_verification, OPTS.openram_temp)
|
||||
|
||||
(outfile, errfile, resultsfile) = run_script(cell_name, "drc")
|
||||
|
||||
|
|
@ -214,6 +188,32 @@ def run_drc(cell_name, gds_name, extract=True, final_verification=False):
|
|||
return errors
|
||||
|
||||
|
||||
def write_lvs_script(cell_name, gds_name, sp_name, final_verification, output_path):
|
||||
""" Write a netgen script to perform LVS. """
|
||||
|
||||
global OPTS
|
||||
|
||||
setup_file = "setup.tcl"
|
||||
full_setup_file = OPTS.openram_tech + "tech/" + setup_file
|
||||
if os.path.exists(full_setup_file):
|
||||
# Copy setup.tcl file into temp dir
|
||||
shutil.copy(full_setup_file, output_path)
|
||||
else:
|
||||
setup_file = 'nosetup'
|
||||
|
||||
run_file = output_path + "/run_lvs.sh"
|
||||
f = open(run_file, "w")
|
||||
f.write("#!/bin/sh\n")
|
||||
f.write("{} -noconsole << EOF\n".format(OPTS.lvs_exe[1]))
|
||||
# f.write("readnet spice {0}.spice\n".format(cell_name))
|
||||
# f.write("readnet spice {0}\n".format(sp_name))
|
||||
f.write("lvs {{{0}.spice {0}}} {{{1} {0}}} {2} {0}.lvs.report -json\n".format(cell_name, sp_name, setup_file))
|
||||
f.write("quit\n")
|
||||
f.write("EOF\n")
|
||||
f.close()
|
||||
os.system("chmod u+x {}".format(run_file))
|
||||
|
||||
|
||||
def run_lvs(cell_name, gds_name, sp_name, final_verification=False):
|
||||
"""Run LVS check on a given top-level name which is
|
||||
implemented in gds_name and sp_name. Final verification will
|
||||
|
|
@ -228,7 +228,7 @@ def run_lvs(cell_name, gds_name, sp_name, final_verification=False):
|
|||
if os.path.dirname(sp_name)!=OPTS.openram_temp.rstrip('/'):
|
||||
shutil.copy(sp_name, OPTS.openram_temp)
|
||||
|
||||
write_netgen_script(cell_name)
|
||||
write_lvs_script(cell_name, gds_name, sp_name, final_verification, OPTS.openram_temp)
|
||||
|
||||
(outfile, errfile, resultsfile) = run_script(cell_name, "lvs")
|
||||
|
||||
|
|
@ -238,7 +238,7 @@ def run_lvs(cell_name, gds_name, sp_name, final_verification=False):
|
|||
try:
|
||||
f = open(resultsfile, "r")
|
||||
except FileNotFoundError:
|
||||
debug.error("Unable to load LVS results from {}".format(resultsfile),1)
|
||||
debug.error("Unable to load LVS results from {}".format(resultsfile), 1)
|
||||
|
||||
results = f.readlines()
|
||||
f.close()
|
||||
|
|
@ -249,7 +249,7 @@ def run_lvs(cell_name, gds_name, sp_name, final_verification=False):
|
|||
if "Subcircuit summary:" in line:
|
||||
break
|
||||
else:
|
||||
final_results.insert(0,line)
|
||||
final_results.insert(0, line)
|
||||
|
||||
# There were property errors in any module.
|
||||
test = re.compile("Property errors were found.")
|
||||
|
|
|
|||
|
|
@ -17,6 +17,10 @@ lvs_warned = False
|
|||
pex_warned = False
|
||||
|
||||
|
||||
def write_drc_script(cell_name, gds_name, extract, final_verification, output_path):
|
||||
pass
|
||||
|
||||
|
||||
def run_drc(cell_name, gds_name, extract=False, final_verification=False):
|
||||
global drc_warned
|
||||
if not drc_warned:
|
||||
|
|
@ -26,6 +30,10 @@ def run_drc(cell_name, gds_name, extract=False, final_verification=False):
|
|||
return 1
|
||||
|
||||
|
||||
def write_lvs_script(cell_name, gds_name, sp_name, final_verification, output_path):
|
||||
pass
|
||||
|
||||
|
||||
def run_lvs(cell_name, gds_name, sp_name, final_verification=False):
|
||||
global lvs_warned
|
||||
if not lvs_warned:
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import os
|
|||
import debug
|
||||
from globals import OPTS
|
||||
|
||||
|
||||
def run_script(cell_name, script="lvs"):
|
||||
""" Run script and create output files. """
|
||||
|
||||
|
|
@ -30,5 +31,5 @@ def run_script(cell_name, script="lvs"):
|
|||
os.system(cmd)
|
||||
os.chdir(cwd)
|
||||
|
||||
return (outfile,errfile,resultsfile)
|
||||
return (outfile, errfile, resultsfile)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue