|
|
@@ -1980,6 +1980,8 @@ def parse_td_cdc_report(path: Path) -> dict[str, Any] | None:
|
|
|
"schema": [],
|
|
|
"retained_sync_register": [],
|
|
|
"false_path_endpoint": [],
|
|
|
+ "false_path_source": [],
|
|
|
+ "structural_failure": [],
|
|
|
}
|
|
|
for raw_line in path.read_text(encoding="utf-8", errors="replace").splitlines():
|
|
|
line = raw_line.strip()
|
|
|
@@ -1995,12 +1997,20 @@ def parse_td_cdc_report(path: Path) -> dict[str, Any] | None:
|
|
|
return None
|
|
|
registers = rows["retained_sync_register"]
|
|
|
endpoints = rows["false_path_endpoint"]
|
|
|
- if len(registers) != len(set(registers)) or len(endpoints) != len(set(endpoints)):
|
|
|
+ sources = rows["false_path_source"]
|
|
|
+ failures = rows["structural_failure"]
|
|
|
+ if (
|
|
|
+ len(registers) != len(set(registers))
|
|
|
+ or len(endpoints) != len(set(endpoints))
|
|
|
+ or len(sources) != len(set(sources))
|
|
|
+ ):
|
|
|
return None
|
|
|
return {
|
|
|
"schema": CDC_REPORT_SCHEMA,
|
|
|
"retained_sync_registers": registers,
|
|
|
"false_path_endpoints": endpoints,
|
|
|
+ "source_only_false_paths": sources,
|
|
|
+ "structural_failures": failures,
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -2010,6 +2020,7 @@ def parse_td_fsm_report(path: Path) -> dict[str, Any] | None:
|
|
|
schema: str | None = None
|
|
|
axes: dict[str, int] = {}
|
|
|
encodings: dict[str, str] = {}
|
|
|
+ failures: list[str] = []
|
|
|
for raw_line in path.read_text(encoding="utf-8", errors="replace").splitlines():
|
|
|
line = raw_line.strip()
|
|
|
if not line or "=" not in line:
|
|
|
@@ -2020,6 +2031,9 @@ def parse_td_fsm_report(path: Path) -> dict[str, Any] | None:
|
|
|
return None
|
|
|
schema = value
|
|
|
continue
|
|
|
+ if key == "structural_failure":
|
|
|
+ failures.append(value)
|
|
|
+ continue
|
|
|
if key != "motion_phase":
|
|
|
return None
|
|
|
match = re.fullmatch(r"([xy]):(\d+):([a-z][a-z0-9_]*)", value)
|
|
|
@@ -2030,7 +2044,12 @@ def parse_td_fsm_report(path: Path) -> dict[str, Any] | None:
|
|
|
encodings[axis] = match.group(3)
|
|
|
if schema != FSM_REPORT_SCHEMA:
|
|
|
return None
|
|
|
- return {"schema": schema, "axes": axes, "encodings": encodings}
|
|
|
+ return {
|
|
|
+ "schema": schema,
|
|
|
+ "axes": axes,
|
|
|
+ "encodings": encodings,
|
|
|
+ "structural_failures": failures,
|
|
|
+ }
|
|
|
|
|
|
|
|
|
def structural_cdc_gate(
|
|
|
@@ -2042,8 +2061,12 @@ def structural_cdc_gate(
|
|
|
failures: list[str] = []
|
|
|
registers = report.get("retained_sync_registers") if isinstance(report, Mapping) else None
|
|
|
endpoints = report.get("false_path_endpoints") if isinstance(report, Mapping) else None
|
|
|
+ source_only = report.get("source_only_false_paths") if isinstance(report, Mapping) else None
|
|
|
+ reported = report.get("structural_failures") if isinstance(report, Mapping) else None
|
|
|
register_set = set(registers) if isinstance(registers, list) and all(isinstance(item, str) for item in registers) else set()
|
|
|
endpoint_set = set(endpoints) if isinstance(endpoints, list) and all(isinstance(item, str) for item in endpoints) else set()
|
|
|
+ source_set = set(source_only) if isinstance(source_only, list) and all(isinstance(item, str) for item in source_only) else set()
|
|
|
+ reported_failures = list(reported) if isinstance(reported, list) and all(isinstance(item, str) for item in reported) else []
|
|
|
|
|
|
if async_reg_count != len(EXPECTED_CDC_SYNC_REGISTERS):
|
|
|
failures.append(f"async_reg_used:{async_reg_count}")
|
|
|
@@ -2053,6 +2076,9 @@ def structural_cdc_gate(
|
|
|
failures.append("retained_sync_registers_mismatch")
|
|
|
if endpoint_set != EXPECTED_CDC_FALSE_PATH_ENDPOINTS:
|
|
|
failures.append("false_path_endpoints_mismatch")
|
|
|
+ if source_set:
|
|
|
+ failures.append(f"source_only_false_paths_used:{','.join(sorted(source_set))}")
|
|
|
+ failures.extend(f"td_report:{failure}" for failure in reported_failures)
|
|
|
|
|
|
return {
|
|
|
"status": "pass" if not failures else "fail",
|
|
|
@@ -2072,6 +2098,8 @@ def structural_cdc_gate(
|
|
|
"status": "pass" if endpoint_set == EXPECTED_CDC_FALSE_PATH_ENDPOINTS else "fail",
|
|
|
"used": len(endpoint_set),
|
|
|
},
|
|
|
+ "source_only_false_paths": sorted(source_set),
|
|
|
+ "reported_failures": reported_failures,
|
|
|
"failures": failures,
|
|
|
}
|
|
|
|
|
|
@@ -2084,8 +2112,10 @@ def structural_fsm_gate(
|
|
|
failures: list[str] = []
|
|
|
axes = report.get("axes") if isinstance(report, Mapping) else None
|
|
|
encodings = report.get("encodings") if isinstance(report, Mapping) else None
|
|
|
+ reported = report.get("structural_failures") if isinstance(report, Mapping) else None
|
|
|
normalized_axes = dict(axes) if isinstance(axes, Mapping) else {}
|
|
|
normalized_encodings = dict(encodings) if isinstance(encodings, Mapping) else {}
|
|
|
+ reported_failures = list(reported) if isinstance(reported, list) and all(isinstance(item, str) for item in reported) else []
|
|
|
if normalized_axes != EXPECTED_FSM_AXES:
|
|
|
failures.append("motion_phase_width_or_axis_mismatch")
|
|
|
if normalized_encodings != {axis: "sequential" for axis in EXPECTED_FSM_AXES}:
|
|
|
@@ -2101,12 +2131,14 @@ def structural_fsm_gate(
|
|
|
)
|
|
|
for encoding in reencoded:
|
|
|
failures.append(f"motion_phase_reencoded:{encoding.casefold()}")
|
|
|
+ failures.extend(f"td_report:{failure}" for failure in reported_failures)
|
|
|
return {
|
|
|
"status": "pass" if not failures else "fail",
|
|
|
"encoding": "sequential" if not failures else None,
|
|
|
"axes": normalized_axes,
|
|
|
"td_log_marker": marker_seen,
|
|
|
"reencoded_motion_phase_count": len(reencoded),
|
|
|
+ "reported_failures": reported_failures,
|
|
|
"failures": failures,
|
|
|
}
|
|
|
|