diff --git a/.github/scripts/parse_rpt.py b/.github/scripts/parse_rpt.py index 28c994da9..32ef92494 100644 --- a/.github/scripts/parse_rpt.py +++ b/.github/scripts/parse_rpt.py @@ -1,3 +1,31 @@ +########################################################################################################### +## 1. DRC and LVS Filename Declaration - ## +## This section declares the possible DRC and LVS filenames for the different generators ## +## The if condition checks for sky130hd_temp and sky130hvl_ldo, and the elif condition ## +## checks for the various possible cryo libraries (sky130hd_cryo, sky130hs_cryo, sky130hvl_cryo) ## +## ## +## 2. DRC Check - ## +## The if condition checks if the content in the generated DRC report file matches the template ## +## report DRC report file stored in .github/scripts/expected_drc_reports/ . ## +## The else condition checks if the number of lines in the DRC report files for the temp-sense- ## +## gen and cryo-gen is greater than 3 (which is the case if there is a non-zero number of errors ## +## in the make process ## +## ## +## 3. LVS Check - ## +## The if condition checks if the LVS report generated by the cryo-gen make has the word 'failed' ## +## in the last line (throws an error if yes). ## +## The else condition carries out a search for the word 'failed' in the LVS reports for ldo-gen ## +## and temp-sense-gen and raises a valueError if found. ## +## ## +## 4. Result File Check - ## +## This section calls the check_gen_files() function in generators/common/check_gen_files.py ## +## script. This function checks if the various files (.v, .sdc, .cdl, .sp, .spice, etc) have been ## +## generated for the required generators. ## +## Takes input parameters as the test.json filename, the dictionary of possible generators, and ## +## the cryo_library ## +########################################################################################################### + + import sys import json import os @@ -7,20 +35,38 @@ sys.stdout.flush() +_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 + else: + _generator_is['sky13XX_cryo'] = 1 + +# check which cryo-gen library's check is possibly being run dir_path = r'flow/reports' lib = os.listdir(dir_path) +cryo_library = str(lib[0]) -if (len(sys.argv) == 1) or (sys.argv[1] == "sky130hvl_ldo"): - # temp-sense-gen and ldo-gen +## 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] == str(lib[0])): - # cryo +elif _generator_is['sky130XX_cryo'] 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" -if (len(sys.argv) > 1) and (sys.argv[1] == "sky130hvl_ldo"): - with open(drc_filename, 'r') as f1, open("../../../.github/scripts/expected_drc_reports/expected_ldo_drc.rpt", 'r') as f2: + +## 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: @@ -32,8 +78,9 @@ else: print("DRC is clean!") -# cryo LVS check -if (len(sys.argv) > 1) and (sys.argv[1] == str(lib[0])): + +## LVS Check +if _generator_is['sky130XX_cryo'] and (sys.argv[1] == cryo_library): lvs_line = subprocess.check_output(["tail", "-1", lvs_filename]).decode( sys.stdout.encoding ) @@ -44,7 +91,7 @@ raise ValueError("LVS failed!") else: print("LVS is clean!") -else: +else: with open(lvs_filename) as f: f1 = f.read() @@ -53,9 +100,10 @@ else: print("LVS is clean!") +## Result File Check json_filename = "test.json" -if check_gen_files(json_filename, (len(sys.argv) == 1)): +if check_gen_files(json_filename, _generator_is, cryo_library): print("Flow check is clean!") else: print("Flow check failed!")