-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'idea-fasoc:main' into main
- Loading branch information
Showing
18 changed files
with
241 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,112 @@ | ||
""" | ||
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!") | ||
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!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
magic==8.3.445_3_g7db77d4 | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,9 @@ libz-dev | |
build-essential | ||
time | ||
git | ||
bison | ||
flex | ||
libx11-dev | ||
libx11-6 | ||
libxaw7-dev | ||
libreadline6-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,4 @@ | |
raise ValueError("LVS failed!") | ||
else: | ||
print("LVS is clean!") | ||
print("Generator check is clean!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.gds | ||
.spice | ||
.v | ||
.cdl | ||
_sim.spice | ||
_pex.spice | ||
.sdc | ||
.def |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,4 @@ | |
raise ValueError("LVS failed!") | ||
else: | ||
print("LVS is clean!") | ||
print("Generator check is clean!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.gds | ||
.spice | ||
.v | ||
_pex.spice | ||
.sdc | ||
.def |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
openfasoc/generators/temp-sense-gen/tools/check_gen_extensions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.gds | ||
.spice | ||
.v | ||
_pex.spice | ||
.sdc | ||
.def |
Oops, something went wrong.