2022-10-09 12:36:50 -05:00
|
|
|
#!/usr/local/bin/python
|
|
|
|
|
|
|
|
import argparse
|
|
|
|
from cmath import log
|
|
|
|
import logging
|
|
|
|
import os
|
|
|
|
import subprocess
|
2022-10-10 06:25:09 -05:00
|
|
|
from sys import stdout
|
2022-10-09 12:36:50 -05:00
|
|
|
import count_lvs
|
|
|
|
import glob
|
|
|
|
import run_pt_sta
|
|
|
|
|
|
|
|
|
|
|
|
def build_caravel(caravel_root, mcw_root, pdk_root, log_dir, pdk_env):
|
|
|
|
os.environ["CARAVEL_ROOT"] = caravel_root
|
|
|
|
os.environ["MCW_ROOT"] = mcw_root
|
|
|
|
os.environ["PDK_ROOT"] = pdk_root
|
|
|
|
os.environ["PDK"] = pdk_env
|
|
|
|
|
|
|
|
gpio_defaults_cmd = ["python3", f"scripts/gen_gpio_defaults.py"]
|
|
|
|
build_cmd = [
|
|
|
|
"magic",
|
|
|
|
"-noconsole",
|
|
|
|
"-dnull",
|
|
|
|
"-rcfile",
|
|
|
|
f"{pdk_root}/{pdk_env}/libs.tech/magic/{pdk_env}.magicrc",
|
|
|
|
"tech-files/build.tcl",
|
|
|
|
]
|
|
|
|
log_file_path = f"{log_dir}/build_caravel.log"
|
|
|
|
with open(log_file_path, "w") as build_log:
|
|
|
|
subprocess.run(
|
|
|
|
gpio_defaults_cmd, cwd=caravel_root, stderr=build_log, stdout=build_log
|
|
|
|
)
|
2022-10-09 13:11:42 -05:00
|
|
|
subprocess.run(build_cmd, stderr=build_log, stdout=build_log)
|
2022-10-09 12:36:50 -05:00
|
|
|
|
2022-10-10 06:25:09 -05:00
|
|
|
|
2022-10-12 11:07:12 -05:00
|
|
|
def run_drc(caravel_root, log_dir, signoff_dir, pdk_root, design):
|
2022-10-09 12:36:50 -05:00
|
|
|
klayout_drc_cmd = [
|
|
|
|
"python3",
|
|
|
|
"klayout_drc.py",
|
|
|
|
"-g",
|
2022-10-13 07:34:41 -05:00
|
|
|
f"{caravel_root}/gds/{design}.gds",
|
2022-10-09 12:36:50 -05:00
|
|
|
"-l",
|
|
|
|
f"{log_dir}",
|
|
|
|
"-s",
|
|
|
|
f"{signoff_dir}",
|
|
|
|
"-d",
|
2022-10-12 11:07:12 -05:00
|
|
|
f"{design}",
|
2022-10-09 12:36:50 -05:00
|
|
|
]
|
|
|
|
p1 = subprocess.Popen(klayout_drc_cmd)
|
|
|
|
return p1
|
|
|
|
|
|
|
|
|
2022-10-12 11:07:12 -05:00
|
|
|
def run_lvs(
|
|
|
|
caravel_root, mcw_root, log_dir, signoff_dir, pdk_root, lvs_root, pdk_env, design
|
|
|
|
):
|
2022-10-10 06:25:09 -05:00
|
|
|
myenv = os.environ.copy()
|
|
|
|
myenv["PDK_ROOT"] = pdk_root
|
|
|
|
myenv["PDK"] = pdk_env
|
|
|
|
myenv["LVS_ROOT"] = lvs_root
|
|
|
|
myenv["LOG_ROOT"] = log_dir
|
|
|
|
myenv["CARAVEL_ROOT"] = caravel_root
|
|
|
|
myenv["MCW_ROOT"] = mcw_root
|
2022-10-14 12:02:08 -05:00
|
|
|
myenv["SIGNOFF_ROOT"] = os.path.join(signoff_dir, f"{design}/standalone_pvr")
|
2022-10-11 05:22:01 -05:00
|
|
|
myenv["WORK_DIR"] = os.path.join(caravel_root, "extra_be_checks")
|
2022-10-09 12:36:50 -05:00
|
|
|
|
|
|
|
if not os.path.exists(f"{lvs_root}"):
|
|
|
|
subprocess.run(
|
|
|
|
[
|
|
|
|
"git",
|
|
|
|
"clone",
|
|
|
|
"https://github.com/d-m-bailey/extra_be_checks.git",
|
|
|
|
"-b",
|
2022-10-12 11:57:56 -05:00
|
|
|
f"caravel",
|
2022-10-09 12:36:50 -05:00
|
|
|
],
|
|
|
|
cwd=f"{caravel_root}/scripts",
|
|
|
|
stdout=subprocess.PIPE,
|
2022-10-11 05:22:01 -05:00
|
|
|
stderr=subprocess.PIPE,
|
2022-10-09 12:36:50 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
lvs_cmd = [
|
|
|
|
"bash",
|
2022-10-11 05:22:01 -05:00
|
|
|
"./run_full_lvs",
|
2022-10-12 11:07:12 -05:00
|
|
|
f"{design}",
|
|
|
|
f"{caravel_root}/verilog/gl/{design}.v",
|
|
|
|
f"{design}",
|
|
|
|
f"{caravel_root}/gds/{design}.gds",
|
2022-10-09 12:36:50 -05:00
|
|
|
]
|
2022-10-10 06:25:09 -05:00
|
|
|
p1 = subprocess.Popen(
|
|
|
|
lvs_cmd,
|
|
|
|
env=myenv,
|
2022-10-11 05:22:01 -05:00
|
|
|
cwd=f"{caravel_root}/scripts/extra_be_checks",
|
2022-10-10 06:25:09 -05:00
|
|
|
universal_newlines=True,
|
|
|
|
)
|
2022-10-09 12:36:50 -05:00
|
|
|
return p1
|
|
|
|
|
|
|
|
|
|
|
|
def run_verification(caravel_root, pdk_root, pdk_env, sim, simulator="vcs"):
|
2022-10-10 06:25:09 -05:00
|
|
|
myenv = os.environ.copy()
|
|
|
|
myenv["PDK_ROOT"] = pdk_root
|
|
|
|
myenv["PDK"] = pdk_env
|
2022-10-09 12:36:50 -05:00
|
|
|
if simulator == "vcs":
|
2022-10-11 05:22:01 -05:00
|
|
|
ver_cmd = [
|
2022-10-09 12:36:50 -05:00
|
|
|
"python3",
|
|
|
|
"verify_cocotb.py",
|
|
|
|
"-tag",
|
|
|
|
f"CI_{sim}",
|
|
|
|
"-r",
|
|
|
|
f"r_{sim}",
|
|
|
|
"-v",
|
|
|
|
]
|
|
|
|
else:
|
2022-10-11 05:22:01 -05:00
|
|
|
ver_cmd = [
|
2022-10-09 12:36:50 -05:00
|
|
|
"python3",
|
|
|
|
"verify_cocotb.py",
|
|
|
|
"-tag",
|
|
|
|
f"CI_{sim}",
|
|
|
|
"-r",
|
|
|
|
f"r_{sim}",
|
|
|
|
]
|
|
|
|
p1 = subprocess.Popen(
|
2022-10-11 05:22:01 -05:00
|
|
|
ver_cmd,
|
2022-10-09 12:36:50 -05:00
|
|
|
cwd=f"{caravel_root}/verilog/dv/cocotb",
|
2022-10-10 06:25:09 -05:00
|
|
|
env=myenv,
|
|
|
|
universal_newlines=True,
|
2022-10-09 12:36:50 -05:00
|
|
|
stdout=subprocess.PIPE,
|
|
|
|
stderr=subprocess.PIPE,
|
|
|
|
)
|
|
|
|
return p1
|
|
|
|
|
|
|
|
|
2022-10-12 11:07:12 -05:00
|
|
|
def run_sta(caravel_root, mcw_root, pt_lib_root, log_dir, signoff_dir, design):
|
2022-10-10 06:25:09 -05:00
|
|
|
myenv = os.environ.copy()
|
|
|
|
myenv["CARAVEL_ROOT"] = caravel_root
|
|
|
|
myenv["MCW_ROOT"] = mcw_root
|
|
|
|
myenv["PT_LIB_ROOT"] = pt_lib_root
|
2022-10-09 12:36:50 -05:00
|
|
|
if not os.path.exists(f"{pt_lib_root}"):
|
|
|
|
subprocess.run(
|
|
|
|
[
|
|
|
|
"git",
|
|
|
|
"clone",
|
|
|
|
"git@github.com:efabless/mpw-2-sta-debug.git",
|
|
|
|
],
|
|
|
|
cwd=f"{caravel_root}/scripts",
|
|
|
|
stdout=subprocess.PIPE,
|
|
|
|
)
|
2022-10-09 13:10:28 -05:00
|
|
|
sta_cmd = [
|
|
|
|
"python3",
|
|
|
|
"run_pt_sta.py",
|
|
|
|
"-a",
|
|
|
|
"-d",
|
2022-10-12 11:07:12 -05:00
|
|
|
f"{design}",
|
2022-10-09 13:10:28 -05:00
|
|
|
"-o",
|
2022-10-14 12:02:08 -05:00
|
|
|
f"{signoff_dir}/{design}/standalone_pvr",
|
2022-10-09 13:10:28 -05:00
|
|
|
"-l",
|
2022-10-10 06:25:09 -05:00
|
|
|
f"{log_dir}",
|
2022-10-09 13:10:28 -05:00
|
|
|
]
|
|
|
|
p1 = subprocess.Popen(
|
|
|
|
sta_cmd,
|
|
|
|
cwd=f"{caravel_root}/scripts",
|
2022-10-10 06:25:09 -05:00
|
|
|
env=myenv,
|
|
|
|
universal_newlines=True,
|
2022-10-09 13:10:28 -05:00
|
|
|
stdout=subprocess.PIPE,
|
|
|
|
stderr=subprocess.PIPE,
|
|
|
|
)
|
|
|
|
return p1
|
2022-10-09 12:36:50 -05:00
|
|
|
|
2022-10-13 10:18:36 -05:00
|
|
|
|
|
|
|
def run_antenna(
|
|
|
|
log_dir, design_root, design, pdk_root, pdk_env, caravel_root, mcw_root
|
|
|
|
):
|
2022-10-13 07:32:24 -05:00
|
|
|
os.environ["DESIGN_GDS_ROOT"] = design_root
|
|
|
|
os.environ["DESIGN"] = design
|
|
|
|
os.environ["LOG_DIR"] = log_dir
|
2022-10-13 10:13:03 -05:00
|
|
|
os.environ["CARAVEL_ROOT"] = caravel_root
|
|
|
|
os.environ["MCW_ROOT"] = mcw_root
|
2022-10-13 07:32:24 -05:00
|
|
|
antenna_cmd = [
|
|
|
|
"magic",
|
|
|
|
"-noconsole",
|
|
|
|
"-dnull",
|
|
|
|
"-rcfile",
|
|
|
|
f"{pdk_root}/{pdk_env}/libs.tech/magic/{pdk_env}.magicrc",
|
2022-10-13 10:13:03 -05:00
|
|
|
"tech-files/antenna_check.tcl",
|
2022-10-13 07:32:24 -05:00
|
|
|
]
|
|
|
|
p1 = subprocess.Popen(antenna_cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
|
|
|
|
return p1
|
2022-10-10 06:25:09 -05:00
|
|
|
|
2022-10-13 10:18:36 -05:00
|
|
|
|
|
|
|
def check_errors(
|
|
|
|
caravel_root, log_dir, signoff_dir, drc, lvs, verification, sta, design, antenna
|
|
|
|
):
|
|
|
|
f = open(os.path.join(signoff_dir, f"{design}/standalone_pvr.rpt"), "w")
|
2022-10-09 12:36:50 -05:00
|
|
|
if drc:
|
2022-10-12 11:07:12 -05:00
|
|
|
drc_count_klayout = os.path.join(log_dir, f"{design}_klayout_drc.total")
|
2022-10-09 12:36:50 -05:00
|
|
|
with open(drc_count_klayout) as rep:
|
2022-10-12 11:07:12 -05:00
|
|
|
if rep.readline().strip() != "0":
|
2022-10-09 12:36:50 -05:00
|
|
|
logging.error(f"klayout DRC failed")
|
2022-10-12 12:35:43 -05:00
|
|
|
f.write("Klayout MR DRC: Failed\n")
|
2022-10-09 12:36:50 -05:00
|
|
|
else:
|
|
|
|
logging.info("Klayout MR DRC: Passed")
|
2022-10-12 12:35:43 -05:00
|
|
|
f.write("Klayout MR DRC: Passed\n")
|
2022-10-09 12:36:50 -05:00
|
|
|
if lvs:
|
2022-10-12 11:07:12 -05:00
|
|
|
lvs_summary_report = open(
|
2022-10-14 12:02:08 -05:00
|
|
|
os.path.join(signoff_dir, f"{design}/standalone_pvr/lvs_summary.rpt"), "w"
|
2022-10-12 11:07:12 -05:00
|
|
|
)
|
2022-10-14 12:02:08 -05:00
|
|
|
lvs_report = os.path.join(signoff_dir, f"{design}/standalone_pvr/{design}.lvs.json")
|
2022-10-12 12:35:43 -05:00
|
|
|
failures = count_lvs.count_LVS_failures(lvs_report)
|
2022-10-09 12:36:50 -05:00
|
|
|
if failures[0] > 0:
|
|
|
|
lvs_summary_report.write("LVS reports:")
|
|
|
|
lvs_summary_report.write(" net count difference = " + str(failures[5]))
|
|
|
|
lvs_summary_report.write(
|
|
|
|
" device count difference = " + str(failures[6])
|
|
|
|
)
|
|
|
|
lvs_summary_report.write(" unmatched nets = " + str(failures[1]))
|
|
|
|
lvs_summary_report.write(" unmatched devices = " + str(failures[2]))
|
|
|
|
lvs_summary_report.write(" unmatched pins = " + str(failures[3]))
|
|
|
|
lvs_summary_report.write(" property failures = " + str(failures[4]))
|
2022-10-12 11:07:12 -05:00
|
|
|
logging.error(f"LVS on {design} failed")
|
2022-10-09 12:36:50 -05:00
|
|
|
logging.info(f"Find full report at {lvs_report}")
|
|
|
|
logging.info(f"Find summary report at {lvs_summary_report}")
|
2022-10-12 12:35:43 -05:00
|
|
|
f.write("Layout Vs Schematic: Failed\n")
|
2022-10-09 12:36:50 -05:00
|
|
|
else:
|
2022-10-12 12:35:43 -05:00
|
|
|
lvs_summary_report.write("Layout Vs Schematic Passed")
|
2022-10-09 12:36:50 -05:00
|
|
|
logging.info("Layout Vs Schematic: Passed")
|
2022-10-12 12:35:43 -05:00
|
|
|
f.write("Layout Vs Schematic: Passed\n")
|
2022-10-09 12:36:50 -05:00
|
|
|
|
|
|
|
if verification:
|
|
|
|
for sim in ["rtl", "gl", "sdf"]:
|
|
|
|
verification_report = os.path.join(
|
|
|
|
caravel_root, f"/verilog/dv/cocotb/sim/CI_{sim}/runs.log"
|
|
|
|
)
|
|
|
|
with open(verification_report) as rep:
|
|
|
|
if "(0)failed" in rep.read():
|
|
|
|
logging.info(f"{sim} simulations: Passed")
|
2022-10-12 12:35:43 -05:00
|
|
|
f.write(f"{sim} simulations: Passed\n")
|
2022-10-09 12:36:50 -05:00
|
|
|
else:
|
|
|
|
logging.error(
|
|
|
|
f"{sim} simulations failed, find report at {verification_report}"
|
|
|
|
)
|
2022-10-12 12:35:43 -05:00
|
|
|
f.write(f"{sim} simulations: Failed\n")
|
2022-10-09 12:36:50 -05:00
|
|
|
|
2022-10-12 11:07:12 -05:00
|
|
|
if sta:
|
|
|
|
sta_logs = glob.glob(f"{log_dir}/{design}/{design}-*sta.log")
|
|
|
|
for l in sta_logs:
|
|
|
|
with open(l) as rep:
|
|
|
|
log_name = l.split("/")[-1]
|
|
|
|
log_name = log_name.split(".")[0]
|
|
|
|
lines = rep.readlines()
|
|
|
|
if "Passed" in lines[-1]:
|
|
|
|
logging.info(f"{log_name} STA: Passed")
|
2022-10-12 12:35:43 -05:00
|
|
|
f.write(f"{log_name} STA: Passed\n")
|
2022-10-12 11:07:12 -05:00
|
|
|
else:
|
|
|
|
logging.error(lines[-1])
|
|
|
|
logging.error(f"{log_name} STA: Failed")
|
2022-10-12 12:35:43 -05:00
|
|
|
f.write(f"{log_name} STA: Failed\n")
|
2022-10-13 10:18:36 -05:00
|
|
|
|
2022-10-13 07:32:24 -05:00
|
|
|
if antenna:
|
2022-10-14 12:02:08 -05:00
|
|
|
antenna_report = os.path.join(signoff_dir, f"{design}/standalone_pvr/antenna-vios.report")
|
2022-10-13 07:32:24 -05:00
|
|
|
with open(antenna_report) as rep:
|
2022-10-13 10:18:36 -05:00
|
|
|
if "Antenna violation detected" in rep.read():
|
2022-10-13 07:32:24 -05:00
|
|
|
logging.error(f"Antenna checks failed find report at {antenna_report}")
|
|
|
|
f.write("Antenna checks: Failed\n")
|
|
|
|
else:
|
|
|
|
logging.info("Antenna checks: Passed")
|
|
|
|
f.write("Antenna checks: Passed\n")
|
2022-10-12 11:07:12 -05:00
|
|
|
|
2022-10-09 12:36:50 -05:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
logging.basicConfig(
|
|
|
|
level=logging.DEBUG,
|
|
|
|
format=f"%(asctime)s | %(levelname)-7s | %(message)s",
|
|
|
|
datefmt="%d-%b-%Y %H:%M:%S",
|
|
|
|
)
|
|
|
|
parser = argparse.ArgumentParser(description="CI wrapper")
|
|
|
|
parser.add_argument(
|
2022-10-12 11:07:12 -05:00
|
|
|
"-drc",
|
2022-10-09 12:36:50 -05:00
|
|
|
"--drc_check",
|
|
|
|
help="run drc check",
|
|
|
|
action="store_true",
|
|
|
|
)
|
|
|
|
parser.add_argument(
|
|
|
|
"-l",
|
|
|
|
"--lvs_check",
|
|
|
|
help="run lvs check",
|
|
|
|
action="store_true",
|
|
|
|
)
|
|
|
|
parser.add_argument(
|
|
|
|
"-v",
|
2022-10-13 07:32:24 -05:00
|
|
|
"--vcs",
|
|
|
|
help="run verification using vcs",
|
2022-10-09 12:36:50 -05:00
|
|
|
action="store_true",
|
|
|
|
)
|
|
|
|
parser.add_argument(
|
|
|
|
"-rtl",
|
|
|
|
"--rtl",
|
|
|
|
help="run rtl verification",
|
|
|
|
action="store_true",
|
|
|
|
)
|
|
|
|
parser.add_argument(
|
|
|
|
"-gl",
|
|
|
|
"--gl",
|
|
|
|
help="run gl verification",
|
|
|
|
action="store_true",
|
|
|
|
)
|
|
|
|
parser.add_argument(
|
|
|
|
"-sdf",
|
|
|
|
"--sdf",
|
|
|
|
help="run sdf verification",
|
|
|
|
action="store_true",
|
|
|
|
)
|
|
|
|
parser.add_argument(
|
|
|
|
"-iv",
|
|
|
|
"--iverilog",
|
|
|
|
help="run verification using iverilog",
|
|
|
|
action="store_true",
|
|
|
|
)
|
|
|
|
parser.add_argument(
|
|
|
|
"-sta",
|
|
|
|
"--primetime_sta",
|
|
|
|
help="run verification using iverilog",
|
|
|
|
action="store_true",
|
|
|
|
)
|
2022-10-13 07:32:24 -05:00
|
|
|
parser.add_argument(
|
|
|
|
"-ant",
|
|
|
|
"--antenna",
|
|
|
|
help="run antenna checks",
|
|
|
|
action="store_true",
|
|
|
|
)
|
2022-10-12 11:07:12 -05:00
|
|
|
parser.add_argument(
|
|
|
|
"-d",
|
|
|
|
"--design",
|
|
|
|
help="design under test",
|
|
|
|
required=True,
|
|
|
|
)
|
2022-10-09 12:36:50 -05:00
|
|
|
parser.add_argument(
|
|
|
|
"-a",
|
|
|
|
"--all",
|
|
|
|
help="run all checks",
|
|
|
|
action="store_true",
|
|
|
|
)
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
if not os.getenv("PDK_ROOT"):
|
|
|
|
logging.error("Please export PDK_ROOT")
|
|
|
|
exit(1)
|
|
|
|
if not os.getenv("PDK"):
|
|
|
|
logging.error("Please export PDK")
|
|
|
|
exit(1)
|
|
|
|
caravel_redesign_root = os.path.dirname(
|
|
|
|
os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
)
|
2022-10-12 03:07:02 -05:00
|
|
|
if os.getenv("CARAVEL_ROOT") == None:
|
|
|
|
caravel_root = os.path.join(caravel_redesign_root, "caravel")
|
2022-10-12 11:07:12 -05:00
|
|
|
logging.warning(f"CARAVEL_ROOT is not defined, defaulting to {caravel_root}")
|
2022-10-12 11:57:56 -05:00
|
|
|
else:
|
|
|
|
caravel_root = os.getenv("CARAVEL_ROOT")
|
2022-10-12 03:07:02 -05:00
|
|
|
|
|
|
|
if os.getenv("MCW_ROOT") == None:
|
|
|
|
mcw_root = os.path.join(caravel_redesign_root, "caravel_mgmt_soc_litex")
|
2022-10-12 11:07:12 -05:00
|
|
|
logging.warning(f"MCW_ROOT is not defined, defaulting to {mcw_root}")
|
2022-10-12 11:57:56 -05:00
|
|
|
else:
|
|
|
|
mcw_root = os.getenv("MCW_ROOT")
|
2022-10-12 03:07:02 -05:00
|
|
|
|
2022-10-12 11:40:55 -05:00
|
|
|
if not os.path.exists(f"{caravel_root}"):
|
|
|
|
logging.error(f"{caravel_root} does not exist!")
|
|
|
|
exit(1)
|
|
|
|
if not os.path.exists(f"{mcw_root}"):
|
|
|
|
logging.error(f"{mcw_root} does not exist!")
|
|
|
|
exit(1)
|
|
|
|
|
2022-10-09 12:36:50 -05:00
|
|
|
pdk_root = os.getenv("PDK_ROOT")
|
|
|
|
pdk_env = os.getenv("PDK")
|
|
|
|
log_dir = os.path.join(caravel_root, "scripts/logs")
|
|
|
|
signoff_dir = os.path.join(caravel_root, "signoff")
|
|
|
|
lvs_root = os.path.join(caravel_root, "scripts/extra_be_checks")
|
|
|
|
drc = args.drc_check
|
|
|
|
lvs = args.lvs_check
|
|
|
|
rtl = args.rtl
|
|
|
|
gl = args.gl
|
|
|
|
sdf = args.sdf
|
|
|
|
iverilog = args.iverilog
|
2022-10-13 07:38:16 -05:00
|
|
|
verification = args.vcs
|
2022-10-09 12:36:50 -05:00
|
|
|
sta = args.primetime_sta
|
2022-10-12 11:07:12 -05:00
|
|
|
design = args.design
|
2022-10-13 07:32:24 -05:00
|
|
|
antenna = args.antenna
|
2022-10-09 12:36:50 -05:00
|
|
|
|
|
|
|
if not os.path.exists(f"{log_dir}"):
|
|
|
|
os.makedirs(f"{log_dir}")
|
2022-10-12 11:07:12 -05:00
|
|
|
if not os.path.exists(f"{signoff_dir}/{design}"):
|
|
|
|
os.makedirs(f"{signoff_dir}/{design}")
|
2022-10-14 12:02:08 -05:00
|
|
|
if not os.path.exists(f"{signoff_dir}/{design}/standalone_pvr"):
|
|
|
|
os.makedirs(f"{signoff_dir}/{design}/standalone_pvr")
|
2022-10-09 12:36:50 -05:00
|
|
|
|
2022-10-13 07:38:16 -05:00
|
|
|
if lvs or drc or antenna:
|
2022-10-12 11:57:56 -05:00
|
|
|
if glob.glob(f"{caravel_root}/gds/*.gz"):
|
2022-10-13 10:18:36 -05:00
|
|
|
logging.error(
|
|
|
|
f"Compressed gds files in {caravel_root}. Please uncompress first."
|
|
|
|
)
|
2022-10-12 11:57:56 -05:00
|
|
|
exit(1)
|
2022-10-13 10:18:36 -05:00
|
|
|
|
2022-10-13 07:32:24 -05:00
|
|
|
if glob.glob(f"{mcw_root}/gds/*.gz"):
|
2022-10-13 10:18:36 -05:00
|
|
|
logging.error(
|
|
|
|
f"Compressed gds files in {mcw_root}. Please uncompress first."
|
|
|
|
)
|
2022-10-13 07:32:24 -05:00
|
|
|
exit(1)
|
2022-10-13 10:18:36 -05:00
|
|
|
|
2022-10-13 07:32:24 -05:00
|
|
|
design_root = os.path.join(caravel_root, f"gds/{design}.gds")
|
|
|
|
if not os.path.exists(design_root):
|
|
|
|
design_root = os.path.join(mcw_root, f"gds/{design}.gds")
|
|
|
|
if not os.path.exists(design_root):
|
|
|
|
logging.error(f"can't find {design}.gds file")
|
2022-10-12 11:57:56 -05:00
|
|
|
|
2022-10-12 11:07:12 -05:00
|
|
|
if design == "caravel":
|
|
|
|
logging.info("Building caravel...")
|
|
|
|
build_caravel(caravel_root, mcw_root, pdk_root, log_dir, pdk_env)
|
|
|
|
else:
|
|
|
|
logging.info(f"running checks on {design}")
|
2022-10-09 12:36:50 -05:00
|
|
|
|
|
|
|
if args.all:
|
|
|
|
drc = True
|
|
|
|
lvs = True
|
|
|
|
verification = True
|
2022-10-10 06:25:09 -05:00
|
|
|
sta = True
|
2022-10-09 12:36:50 -05:00
|
|
|
|
|
|
|
if drc:
|
2022-10-12 11:07:12 -05:00
|
|
|
drc_p1 = run_drc(caravel_root, log_dir, signoff_dir, pdk_root, design)
|
|
|
|
logging.info(f"Running klayout DRC on {design}")
|
2022-10-09 12:36:50 -05:00
|
|
|
if lvs:
|
|
|
|
lvs_p1 = run_lvs(
|
|
|
|
caravel_root,
|
|
|
|
mcw_root,
|
|
|
|
log_dir,
|
|
|
|
signoff_dir,
|
|
|
|
pdk_root,
|
|
|
|
lvs_root,
|
|
|
|
pdk_env,
|
2022-10-12 11:07:12 -05:00
|
|
|
design,
|
2022-10-09 12:36:50 -05:00
|
|
|
)
|
2022-10-12 11:07:12 -05:00
|
|
|
logging.info(f"Running LVS on {design}")
|
2022-10-10 06:25:09 -05:00
|
|
|
|
|
|
|
if sta:
|
2022-10-12 11:07:12 -05:00
|
|
|
logging.info(f"Running PrimeTime STA all corners on {design}")
|
2022-10-10 06:25:09 -05:00
|
|
|
sta_p = run_sta(
|
|
|
|
caravel_root,
|
|
|
|
mcw_root,
|
2022-10-11 05:22:01 -05:00
|
|
|
f"{caravel_root}/scripts/mpw-2-sta-debug/pt_libs",
|
2022-10-10 06:25:09 -05:00
|
|
|
log_dir,
|
|
|
|
signoff_dir,
|
2022-10-12 11:07:12 -05:00
|
|
|
design,
|
2022-10-10 06:25:09 -05:00
|
|
|
)
|
2022-10-13 10:18:36 -05:00
|
|
|
|
2022-10-13 07:32:24 -05:00
|
|
|
if antenna:
|
|
|
|
logging.info(f"Running antenna checks on {design}")
|
2022-10-13 10:18:36 -05:00
|
|
|
ant = run_antenna(
|
|
|
|
log_dir, design_root, design, pdk_root, pdk_env, caravel_root, mcw_root
|
|
|
|
)
|
2022-10-10 06:25:09 -05:00
|
|
|
|
2022-10-09 12:36:50 -05:00
|
|
|
if verification or iverilog:
|
|
|
|
verify_p = []
|
|
|
|
sim = []
|
|
|
|
if rtl:
|
|
|
|
sim.append("rtl")
|
|
|
|
if gl:
|
|
|
|
sim.append("gl")
|
|
|
|
if sdf:
|
|
|
|
sim.append("sdf")
|
|
|
|
if not rtl and not gl and not sdf:
|
|
|
|
sim = ["rtl", "gl", "sdf"]
|
|
|
|
if verification:
|
|
|
|
simulator = "vcs"
|
|
|
|
elif iverilog:
|
|
|
|
simulator = "iverilog"
|
2022-10-10 06:25:09 -05:00
|
|
|
for sim_type in sim:
|
|
|
|
logging.info(f"Running all {sim_type} verification on caravel")
|
2022-10-09 12:36:50 -05:00
|
|
|
verify_p.append(
|
2022-10-10 06:25:09 -05:00
|
|
|
run_verification(caravel_root, pdk_root, pdk_env, sim_type, simulator)
|
2022-10-09 12:36:50 -05:00
|
|
|
)
|
|
|
|
for i in range(len(verify_p)):
|
|
|
|
out, err = verify_p[i].communicate()
|
2022-10-10 06:25:09 -05:00
|
|
|
ver_log = open(f"{log_dir}/{sim[i]}_caravel.log", "w")
|
2022-10-09 12:36:50 -05:00
|
|
|
if err:
|
2022-10-14 12:02:08 -05:00
|
|
|
logging.error(err)
|
2022-10-10 06:25:09 -05:00
|
|
|
ver_log.write(err)
|
|
|
|
if out:
|
|
|
|
ver_log.write(out)
|
2022-10-09 12:36:50 -05:00
|
|
|
|
2022-10-09 13:10:28 -05:00
|
|
|
if lvs and drc and sta:
|
2022-10-10 06:25:09 -05:00
|
|
|
out, err = sta_p.communicate()
|
2022-10-12 11:07:12 -05:00
|
|
|
sta_log = open(f"{log_dir}/PT_STA_{design}.log", "w")
|
2022-10-10 06:25:09 -05:00
|
|
|
if err:
|
2022-10-14 12:02:08 -05:00
|
|
|
logging.error(err)
|
2022-10-10 06:25:09 -05:00
|
|
|
sta_log.write(err)
|
|
|
|
|
2022-10-09 12:36:50 -05:00
|
|
|
drc_p1.wait()
|
|
|
|
lvs_p1.wait()
|
|
|
|
if lvs:
|
|
|
|
lvs_p1.wait()
|
|
|
|
if drc:
|
|
|
|
drc_p1.wait()
|
2022-10-10 06:25:09 -05:00
|
|
|
if sta:
|
|
|
|
out, err = sta_p.communicate()
|
2022-10-12 11:07:12 -05:00
|
|
|
sta_log = open(f"{log_dir}/PT_STA_{design}.log", "w")
|
2022-10-10 06:25:09 -05:00
|
|
|
if err:
|
2022-10-12 16:07:36 -05:00
|
|
|
logging.error(err)
|
2022-10-10 06:25:09 -05:00
|
|
|
sta_log.write(err)
|
2022-10-13 10:18:36 -05:00
|
|
|
|
2022-10-13 07:32:24 -05:00
|
|
|
if antenna:
|
|
|
|
out, err = ant.communicate()
|
2022-10-14 12:02:08 -05:00
|
|
|
ant_rep = open(f"{signoff_dir}/{design}/standalone_pvr/antenna-vios.report", "w")
|
2022-10-13 07:32:24 -05:00
|
|
|
if err:
|
2022-10-13 10:13:03 -05:00
|
|
|
logging.error(err.decode())
|
|
|
|
ant_rep.write(err.decode())
|
2022-10-13 07:32:24 -05:00
|
|
|
if out:
|
2022-10-13 10:13:03 -05:00
|
|
|
ant_rep.write(out.decode())
|
2022-10-09 12:36:50 -05:00
|
|
|
|
2022-10-13 10:18:36 -05:00
|
|
|
check_errors(
|
|
|
|
caravel_root, log_dir, signoff_dir, drc, lvs, verification, sta, design, antenna
|
|
|
|
)
|