From 0823edc14f0510bf0e591d3438cde57c28bc5f44 Mon Sep 17 00:00:00 2001 From: Passant Date: Sun, 6 Nov 2022 06:19:15 -0800 Subject: [PATCH] update signoff scripts to add the logs to `./signoff` --- scripts/README.md | 5 +++-- scripts/klayout_drc.py | 2 +- scripts/run_pt_sta.py | 24 +++++++++--------------- scripts/signoff_automation.py | 31 +++++++++++++++++++++---------- 4 files changed, 34 insertions(+), 28 deletions(-) diff --git a/scripts/README.md b/scripts/README.md index 430eaa6b..240c666e 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -48,6 +48,7 @@ optional arguments: ```` ## Reports and logs -Reports can be found `$CARAVEL_ROOT/signoff//` +Reports can be found at `$CARAVEL_ROOT/signoff//` -Logs can be found at `$CARAVEL_ROOT/scripts/logs/` +Logs can be found at `$CARAVEL_ROOT/signoff//standalone_pvr/logs` and `$CARAVEL_ROOT/signoff//primetime-signoff/logs` +> If the design is related to the Management Core SoC, `$CARAVEL_ROOT` is replaced by `$MCW_ROOT` for the reports and logs \ No newline at end of file diff --git a/scripts/klayout_drc.py b/scripts/klayout_drc.py index ee8e3415..dc07f262 100644 --- a/scripts/klayout_drc.py +++ b/scripts/klayout_drc.py @@ -6,7 +6,7 @@ import os def klayout_gds_drc_check(design_name, drc_script_path, gds_input_file_path, signoff_directory, logs_directory): - report_file_path = signoff_directory / f'{design_name}' / f'standalone_pvr/{design_name}_klayout_drc.xml' + report_file_path = signoff_directory / f'{design_name}_klayout_drc.xml' run_drc_check_cmd = ['klayout', '-b', '-r', drc_script_path, '-rd', f"input={gds_input_file_path}", '-rd', f"report={report_file_path}", diff --git a/scripts/run_pt_sta.py b/scripts/run_pt_sta.py index 426d7f70..151bd474 100644 --- a/scripts/run_pt_sta.py +++ b/scripts/run_pt_sta.py @@ -53,11 +53,11 @@ def run_sta ( # PrimeTime command PT_tcl = f"{SCRIPT_DIR}/pt_sta.tcl" - pt_command = f"source /tools/bashrc_snps; pt_shell -f {PT_tcl} -output_log_file {log_dir}/{design}/{design}-{rc_corner}-{proc_corner}-sta.log" + pt_command = f"source /tools/bashrc_snps; pt_shell -f {PT_tcl} -output_log_file {log_dir}/{design}-{rc_corner}-{proc_corner}-sta.log" os.system(pt_command) - # Check if there exists any violations + # Check if there are any violations sta_pass=search_viol(f"{output_dir}/reports/{rc_corner}/{design}.{proc_corner}{proc_corner}-global.rpt") - log = open(f"{log_dir}/{design}/{design}-{rc_corner}-{proc_corner}-sta.log", "a") + log = open(f"{log_dir}/{design}-{rc_corner}-{proc_corner}-sta.log", "a") if sta_pass == "pass": print (f"STA run Passed!") log.write(f"STA run Passed!") @@ -90,11 +90,11 @@ def run_sta ( print(f"There are violations. check report: {output_dir}/reports/{rc_corner}/{design}.{proc_corner}{proc_corner}-all_viol.rpt") log.write(f"There are violations. check report: {output_dir}/reports/{rc_corner}/{design}.{proc_corner}{proc_corner}-all_viol.rpt") elif sta_pass== "no cons": - print(f"Reading constraints SDC file failed. check log: {log_dir}/{design}/{design}-{rc_corner}-{proc_corner}-sta.log") - log.write(f"Reading constraints SDC file failed. check log: {log_dir}/{design}/{design}-{rc_corner}-{proc_corner}-sta.log") + print(f"Reading constraints SDC file failed. check log: {log_dir}/{design}-{rc_corner}-{proc_corner}-sta.log") + log.write(f"Reading constraints SDC file failed. check log: {log_dir}/{design}-{rc_corner}-{proc_corner}-sta.log") else: - print(f"Linking failed. check log: {log_dir}/{design}/{design}-{rc_corner}-{proc_corner}-sta.log") - log.write(f"Linking failed. check log: {log_dir}/{design}/{design}-{rc_corner}-{proc_corner}-sta.log") + print(f"Linking failed. check log: {log_dir}/{design}-{rc_corner}-{proc_corner}-sta.log") + log.write(f"Linking failed. check log: {log_dir}/{design}-{rc_corner}-{proc_corner}-sta.log") log.close() # Check the required env variables @@ -180,7 +180,7 @@ if __name__ == "__main__": parser.add_argument( "-l", "--logs_dir", - help="output directory", + help="log directory", required=True ) parser.add_argument( @@ -206,7 +206,7 @@ if __name__ == "__main__": args = parser.parse_args() - output = os.path.abspath(os.path.join(args.output_dir,"primetime-signoff")) + output = os.path.abspath(args.output_dir) log = os.path.abspath(args.logs_dir) try: @@ -221,12 +221,6 @@ if __name__ == "__main__": # directory already exists pass - try: - os.makedirs(os.path.join(log,args.design)) - except FileExistsError: - # directory already exists - pass - sub_dirs = ['reports', 'sdf', 'lib'] for item in sub_dirs: try: diff --git a/scripts/signoff_automation.py b/scripts/signoff_automation.py index a7a6b6f2..252d750e 100755 --- a/scripts/signoff_automation.py +++ b/scripts/signoff_automation.py @@ -43,7 +43,7 @@ def run_drc(design_root, log_dir, signoff_dir, pdk_root, design): "-l", f"{log_dir}", "-s", - f"{signoff_dir}", + f"{signoff_dir}/{design}/standalone_pvr", "-d", f"{design}", ] @@ -160,7 +160,7 @@ def run_sta(caravel_root, mcw_root, pt_lib_root, log_dir, signoff_dir, design): "-d", f"{design}", "-o", - f"{signoff_dir}/{design}", + f"{signoff_dir}/{design}/primetime-signoff", "-l", f"{log_dir}", ] @@ -212,6 +212,7 @@ def check_errors( lvs_summary_report = open( os.path.join(signoff_dir, f"{design}/standalone_pvr/lvs_summary.rpt"), "w" ) + lvs_sum_rep = os.path.join(signoff_dir, f"{design}/standalone_pvr/lvs_summary.rpt") lvs_report = os.path.join(signoff_dir, f"{design}/standalone_pvr/{design}.lvs.json") failures = count_lvs.count_LVS_failures(lvs_report) if failures[0] > 0: @@ -226,7 +227,7 @@ def check_errors( lvs_summary_report.write(" property failures = " + str(failures[4]) + "\n") logging.error(f"LVS on {design} failed") logging.info(f"Find full report at {lvs_report}") - logging.info(f"Find summary report at {lvs_summary_report}") + logging.info(f"Find summary report at {lvs_sum_rep}") f.write("Layout Vs Schematic: Failed\n") else: lvs_summary_report.write("Layout Vs Schematic Passed") @@ -249,7 +250,7 @@ def check_errors( f.write(f"{sim} simulations: Failed\n") if sta: - sta_logs = glob.glob(f"{log_dir}/{design}/{design}-*sta.log") + sta_logs = glob.glob(f"{sta_log_dir}/{design}-*sta.log") for l in sta_logs: with open(l) as rep: log_name = l.split("/")[-1] @@ -391,7 +392,6 @@ if __name__ == "__main__": 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 @@ -404,15 +404,18 @@ if __name__ == "__main__": sta = args.primetime_sta design = args.design antenna = args.antenna + log_dir = os.path.join(signoff_dir, f"{design}/standalone_pvr/logs") + if (design == "mgmt_core_wrapper" or design == "RAM128" or design == "RAM256"): signoff_dir = os.path.join(mcw_root, "signoff") + log_dir = os.path.join(signoff_dir, f"{design}/standalone_pvr/logs") - if not os.path.exists(f"{log_dir}"): - os.makedirs(f"{log_dir}") if not os.path.exists(f"{signoff_dir}/{design}"): os.makedirs(f"{signoff_dir}/{design}") if not os.path.exists(f"{signoff_dir}/{design}/standalone_pvr"): os.makedirs(f"{signoff_dir}/{design}/standalone_pvr") + if not os.path.exists(f"{log_dir}"): + os.makedirs(f"{log_dir}") if lvs or drc or antenna: if glob.glob(f"{caravel_root}/gds/*.gz"): @@ -465,12 +468,18 @@ if __name__ == "__main__": logging.info(f"Running LVS on {design}") if sta: + if not os.path.exists(f"{signoff_dir}/{design}/primetime-signoff"): + os.makedirs(f"{signoff_dir}/{design}/primetime-signoff") + sta_log_dir = os.path.join(signoff_dir, f"{design}/primetime-signoff/logs") + if not os.path.exists(f"{sta_log_dir}"): + os.makedirs(f"{sta_log_dir}") + logging.info(f"Running PrimeTime STA all corners on {design}") sta_p = run_sta( caravel_root, mcw_root, f"{caravel_root}/scripts/pt_libs", - log_dir, + sta_log_dir, signoff_dir, design, ) @@ -521,11 +530,13 @@ if __name__ == "__main__": # lvs_p1.wait() if sta: out, err = sta_p.communicate() - sta_log = open(f"{log_dir}/PT_STA_{design}.log", "w") + sta_log = open(f"{sta_log_dir}/PT_STA_{design}.log", "w") if err: logging.error(err) sta_log.write(err) - sta_log.close() + sta_log.close() + else: + os.remove(f"{sta_log_dir}/PT_STA_{design}.log") if lvs: lvs_p1.wait() if drc: