mirror of https://github.com/efabless/caravel.git
Merge branch 'caravel_redesign' of github.com:efabless/caravel into caravel_redesign
This commit is contained in:
commit
11620eb224
|
@ -5,6 +5,7 @@ from cmath import log
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
from sys import stdout
|
||||||
import count_lvs
|
import count_lvs
|
||||||
import glob
|
import glob
|
||||||
import run_pt_sta
|
import run_pt_sta
|
||||||
|
@ -36,6 +37,7 @@ def build_caravel(caravel_root, mcw_root, pdk_root, log_dir, pdk_env):
|
||||||
)
|
)
|
||||||
subprocess.run(build_cmd, stderr=build_log, stdout=build_log)
|
subprocess.run(build_cmd, stderr=build_log, stdout=build_log)
|
||||||
|
|
||||||
|
|
||||||
def run_drc(caravel_root, log_dir, signoff_dir, pdk_root):
|
def run_drc(caravel_root, log_dir, signoff_dir, pdk_root):
|
||||||
klayout_drc_cmd = [
|
klayout_drc_cmd = [
|
||||||
"python3",
|
"python3",
|
||||||
|
@ -54,13 +56,14 @@ def run_drc(caravel_root, log_dir, signoff_dir, pdk_root):
|
||||||
|
|
||||||
|
|
||||||
def run_lvs(caravel_root, mcw_root, log_dir, signoff_dir, pdk_root, lvs_root, pdk_env):
|
def run_lvs(caravel_root, mcw_root, log_dir, signoff_dir, pdk_root, lvs_root, pdk_env):
|
||||||
os.environ["PDK_ROOT"] = pdk_root
|
myenv = os.environ.copy()
|
||||||
os.environ["PDK"] = pdk_env
|
myenv["PDK_ROOT"] = pdk_root
|
||||||
os.environ["LVS_ROOT"] = lvs_root
|
myenv["PDK"] = pdk_env
|
||||||
os.environ["LOG_ROOT"] = log_dir
|
myenv["LVS_ROOT"] = lvs_root
|
||||||
os.environ["CARAVEL_ROOT"] = caravel_root
|
myenv["LOG_ROOT"] = log_dir
|
||||||
os.environ["MCW_ROOT"] = mcw_root
|
myenv["CARAVEL_ROOT"] = caravel_root
|
||||||
os.environ["SIGNOFF_ROOT"] = os.path.join(signoff_dir, "caravel")
|
myenv["MCW_ROOT"] = mcw_root
|
||||||
|
myenv["SIGNOFF_ROOT"] = os.path.join(signoff_dir, "caravel")
|
||||||
|
|
||||||
if not os.path.exists(f"{lvs_root}"):
|
if not os.path.exists(f"{lvs_root}"):
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
|
@ -83,13 +86,20 @@ def run_lvs(caravel_root, mcw_root, log_dir, signoff_dir, pdk_root, lvs_root, pd
|
||||||
"caravel",
|
"caravel",
|
||||||
f"{caravel_root}/gds/caravel.gds",
|
f"{caravel_root}/gds/caravel.gds",
|
||||||
]
|
]
|
||||||
p1 = subprocess.Popen(lvs_cmd)
|
p1 = subprocess.Popen(
|
||||||
|
lvs_cmd,
|
||||||
|
env=myenv,
|
||||||
|
universal_newlines=True,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE,
|
||||||
|
)
|
||||||
return p1
|
return p1
|
||||||
|
|
||||||
|
|
||||||
def run_verification(caravel_root, pdk_root, pdk_env, sim, simulator="vcs"):
|
def run_verification(caravel_root, pdk_root, pdk_env, sim, simulator="vcs"):
|
||||||
os.environ["PDK_ROOT"] = pdk_root
|
myenv = os.environ.copy()
|
||||||
os.environ["PDK"] = pdk_env
|
myenv["PDK_ROOT"] = pdk_root
|
||||||
|
myenv["PDK"] = pdk_env
|
||||||
if simulator == "vcs":
|
if simulator == "vcs":
|
||||||
lvs_cmd = [
|
lvs_cmd = [
|
||||||
"python3",
|
"python3",
|
||||||
|
@ -112,6 +122,8 @@ def run_verification(caravel_root, pdk_root, pdk_env, sim, simulator="vcs"):
|
||||||
p1 = subprocess.Popen(
|
p1 = subprocess.Popen(
|
||||||
lvs_cmd,
|
lvs_cmd,
|
||||||
cwd=f"{caravel_root}/verilog/dv/cocotb",
|
cwd=f"{caravel_root}/verilog/dv/cocotb",
|
||||||
|
env=myenv,
|
||||||
|
universal_newlines=True,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
)
|
)
|
||||||
|
@ -119,9 +131,10 @@ def run_verification(caravel_root, pdk_root, pdk_env, sim, simulator="vcs"):
|
||||||
|
|
||||||
|
|
||||||
def run_sta(caravel_root, mcw_root, pt_lib_root, log_dir, signoff_dir):
|
def run_sta(caravel_root, mcw_root, pt_lib_root, log_dir, signoff_dir):
|
||||||
os.environ["CARAVEL_ROOT"] = caravel_root
|
myenv = os.environ.copy()
|
||||||
os.environ["MCW_ROOT"] = mcw_root
|
myenv["CARAVEL_ROOT"] = caravel_root
|
||||||
os.environ["PT_LIB_ROOT"] = pt_lib_root
|
myenv["MCW_ROOT"] = mcw_root
|
||||||
|
myenv["PT_LIB_ROOT"] = pt_lib_root
|
||||||
if not os.path.exists(f"{pt_lib_root}"):
|
if not os.path.exists(f"{pt_lib_root}"):
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
[
|
[
|
||||||
|
@ -141,23 +154,24 @@ def run_sta(caravel_root, mcw_root, pt_lib_root, log_dir, signoff_dir):
|
||||||
"-o",
|
"-o",
|
||||||
f"{signoff_dir}/caravel",
|
f"{signoff_dir}/caravel",
|
||||||
"-l",
|
"-l",
|
||||||
f"{log_dir}"
|
f"{log_dir}",
|
||||||
]
|
]
|
||||||
p1 = subprocess.Popen(
|
p1 = subprocess.Popen(
|
||||||
sta_cmd,
|
sta_cmd,
|
||||||
cwd=f"{caravel_root}/scripts",
|
cwd=f"{caravel_root}/scripts",
|
||||||
|
env=myenv,
|
||||||
|
universal_newlines=True,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
)
|
)
|
||||||
return p1
|
return p1
|
||||||
|
|
||||||
|
|
||||||
def check_errors(caravel_root, log_dir, signoff_dir, drc, lvs, verification):
|
def check_errors(caravel_root, log_dir, signoff_dir, drc, lvs, verification):
|
||||||
drc_count_klayout = os.path.join(log_dir, "caravel_klayout_drc.total")
|
|
||||||
lvs_report = os.path.join(signoff_dir, "caravel/caravel.lvs.rpt")
|
|
||||||
lvs_summary_report = open(os.path.join(signoff_dir, "caravel/lvs_summary.rpt"))
|
|
||||||
f = open(os.path.join(signoff_dir, "caravel/signoff.rpt"))
|
f = open(os.path.join(signoff_dir, "caravel/signoff.rpt"))
|
||||||
count = 0
|
count = 0
|
||||||
if drc:
|
if drc:
|
||||||
|
drc_count_klayout = os.path.join(log_dir, "caravel_klayout_drc.total")
|
||||||
with open(drc_count_klayout) as rep:
|
with open(drc_count_klayout) as rep:
|
||||||
if rep.readline() != 0:
|
if rep.readline() != 0:
|
||||||
logging.error(f"klayout DRC failed")
|
logging.error(f"klayout DRC failed")
|
||||||
|
@ -167,6 +181,8 @@ def check_errors(caravel_root, log_dir, signoff_dir, drc, lvs, verification):
|
||||||
logging.info("Klayout MR DRC: Passed")
|
logging.info("Klayout MR DRC: Passed")
|
||||||
f.write("Klayout MR DRC: Passed")
|
f.write("Klayout MR DRC: Passed")
|
||||||
if lvs:
|
if lvs:
|
||||||
|
lvs_summary_report = open(os.path.join(signoff_dir, "caravel/lvs_summary.rpt"))
|
||||||
|
lvs_report = os.path.join(signoff_dir, "caravel/caravel.lvs.rpt")
|
||||||
failures = count_lvs.count_LVS_failures(args.file)
|
failures = count_lvs.count_LVS_failures(args.file)
|
||||||
if failures[0] > 0:
|
if failures[0] > 0:
|
||||||
lvs_summary_report.write("LVS reports:")
|
lvs_summary_report.write("LVS reports:")
|
||||||
|
@ -307,6 +323,7 @@ if __name__ == "__main__":
|
||||||
drc = True
|
drc = True
|
||||||
lvs = True
|
lvs = True
|
||||||
verification = True
|
verification = True
|
||||||
|
sta = True
|
||||||
|
|
||||||
if drc:
|
if drc:
|
||||||
drc_p1 = run_drc(caravel_root, log_dir, signoff_dir, pdk_root)
|
drc_p1 = run_drc(caravel_root, log_dir, signoff_dir, pdk_root)
|
||||||
|
@ -323,6 +340,17 @@ if __name__ == "__main__":
|
||||||
pdk_env,
|
pdk_env,
|
||||||
)
|
)
|
||||||
logging.info("Running LVS on caravel")
|
logging.info("Running LVS on caravel")
|
||||||
|
|
||||||
|
if sta:
|
||||||
|
logging.info(f"Running PrimeTime STA all corners on caravel")
|
||||||
|
sta_p = run_sta(
|
||||||
|
caravel_root,
|
||||||
|
mcw_root,
|
||||||
|
f"{caravel_root}/scripts/mpw-2-sta-debug/files/custom/lib",
|
||||||
|
log_dir,
|
||||||
|
signoff_dir,
|
||||||
|
)
|
||||||
|
|
||||||
if verification or iverilog:
|
if verification or iverilog:
|
||||||
verify_p = []
|
verify_p = []
|
||||||
sim = []
|
sim = []
|
||||||
|
@ -338,29 +366,39 @@ if __name__ == "__main__":
|
||||||
simulator = "vcs"
|
simulator = "vcs"
|
||||||
elif iverilog:
|
elif iverilog:
|
||||||
simulator = "iverilog"
|
simulator = "iverilog"
|
||||||
for sim in sim:
|
for sim_type in sim:
|
||||||
logging.info(f"Running all {sim} verification on caravel")
|
logging.info(f"Running all {sim_type} verification on caravel")
|
||||||
verify_p.append(
|
verify_p.append(
|
||||||
run_verification(caravel_root, pdk_root, pdk_env, sim, simulator)
|
run_verification(caravel_root, pdk_root, pdk_env, sim_type, simulator)
|
||||||
)
|
)
|
||||||
for i in range(len(verify_p)):
|
for i in range(len(verify_p)):
|
||||||
out, err = verify_p[i].communicate()
|
out, err = verify_p[i].communicate()
|
||||||
|
ver_log = open(f"{log_dir}/{sim[i]}_caravel.log", "w")
|
||||||
if err:
|
if err:
|
||||||
logging.error(err.decode())
|
logging.error(err.decode())
|
||||||
|
ver_log.write(err)
|
||||||
if sta:
|
if out:
|
||||||
logging.info(f"Running PrimeTime STA all corners on caravel")
|
ver_log.write(out)
|
||||||
sta_p = run_sta(caravel_root, mcw_root, "mpw-2-sta-debug", log_dir, signoff_dir)
|
|
||||||
|
|
||||||
|
|
||||||
if lvs and drc and sta:
|
if lvs and drc and sta:
|
||||||
sta_p.wait()
|
out, err = sta_p.communicate()
|
||||||
|
sta_log = open(f"{log_dir}/PT_STA_caravel.log", "w")
|
||||||
|
if err:
|
||||||
|
logging.error(err.decode())
|
||||||
|
sta_log.write(err)
|
||||||
|
|
||||||
drc_p1.wait()
|
drc_p1.wait()
|
||||||
lvs_p1.wait()
|
lvs_p1.wait()
|
||||||
if lvs:
|
if lvs:
|
||||||
lvs_p1.wait()
|
lvs_p1.wait()
|
||||||
if drc:
|
if drc:
|
||||||
drc_p1.wait()
|
drc_p1.wait()
|
||||||
|
if sta:
|
||||||
|
out, err = sta_p.communicate()
|
||||||
|
sta_log = open(f"{log_dir}/PT_STA_caravel.log", "w")
|
||||||
|
if err:
|
||||||
|
logging.error(err.decode())
|
||||||
|
sta_log.write(err)
|
||||||
|
|
||||||
if not check_errors(caravel_root, log_dir, signoff_dir, drc, lvs, verification):
|
if not check_errors(caravel_root, log_dir, signoff_dir, drc, lvs, verification):
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
Loading…
Reference in New Issue