From 967086aaae7a73a0e55979febe717532ae674747 Mon Sep 17 00:00:00 2001 From: Chetanya <95761876+chetanyagoyal@users.noreply.github.com> Date: Sun, 12 Nov 2023 21:24:39 +0530 Subject: [PATCH] add simulation checks --- .github/scripts/parse_rpt.py | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/.github/scripts/parse_rpt.py b/.github/scripts/parse_rpt.py index 6b4705cba..d8de6d10e 100644 --- a/.github/scripts/parse_rpt.py +++ b/.github/scripts/parse_rpt.py @@ -109,4 +109,34 @@ if check_gen_files(json_filename, _generator_is, cryo_library): print("Flow check is clean!") else: - print("Flow check failed!") \ No newline at end of file + print("Flow check failed!") + +if len(sys.argv) == 1 and sys.argv[1] == "sky130hd_temp_full": + result_filename = "work/prePEX_sim_result" # might remove from check or need to implement different logic later if sim outputs change due to downstream changes + sim_state_filename = "work/sim_state_file.txt" + + with open(result_filename) as f2, open("../../../.github/scripts/expected_sim_outputs/prePEX_sim_result.txt") as f1: + content1 = f2.readlines() + content2 = f1.readlines() + if content1 != content2: + raise ValueError("Simulations failed: simulation result file does not match!") + + sim_state = json.load(open("work/sim_state_file.txt")) + if sim_state["failed_sims"] != 0: + raise ValueError("Simulations failed: Non zero failed simulations!") + + 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/" + pex_path + "/" + 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 files do not exist in sim run folders!") + + print("Simulations are clean!")