krishnax12/t113-minimal-linux

Allwinner T113-S3 dual-Cortex-A7 SoC with integrated 128MB DDR3, multi-rail decoupling, 24MHz and 32.768kHz oscillators, filtering, and exposed test points.

Version
0.1.1
License
unset
Stars
0

scripts/check-schematic.py

"""Check formal schematic diagnostics and retain solver-invocation evidence."""
import collections
import hashlib
import json
import sys
from pathlib import Path

circuit_path, solver_path = map(Path, sys.argv[1:3])
circuit = json.loads(circuit_path.read_text())
solver_debug = json.loads(solver_path.read_text())
warning_counts = dict(collections.Counter(record["type"] for record in circuit if record["type"].endswith("_warning")))
error_counts = dict(collections.Counter(record["type"] for record in circuit if record["type"].endswith("_error")))
solver_counts = dict(collections.Counter(record["solver_name"] for record in solver_debug["solvers"]))
required_solvers = {"LayoutPipelineSolver", "SchematicTracePipelineSolver", "PackSolver2"}
report = {
    "passed": not warning_counts and not error_counts and required_solvers <= solver_counts.keys(),
    "formalWarnings": warning_counts,
    "formalErrors": error_counts,
    "solverCounts": solver_counts,
    "sourceBaselineSha256": hashlib.sha256(circuit_path.read_bytes()).hexdigest(),
    "scope": "Circuit JSON warning/error records and recorded solver invocations. Runtime solver iteration diagnostics remain in source-build.log and are not included in these counts.",
}
Path("routing/schematic-check.json").write_text(json.dumps(report, indent=2) + "\n")
print(json.dumps(report, indent=2))
if not report["passed"]:
    sys.exit(1)