|
@@ -1332,6 +1332,34 @@ def hdl_target_manifest_evidence(backend: str) -> dict[str, Any]:
|
|
|
return target_manifest_evidence(backend, observed)
|
|
return target_manifest_evidence(backend, observed)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+def _aggregate_hdl_sim_payload(
|
|
|
|
|
+ children: Mapping[str, Mapping[str, Any]],
|
|
|
|
|
+ *,
|
|
|
|
|
+ work_root: Path,
|
|
|
|
|
+) -> dict[str, Any]:
|
|
|
|
|
+ aggregate_manifest = hdl_target_manifest_evidence("all")
|
|
|
|
|
+ passed = (
|
|
|
|
|
+ all(child.get("status") == "pass" for child in children.values()) and
|
|
|
|
|
+ aggregate_manifest["status"] == "pass"
|
|
|
|
|
+ )
|
|
|
|
|
+ return {
|
|
|
|
|
+ "schema": HDL_RECEIPT_SCHEMA,
|
|
|
|
|
+ "status": "pass" if passed else "fail",
|
|
|
|
|
+ "verification_layer": "hdl_sim",
|
|
|
|
|
+ "profile": PROFILE,
|
|
|
|
|
+ "backend": "all",
|
|
|
|
|
+ "work_root": str(work_root),
|
|
|
|
|
+ "backend_results": dict(children),
|
|
|
|
|
+ "tests": [
|
|
|
|
|
+ item
|
|
|
|
|
+ for child in children.values()
|
|
|
|
|
+ for item in child.get("tests", [])
|
|
|
|
|
+ ],
|
|
|
|
|
+ "target_manifest": aggregate_manifest,
|
|
|
|
|
+ "safety": dict(SAFETY_BOUNDARY),
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
def hdl_sim_payload(
|
|
def hdl_sim_payload(
|
|
|
run: bool,
|
|
run: bool,
|
|
|
backend: str = "icarus",
|
|
backend: str = "icarus",
|
|
@@ -1400,27 +1428,7 @@ def hdl_sim_payload(
|
|
|
name: hdl_sim_payload(run=True, backend=name, work_root=resolved)
|
|
name: hdl_sim_payload(run=True, backend=name, work_root=resolved)
|
|
|
for name in ("icarus", "verilator", "cocotb")
|
|
for name in ("icarus", "verilator", "cocotb")
|
|
|
}
|
|
}
|
|
|
- aggregate_manifest = hdl_target_manifest_evidence("all")
|
|
|
|
|
- passed = (
|
|
|
|
|
- all(child.get("status") == "pass" for child in children.values()) and
|
|
|
|
|
- aggregate_manifest["status"] == "pass"
|
|
|
|
|
- )
|
|
|
|
|
- return {
|
|
|
|
|
- "schema": HDL_RECEIPT_SCHEMA,
|
|
|
|
|
- "status": "pass" if passed else "fail",
|
|
|
|
|
- "verification_layer": "hdl_sim",
|
|
|
|
|
- "profile": PROFILE,
|
|
|
|
|
- "backend": "all",
|
|
|
|
|
- "work_root": str(resolved),
|
|
|
|
|
- "backend_results": children,
|
|
|
|
|
- "tests": [
|
|
|
|
|
- item
|
|
|
|
|
- for child in children.values()
|
|
|
|
|
- for item in child.get("tests", [])
|
|
|
|
|
- ],
|
|
|
|
|
- "target_manifest": aggregate_manifest,
|
|
|
|
|
- "safety": dict(SAFETY_BOUNDARY),
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ return _aggregate_hdl_sim_payload(children, work_root=resolved)
|
|
|
|
|
|
|
|
|
|
|
|
|
def formal_payload(run: bool, *, work_root: Path | None = None) -> dict[str, Any]:
|
|
def formal_payload(run: bool, *, work_root: Path | None = None) -> dict[str, Any]:
|
|
@@ -1712,6 +1720,51 @@ def source_integrity_payload() -> dict[str, Any]:
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+def _offline_runner_exception_payload(
|
|
|
|
|
+ name: str,
|
|
|
|
|
+ *,
|
|
|
|
|
+ work_root: Path,
|
|
|
|
|
+ exception: Exception,
|
|
|
|
|
+) -> dict[str, Any]:
|
|
|
|
|
+ reason = f"{type(exception).__name__}: {exception}"
|
|
|
|
|
+ if name in {"icarus", "verilator", "cocotb"}:
|
|
|
|
|
+ return {
|
|
|
|
|
+ "schema": HDL_RECEIPT_SCHEMA,
|
|
|
|
|
+ "status": "fail",
|
|
|
|
|
+ "verification_layer": "hdl_sim",
|
|
|
|
|
+ "profile": PROFILE,
|
|
|
|
|
+ "backend": name,
|
|
|
|
|
+ "work_root": str(work_root),
|
|
|
|
|
+ "reason": reason,
|
|
|
|
|
+ "tests": [],
|
|
|
|
|
+ "target_manifest": hdl_target_manifest_evidence(name),
|
|
|
|
|
+ "safety": dict(SAFETY_BOUNDARY),
|
|
|
|
|
+ }
|
|
|
|
|
+ if name == "formal":
|
|
|
|
|
+ return {
|
|
|
|
|
+ "schema": FORMAL_RECEIPT_SCHEMA,
|
|
|
|
|
+ "status": "fail",
|
|
|
|
|
+ "verification_layer": "formal",
|
|
|
|
|
+ "profile": PROFILE,
|
|
|
|
|
+ "work_root": str(work_root),
|
|
|
|
|
+ "reason": reason,
|
|
|
|
|
+ "targets": [],
|
|
|
|
|
+ "target_manifest": target_manifest_evidence(
|
|
|
|
|
+ "formal",
|
|
|
|
|
+ {
|
|
|
|
|
+ target["name"]: list(target.get("tasks", []))
|
|
|
|
|
+ for target in formal_targets()
|
|
|
|
|
+ },
|
|
|
|
|
+ ),
|
|
|
|
|
+ "safety": dict(SAFETY_BOUNDARY),
|
|
|
|
|
+ }
|
|
|
|
|
+ return {
|
|
|
|
|
+ "status": "fail",
|
|
|
|
|
+ "work_root": str(work_root),
|
|
|
|
|
+ "reason": reason,
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
def strict_offline_gate_payload(
|
|
def strict_offline_gate_payload(
|
|
|
*,
|
|
*,
|
|
|
work_root: Path,
|
|
work_root: Path,
|
|
@@ -1734,11 +1787,61 @@ def strict_offline_gate_payload(
|
|
|
"safety": dict(SAFETY_BOUNDARY),
|
|
"safety": dict(SAFETY_BOUNDARY),
|
|
|
}
|
|
}
|
|
|
assert resolved is not None
|
|
assert resolved is not None
|
|
|
|
|
+ source_integrity = source_integrity_payload()
|
|
|
|
|
+ runner_roots = {
|
|
|
|
|
+ name: resolved / name
|
|
|
|
|
+ for name in ("unit", "icarus", "verilator", "cocotb", "formal")
|
|
|
|
|
+ }
|
|
|
|
|
+ runners = {
|
|
|
|
|
+ "unit": lambda: unit_payload(runner_roots["unit"]),
|
|
|
|
|
+ "icarus": lambda: hdl_sim_payload(
|
|
|
|
|
+ run=True,
|
|
|
|
|
+ backend="icarus",
|
|
|
|
|
+ work_root=runner_roots["icarus"],
|
|
|
|
|
+ ),
|
|
|
|
|
+ "verilator": lambda: hdl_sim_payload(
|
|
|
|
|
+ run=True,
|
|
|
|
|
+ backend="verilator",
|
|
|
|
|
+ work_root=runner_roots["verilator"],
|
|
|
|
|
+ ),
|
|
|
|
|
+ "cocotb": lambda: hdl_sim_payload(
|
|
|
|
|
+ run=True,
|
|
|
|
|
+ backend="cocotb",
|
|
|
|
|
+ work_root=runner_roots["cocotb"],
|
|
|
|
|
+ ),
|
|
|
|
|
+ "formal": lambda: formal_payload(
|
|
|
|
|
+ run=True,
|
|
|
|
|
+ work_root=runner_roots["formal"],
|
|
|
|
|
+ ),
|
|
|
|
|
+ }
|
|
|
|
|
+ runner_results: dict[str, dict[str, Any]] = {}
|
|
|
|
|
+ with ThreadPoolExecutor(max_workers=5) as executor:
|
|
|
|
|
+ futures = {
|
|
|
|
|
+ name: executor.submit(runner)
|
|
|
|
|
+ for name, runner in runners.items()
|
|
|
|
|
+ }
|
|
|
|
|
+ for name, future in futures.items():
|
|
|
|
|
+ try:
|
|
|
|
|
+ runner_results[name] = future.result()
|
|
|
|
|
+ except Exception as exc:
|
|
|
|
|
+ runner_results[name] = _offline_runner_exception_payload(
|
|
|
|
|
+ name,
|
|
|
|
|
+ work_root=runner_roots[name],
|
|
|
|
|
+ exception=exc,
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ hdl_children = {
|
|
|
|
|
+ name: runner_results[name]
|
|
|
|
|
+ for name in ("icarus", "verilator", "cocotb")
|
|
|
|
|
+ }
|
|
|
layers = {
|
|
layers = {
|
|
|
- "source_integrity": source_integrity_payload(),
|
|
|
|
|
- "unit": unit_payload(resolved),
|
|
|
|
|
- "hdl_sim": hdl_sim_payload(run=True, backend="all", work_root=resolved),
|
|
|
|
|
- "formal": formal_payload(run=True, work_root=resolved),
|
|
|
|
|
|
|
+ "source_integrity": source_integrity,
|
|
|
|
|
+ "unit": runner_results["unit"],
|
|
|
|
|
+ "hdl_sim": _aggregate_hdl_sim_payload(
|
|
|
|
|
+ hdl_children,
|
|
|
|
|
+ work_root=resolved,
|
|
|
|
|
+ ),
|
|
|
|
|
+ "formal": runner_results["formal"],
|
|
|
}
|
|
}
|
|
|
required = list(layers)
|
|
required = list(layers)
|
|
|
failures = [
|
|
failures = [
|
|
@@ -2310,7 +2413,7 @@ def post_route_pin_gate(rows: Sequence[Mapping[str, str]] | None) -> dict[str, A
|
|
|
normalized = [dict(row) for row in rows or []]
|
|
normalized = [dict(row) for row in rows or []]
|
|
|
by_name = {row.get("name"): row for row in normalized if row.get("name")}
|
|
by_name = {row.get("name"): row for row in normalized if row.get("name")}
|
|
|
locations = [str(row.get("location", "")) for row in normalized]
|
|
locations = [str(row.get("location", "")) for row in normalized]
|
|
|
- if len(normalized) != 41:
|
|
|
|
|
|
|
+ if len(normalized) != 43:
|
|
|
failures.append(f"io_row_count:{len(normalized)}")
|
|
failures.append(f"io_row_count:{len(normalized)}")
|
|
|
if len(by_name) != len(normalized):
|
|
if len(by_name) != len(normalized):
|
|
|
failures.append("io_name_not_unique")
|
|
failures.append("io_name_not_unique")
|
|
@@ -2412,7 +2515,7 @@ def pin_binding_gate() -> dict[str, Any]:
|
|
|
)
|
|
)
|
|
|
by_signal = {signal.strip(): (ball.strip(), standard.strip(), pull.strip()) for signal, ball, standard, pull in assignments}
|
|
by_signal = {signal.strip(): (ball.strip(), standard.strip(), pull.strip()) for signal, ball, standard, pull in assignments}
|
|
|
failures: list[str] = []
|
|
failures: list[str] = []
|
|
|
- if len(assignments) != 41:
|
|
|
|
|
|
|
+ if len(assignments) != 43:
|
|
|
failures.append(f"pad_count:{len(assignments)}")
|
|
failures.append(f"pad_count:{len(assignments)}")
|
|
|
if len(by_signal) != len(assignments):
|
|
if len(by_signal) != len(assignments):
|
|
|
failures.append("duplicate_signal")
|
|
failures.append("duplicate_signal")
|
|
@@ -2495,32 +2598,30 @@ def structural_resource_gate(
|
|
|
) -> dict[str, Any]:
|
|
) -> dict[str, Any]:
|
|
|
failures: list[str] = []
|
|
failures: list[str] = []
|
|
|
utilization = resources.get("utilization") if isinstance(resources, Mapping) else None
|
|
utilization = resources.get("utilization") if isinstance(resources, Mapping) else None
|
|
|
|
|
+ reported_resources = ("bram", "bram32k", "bram128k", "bram256k", "dsp")
|
|
|
|
|
+ exact_resources = {"pad": 43, "ireg": 0}
|
|
|
if not isinstance(utilization, Mapping):
|
|
if not isinstance(utilization, Mapping):
|
|
|
failures.append("resource_report_missing")
|
|
failures.append("resource_report_missing")
|
|
|
else:
|
|
else:
|
|
|
- expected = {
|
|
|
|
|
- "bram": 0,
|
|
|
|
|
- "bram32k": 0,
|
|
|
|
|
- "bram128k": 0,
|
|
|
|
|
- "bram256k": 0,
|
|
|
|
|
- "dsp": 0,
|
|
|
|
|
- "pad": 41,
|
|
|
|
|
- "ireg": 0,
|
|
|
|
|
- }
|
|
|
|
|
- for name, value in expected.items():
|
|
|
|
|
|
|
+ for name in reported_resources:
|
|
|
|
|
+ observed = utilization.get(name)
|
|
|
|
|
+ used = observed.get("used") if isinstance(observed, Mapping) else None
|
|
|
|
|
+ if not isinstance(used, int) or isinstance(used, bool) or used < 0:
|
|
|
|
|
+ failures.append(f"{name}_used:{used}")
|
|
|
|
|
+ for name, value in exact_resources.items():
|
|
|
observed = utilization.get(name)
|
|
observed = utilization.get(name)
|
|
|
used = observed.get("used") if isinstance(observed, Mapping) else None
|
|
used = observed.get("used") if isinstance(observed, Mapping) else None
|
|
|
- if used != value:
|
|
|
|
|
|
|
+ if used != value or isinstance(used, bool):
|
|
|
failures.append(f"{name}_used:{used}")
|
|
failures.append(f"{name}_used:{used}")
|
|
|
return {
|
|
return {
|
|
|
"status": "pass" if not failures else "fail",
|
|
"status": "pass" if not failures else "fail",
|
|
|
"required": {
|
|
"required": {
|
|
|
- "bram": 0,
|
|
|
|
|
- "bram32k": 0,
|
|
|
|
|
- "bram128k": 0,
|
|
|
|
|
- "bram256k": 0,
|
|
|
|
|
- "dsp": 0,
|
|
|
|
|
- "pad": 41,
|
|
|
|
|
|
|
+ "bram": "reported_nonnegative_integer",
|
|
|
|
|
+ "bram32k": "reported_nonnegative_integer",
|
|
|
|
|
+ "bram128k": "reported_nonnegative_integer",
|
|
|
|
|
+ "bram256k": "reported_nonnegative_integer",
|
|
|
|
|
+ "dsp": "reported_nonnegative_integer",
|
|
|
|
|
+ "pad": 43,
|
|
|
"ireg": 0,
|
|
"ireg": 0,
|
|
|
},
|
|
},
|
|
|
"failures": failures,
|
|
"failures": failures,
|
|
@@ -3415,19 +3516,15 @@ def _td_final_failures(
|
|
|
|
|
|
|
|
resources = receipt.get("resources")
|
|
resources = receipt.get("resources")
|
|
|
utilization = resources.get("utilization") if isinstance(resources, Mapping) else None
|
|
utilization = resources.get("utilization") if isinstance(resources, Mapping) else None
|
|
|
- required_resources = {
|
|
|
|
|
- "bram": 0,
|
|
|
|
|
- "bram32k": 0,
|
|
|
|
|
- "bram128k": 0,
|
|
|
|
|
- "bram256k": 0,
|
|
|
|
|
- "dsp": 0,
|
|
|
|
|
- "pad": 41,
|
|
|
|
|
- "ireg": 0,
|
|
|
|
|
- }
|
|
|
|
|
- for name, expected in required_resources.items():
|
|
|
|
|
|
|
+ for name in ("bram", "bram32k", "bram128k", "bram256k", "dsp"):
|
|
|
|
|
+ item = utilization.get(name) if isinstance(utilization, Mapping) else None
|
|
|
|
|
+ used = item.get("used") if isinstance(item, Mapping) else None
|
|
|
|
|
+ if not isinstance(used, int) or isinstance(used, bool) or used < 0:
|
|
|
|
|
+ failures.append(prefix + f"resource:{name}:{used}")
|
|
|
|
|
+ for name, expected in {"pad": 43, "ireg": 0}.items():
|
|
|
item = utilization.get(name) if isinstance(utilization, Mapping) else None
|
|
item = utilization.get(name) if isinstance(utilization, Mapping) else None
|
|
|
used = item.get("used") if isinstance(item, Mapping) else None
|
|
used = item.get("used") if isinstance(item, Mapping) else None
|
|
|
- if used != expected:
|
|
|
|
|
|
|
+ if used != expected or isinstance(used, bool):
|
|
|
failures.append(prefix + f"resource:{name}:{used}")
|
|
failures.append(prefix + f"resource:{name}:{used}")
|
|
|
|
|
|
|
|
timing = receipt.get("timing")
|
|
timing = receipt.get("timing")
|
|
@@ -3443,7 +3540,7 @@ def _td_final_failures(
|
|
|
|
|
|
|
|
routed_pins = receipt.get("post_route_pin_gate")
|
|
routed_pins = receipt.get("post_route_pin_gate")
|
|
|
if isinstance(routed_pins, Mapping):
|
|
if isinstance(routed_pins, Mapping):
|
|
|
- if routed_pins.get("row_count") != 41:
|
|
|
|
|
|
|
+ if routed_pins.get("row_count") != 43:
|
|
|
failures.append(prefix + "post_route_pin_count")
|
|
failures.append(prefix + "post_route_pin_count")
|
|
|
observed = routed_pins.get("observed")
|
|
observed = routed_pins.get("observed")
|
|
|
expected_pins = {
|
|
expected_pins = {
|