From 456e155f59bbea499499290562c329bd47bd957b Mon Sep 17 00:00:00 2001 From: Chetanya <95761876+chetanyagoyal@users.noreply.github.com> Date: Thu, 9 Nov 2023 15:16:10 +0530 Subject: [PATCH 1/9] Update tempSense_sky130hd.yml, add job for sim test --- .github/workflows/tempSense_sky130hd.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/tempSense_sky130hd.yml b/.github/workflows/tempSense_sky130hd.yml index 92ddee223..849829ce0 100644 --- a/.github/workflows/tempSense_sky130hd.yml +++ b/.github/workflows/tempSense_sky130hd.yml @@ -44,3 +44,20 @@ jobs: " && exit_code=$? | tee -a file.log if [ $? -ne 0 ]; then exit 1; fi if grep "\[ERROR\]" file.log; then exit 1; else exit 0; fi + - name: Test sky130hd Temp sensor simulations + env: + IMAGE_NAME: msaligane/openfasoc:stable + run: | + cd $GITHUB_WORKSPACE + touch file.log + docker run --rm \ + -v $PWD:$PWD\ + -w $PWD\ + $IMAGE_NAME\ + bash -c "\ + cd ./openfasoc/generators/temp-sense-gen &&\ + make sky130hd_temp_full &&\ + python3 parse_rpt.py sky130hd_temp_full + " && exit_code=$? | tee -a file.log + if [ $? -ne 0 ]; then exit 1; fi + if grep "\[ERROR\]" sim_file.log; then exit 1; else exit 0; fi From 1c838ed9de3e449bcc869ed9d88978fb0859c456 Mon Sep 17 00:00:00 2001 From: Chetanya <95761876+chetanyagoyal@users.noreply.github.com> Date: Thu, 9 Nov 2023 15:19:34 +0530 Subject: [PATCH 2/9] Add simulation tests in parse_rpt.py --- .github/scripts/parse_rpt.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/scripts/parse_rpt.py b/.github/scripts/parse_rpt.py index 71ca1e180..c34b02ecc 100644 --- a/.github/scripts/parse_rpt.py +++ b/.github/scripts/parse_rpt.py @@ -31,3 +31,19 @@ raise ValueError("LVS failed!") else: print("LVS is clean!") + +if len(sys.argv) > 1 and sys.argv[1] == "sky130hd_temp_full": + result_filename = "work/prePEX_sim_result" + 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!") + + print("Simulations are clean!") From 13d672876ea345a19713f682c0e18edac28f498a Mon Sep 17 00:00:00 2001 From: Chetanya <95761876+chetanyagoyal@users.noreply.github.com> Date: Thu, 9 Nov 2023 22:40:19 +0530 Subject: [PATCH 3/9] Add check for .log, .sp, parameters.txt files in run folder --- .github/scripts/parse_rpt.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/scripts/parse_rpt.py b/.github/scripts/parse_rpt.py index c34b02ecc..722397f3c 100644 --- a/.github/scripts/parse_rpt.py +++ b/.github/scripts/parse_rpt.py @@ -1,4 +1,4 @@ -import sys +import sys, os sys.stdout.flush() @@ -33,7 +33,7 @@ print("LVS is clean!") if len(sys.argv) > 1 and sys.argv[1] == "sky130hd_temp_full": - result_filename = "work/prePEX_sim_result" + 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: @@ -45,5 +45,19 @@ 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 of run folders do not exist!") print("Simulations are clean!") From d383881d42023a1af156f2df7c48515cb940ed7f Mon Sep 17 00:00:00 2001 From: Chetanya <95761876+chetanyagoyal@users.noreply.github.com> Date: Sat, 11 Nov 2023 14:11:49 +0530 Subject: [PATCH 4/9] include json import statement --- .github/scripts/parse_rpt.py | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/scripts/parse_rpt.py b/.github/scripts/parse_rpt.py index 722397f3c..d92802594 100644 --- a/.github/scripts/parse_rpt.py +++ b/.github/scripts/parse_rpt.py @@ -1,4 +1,5 @@ import sys, os +import json sys.stdout.flush() From 1a1f94db0838a0e6f6d985f9c9e3572a3633cd00 Mon Sep 17 00:00:00 2001 From: Chetanya <95761876+chetanyagoyal@users.noreply.github.com> Date: Sat, 11 Nov 2023 16:10:56 +0530 Subject: [PATCH 5/9] update check for temp-sense-gen sim --- .github/scripts/parse_rpt.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/scripts/parse_rpt.py b/.github/scripts/parse_rpt.py index d92802594..01e2aeef3 100644 --- a/.github/scripts/parse_rpt.py +++ b/.github/scripts/parse_rpt.py @@ -33,7 +33,7 @@ else: print("LVS is clean!") -if len(sys.argv) > 1 and sys.argv[1] == "sky130hd_temp_full": +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" @@ -59,6 +59,6 @@ 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 of run folders do not exist!") + raise ValueError("Simulations failed: required files do not exist in sim run folders!") print("Simulations are clean!") From 4170f174964bd54c340c7f2dedf93dbdbee3d0c2 Mon Sep 17 00:00:00 2001 From: Chetanya <95761876+chetanyagoyal@users.noreply.github.com> Date: Sat, 11 Nov 2023 16:12:06 +0530 Subject: [PATCH 6/9] remove extra job for simulation --- .github/workflows/tempSense_sky130hd.yml | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/.github/workflows/tempSense_sky130hd.yml b/.github/workflows/tempSense_sky130hd.yml index 849829ce0..7182b97ae 100644 --- a/.github/workflows/tempSense_sky130hd.yml +++ b/.github/workflows/tempSense_sky130hd.yml @@ -39,25 +39,8 @@ jobs: cp ./.github/scripts/parse_rpt.py ./openfasoc/generators/temp-sense-gen/. &&\ pip3 install -r requirements.txt &&\ cd ./openfasoc/generators/temp-sense-gen &&\ - make sky130hd_temp &&\ + make sky130hd_temp_full &&\ python3 parse_rpt.py " && exit_code=$? | tee -a file.log if [ $? -ne 0 ]; then exit 1; fi if grep "\[ERROR\]" file.log; then exit 1; else exit 0; fi - - name: Test sky130hd Temp sensor simulations - env: - IMAGE_NAME: msaligane/openfasoc:stable - run: | - cd $GITHUB_WORKSPACE - touch file.log - docker run --rm \ - -v $PWD:$PWD\ - -w $PWD\ - $IMAGE_NAME\ - bash -c "\ - cd ./openfasoc/generators/temp-sense-gen &&\ - make sky130hd_temp_full &&\ - python3 parse_rpt.py sky130hd_temp_full - " && exit_code=$? | tee -a file.log - if [ $? -ne 0 ]; then exit 1; fi - if grep "\[ERROR\]" sim_file.log; then exit 1; else exit 0; fi From fa36295aa9a3d7a88fd018c6f1721b1be511b940 Mon Sep 17 00:00:00 2001 From: chetanyagoyal Date: Sun, 12 Nov 2023 17:27:15 +0530 Subject: [PATCH 7/9] syncing with idea-fasoc:main --- .github/scripts/parse_rpt.py | 130 ++++++++++++------ README.rst | 6 +- conda_versions.txt | 6 +- docker/conda/Dockerfile | 5 +- docker/conda/packages.txt | 6 + .../generators/PMU-gen/tools/parse_rpt.py | 1 + openfasoc/generators/common/__init__.py | 5 +- .../generators/common/check_gen_files.py | 64 +++++++++ .../cryo-gen/tools/check_gen_extensions | 8 ++ .../generators/cryo-gen/tools/parse_rpt.py | 26 +++- .../generators/dcdc-gen/tools/parse_rpt.py | 1 + .../ldo-gen/tools/check_gen_extensions | 6 + .../generators/scpa-gen/tools/parse_rpt.py | 14 +- openfasoc/generators/temp-sense-gen/Makefile | 4 +- .../temp-sense-gen/tools/check_gen_extensions | 6 + .../temp-sense-gen/tools/parse_rpt.py | 22 ++- .../temp-sense-gen/tools/verify_op.sh | 25 ---- versions.txt | 4 +- 18 files changed, 242 insertions(+), 97 deletions(-) create mode 100644 openfasoc/generators/common/check_gen_files.py create mode 100644 openfasoc/generators/cryo-gen/tools/check_gen_extensions create mode 100644 openfasoc/generators/ldo-gen/tools/check_gen_extensions create mode 100644 openfasoc/generators/temp-sense-gen/tools/check_gen_extensions delete mode 100755 openfasoc/generators/temp-sense-gen/tools/verify_op.sh diff --git a/.github/scripts/parse_rpt.py b/.github/scripts/parse_rpt.py index 01e2aeef3..6b4705cba 100644 --- a/.github/scripts/parse_rpt.py +++ b/.github/scripts/parse_rpt.py @@ -1,64 +1,112 @@ -import sys, os +""" +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 +sys.path.append(os.path.join(os.path.dirname(__file__), '..')) +from common.check_gen_files import check_gen_files sys.stdout.flush() -if len(sys.argv) == 1 or sys.argv[1] == "sky130hvl_ldo": +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 + 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" -else: - drc_filename = "work/"+sys.argv[1]+"/6_final_drc.rpt" - lvs_filename = "work/"+sys.argv[1]+"/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" -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 == content1: + 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!") -with open(lvs_filename) as f: - f1 = f.read() - - if "failed" in f1: +## 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!") - -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!") +else: + with open(lvs_filename) as f: + f1 = f.read() - 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 + if "failed" in f1: + raise ValueError("LVS failed!") else: - raise ValueError("Simulations failed: required files do not exist in sim run folders!") - - print("Simulations are clean!") + 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!") \ No newline at end of file diff --git a/README.rst b/README.rst index 80fb1f935..d3f42ef43 100644 --- a/README.rst +++ b/README.rst @@ -46,7 +46,7 @@ For more info on getting-started, please refer to ["Getting Started" section ](h Below are the tool requirements along with their currently support versions that are updated regularly upon testing againsts the generators. - 1. `Magic `_ (version:8.3.445) + 1. `Magic `_ (version:8.3.447) 2. `Netgen `_ (version:1.5.262) @@ -60,7 +60,7 @@ Below are the tool requirements along with their currently support versions that 5. `OpenROAD `_ (version:2.0_10905) - 6. `Open_pdks `_ (version:1.0.286) + 6. `Open_pdks `_ (version:1.0.457) - open_pdks is required to run drc/lvs check and the simulations - After open_pdks is installed, please update the **open_pdks** key in `common/platform_config.json` with the installed path, down to the sky130A folder @@ -107,4 +107,4 @@ If you find this tool useful in your research, we kindly request to cite our pap - Tutu Ajayi et al., "`An Open-source Framework for Autonomous SoC Design with Analog Block Generation `_," 2020 IFIP/IEEE 28th International Conference on Very Large Scale Integration (VLSI-SOC), 2020, pp. 141-146. - - Qirui Zhang et al., "`An Open-Source and Autonomous Temperature Sensor Generator Verified With 64 Instances in SkyWater 130 nm for Comprehensive Design Space Exploration `_," in IEEE Solid-State Circuits Letters, vol. 5, pp. 174-177, 2022. + - Qirui Zhang et al., "`An Open-Source and Autonomous Temperature Sensor Generator Verified With 64 Instances in SkyWater 130 nm for Comprehensive Design Space Exploration `_," in IEEE Solid-State Circuits Letters, vol. 5, pp. 174-177, 2022. \ No newline at end of file diff --git a/conda_versions.txt b/conda_versions.txt index dae601a24..2ba8455b1 100644 --- a/conda_versions.txt +++ b/conda_versions.txt @@ -1,5 +1,5 @@ -magic==8.3.445_0_g8445f3e +magic==8.3.446_1_g1108046 netgen==1.5.262_0_gc1ed4ce -open_pdks.sky130a==1.0.286_0_g52af776 +open_pdks.sky130a==1.0.457_0_g32e8f23 openroad==2.0_10905_ge89829335 -yosys==0.35_8_g5691cd095 +yosys==0.35_8_g5691cd095 \ No newline at end of file diff --git a/docker/conda/Dockerfile b/docker/conda/Dockerfile index 89a8eb8ad..892159a60 100755 --- a/docker/conda/Dockerfile +++ b/docker/conda/Dockerfile @@ -17,7 +17,6 @@ RUN conda install python=3.10 \ magic \ netgen \ openroad \ - ngspice \ -c litex-hub \ -c conda-forge \ -c anaconda \ @@ -29,3 +28,7 @@ RUN dpkg -i klayout_0.28.12-1_amd64.deb RUN strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 COPY ./scripts /scripts + +RUN git clone http://git.code.sf.net/p/ngspice/ngspice && \ + cd ngspice && \ + ./compile_linux.sh \ No newline at end of file diff --git a/docker/conda/packages.txt b/docker/conda/packages.txt index 04d7597fc..9a0e68ae2 100644 --- a/docker/conda/packages.txt +++ b/docker/conda/packages.txt @@ -17,3 +17,9 @@ libz-dev build-essential time git +bison +flex +libx11-dev +libx11-6 +libxaw7-dev +libreadline6-dev \ No newline at end of file diff --git a/openfasoc/generators/PMU-gen/tools/parse_rpt.py b/openfasoc/generators/PMU-gen/tools/parse_rpt.py index 7384eb979..aafeabcd3 100755 --- a/openfasoc/generators/PMU-gen/tools/parse_rpt.py +++ b/openfasoc/generators/PMU-gen/tools/parse_rpt.py @@ -22,3 +22,4 @@ raise ValueError("LVS failed!") else: print("LVS is clean!") +print("Generator check is clean!") \ No newline at end of file diff --git a/openfasoc/generators/common/__init__.py b/openfasoc/generators/common/__init__.py index c1ca2645e..739673f43 100644 --- a/openfasoc/generators/common/__init__.py +++ b/openfasoc/generators/common/__init__.py @@ -7,6 +7,9 @@ 2. `COMMON_PLATFORMS_PREFIX_MAP` (dict): This is a dictionary of common platforms (currently sky130) and their cell naming prefixes. - `common.simulation` 1. `run_simulations()`: Used to run SPICE testbenches with multiple parameters. - +- `common.check_gen_files` + 1. `check_gen_files(parameters: json_filename, _generator_is, cryo_library)`: Used to check if the various files that should be generated by the flow are present in their required directories. +- `common.check_gen_extensions` + 1. Stores the extensions of the files generated by the flow. See individual function documentation for more information on a particular function. """ \ No newline at end of file diff --git a/openfasoc/generators/common/check_gen_files.py b/openfasoc/generators/common/check_gen_files.py new file mode 100644 index 000000000..ae6151480 --- /dev/null +++ b/openfasoc/generators/common/check_gen_files.py @@ -0,0 +1,64 @@ +""" +This script is used to check for the presence of the required non-report files that each generator creates. It gets +the module_name (str) from the .json file present in the generator top-level folder. + +Args: + json_filename (str): String containing the name of the .json filename for each generator + _generator_is (dict): Dictionary containing key-value pairs that signify which generator's flow results are being checked + cryo_library (str): String containing which cryo-gen library (sky130hs, sky130hd, sky130hvl) is being checked for +Uses: + work_dir (str): String containing the directory in which to check files + data (str): String containing data from the .json file + module_name (str): String containing the name of module that the check is being done for (eg. tempsenseInst_error) + extension_file_path (str): Contains the extensions of the files which each generator produces for the flows +Returns: + 1: if all checks are successful +Raises: + ValueError: If any of the various checks go wrong (.csv file checks for temp-sense, flow generated files for all generators) +""" + +import json +import os + +def check_gen_files(json_filename, _generator_is, cryo_library) -> int: + with open(json_filename) as file: + data = json.load(file) + + # print('Found .json config file...') + + module_name = data.get("module_name", "default") + + if _generator_is['sky130XX_cryo']: + work_dir = "./work/" + cryo_library + "/" + else: + work_dir = "./work/" + + if (os.path.exists(work_dir) == 0): + raise ValueError("work directory does not exist!") + else: + filename = work_dir + module_name + extension_file_path = "./tools/check_gen_extensions" + + if os.path.exists(extension_file_path): + with open(extension_file_path) as f: + + for extension in f: + file = "".join([filename, extension.strip()]) + if (os.path.exists(file) == 0): + raise ValueError(file + " does not exist!") + else: + print("checking flow results with possibly stale list of extensions...") + extensions = [".sdc", ".gds", ".def", ".spice", ".v", "_pex.spice"] + for extension in extensions: + file = "".join([filename, extension]) + + if (os.path.exists(file) == 0): + raise ValueError(file + " does not exist!") + # print("Found necessary work result files!") + if _generator_is['sky130hd_temp']: + for file in ("error_within_x.csv", "golden_error_opt.csv", "search_result.csv"): + if os.path.exists(file) == 0: + raise ValueError(file + " does not exist!") + + #print("Found generated .csv files!") + return 1 \ No newline at end of file diff --git a/openfasoc/generators/cryo-gen/tools/check_gen_extensions b/openfasoc/generators/cryo-gen/tools/check_gen_extensions new file mode 100644 index 000000000..15f83a789 --- /dev/null +++ b/openfasoc/generators/cryo-gen/tools/check_gen_extensions @@ -0,0 +1,8 @@ +.gds +.spice +.v +.cdl +_sim.spice +_pex.spice +.sdc +.def \ No newline at end of file diff --git a/openfasoc/generators/cryo-gen/tools/parse_rpt.py b/openfasoc/generators/cryo-gen/tools/parse_rpt.py index 7384eb979..744addb4d 100644 --- a/openfasoc/generators/cryo-gen/tools/parse_rpt.py +++ b/openfasoc/generators/cryo-gen/tools/parse_rpt.py @@ -1,8 +1,21 @@ import re import subprocess -import sys +import sys, os -drc_filename = "flow/reports/sky130hd/cyro/6_final_drc.rpt" +sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..')) +from common.check_gen_files import check_gen_files + +_generator_is = { + 'sky130hvl_ldo': 0, + 'sky130hd_temp': 0, + 'sky130XX_cryo': 1 +} + +dir_path = r'flow/reports' +lib = os.listdir(dir_path) +cryo_library = str(lib[0]) + +drc_filename = "flow/reports/" + cryo_library + "/cryo/6_final_drc.rpt" num_lines = sum(1 for line in open(drc_filename)) if num_lines > 3: @@ -10,7 +23,7 @@ else: print("DRC is clean!") -lvs_filename = "flow/reports/sky130hd/cyro/6_final_lvs.rpt" +lvs_filename = "flow/reports/" + cryo_library + "/cryo/6_final_lvs.rpt" lvs_line = subprocess.check_output(["tail", "-1", lvs_filename]).decode( sys.stdout.encoding ) @@ -22,3 +35,10 @@ raise ValueError("LVS failed!") else: print("LVS is clean!") + +json_filename = "test.json" + +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 diff --git a/openfasoc/generators/dcdc-gen/tools/parse_rpt.py b/openfasoc/generators/dcdc-gen/tools/parse_rpt.py index 7384eb979..c79688da6 100755 --- a/openfasoc/generators/dcdc-gen/tools/parse_rpt.py +++ b/openfasoc/generators/dcdc-gen/tools/parse_rpt.py @@ -22,3 +22,4 @@ raise ValueError("LVS failed!") else: print("LVS is clean!") +print("Generator check is clean") \ No newline at end of file diff --git a/openfasoc/generators/ldo-gen/tools/check_gen_extensions b/openfasoc/generators/ldo-gen/tools/check_gen_extensions new file mode 100644 index 000000000..93a7f6b57 --- /dev/null +++ b/openfasoc/generators/ldo-gen/tools/check_gen_extensions @@ -0,0 +1,6 @@ +.gds +.spice +.v +_pex.spice +.sdc +.def \ No newline at end of file diff --git a/openfasoc/generators/scpa-gen/tools/parse_rpt.py b/openfasoc/generators/scpa-gen/tools/parse_rpt.py index de68aaaa9..cd718044e 100644 --- a/openfasoc/generators/scpa-gen/tools/parse_rpt.py +++ b/openfasoc/generators/scpa-gen/tools/parse_rpt.py @@ -6,16 +6,4 @@ else: print("DRC is clean!") - -# LVS Bypassed - -# lvs_filename = "flow/reports/sky130hd/tempsense/6_final_lvs.rpt" -# 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!") +print("Generator check is clean!") \ No newline at end of file diff --git a/openfasoc/generators/temp-sense-gen/Makefile b/openfasoc/generators/temp-sense-gen/Makefile index 1c2cf3806..c3ce7b356 100644 --- a/openfasoc/generators/temp-sense-gen/Makefile +++ b/openfasoc/generators/temp-sense-gen/Makefile @@ -47,7 +47,6 @@ sky130hd_temp_verilog: sky130hd_temp: @python3 tools/temp-sense-gen.py --specfile test.json --outputDir ./work $(inv) $(ninv) $(head) $(nhead) --prepex $(sim_pex) --platform sky130hd --mode macro @python3 tools/parse_rpt.py - @tools/verify_op.sh @@echo "==================================================================================" @@echo "Thank you for using OpenFASOC" @@echo "For more info, please read the latest documentation on openfasoc.readthedocs.io" @@ -58,7 +57,6 @@ sky130hd_temp_full: # add --pex to also run pex simulations @python3 tools/temp-sense-gen.py --specfile test.json --outputDir ./work --platform sky130hd --mode full --prepex $(sim_pex) $(inv) $(ninv) $(head) $(nhead) @python3 tools/parse_rpt.py - @tools/verify_op.sh @@echo "==================================================================================" @@echo "Thank you for using OpenFASOC" @@echo "For more info, please read the latest documentation on openfasoc.readthedocs.io" @@ -81,4 +79,4 @@ banner: @@echo " | |_| | __/ | |___| |\ | _|/ ___ \ ___) | |_| | |___ " @@echo " \___/|_| |_____|_| \_|_| /_/ \_\|____/ \___/ \____|" @@echo "" - @@echo "===============================================================" + @@echo "===============================================================" \ No newline at end of file diff --git a/openfasoc/generators/temp-sense-gen/tools/check_gen_extensions b/openfasoc/generators/temp-sense-gen/tools/check_gen_extensions new file mode 100644 index 000000000..93a7f6b57 --- /dev/null +++ b/openfasoc/generators/temp-sense-gen/tools/check_gen_extensions @@ -0,0 +1,6 @@ +.gds +.spice +.v +_pex.spice +.sdc +.def \ No newline at end of file diff --git a/openfasoc/generators/temp-sense-gen/tools/parse_rpt.py b/openfasoc/generators/temp-sense-gen/tools/parse_rpt.py index df5408bb7..b1a8926e7 100644 --- a/openfasoc/generators/temp-sense-gen/tools/parse_rpt.py +++ b/openfasoc/generators/temp-sense-gen/tools/parse_rpt.py @@ -1,4 +1,15 @@ -drc_filename = "flow/reports/sky130hd/tempsense/6_final_drc.rpt" +import os, sys + +sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..')) +from common.check_gen_files import check_gen_files + +_generator_is = { + 'sky130hvl_ldo': 0, + 'sky130hd_temp': 1, + 'sky130XX_cryo': 0 +} + +drc_filename = "work/6_final_drc.rpt" num_lines = sum(1 for line in open(drc_filename)) if num_lines > 3: @@ -7,7 +18,7 @@ print("DRC is clean!") -lvs_filename = "flow/reports/sky130hd/tempsense/6_final_lvs.rpt" +lvs_filename = "work/6_final_lvs.rpt" with open(lvs_filename) as f: f1 = f.read() @@ -16,3 +27,10 @@ raise ValueError("LVS failed!") else: print("LVS is clean!") + +json_filename = "test.json" + +if check_gen_files(json_filename, _generator_is, " "): + print("Flow check is clean!") +else: + print("Flow check failed!") \ No newline at end of file diff --git a/openfasoc/generators/temp-sense-gen/tools/verify_op.sh b/openfasoc/generators/temp-sense-gen/tools/verify_op.sh deleted file mode 100755 index 2d3470f43..000000000 --- a/openfasoc/generators/temp-sense-gen/tools/verify_op.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -for file in error_within_x.csv golden_error_opt.csv search_result.csv -do - if ! [ -e $file ] - then - echo "[ERROR] $file is not created" - fi -done - -module_name=$(grep "module_name" test.json | cut -d "\"" -f 4) - -if [ -e work ] -then - cd work - for file in $module_name.def $module_name.gds $module_name\_pex.spice $module_name.spice $module_name.v $module_name.sdc - do - if ! [ -e $file ] - then - echo "[ERROR] $file is not created" - fi - done -else - echo "[ERROR] Work directory not created" -fi diff --git a/versions.txt b/versions.txt index 18bc77c62..7822834de 100644 --- a/versions.txt +++ b/versions.txt @@ -1,6 +1,6 @@ klayout - 0.28.12-1 OpenROAD - 2.0_10905 yosys - 0.35+7 -magic - 8.3.445 +magic - 8.3.447 netgen - 1.5.262 -open_pdks - 1.0.286 +open_pdks - 1.0.457 \ No newline at end of file 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 8/9] 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!") From 6d26a96f222ca0bcc0e7458388b6681e944cb3dc Mon Sep 17 00:00:00 2001 From: Chetanya <95761876+chetanyagoyal@users.noreply.github.com> Date: Wed, 15 Nov 2023 14:46:46 +0530 Subject: [PATCH 9/9] remove extra arg from simulation condition check --- .github/scripts/parse_rpt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/parse_rpt.py b/.github/scripts/parse_rpt.py index d8de6d10e..e01f62d03 100644 --- a/.github/scripts/parse_rpt.py +++ b/.github/scripts/parse_rpt.py @@ -111,7 +111,7 @@ else: print("Flow check failed!") -if len(sys.argv) == 1 and sys.argv[1] == "sky130hd_temp_full": +if len(sys.argv) == 1: 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"