Skip to content

Commit

Permalink
Fix missing values in final metrics generated
Browse files Browse the repository at this point in the history
Signed-off-by: Kareem Farid <kareefardi@users.noreply.github.com>
  • Loading branch information
kareefardi committed Jun 25, 2024
1 parent e0d2e61 commit 063e0ad
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 28 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,6 @@ pdks/
/install

# Venv
/venv
/venv

sandbox
84 changes: 57 additions & 27 deletions scripts/report/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import json
import yaml
import fnmatch
import glob
from collections import defaultdict
from typing import Iterable, Optional, Dict

Expand All @@ -40,6 +41,7 @@ def __init__(
step: str,
filename: str,
find_by_partial_match: bool = False,
wildcard: bool = False,
):
self.run_path = run_path
self.kind = kind
Expand All @@ -48,6 +50,17 @@ def __init__(
self.pathname = os.path.join(self.run_path, self.kind, self.step)
self.filename = filename

if wildcard:
matches = glob.glob(self.pathname)
if len(matches) > 1:
print(
f"Too many matches for {self.pathname}",
file=sys.stderr,
)
exit(1)
else:
self.pathname = matches[0]

self.index, self.path = get_name(
self.pathname, self.filename, find_by_partial_match
)
Expand Down Expand Up @@ -149,7 +162,6 @@ def __init__(
"pin_antenna_violations",
"net_antenna_violations",
"lvs_total_errors",
"cvc_total_errors",
"klayout_violations",
"wire_length",
"vias",
Expand Down Expand Up @@ -239,7 +251,6 @@ def reports_from_logs(self):
("rsz_design", Artifact(rp, "logs", "routing", "rsz_design_sta.log")),
("rsz_timing", Artifact(rp, "logs", "routing", "rsz_timing_sta.log")),
("grt", Artifact(rp, "logs", "routing", "grt_sta.log")),
("rcx", Artifact(rp, "logs", "signoff", "rcx_sta.log")),
(
"sta-rcx_nom/multi_corner",
Artifact(rp, "logs", "signoff", "rcx_mcsta.nom.log"),
Expand Down Expand Up @@ -343,7 +354,13 @@ def re_get_last_capture(rx, string):

# Power after parasitics-extraction, multi-corner STA
power_multi_corner_sta = defaultdict(lambda: defaultdict(lambda: -1))
power_report = Artifact(rp, "reports", "signoff", "rcx_sta.power.rpt")
power_report = Artifact(
rp,
"reports",
"signoff/*sta-rcx_nom",
"multi_corner_sta.power.rpt",
wildcard=True,
)
power_report_content = power_report.get_content()
if power_report_content is not None:
current_corner = None
Expand Down Expand Up @@ -379,10 +396,16 @@ def re_get_last_capture(rx, string):
power_multi_corner_sta["fastest"]["switching"],
power_multi_corner_sta["fastest"]["leakage"],
]

# Critical path
critical_path_ns = -1
critical_path_report = Artifact(rp, "reports", "signoff", "rcx_sta.max.rpt")
critical_path_report = Artifact(
rp,
"reports",
"signoff/*sta-rcx_nom",
"multi_corner_sta.max.rpt",
True,
wildcard=True,
)
critical_path_report_content = critical_path_report.get_content()
if critical_path_report_content is not None:
start = 0
Expand Down Expand Up @@ -495,7 +518,7 @@ def re_get_last_capture(rx, string):
magic_violations = (magic_violations_raw + 3) // 4

# KLayout DRC Violations
klayout_drc = Artifact(rp, "reports", "signoff", "magic.lydrc", True)
klayout_drc = Artifact(rp, "reports", "signoff", "drc.klayout.xml", True)
klayout_drc_content = klayout_drc.get_content()

klayout_violations = -1
Expand Down Expand Up @@ -533,10 +556,14 @@ def re_get_last_capture(rx, string):

# STA Report Extractions
def sta_report_extraction(
sta_report_filename: str, filter: str, kind="reports", step="synthesis"
sta_report_filename: str,
filter: str,
kind="reports",
step="synthesis",
wildcard=False,
):
value = -1
report = Artifact(rp, kind, step, sta_report_filename)
report = Artifact(rp, kind, step, sta_report_filename, wildcard=wildcard)
report_content = report.get_content()
if report_content is not None:
match = re.search(rf"{filter}\s+(-?[\d\.]+)", report_content)
Expand All @@ -551,20 +578,34 @@ def sta_report_extraction(
return value

wns = sta_report_extraction("syn_sta.summary.rpt", "wns", step="synthesis")
spef_wns = sta_report_extraction("rcx_sta.summary.rpt", "wns", step="signoff")
opt_wns = sta_report_extraction("rt_rsz_sta.summary.rpt", "wns", step="routing")
spef_wns = sta_report_extraction(
"multi_corner_sta.summary.rpt",
"wns",
step="signoff/*sta-rcx_nom",
wildcard=True,
)
opt_wns = sta_report_extraction("grt_sta.summary.rpt", "wns", step="routing")
pl_wns = sta_report_extraction(
"global.log", "wns", kind="logs", step="placement"
"gpl_sta.log", "wns", kind="logs", step="placement"
)
fr_wns = sta_report_extraction(
"grt_sta.log", "wns", kind="logs", step="routing"
)
fr_wns = sta_report_extraction("global.log", "wns", kind="logs", step="routing")

tns = sta_report_extraction("syn_sta.summary.rpt", "tns", step="synthesis")
spef_tns = sta_report_extraction("rcx_sta.summary.rpt", "tns", step="signoff")
opt_tns = sta_report_extraction("rt_rsz_sta.summary.rpt", "tns", step="routing")
spef_tns = sta_report_extraction(
"multi_corner_sta.summary.rpt",
"tns",
step="signoff/*-sta-rcx_nom",
wildcard=True,
)
opt_tns = sta_report_extraction("grt_sta.summary.rpt", "tns", step="routing")
pl_tns = sta_report_extraction(
"global.log", "tns", kind="logs", step="placement"
"gpl_sta.log", "tns", kind="logs", step="placement"
)
fr_tns = sta_report_extraction(
"grt_sta.log", "tns", kind="logs", step="routing"
)
fr_tns = sta_report_extraction("global.log", "tns", kind="logs", step="routing")

# Yosys Metrics
yosys_metrics = [
Expand Down Expand Up @@ -708,16 +749,6 @@ def count_cells(cell_wildcards, def_content):
if match is not None:
lvs_total_errors = int(match[1])

# CVC Total Errors
cvc_log = Artifact(rp, "logs", "signoff", "erc_screen.log")
cvc_log_content = cvc_log.get_content()

cvc_total_errors = -1
if cvc_log_content is not None:
match = re.search(r"CVC:\s*Total:\s*(\d+)", cvc_log_content)
if match is not None:
cvc_total_errors = int(match[1])

return [
flow_status,
total_runtime,
Expand All @@ -738,7 +769,6 @@ def count_cells(cell_wildcards, def_content):
pin_antenna_violations,
net_antenna_violations,
lvs_total_errors,
cvc_total_errors,
klayout_violations,
wire_length,
vias,
Expand Down

0 comments on commit 063e0ad

Please sign in to comment.