@tscircuit/schematic-trace-solver 0.0.122 → 0.0.123

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,578 @@
1
+ {
2
+ "chips": [
3
+ {
4
+ "chipId": "schematic_component_0",
5
+ "center": {
6
+ "x": 0,
7
+ "y": 0
8
+ },
9
+ "width": 2.5,
10
+ "height": 4,
11
+ "pins": [
12
+ {
13
+ "pinId": "schematic_port_0",
14
+ "x": 1.25,
15
+ "y": 1.4000000000000001
16
+ },
17
+ {
18
+ "pinId": "schematic_port_1",
19
+ "x": 1.25,
20
+ "y": 1.2
21
+ },
22
+ {
23
+ "pinId": "schematic_port_2",
24
+ "x": 1.25,
25
+ "y": 0.8499999999999999
26
+ },
27
+ {
28
+ "pinId": "schematic_port_3",
29
+ "x": 1.25,
30
+ "y": 0.6499999999999997
31
+ },
32
+ {
33
+ "pinId": "schematic_port_4",
34
+ "x": 1.25,
35
+ "y": 0.2999999999999998
36
+ },
37
+ {
38
+ "pinId": "schematic_port_5",
39
+ "x": 1.25,
40
+ "y": 0.09999999999999987
41
+ },
42
+ {
43
+ "pinId": "schematic_port_6",
44
+ "x": 1.25,
45
+ "y": -0.10000000000000009
46
+ },
47
+ {
48
+ "pinId": "schematic_port_7",
49
+ "x": 1.25,
50
+ "y": -0.30000000000000004
51
+ },
52
+ {
53
+ "pinId": "schematic_port_8",
54
+ "x": 1.25,
55
+ "y": -0.6500000000000001
56
+ },
57
+ {
58
+ "pinId": "schematic_port_9",
59
+ "x": 1.25,
60
+ "y": -0.8500000000000001
61
+ },
62
+ {
63
+ "pinId": "schematic_port_10",
64
+ "x": 1.25,
65
+ "y": -1.2000000000000002
66
+ },
67
+ {
68
+ "pinId": "schematic_port_11",
69
+ "x": 1.25,
70
+ "y": -1.4000000000000001
71
+ },
72
+ {
73
+ "pinId": "schematic_port_12",
74
+ "x": -0.37500000000000006,
75
+ "y": -2
76
+ },
77
+ {
78
+ "pinId": "schematic_port_13",
79
+ "x": -0.17500000000000004,
80
+ "y": -2
81
+ },
82
+ {
83
+ "pinId": "schematic_port_14",
84
+ "x": 0.024999999999999967,
85
+ "y": -2
86
+ },
87
+ {
88
+ "pinId": "schematic_port_15",
89
+ "x": 0.22500000000000003,
90
+ "y": -2
91
+ }
92
+ ],
93
+ "sectionId": "Power Input & 3V3 Regulator"
94
+ },
95
+ {
96
+ "chipId": "schematic_component_1",
97
+ "center": {
98
+ "x": 5.0249999999999995,
99
+ "y": -0.7950000000000014
100
+ },
101
+ "width": 1.040000000000001,
102
+ "height": 0.6799999999999999,
103
+ "pins": [
104
+ {
105
+ "pinId": "schematic_port_16",
106
+ "x": 4.504999999999999,
107
+ "y": -0.8650000000000013,
108
+ "_facingDirection": "x-"
109
+ },
110
+ {
111
+ "pinId": "schematic_port_17",
112
+ "x": 5.545,
113
+ "y": -0.8650000000000013,
114
+ "_facingDirection": "x+"
115
+ }
116
+ ],
117
+ "sectionId": "Power Input & 3V3 Regulator"
118
+ },
119
+ {
120
+ "chipId": "schematic_component_2",
121
+ "center": {
122
+ "x": 2.88,
123
+ "y": -0.6500000000000015
124
+ },
125
+ "width": 0.8399999999999999,
126
+ "height": 1.1000000000000003,
127
+ "pins": [
128
+ {
129
+ "pinId": "schematic_port_18",
130
+ "x": 3.1799999999999997,
131
+ "y": -0.10000000000000131
132
+ },
133
+ {
134
+ "pinId": "schematic_port_19",
135
+ "x": 3.19,
136
+ "y": -1.2000000000000015
137
+ },
138
+ {
139
+ "pinId": "schematic_port_20",
140
+ "x": 2.46,
141
+ "y": -0.7500000000000013
142
+ }
143
+ ],
144
+ "sectionId": "Power Input & 3V3 Regulator"
145
+ },
146
+ {
147
+ "chipId": "schematic_component_3",
148
+ "center": {
149
+ "x": 3.0125,
150
+ "y": 1.4099999999999986
151
+ },
152
+ "width": 1.0850000000000004,
153
+ "height": 0.6000000000000001,
154
+ "pins": [
155
+ {
156
+ "pinId": "schematic_port_21",
157
+ "x": 2.795,
158
+ "y": 1.7099999999999986,
159
+ "_facingDirection": "y+"
160
+ },
161
+ {
162
+ "pinId": "schematic_port_22",
163
+ "x": 2.795,
164
+ "y": 1.1099999999999985,
165
+ "_facingDirection": "y-"
166
+ }
167
+ ],
168
+ "sectionId": "Power Input & 3V3 Regulator"
169
+ },
170
+ {
171
+ "chipId": "schematic_component_4",
172
+ "center": {
173
+ "x": 2.65,
174
+ "y": -3.2050000000000014
175
+ },
176
+ "width": 2,
177
+ "height": 0.7999999999999998,
178
+ "pins": [
179
+ {
180
+ "pinId": "schematic_port_23",
181
+ "x": 1.65,
182
+ "y": -3.0050000000000012
183
+ },
184
+ {
185
+ "pinId": "schematic_port_24",
186
+ "x": 1.65,
187
+ "y": -3.2050000000000014
188
+ },
189
+ {
190
+ "pinId": "schematic_port_25",
191
+ "x": 1.65,
192
+ "y": -3.4050000000000016
193
+ },
194
+ {
195
+ "pinId": "schematic_port_26",
196
+ "x": 3.65,
197
+ "y": -3.3050000000000015
198
+ },
199
+ {
200
+ "pinId": "schematic_port_27",
201
+ "x": 3.65,
202
+ "y": -3.1050000000000013
203
+ }
204
+ ],
205
+ "sectionId": "Power Input & 3V3 Regulator"
206
+ },
207
+ {
208
+ "chipId": "schematic_component_5",
209
+ "center": {
210
+ "x": 5.055,
211
+ "y": 0.9799999999999988
212
+ },
213
+ "width": 0.9200000000000008,
214
+ "height": 0.76,
215
+ "pins": [
216
+ {
217
+ "pinId": "schematic_port_28",
218
+ "x": 4.92,
219
+ "y": 1.3599999999999988,
220
+ "_facingDirection": "y+"
221
+ },
222
+ {
223
+ "pinId": "schematic_port_29",
224
+ "x": 4.92,
225
+ "y": 0.5999999999999988,
226
+ "_facingDirection": "y-"
227
+ }
228
+ ],
229
+ "sectionId": "Power Input & 3V3 Regulator"
230
+ },
231
+ {
232
+ "chipId": "schematic_component_6",
233
+ "center": {
234
+ "x": 4.914999999999999,
235
+ "y": -3.8050000000000015
236
+ },
237
+ "width": 1.04,
238
+ "height": 0.7600000000000011,
239
+ "pins": [
240
+ {
241
+ "pinId": "schematic_port_30",
242
+ "x": 4.72,
243
+ "y": -3.4250000000000007,
244
+ "_facingDirection": "y+"
245
+ },
246
+ {
247
+ "pinId": "schematic_port_31",
248
+ "x": 4.72,
249
+ "y": -4.185000000000002,
250
+ "_facingDirection": "y-"
251
+ }
252
+ ],
253
+ "sectionId": "Power Input & 3V3 Regulator"
254
+ },
255
+ {
256
+ "chipId": "schematic_component_7",
257
+ "center": {
258
+ "x": 6.464999999999999,
259
+ "y": -3.8050000000000015
260
+ },
261
+ "width": 1.4499999999999993,
262
+ "height": 0.7799999999999994,
263
+ "pins": [
264
+ {
265
+ "pinId": "schematic_port_32",
266
+ "x": 6.289999999999999,
267
+ "y": -4.195000000000001,
268
+ "_facingDirection": "y-"
269
+ },
270
+ {
271
+ "pinId": "schematic_port_33",
272
+ "x": 6.289999999999999,
273
+ "y": -3.415000000000002,
274
+ "_facingDirection": "y+"
275
+ }
276
+ ],
277
+ "sectionId": "Power Input & 3V3 Regulator"
278
+ },
279
+ {
280
+ "chipId": "schematic_component_8",
281
+ "center": {
282
+ "x": 7.794999999999999,
283
+ "y": -3.8050000000000015
284
+ },
285
+ "width": 0.9199999999999999,
286
+ "height": 0.7600000000000011,
287
+ "pins": [
288
+ {
289
+ "pinId": "schematic_port_34",
290
+ "x": 7.659999999999999,
291
+ "y": -3.4250000000000007,
292
+ "_facingDirection": "y+"
293
+ },
294
+ {
295
+ "pinId": "schematic_port_35",
296
+ "x": 7.659999999999999,
297
+ "y": -4.185000000000002,
298
+ "_facingDirection": "y-"
299
+ }
300
+ ],
301
+ "sectionId": "Power Input & 3V3 Regulator"
302
+ },
303
+ {
304
+ "chipId": "schematic_component_9",
305
+ "center": {
306
+ "x": 9.8025,
307
+ "y": -5.3450000000000015
308
+ },
309
+ "width": 1.0150000000000006,
310
+ "height": 1.1300000000000008,
311
+ "pins": [
312
+ {
313
+ "pinId": "schematic_port_36",
314
+ "x": 9.62,
315
+ "y": -5.910000000000002,
316
+ "_facingDirection": "y-"
317
+ },
318
+ {
319
+ "pinId": "schematic_port_37",
320
+ "x": 9.62,
321
+ "y": -4.780000000000001,
322
+ "_facingDirection": "y+"
323
+ }
324
+ ],
325
+ "sectionId": "Power Input & 3V3 Regulator"
326
+ },
327
+ {
328
+ "chipId": "schematic_component_10",
329
+ "center": {
330
+ "x": 9.7775,
331
+ "y": -3.8050000000000015
332
+ },
333
+ "width": 0.9649999999999999,
334
+ "height": 0.6000000000000014,
335
+ "pins": [
336
+ {
337
+ "pinId": "schematic_port_38",
338
+ "x": 9.62,
339
+ "y": -4.105000000000002
340
+ },
341
+ {
342
+ "pinId": "schematic_port_39",
343
+ "x": 9.62,
344
+ "y": -3.505000000000001
345
+ }
346
+ ],
347
+ "sectionId": "Power Input & 3V3 Regulator"
348
+ },
349
+ {
350
+ "chipId": "schematic_component_11",
351
+ "center": {
352
+ "x": 0.19500000000000028,
353
+ "y": -7.1949999999999985
354
+ },
355
+ "width": 0.5,
356
+ "height": 0.7599999999999998,
357
+ "pins": [
358
+ {
359
+ "pinId": "schematic_port_40",
360
+ "x": 0.19500000000000026,
361
+ "y": -7.574999999999998,
362
+ "_facingDirection": "y-"
363
+ },
364
+ {
365
+ "pinId": "schematic_port_41",
366
+ "x": 0.1950000000000003,
367
+ "y": -6.814999999999999,
368
+ "_facingDirection": "y+"
369
+ }
370
+ ],
371
+ "sectionId": "Power Input & 3V3 Regulator"
372
+ },
373
+ {
374
+ "chipId": "schematic_component_12",
375
+ "center": {
376
+ "x": 4.8925,
377
+ "y": 2.7899999999999983
378
+ },
379
+ "width": 1.085,
380
+ "height": 0.5999999999999996,
381
+ "pins": [
382
+ {
383
+ "pinId": "schematic_port_42",
384
+ "x": 4.675,
385
+ "y": 3.089999999999998,
386
+ "_facingDirection": "y+"
387
+ },
388
+ {
389
+ "pinId": "schematic_port_43",
390
+ "x": 4.675,
391
+ "y": 2.4899999999999984,
392
+ "_facingDirection": "y-"
393
+ }
394
+ ],
395
+ "sectionId": "Power Input & 3V3 Regulator"
396
+ }
397
+ ],
398
+ "directConnections": [
399
+ {
400
+ "netId": ".U3 > .BYP to .C2 > .pin1",
401
+ "pinIds": [
402
+ "schematic_port_26",
403
+ "schematic_port_30"
404
+ ]
405
+ },
406
+ {
407
+ "netId": ".R1 > .pin1 to .LED1 > .cathode",
408
+ "pinIds": [
409
+ "schematic_port_38",
410
+ "schematic_port_37"
411
+ ]
412
+ }
413
+ ],
414
+ "netConnections": [
415
+ {
416
+ "netId": "V5",
417
+ "netLabelWidth": 0.42,
418
+ "netLabelHeight": 0.36,
419
+ "pinIds": [
420
+ "schematic_port_0",
421
+ "schematic_port_1",
422
+ "schematic_port_17",
423
+ "schematic_port_20",
424
+ "schematic_port_21"
425
+ ]
426
+ },
427
+ {
428
+ "netId": "DP",
429
+ "netLabelWidth": 0.36,
430
+ "pinIds": [
431
+ "schematic_port_4",
432
+ "schematic_port_5"
433
+ ]
434
+ },
435
+ {
436
+ "netId": "DM",
437
+ "netLabelWidth": 0.36,
438
+ "pinIds": [
439
+ "schematic_port_6",
440
+ "schematic_port_7"
441
+ ]
442
+ },
443
+ {
444
+ "netId": "GND",
445
+ "netLabelWidth": 0.42,
446
+ "netLabelHeight": 0.48,
447
+ "pinIds": [
448
+ "schematic_port_10",
449
+ "schematic_port_11",
450
+ "schematic_port_12",
451
+ "schematic_port_13",
452
+ "schematic_port_14",
453
+ "schematic_port_15",
454
+ "schematic_port_22",
455
+ "schematic_port_24",
456
+ "schematic_port_29",
457
+ "schematic_port_31",
458
+ "schematic_port_32",
459
+ "schematic_port_35",
460
+ "schematic_port_36",
461
+ "schematic_port_40"
462
+ ]
463
+ },
464
+ {
465
+ "netId": "VBUS",
466
+ "netLabelWidth": 0.42,
467
+ "netLabelHeight": 0.6,
468
+ "pinIds": [
469
+ "schematic_port_16",
470
+ "schematic_port_19",
471
+ "schematic_port_23",
472
+ "schematic_port_28",
473
+ "schematic_port_42"
474
+ ]
475
+ },
476
+ {
477
+ "netId": "BATT",
478
+ "netLabelWidth": 0.6,
479
+ "pinIds": [
480
+ "schematic_port_18"
481
+ ]
482
+ },
483
+ {
484
+ "netId": "LDO_EN",
485
+ "netLabelWidth": 0.84,
486
+ "pinIds": [
487
+ "schematic_port_25",
488
+ "schematic_port_41"
489
+ ]
490
+ },
491
+ {
492
+ "netId": "V3V3",
493
+ "netLabelWidth": 0.42,
494
+ "netLabelHeight": 0.6,
495
+ "pinIds": [
496
+ "schematic_port_27",
497
+ "schematic_port_33",
498
+ "schematic_port_34",
499
+ "schematic_port_39"
500
+ ]
501
+ },
502
+ {
503
+ "netId": "LDO_H",
504
+ "netLabelWidth": 0.72,
505
+ "pinIds": [
506
+ "schematic_port_43"
507
+ ]
508
+ }
509
+ ],
510
+ "textBoxes": [
511
+ {
512
+ "chipId": "schematic_component_0",
513
+ "center": {
514
+ "x": 1.07,
515
+ "y": 1.7149999999999999
516
+ },
517
+ "width": 0.3599999999999999,
518
+ "height": 0.24999999999999978,
519
+ "text": "J1"
520
+ },
521
+ {
522
+ "chipId": "schematic_component_4",
523
+ "center": {
524
+ "x": 3.07,
525
+ "y": -3.735000000000001
526
+ },
527
+ "width": 2.04,
528
+ "height": 0.17999999999999972,
529
+ "text": "MIC5219_3_3YM5_TR"
530
+ },
531
+ {
532
+ "chipId": "schematic_component_4",
533
+ "center": {
534
+ "x": 2.17,
535
+ "y": -2.6900000000000013
536
+ },
537
+ "width": 0.3600000000000003,
538
+ "height": 0.24999999999999956,
539
+ "text": "U3"
540
+ }
541
+ ],
542
+ "availableNetLabelOrientations": {
543
+ "V5": [
544
+ "y+"
545
+ ],
546
+ "GND": [
547
+ "y-"
548
+ ],
549
+ "DP": [
550
+ "x-",
551
+ "x+"
552
+ ],
553
+ "DM": [
554
+ "x-",
555
+ "x+"
556
+ ],
557
+ "VBUS": [
558
+ "y+"
559
+ ],
560
+ "BATT": [
561
+ "x-",
562
+ "x+"
563
+ ],
564
+ "LDO_EN": [
565
+ "x-",
566
+ "x+"
567
+ ],
568
+ "V3V3": [
569
+ "y+"
570
+ ],
571
+ "LDO_H": [
572
+ "x-",
573
+ "x+"
574
+ ]
575
+ },
576
+ "maxMspPairDistance": 8,
577
+ "_hideRatsNet": false
578
+ }
@@ -0,0 +1,34 @@
1
+ import { expect, test } from "bun:test"
2
+ import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
3
+ import type { InputProblem } from "lib/types/InputProblem"
4
+ import "tests/fixtures/matcher"
5
+ import inputProblemJson from "./assets/repro161-power-section-autolayout.input.json"
6
+
7
+ const EXPECTED_V3V3_RAIL_Y = -3.105
8
+
9
+ // Captured from @tscircuit/core repro161 after schematic auto-layout.
10
+ test("core repro161 power section trace routing", () => {
11
+ const inputProblem: InputProblem = JSON.parse(
12
+ JSON.stringify(inputProblemJson),
13
+ )
14
+ const solver = new SchematicTracePipelineSolver(inputProblem)
15
+
16
+ solver.solve()
17
+
18
+ const v3v3Traces = solver.sameNetJunctionAlignmentSolver!.outputTraces.filter(
19
+ (trace) => trace.userNetId === "V3V3",
20
+ )
21
+ const horizontalRailYs = v3v3Traces.flatMap((trace) =>
22
+ trace.tracePath.flatMap((point, index) => {
23
+ const nextPoint = trace.tracePath[index + 1]
24
+ if (!nextPoint || point.y !== nextPoint.y) return []
25
+ return [point.y]
26
+ }),
27
+ )
28
+
29
+ expect(horizontalRailYs).toHaveLength(3)
30
+ for (const railY of horizontalRailYs) {
31
+ expect(railY).toBeCloseTo(EXPECTED_V3V3_RAIL_Y)
32
+ }
33
+ expect(solver).toMatchSolverSnapshot(import.meta.path)
34
+ })