Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dangling files, update parsing scripts across generators and workflows #251

Merged
merged 50 commits into from
Nov 12, 2023
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
81d5468
Delete openfasoc/generators/temp-sense-gen/tools/verify_op.sh
chetanyagoyal Oct 11, 2023
8ff30e7
Update parse_rpt.py
chetanyagoyal Oct 11, 2023
2a5bf58
Update Makefile
chetanyagoyal Oct 11, 2023
069f936
Update parse_rpt.py
chetanyagoyal Oct 11, 2023
aae4dae
Update parse_rpt.py
chetanyagoyal Oct 11, 2023
edd3eff
Update parse_rpt.py
chetanyagoyal Oct 11, 2023
78dcabb
Update parse_rpt.py
chetanyagoyal Oct 11, 2023
a24e75e
Update parse_rpt.py
chetanyagoyal Oct 11, 2023
bc8bce1
Update parse_rpt.py
chetanyagoyal Oct 11, 2023
ff6979e
Update parse_rpt.py
chetanyagoyal Oct 11, 2023
95eb257
Update parse_rpt.py
chetanyagoyal Oct 11, 2023
ebae01d
Update parse_rpt.py
chetanyagoyal Oct 16, 2023
42dc6ce
Update parse_rpt.py
chetanyagoyal Oct 16, 2023
ccd2951
Update parse_rpt.py
chetanyagoyal Oct 16, 2023
3b8d274
Update parse_rpt.py
chetanyagoyal Oct 16, 2023
81ac3e3
Update parse_rpt.py
chetanyagoyal Oct 16, 2023
7c9be0b
Update parse_rpt.py
chetanyagoyal Oct 16, 2023
318cba8
Update parse_rpt.py
chetanyagoyal Oct 16, 2023
963090b
Merge branch 'idea-fasoc:main' into main
chetanyagoyal Oct 27, 2023
42c8edb
Update save_images.tcl
chetanyagoyal Oct 27, 2023
d0c993d
Update save_images.tcl
chetanyagoyal Oct 27, 2023
92e826d
Change "content1" in if condition to "content2"
chetanyagoyal Oct 30, 2023
ad89183
add check for presence of json file
chetanyagoyal Nov 8, 2023
ed795dc
Merge branch 'idea-fasoc:main' into main
chetanyagoyal Nov 8, 2023
516ac53
modularised code and fixed misc. erros in .github/scripts/parse_rpt.py
chetanyagoyal Nov 8, 2023
f305756
created file extension file to make editable (in common folder)
chetanyagoyal Nov 8, 2023
b7ffbf8
moved extension list file to tools folders for each generator
chetanyagoyal Nov 8, 2023
49d615a
fix dubious if condition in .github/scripts/parse.py, add cryo libs
chetanyagoyal Nov 8, 2023
634db53
reform ldo_place.txt
chetanyagoyal Nov 8, 2023
d001629
add missing cryo library check in .github/scripts
chetanyagoyal Nov 9, 2023
e4ea479
Merge branch 'main' of https://github.com/chetanya-goyal/OpenFASOC_ha…
chetanyagoyal Nov 9, 2023
b53a2e4
Merge branch 'idea-fasoc:main' into main
chetanyagoyal Nov 9, 2023
bddf475
Remove block comment for file check
chetanyagoyal Nov 11, 2023
2174b3d
Remove block comment for file check
chetanyagoyal Nov 11, 2023
a5a9963
Remove block comment for file check
chetanyagoyal Nov 11, 2023
889a4aa
update file_paths to follow convention
chetanyagoyal Nov 11, 2023
2f64d4c
Remove redundant if statement
chetanyagoyal Nov 11, 2023
2b882be
Merge branch 'idea-fasoc:main' into main
chetanyagoyal Nov 11, 2023
b9cdbd9
Update if statements to set lvs and drc filenames
chetanyagoyal Nov 11, 2023
bb6c483
Update parse_rpt.py
chetanyagoyal Nov 11, 2023
ba5674c
Make all updates for modularity
chetanyagoyal Nov 11, 2023
2e9b5ad
make all updates for modularity
chetanyagoyal Nov 11, 2023
8ce7a99
make updates for modularity and add difference in workdir for cryo
chetanyagoyal Nov 11, 2023
8ac2a58
Modularise code and make the if-else conditions easier to read
chetanyagoyal Nov 11, 2023
93c824f
Update documentation
chetanyagoyal Nov 11, 2023
837a924
Convert documentation to google docstring format
chetanyagoyal Nov 11, 2023
91bb365
Add documentation
chetanyagoyal Nov 11, 2023
6431f34
Finalise
chetanyagoyal Nov 11, 2023
f31097c
Fix index error
chetanyagoyal Nov 11, 2023
2b90e9e
Update parse_rpt.py
chetanyagoyal Nov 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 40 additions & 12 deletions .github/scripts/parse_rpt.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,61 @@
import sys
chetanyagoyal marked this conversation as resolved.
Show resolved Hide resolved
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":
dir_path = r'flow/reports'
lib = os.listdir(dir_path)

if (len(sys.argv) == 1) or (sys.argv[1] == "sky130hvl_ldo"):
# temp-sense-gen and ldo-gen
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] == str(lib[0])):
# cryo
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":
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:
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:
# cryo LVS check
if (len(sys.argv) > 1) and (sys.argv[1] == str(lib[0])):
chetanyagoyal marked this conversation as resolved.
Show resolved Hide resolved
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!")

json_filename = "test.json"

if check_gen_files(json_filename, (len(sys.argv) == 1)):
print("Flow check is clean!")
else:
print("Flow check failed!")
1 change: 1 addition & 0 deletions openfasoc/generators/PMU-gen/tools/parse_rpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@
raise ValueError("LVS failed!")
else:
print("LVS is clean!")
print("Generator check is clean!")
5 changes: 4 additions & 1 deletion openfasoc/generators/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, is_tempsense)`: Used to check if the various files that should be generated by the flow are present in their required directories.
- `common.check_gen_extensions`
chetanyagoyal marked this conversation as resolved.
Show resolved Hide resolved
1. Stores the extensions of the files generated by the flow.
See individual function documentation for more information on a particular function.
"""
42 changes: 42 additions & 0 deletions openfasoc/generators/common/check_gen_files.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import json
import os

def check_gen_files(json_filename, is_tempsense) -> int:
with open(json_filename) as file:
data = json.load(file)

# print('Found .json config file...')

module_name = data.get("module_name", "default")

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 (is_tempsense):
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
8 changes: 8 additions & 0 deletions openfasoc/generators/cryo-gen/tools/check_gen_extensions
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.gds
.spice
.v
.cdl
_sim.spice
_pex.spice
.sdc
.def
19 changes: 16 additions & 3 deletions openfasoc/generators/cryo-gen/tools/parse_rpt.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
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

dir_path = r'flow/reports'
lib = os.listdir(dir_path)

drc_filename = "flow/reports/" + str(lib[0]) + "/cryo/6_final_drc.rpt"
num_lines = sum(1 for line in open(drc_filename))

if num_lines > 3:
raise ValueError("DRC failed!")
else:
print("DRC is clean!")

lvs_filename = "flow/reports/sky130hd/cyro/6_final_lvs.rpt"
lvs_filename = "flow/reports/" + str(lib[0]) + "/cryo/6_final_lvs.rpt"
lvs_line = subprocess.check_output(["tail", "-1", lvs_filename]).decode(
sys.stdout.encoding
)
Expand All @@ -22,3 +28,10 @@
raise ValueError("LVS failed!")
else:
print("LVS is clean!")

json_filename = "test.json"

if check_gen_files(json_filename, (len(sys.argv) == 1)):
print("Flow check is clean!")
else:
print("Flow check failed!")
1 change: 1 addition & 0 deletions openfasoc/generators/dcdc-gen/tools/parse_rpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@
raise ValueError("LVS failed!")
else:
print("LVS is clean!")
print("Generator check is clean!")
6 changes: 6 additions & 0 deletions openfasoc/generators/ldo-gen/tools/check_gen_extensions
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.gds
.spice
.v
_pex.spice
.sdc
.def
14 changes: 1 addition & 13 deletions openfasoc/generators/scpa-gen/tools/parse_rpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!")
2 changes: 0 additions & 2 deletions openfasoc/generators/temp-sense-gen/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.gds
.spice
.v
_pex.spice
.sdc
.def
16 changes: 14 additions & 2 deletions openfasoc/generators/temp-sense-gen/tools/parse_rpt.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
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

drc_filename = "work/6_final_drc.rpt"
num_lines = sum(1 for line in open(drc_filename))

if num_lines > 3:
Expand All @@ -7,7 +12,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()
Expand All @@ -16,3 +21,10 @@
raise ValueError("LVS failed!")
else:
print("LVS is clean!")

json_filename = "test.json"

if check_gen_files(json_filename, (len(sys.argv) == 1)):
print("Flow check is clean!")
else:
print("Flow check failed!")
25 changes: 0 additions & 25 deletions openfasoc/generators/temp-sense-gen/tools/verify_op.sh

This file was deleted.

Loading