Add Layout F1 functional groups and crystal/NC checks.

Write routing-first domain/satellite topology after graph_build, and
flag crystal CL mismatches and NC pins on active nets without inventing
millimetres.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-12 16:22:56 +02:00
co-authored by Cursor
parent 30aaf55de6
commit 2950446e12
10 changed files with 1020 additions and 3 deletions
+20
View File
@@ -1538,6 +1538,24 @@ def _write_layout_graph(ws: PipelineWorkspace, project_id: str) -> None:
logger.exception("kicad_pcb parse failed — continuing without layout")
def _write_functional_groups(ws: PipelineWorkspace, graph) -> None:
"""Layout F1: topology domains/groups (no mm). Fail-soft."""
try:
from backend.pinscopex.functional_groups import build_functional_groups
from backend.pinscopex.validate import _build_constraints_map, _load_datasheets
extracted_dir = ws.local_path("extracted")
cmap = {}
if extracted_dir.is_dir():
cmap = _build_constraints_map(_load_datasheets(extracted_dir))
report = build_functional_groups(graph, cmap)
out = ws.local_path("functional_groups.json")
out.write_text(report.model_dump_json(indent=2) + "\n")
ws._upload_file("functional_groups.json")
except Exception:
logger.exception("functional_groups.json write failed — continuing")
def _write_impedance_nets(ws: PipelineWorkspace, graph) -> None:
"""ImpedenceFinder Z0 on routed signal nets. Skip without PCB stackup."""
path = ws.local_path("layout_graph.json")
@@ -1592,6 +1610,7 @@ async def _stage_graph_build(ctx: PipelineContext) -> None:
graph_path.write_text(ctx.graph.model_dump_json(indent=2) + "\n")
_write_layout_graph(ctx.ws, ctx.project_id)
_write_impedance_nets(ctx.ws, ctx.graph)
_write_functional_groups(ctx.ws, ctx.graph)
broker.publish(ctx.project_id, "step_update",
{"stage": "graph_build", "status": "complete",
@@ -2158,6 +2177,7 @@ async def run_regen_pipeline(
graph_path.write_text(graph.model_dump_json(indent=2) + "\n")
_write_layout_graph(ws, project_id)
_write_impedance_nets(ws, graph)
_write_functional_groups(ws, graph)
broker.publish(project_id, "step_update",
{"stage": "graph_build", "status": "complete",
+4
View File
@@ -63,6 +63,8 @@ from backend.pinscopex.errata_check import check_errata
from backend.pinscopex.internal_features_check import check_internal_features
from backend.pinscopex.placement_check import check_placement
from backend.pinscopex.si_check import check_si
from backend.pinscopex.crystal_cl_check import check_crystal_cl
from backend.pinscopex.nc_pin_check import check_nc_pins
TRACE_VERSION = 1
@@ -100,6 +102,8 @@ def _run_deterministic_checks(
("internal_features_check", lambda: check_internal_features(graph, constraints_map)),
("placement_check", lambda: check_placement(graph, constraints_map, layout)),
("si_check", lambda: check_si(graph, constraints_map, layout)),
("crystal_cl_check", lambda: check_crystal_cl(graph)),
("nc_pin_check", lambda: check_nc_pins(graph, constraints_map)),
):
try:
out.extend(fn())