|
|
@@ -35,6 +35,9 @@ TRIALS = {
|
|
|
}
|
|
|
CANDIDATES = tuple(top for pair in TRIALS.values() for top in pair)
|
|
|
|
|
|
+TIMING_MEASURED = "MEASURED_REGISTER_TO_REGISTER_PATH"
|
|
|
+TIMING_NOT_APPLICABLE = "NOT_APPLICABLE_NO_REG_TO_REG_PATH"
|
|
|
+
|
|
|
|
|
|
def sha256(path: Path) -> str:
|
|
|
digest = hashlib.sha256()
|
|
|
@@ -116,9 +119,24 @@ def parse_candidate(top: str, root: Path) -> dict[str, object]:
|
|
|
slice_matches = re.findall(r"(\d+)\s+mslices,\s+(\d+)\s+lslices", log_text, re.IGNORECASE)
|
|
|
mslice = int(slice_matches[-1][0]) if slice_matches else None
|
|
|
lslice = int(slice_matches[-1][1]) if slice_matches else None
|
|
|
+ reported_total_luts = first_int(area, (r"^#Total_luts\s+(\d+)",))
|
|
|
+ lut = first_int(area, (r"^#lut\s+(\d+)",))
|
|
|
+ fmax_mhz = first_float(
|
|
|
+ timing,
|
|
|
+ (r"Fmax[^\n]*?([0-9]+(?:\.[0-9]+)?)\s*MHz", r"([0-9]+(?:\.[0-9]+)?)\s*MHz"),
|
|
|
+ )
|
|
|
+ register_to_register_path = bool(
|
|
|
+ re.search(r"^From Clock\s*:\s*\S+", timing, re.IGNORECASE | re.MULTILINE)
|
|
|
+ and re.search(r"^To Clock\s*:\s*\S+", timing, re.IGNORECASE | re.MULTILINE)
|
|
|
+ )
|
|
|
+ violation_endpoint_counts = [
|
|
|
+ int(value)
|
|
|
+ for value in re.findall(r"(\d+)\s+Viol Endpoints", timing, re.IGNORECASE)
|
|
|
+ ]
|
|
|
metrics = {
|
|
|
- "total_luts": first_int(area, (r"^#Total_luts\s+(\d+)",)),
|
|
|
- "lut": first_int(area, (r"^#lut\s+(\d+)",)),
|
|
|
+ "total_luts": reported_total_luts if reported_total_luts is not None else lut,
|
|
|
+ "total_luts_source": "#Total_luts" if reported_total_luts is not None else "#lut_fallback",
|
|
|
+ "lut": lut,
|
|
|
"registers": first_int(area, (r"^#reg\s+(\d+)",)),
|
|
|
"dsp": first_int(area, (r"^#dsp\s+(\d+)",)),
|
|
|
"eram_bram": first_int(area, (r"^#(?:eram|bram)\s+(\d+)",)),
|
|
|
@@ -126,15 +144,28 @@ def parse_candidate(top: str, root: Path) -> dict[str, object]:
|
|
|
"lslice": lslice,
|
|
|
"packed_slices": mslice + lslice if mslice is not None and lslice is not None else None,
|
|
|
"packed_slices_derivation": "mslice_plus_lslice",
|
|
|
- "fmax_mhz": first_float(
|
|
|
- timing,
|
|
|
- (r"Fmax[^\n]*?([0-9]+(?:\.[0-9]+)?)\s*MHz", r"([0-9]+(?:\.[0-9]+)?)\s*MHz"),
|
|
|
+ "fmax_mhz": fmax_mhz,
|
|
|
+ "timing_applicability": (
|
|
|
+ TIMING_MEASURED if register_to_register_path else TIMING_NOT_APPLICABLE
|
|
|
+ ),
|
|
|
+ "register_to_register_path_present": register_to_register_path,
|
|
|
+ "violation_endpoint_counts": violation_endpoint_counts,
|
|
|
+ "all_violation_endpoint_counts_zero": all(
|
|
|
+ value == 0 for value in violation_endpoint_counts
|
|
|
),
|
|
|
"setup_slack_ns": first_float(
|
|
|
- timing, (r"(?:Setup|WNS)[^\n]*?(-?[0-9]+(?:\.[0-9]+)?)\s*ns",)
|
|
|
+ timing,
|
|
|
+ (
|
|
|
+ r"^\s*SWNS\s*:\s*(-?[0-9]+(?:\.[0-9]+)?)\s*ns",
|
|
|
+ r"(?:Setup|WNS)[^\n]*?(-?[0-9]+(?:\.[0-9]+)?)\s*ns",
|
|
|
+ ),
|
|
|
),
|
|
|
"hold_slack_ns": first_float(
|
|
|
- timing, (r"(?:Hold|HWNS)[^\n]*?(-?[0-9]+(?:\.[0-9]+)?)\s*ns",)
|
|
|
+ timing,
|
|
|
+ (
|
|
|
+ r"^\s*HWNS\s*:\s*(-?[0-9]+(?:\.[0-9]+)?)\s*ns",
|
|
|
+ r"(?:Hold|HWNS)[^\n]*?(-?[0-9]+(?:\.[0-9]+)?)\s*ns",
|
|
|
+ ),
|
|
|
),
|
|
|
}
|
|
|
return {
|
|
|
@@ -150,22 +181,101 @@ def parse_candidate(top: str, root: Path) -> dict[str, object]:
|
|
|
}
|
|
|
|
|
|
|
|
|
+def evaluate_timing(metrics: dict[str, object]) -> dict[str, object]:
|
|
|
+ """Evaluate timing while distinguishing designs with no reg-to-reg path."""
|
|
|
+ setup_slack = metrics["setup_slack_ns"]
|
|
|
+ hold_slack = metrics["hold_slack_ns"]
|
|
|
+ violation_counts = metrics["violation_endpoint_counts"]
|
|
|
+ common_pass = bool(
|
|
|
+ setup_slack is not None
|
|
|
+ and hold_slack is not None
|
|
|
+ and setup_slack >= 0.0
|
|
|
+ and hold_slack >= 0.0
|
|
|
+ and all(value == 0 for value in violation_counts)
|
|
|
+ )
|
|
|
+ applicability = metrics["timing_applicability"]
|
|
|
+ if applicability == TIMING_NOT_APPLICABLE:
|
|
|
+ passed = common_pass and metrics["fmax_mhz"] is None
|
|
|
+ return {
|
|
|
+ "status": "PASS" if passed else "FAIL",
|
|
|
+ "classification": TIMING_NOT_APPLICABLE,
|
|
|
+ "fmax_requirement": "NOT_APPLICABLE",
|
|
|
+ "meets_25mhz": None,
|
|
|
+ "reason": (
|
|
|
+ "No register-to-register path; all reported setup/hold slacks and "
|
|
|
+ "violation counts are non-negative/zero."
|
|
|
+ if passed
|
|
|
+ else "No register-to-register path, but timing status is incomplete or failing."
|
|
|
+ ),
|
|
|
+ }
|
|
|
+
|
|
|
+ fmax_mhz = metrics["fmax_mhz"]
|
|
|
+ passed = bool(
|
|
|
+ common_pass
|
|
|
+ and violation_counts
|
|
|
+ and fmax_mhz is not None
|
|
|
+ and fmax_mhz >= 25.0
|
|
|
+ )
|
|
|
+ return {
|
|
|
+ "status": "PASS" if passed else "FAIL",
|
|
|
+ "classification": TIMING_MEASURED,
|
|
|
+ "fmax_requirement": "AT_LEAST_25_MHZ",
|
|
|
+ "meets_25mhz": bool(fmax_mhz is not None and fmax_mhz >= 25.0),
|
|
|
+ "reason": (
|
|
|
+ "Register-to-register Fmax and all setup/hold checks pass."
|
|
|
+ if passed
|
|
|
+ else "Register-to-register timing is missing, below 25 MHz, or has violations."
|
|
|
+ ),
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
def warning_audit(log_path: Path) -> dict[str, object]:
|
|
|
lines = log_path.read_text(encoding="utf-8", errors="replace").splitlines()
|
|
|
+ severity = re.compile(
|
|
|
+ r"^\s*(?:(?:[A-Z][A-Z0-9_-]*-\d+)\s+)?"
|
|
|
+ r"(?:CRITICAL-WARNING|WARNING|ERROR|FATAL)\s*:",
|
|
|
+ re.IGNORECASE,
|
|
|
+ )
|
|
|
noteworthy = [
|
|
|
line.strip()
|
|
|
for line in lines
|
|
|
- if re.search(r"\b(?:warning|error|fatal|unrouted|violation)\b", line, re.IGNORECASE)
|
|
|
+ if severity.search(line)
|
|
|
+ or re.search(
|
|
|
+ r"Bitgen will abort|No ADC ports:|\bunrouted\b|\bviolations?\b",
|
|
|
+ line,
|
|
|
+ re.IGNORECASE,
|
|
|
+ )
|
|
|
]
|
|
|
+ allowlisted = [
|
|
|
+ line
|
|
|
+ for line in noteworthy
|
|
|
+ if re.search(r"\bSYN-6021\b|Bitgen will abort|No ADC ports:", line, re.IGNORECASE)
|
|
|
+ ]
|
|
|
+ blocking_patterns = (
|
|
|
+ re.compile(
|
|
|
+ r"^\s*(?:(?:[A-Z][A-Z0-9_-]*-\d+)\s+)?(?:ERROR|FATAL)\s*:",
|
|
|
+ re.IGNORECASE,
|
|
|
+ ),
|
|
|
+ re.compile(r"^\s*\[(?:ERROR|FATAL)\]", re.IGNORECASE),
|
|
|
+ re.compile(
|
|
|
+ r"\b(?:synthesis|placement|place\s*&\s*route|routing|route|fit|bitgen)"
|
|
|
+ r"\s+(?:failed|failure)\b",
|
|
|
+ re.IGNORECASE,
|
|
|
+ ),
|
|
|
+ re.compile(r"\b(?:setup|hold|timing)\s+(?:check\s+)?(?:failed|failure)\b", re.IGNORECASE),
|
|
|
+ re.compile(r"(?:\b[1-9]\d*\s+unrouted\b|\bunrouted\s*[:=]\s*[1-9]\d*)", re.IGNORECASE),
|
|
|
+ )
|
|
|
blocking = [
|
|
|
line
|
|
|
for line in noteworthy
|
|
|
- if re.search(r"\b(?:error|fatal|unrouted|timing violation)\b", line, re.IGNORECASE)
|
|
|
+ if any(pattern.search(line) for pattern in blocking_patterns)
|
|
|
]
|
|
|
return {
|
|
|
"status": "FAIL" if blocking else "PASS",
|
|
|
"noteworthy_count": len(noteworthy),
|
|
|
"blocking_count": len(blocking),
|
|
|
+ "allowlisted_expected_count": len(allowlisted),
|
|
|
+ "allowlisted_expected": allowlisted[:100],
|
|
|
"noteworthy": noteworthy[:200],
|
|
|
"blocking": blocking[:100],
|
|
|
}
|
|
|
@@ -232,15 +342,16 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
metrics = parsed["metrics"]
|
|
|
required_metrics = (
|
|
|
"total_luts", "lut", "registers", "dsp", "eram_bram", "mslice",
|
|
|
- "lslice", "packed_slices", "fmax_mhz", "setup_slack_ns", "hold_slack_ns",
|
|
|
+ "lslice", "packed_slices", "setup_slack_ns", "hold_slack_ns",
|
|
|
)
|
|
|
missing_metrics = [name for name in required_metrics if metrics[name] is None]
|
|
|
- timing_pass = bool(
|
|
|
- not missing_metrics
|
|
|
- and metrics["fmax_mhz"] >= 25.0
|
|
|
- and metrics["setup_slack_ns"] >= 0.0
|
|
|
- and metrics["hold_slack_ns"] >= 0.0
|
|
|
- )
|
|
|
+ if (
|
|
|
+ metrics["timing_applicability"] == TIMING_MEASURED
|
|
|
+ and metrics["fmax_mhz"] is None
|
|
|
+ ):
|
|
|
+ missing_metrics.append("fmax_mhz")
|
|
|
+ timing_evaluation = evaluate_timing(metrics)
|
|
|
+ timing_pass = timing_evaluation["status"] == "PASS"
|
|
|
candidate_status = "PASS" if (
|
|
|
run["exit_code"] == 0
|
|
|
and not run["timed_out"]
|
|
|
@@ -257,6 +368,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
"missing_outputs": missing,
|
|
|
"missing_metrics": missing_metrics,
|
|
|
"timing_pass_25mhz": timing_pass,
|
|
|
+ "timing_evaluation": timing_evaluation,
|
|
|
"warning_audit": audit,
|
|
|
"outputs": {
|
|
|
name: {"path": str(path), "sha256": sha256(path)}
|