@tscircuit/schematic-trace-solver 0.0.153 → 0.0.155

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +354 -118
  3. package/lib/solvers/AvailableNetOrientationSolver/AvailableNetOrientationSolver.ts +60 -16
  4. package/lib/solvers/SameNetJunctionAlignmentSolver/alignSameNetJunctions.ts +81 -8
  5. package/lib/solvers/TraceCleanupSolver/alignSameNetRails.ts +17 -0
  6. package/lib/solvers/TraceCleanupSolver/sameNetRailAlignment/evaluateRailGroup.ts +32 -4
  7. package/lib/solvers/TraceCleanupSolver/sameNetRailAlignment/getComponentSideRailSegments.ts +28 -5
  8. package/lib/solvers/TraceCleanupSolver/sameNetRailAlignment/getFixedLabelCoordinate.ts +114 -0
  9. package/lib/solvers/TraceCleanupSolver/sameNetRailAlignment/getRailGroups.ts +98 -32
  10. package/lib/solvers/TraceCleanupSolver/sameNetRailAlignment/moveRailSegments.ts +2 -0
  11. package/package.json +1 -1
  12. package/site/bug-reports/bug-report-20260825T103621Z.page.tsx +4 -0
  13. package/tests/bug-reports/bug-report-20260707T134549Z/__snapshots__/bug-report-20260707T134549Z.snap.svg +2 -2
  14. package/tests/bug-reports/bug-report-20260730T061837Z/__snapshots__/bug-report-20260730T061837Z.snap.svg +2 -2
  15. package/tests/bug-reports/bug-report-20260825T103621Z/__snapshots__/bug-report-20260825T103621Z.snap.svg +452 -0
  16. package/tests/bug-reports/bug-report-20260825T103621Z/bug-report-20260825T103621Z.json +1696 -0
  17. package/tests/bug-reports/bug-report-20260825T103621Z/bug-report-20260825T103621Z.test.ts +12 -0
  18. package/tests/examples/__snapshots__/example51.snap.svg +2 -2
  19. package/tests/repros/__snapshots__/repro-pga300-c6-trace-alignment.snap.svg +88 -0
  20. package/tests/repros/__snapshots__/repro-ti-power-output-section.snap.svg +45 -45
  21. package/tests/repros/assets/repro-pga300-c6-trace-alignment.input.json +97 -0
  22. package/tests/repros/repro-pga300-c6-trace-alignment.test.ts +36 -0
@@ -0,0 +1,97 @@
1
+ {
2
+ "chips": [
3
+ {
4
+ "chipId": "U1",
5
+ "center": { "x": -4.2, "y": 0 },
6
+ "width": 4.6,
7
+ "height": 8,
8
+ "pins": [
9
+ { "pinId": "U1.VINPP", "x": -6.5, "y": 0.75 },
10
+ { "pinId": "U1.VINPN", "x": -6.5, "y": 0.24 }
11
+ ]
12
+ },
13
+ {
14
+ "chipId": "R2",
15
+ "center": { "x": -10.1, "y": 0.95 },
16
+ "width": 0.6,
17
+ "height": 0.68,
18
+ "pins": [
19
+ {
20
+ "pinId": "R2.1",
21
+ "x": -10.4,
22
+ "y": 0.95,
23
+ "_facingDirection": "x-"
24
+ },
25
+ {
26
+ "pinId": "R2.2",
27
+ "x": -9.8,
28
+ "y": 0.95,
29
+ "_facingDirection": "x+"
30
+ }
31
+ ]
32
+ },
33
+ {
34
+ "chipId": "R3",
35
+ "center": { "x": -10.1, "y": 0.15 },
36
+ "width": 0.6,
37
+ "height": 0.68,
38
+ "pins": [
39
+ {
40
+ "pinId": "R3.1",
41
+ "x": -10.4,
42
+ "y": 0.15,
43
+ "_facingDirection": "x-"
44
+ },
45
+ {
46
+ "pinId": "R3.2",
47
+ "x": -9.8,
48
+ "y": 0.15,
49
+ "_facingDirection": "x+"
50
+ }
51
+ ]
52
+ },
53
+ {
54
+ "chipId": "C6",
55
+ "center": { "x": -8.3775, "y": 0.55 },
56
+ "width": 1.045,
57
+ "height": 0.76,
58
+ "pins": [
59
+ {
60
+ "pinId": "C6.1",
61
+ "x": -8.45,
62
+ "y": 0.93,
63
+ "_facingDirection": "y+"
64
+ },
65
+ {
66
+ "pinId": "C6.2",
67
+ "x": -8.45,
68
+ "y": 0.17,
69
+ "_facingDirection": "y-"
70
+ }
71
+ ]
72
+ }
73
+ ],
74
+ "directConnections": [
75
+ {
76
+ "pinIds": ["U1.VINPP", "R2.2"],
77
+ "netId": "U1.VINPP to R2.pin2"
78
+ },
79
+ {
80
+ "pinIds": ["R2.2", "C6.1"],
81
+ "netId": "R2.pin2 to C6.pin1"
82
+ },
83
+ {
84
+ "pinIds": ["U1.VINPN", "R3.2"],
85
+ "netId": "U1.VINPN to R3.pin2"
86
+ },
87
+ {
88
+ "pinIds": ["R3.2", "C6.2"],
89
+ "netId": "R3.pin2 to C6.pin2"
90
+ }
91
+ ],
92
+ "netConnections": [],
93
+ "textBoxes": [],
94
+ "availableNetLabelOrientations": {},
95
+ "maxMspPairDistance": 100,
96
+ "_hideRatsNet": false
97
+ }
@@ -0,0 +1,36 @@
1
+ import { expect, test } from "bun:test"
2
+ import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
3
+ import "tests/fixtures/matcher"
4
+ import inputProblem from "./assets/repro-pga300-c6-trace-alignment.input.json"
5
+
6
+ test("repro: PGA300 C6 trace routing", () => {
7
+ const solver = new SchematicTracePipelineSolver(inputProblem as any)
8
+
9
+ solver.solve()
10
+
11
+ expect(
12
+ solver.sameNetJunctionAlignmentSolver!.stats.alignedJunctionCount,
13
+ ).toBe(2)
14
+
15
+ const alignedTraces = solver.sameNetJunctionAlignmentSolver!.outputTraces
16
+ for (const [c6PinId, railY] of [
17
+ ["C6.1", 0.95],
18
+ ["C6.2", 0.15],
19
+ ] as const) {
20
+ const traceToU1 = alignedTraces.find(
21
+ (trace) =>
22
+ trace.pins.some((pin) => pin.pinId === c6PinId) &&
23
+ trace.pins.some((pin) => pin.pinId.startsWith("U1.")),
24
+ )!
25
+ expect(
26
+ traceToU1.tracePath.some(
27
+ (point, index, path) =>
28
+ index > 0 &&
29
+ Math.abs(point.y - railY) < 1e-6 &&
30
+ Math.abs(path[index - 1]!.y - railY) < 1e-6,
31
+ ),
32
+ ).toBe(true)
33
+ }
34
+
35
+ expect(solver).toMatchSolverSnapshot(import.meta.path)
36
+ })