From a8b74e0df0c42a9c1a637a3501eaf2b3162104c4 Mon Sep 17 00:00:00 2001 From: Chetanya Goyal <95761876+chetanyagoyal@users.noreply.github.com> Date: Fri, 12 Jan 2024 20:41:47 +0530 Subject: [PATCH] revert oopsie delete parse_rpt.py file from temp-sense-gen top-level directory --- .../generators/temp-sense-gen/parse_rpt.py | 153 ------------------ 1 file changed, 153 deletions(-) delete mode 100644 openfasoc/generators/temp-sense-gen/parse_rpt.py diff --git a/openfasoc/generators/temp-sense-gen/parse_rpt.py b/openfasoc/generators/temp-sense-gen/parse_rpt.py deleted file mode 100644 index 7c0fea4bf..000000000 --- a/openfasoc/generators/temp-sense-gen/parse_rpt.py +++ /dev/null @@ -1,153 +0,0 @@ -""" -This script performs checks on generated files and reports for different generators based on workflow parameters. - -The `generator_is` variable is a dictionary with keys and values indicating information about the workflow being run. -Values for each key are determined by how this script is called by the .yml files in .github/workflows. - -The `cryo_library` variable is used to determine which library (sky130hd_cryo, sky130hs_cryo, sky130hvl_cryo) the workflow is targeting. - -1. DRC and LVS Filename Declaration: - This section declares possible DRC and LVS filenames for different generators. - The first condition checks for sky130hd_temp and sky130hvl_ldo, while the elif condition checks for various cryo libraries. - -2. DRC Check: - - Checks if the content in the generated DRC report file matches the template DRC report file stored in .github/scripts/expected_drc_reports/. - - If the number of lines in the DRC report files for temp-sense-gen and cryo-gen is greater than 3, it indicates non-zero errors in the make process. - -3. LVS Check: - - Checks if the LVS report generated by the cryo-gen make has the word 'failed' in the last line, raising an error if found. - - Conducts a search for the word 'failed' in the LVS reports for ldo-gen and temp-sense-gen, raising a ValueError if found. - -4. Result File Check: - - Calls the check_gen_files() function from generators/common/check_gen_files.py. - - Checks if various files (.v, .sdc, .cdl, .sp, .spice, etc.) have been generated for the required generators. - - Takes input parameters: the test.json filename, the dictionary of possible generators, and the cryo_library. -""" - -import sys -import json -import os -import re, subprocess -import warnings - -sys.path.append(os.path.join(os.path.dirname(__file__), '..')) -sys.path.append(os.path.join(os.path.dirname(__file__), '../common')) -from common.check_gen_files import check_gen_files -from simulation.classify_sim_error import classify_sim_error -from tools.compare_files import compare_files - -sys.stdout.flush() - -cryo_library = "" -generator_is = { - 'sky130hvl_ldo': 0, - 'sky130hd_temp': 0, - 'sky130XX_cryo': 0 -} - -if len(sys.argv) == 1: - generator_is['sky130hd_temp'] = 1 -elif len(sys.argv) > 1: - if sys.argv[1] == 'sky130hvl_ldo': - generator_is['sky130hvl_ldo'] = 1 - elif sys.argv[1] == 'sky130hd_temp_full': - generator_is['sky130hd_temp'] = 1 - else: - generator_is['sky130XX_cryo'] = 1 - -if generator_is['sky130XX_cryo']: - # check which cryo-gen library's workflow is being run - dir_path = r'flow/reports' - lib = os.listdir(dir_path) - cryo_library = str(lib[0]) - -## DRC and LVS Filename Declaration -if generator_is['sky130hd_temp'] or generator_is['sky130hvl_ldo']: - drc_filename = "work/6_final_drc.rpt" - lvs_filename = "work/6_final_lvs.rpt" -elif len(sys.argv) > 1 and sys.argv[1] == cryo_library: - drc_filename = "flow/reports/" + sys.argv[1] + "/cryo/6_final_drc.rpt" - lvs_filename = "flow/reports/" + sys.argv[1] + "/cryo/6_final_lvs.rpt" - - -## DRC check -if generator_is['sky130hvl_ldo']: - expected_ldo_rpt_filename = "../../../.github/scripts/expected_drc_reports/expected_ldo_drc.rpt" - with open(drc_filename) as f1, open(expected_ldo_rpt_filename) as f2: - content1 = f1.readlines() - content2 = f2.readlines() - if content1 == content2: - print("DRC is clean!") - else: - raise ValueError("DRC failed!") -elif sum(1 for line in open(drc_filename)) > 3: - raise ValueError("DRC failed!") -else: - print("DRC is clean!") - - -## LVS Check -if len(sys.argv) > 1 and sys.argv[1] == cryo_library: - lvs_line = subprocess.check_output(["tail", "-1", lvs_filename]).decode( - sys.stdout.encoding - ) - regex = r"failed" - match = re.search(regex, lvs_line) - - if match != None: - raise ValueError("LVS failed!") - else: - print("LVS is clean!") -else: - with open(lvs_filename) as f: - f1 = f.read() - - if "failed" in f1: - raise ValueError("LVS failed!") - else: - print("LVS is clean!") - -## Result File Check -if generator_is['sky130hvl_ldo']: - json_filename = "spec.json" -else: - json_filename = "test.json" - -if check_gen_files(json_filename, generator_is, cryo_library): - print("Flow check is clean!") -else: - print("Flow check failed!") - -if len(sys.argv) > 1 and sys.argv[1] == "sky130hd_temp_full": - sim_state_filename = "work/sim_state_file.txt" - result_filename = "work/prePEX_sim_result" - template_filename = "../../../.github/scripts/expected_sim_outputs/temp-sense-gen/prePEX_sim_result" - - ### Generated result file check against stored template - sim_error_type = classify_sim_error(template_filename, result_filename, compare_files) - if sim_error_type == 'red': - raise ValueError("Simulation results do not match with those in stored template file!") - elif sim_error_type == 'amber': - warnings.warn("Simulation results are within an allowable error range from template files!") - - ### Number of failed simulations returned from simulation state check - sim_state = json.load(open("work/sim_state_file.txt")) - if sim_state["failed_sims"] != 0: - raise ValueError("Simulations failed: Non zero failed simulations!") - - ### Generated file check - for folder_num in range(1, sim_state["completed_sims"] + 1): - dir_path = r'simulations/run/' - pex_path = os.listdir(dir_path) - - file_name = "simulations/run/" + str(pex_path[0]) + "/" + str(folder_num) + "/" - param_file = file_name + "parameters.txt" - log_file = file_name + "sim_" + str(folder_num) + ".log" - spice_file = file_name + "sim_" + str(folder_num) + ".sp" - - if os.path.exists(log_file) and os.path.exists(log_file) and os.path.exists(spice_file): - pass - else: - raise ValueError("Simulations failed: required number of run folders do not exist!") - - print("Simulations are clean!")