@tscircuit/schematic-trace-solver 0.0.153 → 0.0.154

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.
@@ -0,0 +1,12 @@
1
+ import { expect, test } from "bun:test"
2
+ import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
3
+ import inputProblem from "./bug-report-20260825T103621Z.json"
4
+ import "tests/fixtures/matcher"
5
+
6
+ test("bug-report-20260825T103621Z", () => {
7
+ const solver = new SchematicTracePipelineSolver(inputProblem as any)
8
+
9
+ solver.solve()
10
+
11
+ expect(solver).toMatchSolverSnapshot(import.meta.path)
12
+ })
@@ -0,0 +1,88 @@
1
+ <svg width="2416" height="1200" viewBox="0 0 2416 1200" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Solver debug visualization on the left and Circuit JSON schematic on the right">
2
+ <g transform="translate(0, 0) scale(1.875, 1.875) translate(0, 0)">
3
+ <rect width="100%" height="100%" fill="white"/><g><polyline data-points="-6.5,0.75 -9.799999999999999,0.95" data-type="line" data-label="" points="296.94117647058835,270.5882352941177 79.52941176470608,257.4117647058824" fill="none" stroke="hsl(104, 100%, 50%, 0.8)" stroke-width="1px"/></g><g><polyline data-points="-9.799999999999999,0.95 -8.45,0.93" data-type="line" data-label="" points="79.52941176470608,257.4117647058824 168.47058823529426,258.7294117647059" fill="none" stroke="hsl(336, 100%, 50%, 0.8)" stroke-width="1px"/></g><g><polyline data-points="-6.5,0.24 -9.799999999999999,0.15" data-type="line" data-label="" points="296.94117647058835,304.18823529411765 79.52941176470608,310.11764705882354" fill="none" stroke="hsl(88, 100%, 50%, 0.8)" stroke-width="1px"/></g><g><polyline data-points="-9.799999999999999,0.15 -8.45,0.17" data-type="line" data-label="" points="79.52941176470608,310.11764705882354 168.47058823529426,308.8" fill="none" stroke="hsl(16, 100%, 50%, 0.8)" stroke-width="1px"/></g><g><polyline data-points="-9.799999999999999,0.95 -8.45,0.95 -8.45,0.93" data-type="line" data-label="" points="79.52941176470608,257.4117647058824 168.47058823529426,257.4117647058824 168.47058823529426,258.7294117647059" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="-6.5,0.75 -7.475,0.75 -7.475,0.95 -8.45,0.95 -8.45,0.93" data-type="line" data-label="" points="296.94117647058835,270.5882352941177 232.70588235294133,270.5882352941177 232.70588235294133,257.4117647058824 168.47058823529426,257.4117647058824 168.47058823529426,258.7294117647059" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="-9.799999999999999,0.15 -8.45,0.15 -8.45,0.17" data-type="line" data-label="" points="79.52941176470608,310.11764705882354 168.47058823529426,310.11764705882354 168.47058823529426,308.8" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="-6.5,0.24 -7.475,0.24 -7.475,0.15 -8.45,0.15 -8.45,0.17" data-type="line" data-label="" points="296.94117647058835,304.18823529411765 232.70588235294133,304.18823529411765 232.70588235294133,310.11764705882354 168.47058823529426,310.11764705882354 168.47058823529426,308.8" fill="none" stroke="purple" stroke-width="1px"/></g><g><rect data-type="rect" data-label="U1" data-x="-4.2" data-y="0" x="296.9411764705884" y="56.470588235294144" width="303.05882352941165" height="527.0588235294117" fill="hsl(164, 100%, 50%, 0.8)" stroke="black" stroke-width="0.01517857142857143"/></g><g><rect data-type="rect" data-label="R2" data-x="-10.1" data-y="0.95" x="40.00000000000017" y="235.01176470588237" width="39.52941176470597" height="44.80000000000001" fill="hsl(72, 100%, 50%, 0.8)" stroke="black" stroke-width="0.01517857142857143"/></g><g><rect data-type="rect" data-label="R3" data-x="-10.1" data-y="0.15" x="40.00000000000017" y="287.71764705882356" width="39.52941176470597" height="44.799999999999955" fill="hsl(73, 100%, 50%, 0.8)" stroke="black" stroke-width="0.01517857142857143"/></g><g><rect data-type="rect" data-label="C6" data-x="-8.3775" data-y="0.55" x="138.82352941176487" y="258.7294117647059" width="68.84705882352932" height="50.07058823529411" fill="hsl(331, 100%, 50%, 0.8)" stroke="black" stroke-width="0.01517857142857143"/></g><g><rect data-type="rect" data-label="netId: R2.pin2 to C6.pin1
4
+ globalConnNetId: connectivity_net0" data-x="-9.125" data-y="1.175" x="117.41176470588249" y="227.76470588235293" width="13.176470588235247" height="29.64705882352945" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.01517857142857143"/></g><g><rect data-type="rect" data-label="netId: R3.pin2 to C6.pin2
5
+ globalConnNetId: connectivity_net1" data-x="-9.125" data-y="0.375" x="117.41176470588249" y="280.47058823529414" width="13.176470588235247" height="29.64705882352939" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.01517857142857143"/></g><g><circle data-type="point" data-label="U1.VINPP
6
+ x-" data-x="-6.5" data-y="0.75" cx="296.94117647058835" cy="270.5882352941177" r="3" fill="hsl(337, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="U1.VINPN
7
+ x-" data-x="-6.5" data-y="0.24" cx="296.94117647058835" cy="304.18823529411765" r="3" fill="hsl(335, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="R2.1
8
+ x-" data-x="-10.4" data-y="0.95" cx="40.000000000000114" cy="257.4117647058824" r="3" fill="hsl(107, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="R2.2
9
+ x+" data-x="-9.799999999999999" data-y="0.95" cx="79.52941176470608" cy="257.4117647058824" r="3" fill="hsl(108, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="R3.1
10
+ x-" data-x="-10.4" data-y="0.15" cx="40.000000000000114" cy="310.11764705882354" r="3" fill="hsl(348, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="R3.2
11
+ x+" data-x="-9.799999999999999" data-y="0.15" cx="79.52941176470608" cy="310.11764705882354" r="3" fill="hsl(349, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="C6.1
12
+ y+" data-x="-8.45" data-y="0.93" cx="168.47058823529426" cy="258.7294117647059" r="3" fill="hsl(246, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="C6.2
13
+ y-" data-x="-8.45" data-y="0.17" cx="168.47058823529426" cy="308.8" r="3" fill="hsl(247, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="anchorPoint
14
+ orientation: y+" data-x="-9.125" data-y="0.95" cx="124.00000000000011" cy="257.4117647058824" r="3" fill="hsl(40, 100%, 50%, 0.9)"/></g><g><circle data-type="point" data-label="anchorPoint
15
+ orientation: y+" data-x="-9.125" data-y="0.15" cx="124.00000000000011" cy="310.11764705882354" r="3" fill="hsl(40, 100%, 50%, 0.9)"/></g><g id="crosshair" style="display: none"><line id="crosshair-h" y1="0" y2="640" stroke="#666" stroke-width="0.5"/><line id="crosshair-v" x1="0" x2="640" stroke="#666" stroke-width="0.5"/><text id="coordinates" font-family="monospace" font-size="12" fill="#666"></text></g><script><![CDATA[
16
+ document.currentScript.parentElement.addEventListener('mousemove', (e) => {
17
+ const svg = e.currentTarget;
18
+ const rect = svg.getBoundingClientRect();
19
+ const x = e.clientX - rect.left;
20
+ const y = e.clientY - rect.top;
21
+ const crosshair = svg.getElementById('crosshair');
22
+ const h = svg.getElementById('crosshair-h');
23
+ const v = svg.getElementById('crosshair-v');
24
+ const coords = svg.getElementById('coordinates');
25
+
26
+ crosshair.style.display = 'block';
27
+ h.setAttribute('x1', '0');
28
+ h.setAttribute('x2', '640');
29
+ h.setAttribute('y1', y);
30
+ h.setAttribute('y2', y);
31
+ v.setAttribute('x1', x);
32
+ v.setAttribute('x2', x);
33
+ v.setAttribute('y1', '0');
34
+ v.setAttribute('y2', '640');
35
+
36
+ // Calculate real coordinates using inverse transformation
37
+ const matrix = {"a":65.88235294117646,"c":0,"e":725.1764705882354,"b":0,"d":-65.88235294117646,"f":320};
38
+ // Manually invert and apply the affine transform
39
+ // Since we only use translate and scale, we can directly compute:
40
+ // x' = (x - tx) / sx
41
+ // y' = (y - ty) / sy
42
+ const sx = matrix.a;
43
+ const sy = matrix.d;
44
+ const tx = matrix.e;
45
+ const ty = matrix.f;
46
+ const realPoint = {
47
+ x: (x - tx) / sx,
48
+ y: (y - ty) / sy // Flip y back since we used negative scale
49
+ }
50
+
51
+ coords.textContent = `(${realPoint.x.toFixed(2)}, ${realPoint.y.toFixed(2)})`;
52
+ coords.setAttribute('x', (x + 5).toString());
53
+ coords.setAttribute('y', (y - 5).toString());
54
+ });
55
+ document.currentScript.parentElement.addEventListener('mouseleave', () => {
56
+ document.currentScript.parentElement.getElementById('crosshair').style.display = 'none';
57
+ });
58
+ ]]></script>
59
+ </g>
60
+ <g transform="translate(1216, 200)">
61
+ <style>
62
+ .boundary { fill: rgb(245, 241, 237); }
63
+ .schematic-boundary { fill: none; stroke: #fff; }
64
+ .component { fill: none; stroke: rgb(132, 0, 0); }
65
+ .chip { fill: rgb(255, 255, 194); stroke: rgb(132, 0, 0); }
66
+ .component-pin { fill: none; stroke: rgb(132, 0, 0); }
67
+ .text { font-family: sans-serif; fill: rgb(0, 150, 0); }
68
+ .pin-number { fill: rgb(169, 0, 0); }
69
+ .port-label { fill: rgb(0, 100, 100); }
70
+ .component-name { fill: rgb(0, 100, 100); }
71
+
72
+ </style><rect class="boundary" x="0" y="0" width="1200" height="800"/><g class="trace sch-trace" data-layer="base" data-circuit-json-type="schematic_trace" data-schematic-trace-id="schematic_trace_0__stack1"><path d="M 297.77777777768017 315.55555555554497 L 417.7777777776952 315.55555555554497 L 417.7777777776952 317.333333333323" class="trace-invisible-hover-outline sch-trace-hitbox" stroke="rgb(0, 150, 0)" fill="none" stroke-width="14.222222222224px" stroke-linecap="round" opacity="0" stroke-linejoin="round"/><path class="sch-trace-path" d="M 297.77777777768017 315.55555555554497 L 417.7777777776952 315.55555555554497 L 417.7777777776952 317.333333333323" stroke="rgb(0, 150, 0)" fill="none" stroke-width="1.777777777778px" stroke-linecap="round" stroke-linejoin="round"/></g><g class="trace sch-trace" data-layer="base" data-circuit-json-type="schematic_trace" data-schematic-trace-id="schematic_trace_1__stack1"><path d="M 591.11111111105 333.333333333325 L 504.4444444443726 333.333333333325 L 504.4444444443726 315.55555555554497 L 417.7777777776952 315.55555555554497 L 417.7777777776952 317.333333333323" class="trace-invisible-hover-outline sch-trace-hitbox" stroke="rgb(0, 150, 0)" fill="none" stroke-width="14.222222222224px" stroke-linecap="round" opacity="0" stroke-linejoin="round"/><path class="sch-trace-path" d="M 591.11111111105 333.333333333325 L 504.4444444443726 333.333333333325 L 504.4444444443726 315.55555555554497 L 417.7777777776952 315.55555555554497 L 417.7777777776952 317.333333333323" stroke="rgb(0, 150, 0)" fill="none" stroke-width="1.777777777778px" stroke-linecap="round" stroke-linejoin="round"/></g><g class="trace sch-trace" data-layer="base" data-circuit-json-type="schematic_trace" data-schematic-trace-id="schematic_trace_2__stack1"><path d="M 297.77777777768017 386.666666666665 L 417.7777777776952 386.666666666665 L 417.7777777776952 384.888888888887" class="trace-invisible-hover-outline sch-trace-hitbox" stroke="rgb(0, 150, 0)" fill="none" stroke-width="14.222222222224px" stroke-linecap="round" opacity="0" stroke-linejoin="round"/><path class="sch-trace-path" d="M 297.77777777768017 386.666666666665 L 417.7777777776952 386.666666666665 L 417.7777777776952 384.888888888887" stroke="rgb(0, 150, 0)" fill="none" stroke-width="1.777777777778px" stroke-linecap="round" stroke-linejoin="round"/></g><g class="trace sch-trace" data-layer="base" data-circuit-json-type="schematic_trace" data-schematic-trace-id="schematic_trace_3__stack1"><path d="M 591.11111111105 378.666666666664 L 504.4444444443726 378.666666666664 L 504.4444444443726 386.666666666665 L 417.7777777776952 386.666666666665 L 417.7777777776952 384.888888888887" class="trace-invisible-hover-outline sch-trace-hitbox" stroke="rgb(0, 150, 0)" fill="none" stroke-width="14.222222222224px" stroke-linecap="round" opacity="0" stroke-linejoin="round"/><path class="sch-trace-path" d="M 591.11111111105 378.666666666664 L 504.4444444443726 378.666666666664 L 504.4444444443726 386.666666666665 L 417.7777777776952 386.666666666665 L 417.7777777776952 384.888888888887" stroke="rgb(0, 150, 0)" fill="none" stroke-width="1.777777777778px" stroke-linecap="round" stroke-linejoin="round"/></g><g class="trace-overlays sch-trace-overlays" data-layer="overlay" data-circuit-json-type="schematic_trace" data-schematic-trace-id="schematic_trace_0__stack1"><circle cx="417.7777777776952" cy="315.55555555554497" r="2.666666666667" class="trace-junction sch-trace-junction" fill="rgb(0, 150, 0)"/><circle cx="417.7777777776952" cy="317.333333333323" r="2.666666666667" class="trace-junction sch-trace-junction" fill="rgb(0, 150, 0)"/></g><g class="trace-overlays sch-trace-overlays" data-layer="overlay" data-circuit-json-type="schematic_trace" data-schematic-trace-id="schematic_trace_1__stack1"/><g class="trace-overlays sch-trace-overlays" data-layer="overlay" data-circuit-json-type="schematic_trace" data-schematic-trace-id="schematic_trace_2__stack1"><circle cx="417.7777777776952" cy="386.666666666665" r="2.666666666667" class="trace-junction sch-trace-junction" fill="rgb(0, 150, 0)"/><circle cx="417.7777777776952" cy="384.888888888887" r="2.666666666667" class="trace-junction sch-trace-junction" fill="rgb(0, 150, 0)"/></g><g class="trace-overlays sch-trace-overlays" data-layer="overlay" data-circuit-json-type="schematic_trace" data-schematic-trace-id="schematic_trace_3__stack1"/><g class="sch-component" data-circuit-json-type="schematic_component" data-schematic-component-id="schematic_component_0__stack1"><rect class="component chip sch-component-body" x="626.6666666666101" y="44.444444444400006" width="337.7777777778199" height="711.1111111112" stroke-width="1.777777777778px" fill="rgb(255, 255, 194)" stroke="rgb(132, 0, 0)"/><rect class="component-overlay sch-component-overlay" x="626.6666666666101" y="44.444444444400006" width="337.7777777778199" height="711.1111111112" fill="transparent"/><text class="sch-text" x="795.5555555555201" y="400" fill="#0f172a" text-anchor="middle" dominant-baseline="middle" font-family="sans-serif" font-size="16.000000000002px" transform="rotate(0, 795.5555555555201, 400)">U1</text><line class="component-pin sch-component-pin sch-port-line" x1="626.6666666666101" y1="333.333333333325" x2="591.11111111105" y2="333.333333333325" stroke-width="1.777777777778px"/><g class="sch-port" data-schematic-port-id="source_port_0_0__stack1"><rect x="589.333333333272" y="331.555555555547" width="3.555555555556" height="3.555555555556" opacity="0"/></g><text class="pin-number sch-pin-number" x="608.88888888883" y="331.555555555547" style="font-family: sans-serif;" fill="rgb(169, 0, 0)" text-anchor="middle" dominant-baseline="auto" font-size="13.333333333335px" transform=""></text><text class="pin-number sch-pin-label" x="635.5555555555001" y="333.333333333325" style="font-family: sans-serif;" fill="rgb(169, 0, 0)" text-anchor="start" dominant-baseline="middle" font-size="13.333333333335px" transform="">VINPP</text><line class="component-pin sch-component-pin sch-port-line" x1="626.6666666666101" y1="378.666666666664" x2="591.11111111105" y2="378.666666666664" stroke-width="1.777777777778px"/><g class="sch-port" data-schematic-port-id="source_port_0_1__stack1"><rect x="589.333333333272" y="376.888888888886" width="3.555555555556" height="3.555555555556" opacity="0"/></g><text class="pin-number sch-pin-number" x="608.88888888883" y="376.888888888886" style="font-family: sans-serif;" fill="rgb(169, 0, 0)" text-anchor="middle" dominant-baseline="auto" font-size="13.333333333335px" transform=""></text><text class="pin-number sch-pin-label" x="635.5555555555001" y="378.666666666664" style="font-family: sans-serif;" fill="rgb(169, 0, 0)" text-anchor="start" dominant-baseline="middle" font-size="13.333333333335px" transform="">VINPN</text></g><g class="sch-component" data-circuit-json-type="schematic_component" data-schematic-component-id="schematic_component_1__stack1"><rect class="component-overlay sch-component-overlay" x="244.44444444434006" y="308.44622222221074" width="53.33333333334011" height="14.218666666668469" fill="transparent"/><path class="sch-component-symbol-path" d="M 244.44444444434006 315.55555555554497 L 253.33511111100788 315.55555555554497" stroke="rgb(132, 0, 0)" fill="none" stroke-width="1.777777777778px" stroke-linecap="round"/><path class="sch-component-symbol-path" d="M 288.8871111110124 315.55555555554497 L 297.77777777768017 315.55555555554497" stroke="rgb(132, 0, 0)" fill="none" stroke-width="1.777777777778px" stroke-linecap="round"/><path class="sch-component-symbol-path" d="M 253.33511111100788 308.44622222221074 L 288.8871111110124 308.44622222221074 L 288.8871111110124 322.6648888888792 L 253.33511111100788 322.6648888888792 L 253.33511111100788 308.44622222221074" stroke="rgb(132, 0, 0)" fill="none" stroke-width="1.777777777778px" stroke-linecap="round"/><text class="sch-component-name sch-component-text" x="271.11111111101013" y="301.3333333333209" stroke="rgb(245, 241, 237)" stroke-width="1.777777777778px" paint-order="stroke" fill="rgb(15, 15, 15)" font-family="sans-serif" text-anchor="middle" dominant-baseline="ideographic" font-size="16.000000000002px">R2</text><text class="sch-component-text" x="271.11111111101013" y="329.777777777769" fill="rgb(15, 15, 15)" font-family="sans-serif" text-anchor="middle" dominant-baseline="hanging" font-size="16.000000000002px"></text><circle class="component-pin sch-component-pin" cx="244.44444444434006" cy="315.55555555554497" r="1.777777777778px" stroke-width="1.777777777778px" fill="none" stroke="rgb(132, 0, 0)"/></g><g class="sch-component" data-circuit-json-type="schematic_component" data-schematic-component-id="schematic_component_2__stack1"><rect class="component-overlay sch-component-overlay" x="244.44444444434006" y="379.55733333333075" width="53.33333333334011" height="14.218666666668469" fill="transparent"/><path class="sch-component-symbol-path" d="M 244.44444444434006 386.666666666665 L 253.33511111100788 386.666666666665" stroke="rgb(132, 0, 0)" fill="none" stroke-width="1.777777777778px" stroke-linecap="round"/><path class="sch-component-symbol-path" d="M 288.8871111110124 386.666666666665 L 297.77777777768017 386.666666666665" stroke="rgb(132, 0, 0)" fill="none" stroke-width="1.777777777778px" stroke-linecap="round"/><path class="sch-component-symbol-path" d="M 253.33511111100788 379.55733333333075 L 288.8871111110124 379.55733333333075 L 288.8871111110124 393.7759999999992 L 253.33511111100788 393.7759999999992 L 253.33511111100788 379.55733333333075" stroke="rgb(132, 0, 0)" fill="none" stroke-width="1.777777777778px" stroke-linecap="round"/><text class="sch-component-name sch-component-text" x="271.11111111101013" y="372.44444444444093" stroke="rgb(245, 241, 237)" stroke-width="1.777777777778px" paint-order="stroke" fill="rgb(15, 15, 15)" font-family="sans-serif" text-anchor="middle" dominant-baseline="ideographic" font-size="16.000000000002px">R3</text><text class="sch-component-text" x="271.11111111101013" y="400.888888888889" fill="rgb(15, 15, 15)" font-family="sans-serif" text-anchor="middle" dominant-baseline="hanging" font-size="16.000000000002px"></text><circle class="component-pin sch-component-pin" cx="244.44444444434006" cy="386.666666666665" r="1.777777777778px" stroke-width="1.777777777778px" fill="none" stroke="rgb(132, 0, 0)"/></g><g class="sch-component" data-circuit-json-type="schematic_component" data-schematic-component-id="schematic_component_3__stack1"><rect class="component-overlay sch-component-overlay" x="399.76071111102624" y="317.333333333323" width="36.03413333333788" height="67.55555555556396" fill="transparent"/><path class="sch-component-symbol-path" d="M 417.7777777776952 384.888888888887 L 417.7777777776952 357.8666666666614" stroke="rgb(132, 0, 0)" fill="none" stroke-width="1.777777777778px" stroke-linecap="round"/><path class="sch-component-symbol-path" d="M 417.7777777776952 344.3555555555486 L 417.7777777776952 317.333333333323" stroke="rgb(132, 0, 0)" fill="none" stroke-width="1.777777777778px" stroke-linecap="round"/><path class="sch-component-symbol-path" d="M 435.7948444443641 357.8666666666614 L 399.76071111102624 357.8666666666614" stroke="rgb(132, 0, 0)" fill="none" stroke-width="1.777777777778px" stroke-linecap="round"/><path class="sch-component-symbol-path" d="M 435.7948444443641 344.3555555555486 L 399.76071111102624 344.3555555555486" stroke="rgb(132, 0, 0)" fill="none" stroke-width="1.777777777778px" stroke-linecap="round"/><text class="sch-component-name sch-component-text" x="430.72592592584493" y="328.5925925925837" stroke="rgb(245, 241, 237)" stroke-width="1.777777777778px" paint-order="stroke" fill="rgb(15, 15, 15)" font-family="sans-serif" text-anchor="start" dominant-baseline="ideographic" font-size="16.000000000002px">C6</text><text class="sch-component-text" x="430.72592592584493" y="373.6296296296263" fill="rgb(15, 15, 15)" font-family="sans-serif" text-anchor="start" dominant-baseline="hanging" font-size="16.000000000002px"></text></g><g class="schematic-port-hover sch-port-hover" data-schematic-port-id="source_port_0_0__stack1"><circle cx="591.11111111105" cy="333.333333333325" r="3.555555555556" fill="red" opacity="0"/></g><g class="schematic-port-hover sch-port-hover" data-schematic-port-id="source_port_0_1__stack1"><circle cx="591.11111111105" cy="378.666666666664" r="3.555555555556" fill="red" opacity="0"/></g><g class="schematic-port-hover sch-port-hover" data-schematic-port-id="source_port_1_0__stack1"><circle cx="244.4444444443401" cy="315.55555555554497" r="3.555555555556" fill="red" opacity="0"/></g><g class="schematic-port-hover sch-port-hover" data-schematic-port-id="source_port_1_1__stack1"><circle cx="297.77777777768017" cy="315.55555555554497" r="3.555555555556" fill="red" opacity="0"/></g><g class="schematic-port-hover sch-port-hover" data-schematic-port-id="source_port_2_0__stack1"><circle cx="244.4444444443401" cy="386.666666666665" r="3.555555555556" fill="red" opacity="0"/></g><g class="schematic-port-hover sch-port-hover" data-schematic-port-id="source_port_2_1__stack1"><circle cx="297.77777777768017" cy="386.666666666665" r="3.555555555556" fill="red" opacity="0"/></g><g class="schematic-port-hover sch-port-hover" data-schematic-port-id="source_port_3_0__stack1"><circle cx="417.7777777776952" cy="324.444444444435" r="3.555555555556" fill="red" opacity="0"/></g><g class="schematic-port-hover sch-port-hover" data-schematic-port-id="source_port_3_1__stack1"><circle cx="417.7777777776952" cy="391.999999999999" r="3.555555555556" fill="red" opacity="0"/></g><path class="net-label sch-net-label" data-circuit-json-type="schematic_net_label" data-schematic-net-label-id="schematic_net_label_0__stack1" d="
73
+ M 357.77777777768756,315.55555555554497
74
+ L 348.88888888879757,310.7555555555444
75
+ L 348.88888888879757,280.2725925925776
76
+ L 366.66666666657756,280.2725925925776
77
+ L 366.66666666657756,310.7555555555444
78
+ Z
79
+ " fill="rgba(255, 255, 255, 0.6)" stroke="rgb(132, 0, 0)" stroke-width="1.777777777778px"/><text class="net-label-text sch-net-label-text" data-circuit-json-type="schematic_net_label" data-schematic-net-label-id="schematic_net_label_0__stack1" x="357.77777777768756" y="307.55555555554395" fill="rgb(132, 0, 0)" text-anchor="start" dominant-baseline="central" font-family="sans-serif" font-variant-numeric="tabular-nums" font-size="16.000000000002px" transform="rotate(-90 357.77777777768756 307.55555555554395)">XX</text><path class="net-label sch-net-label" data-circuit-json-type="schematic_net_label" data-schematic-net-label-id="schematic_net_label_1__stack1" d="
80
+ M 357.77777777768756,386.666666666665
81
+ L 348.88888888879757,381.8666666666644
82
+ L 348.88888888879757,351.3837037036976
83
+ L 366.66666666657756,351.3837037036976
84
+ L 366.66666666657756,381.8666666666644
85
+ Z
86
+ " fill="rgba(255, 255, 255, 0.6)" stroke="rgb(132, 0, 0)" stroke-width="1.777777777778px"/><text class="net-label-text sch-net-label-text" data-circuit-json-type="schematic_net_label" data-schematic-net-label-id="schematic_net_label_1__stack1" x="357.77777777768756" y="378.66666666666396" fill="rgb(132, 0, 0)" text-anchor="start" dominant-baseline="central" font-family="sans-serif" font-variant-numeric="tabular-nums" font-size="16.000000000002px" transform="rotate(-90 357.77777777768756 378.66666666666396)">XX</text>
87
+ </g>
88
+ </svg>
@@ -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
+ })