@tscircuit/schematic-trace-solver 0.0.33 → 0.0.35

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 (27) hide show
  1. package/dist/index.js +36 -4
  2. package/lib/solvers/NetLabelPlacementSolver/NetLabelPlacementSolver.ts +25 -4
  3. package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/SchematicTraceSingleLineSolver2.ts +19 -0
  4. package/package.json +2 -2
  5. package/site/SchematicTraceSingleLineSolver2/SchematicTraceSingleLineSolver2_01-example17.page.tsx +324 -0
  6. package/site/examples/example15-rp2040-caps.page.tsx +623 -0
  7. package/site/examples/example16-core-repro51.page.tsx +107 -0
  8. package/site/examples/example17-straight-line-trace.page.tsx +165 -0
  9. package/site/examples/example18.page.tsx +181 -0
  10. package/site/examples/example19.page.tsx +169 -0
  11. package/tests/examples/__snapshots__/example02.snap.svg +5 -8
  12. package/tests/examples/__snapshots__/example04.snap.svg +15 -12
  13. package/tests/examples/__snapshots__/example15.snap.svg +797 -71
  14. package/tests/examples/__snapshots__/example16.snap.svg +40 -86
  15. package/tests/examples/__snapshots__/example17.snap.svg +187 -0
  16. package/tests/examples/__snapshots__/example18.snap.svg +235 -0
  17. package/tests/examples/__snapshots__/example19.snap.svg +195 -0
  18. package/tests/examples/example15.test.tsx +524 -82
  19. package/tests/examples/example16.test.tsx +56 -118
  20. package/tests/examples/example17.test.tsx +171 -0
  21. package/tests/examples/example18.test.tsx +187 -0
  22. package/tests/examples/example19.test.tsx +175 -0
  23. package/tests/fixtures/matcher.ts +17 -15
  24. package/tests/fixtures/preload.ts +1 -0
  25. package/tests/solvers/SchematicTraceSingleLineSolver/SchematicTraceSingleLineSolver_repro01.test.ts +1 -1
  26. package/tests/solvers/SchematicTraceSingleLineSolver2/SchematicTraceSingleLineSolver2_01-example17-d1_1-u1_1.test.ts +323 -0
  27. package/tests/solvers/SchematicTraceSingleLineSolver2/__snapshots__/SchematicTraceSingleLineSolver2_01-example17-d1_1-u1_1.snap.svg +160 -0
@@ -3,184 +3,626 @@ import { test } from "bun:test"
3
3
  import { SchematicTracePipelineSolver, type InputProblem } from "lib/index"
4
4
  import "tests/fixtures/matcher"
5
5
 
6
- const inputProblem = {
6
+ const inputProblem: InputProblem = {
7
7
  chips: [
8
8
  {
9
9
  chipId: "schematic_component_0",
10
10
  center: {
11
- x: 0,
11
+ x: 0.79,
12
12
  y: 0,
13
13
  },
14
- width: 2,
15
- height: 1.4,
14
+ width: 3.8,
15
+ height: 8.400000000000004,
16
16
  pins: [
17
17
  {
18
- pinId: "U3.8",
19
- x: -1.4,
20
- y: 0.42500000000000004,
18
+ pinId: "U3.1",
19
+ x: -1.1099999999999999,
20
+ y: 1.2000000000000015,
21
+ },
22
+ {
23
+ pinId: "U3.2",
24
+ x: -1.1099999999999999,
25
+ y: -1.8000000000000007,
26
+ },
27
+ {
28
+ pinId: "U3.3",
29
+ x: -1.1099999999999999,
30
+ y: -2.000000000000001,
21
31
  },
22
32
  {
23
33
  pinId: "U3.4",
24
- x: -1.4,
25
- y: -0.42500000000000004,
34
+ x: -1.1099999999999999,
35
+ y: -2.200000000000001,
26
36
  },
27
37
  {
28
- pinId: "U3.1",
29
- x: 1.4,
30
- y: 0.5,
38
+ pinId: "U3.5",
39
+ x: -1.1099999999999999,
40
+ y: -2.4000000000000012,
31
41
  },
32
42
  {
33
43
  pinId: "U3.6",
34
- x: 1.4,
35
- y: 0.30000000000000004,
44
+ x: -1.1099999999999999,
45
+ y: -2.6000000000000014,
36
46
  },
37
47
  {
38
- pinId: "U3.5",
39
- x: 1.4,
40
- y: 0.10000000000000009,
48
+ pinId: "U3.7",
49
+ x: -1.1099999999999999,
50
+ y: -2.8000000000000016,
41
51
  },
42
52
  {
43
- pinId: "U3.2",
44
- x: 1.4,
45
- y: -0.09999999999999998,
53
+ pinId: "U3.8",
54
+ x: -1.1099999999999999,
55
+ y: -3.0000000000000018,
46
56
  },
47
57
  {
48
- pinId: "U3.3",
49
- x: 1.4,
50
- y: -0.3,
58
+ pinId: "U3.9",
59
+ x: -1.1099999999999999,
60
+ y: -3.200000000000002,
51
61
  },
52
62
  {
53
- pinId: "U3.7",
54
- x: 1.4,
55
- y: -0.5,
63
+ pinId: "U3.10",
64
+ x: -1.1099999999999999,
65
+ y: 1.0000000000000013,
66
+ },
67
+ {
68
+ pinId: "U3.11",
69
+ x: -1.1099999999999999,
70
+ y: -3.400000000000002,
71
+ },
72
+ {
73
+ pinId: "U3.12",
74
+ x: -1.1099999999999999,
75
+ y: -3.6000000000000023,
76
+ },
77
+ {
78
+ pinId: "U3.13",
79
+ x: -1.1099999999999999,
80
+ y: -3.8000000000000025,
81
+ },
82
+ {
83
+ pinId: "U3.14",
84
+ x: -1.1099999999999999,
85
+ y: -4.000000000000002,
86
+ },
87
+ {
88
+ pinId: "U3.15",
89
+ x: 2.69,
90
+ y: -0.5000000000000009,
91
+ },
92
+ {
93
+ pinId: "U3.16",
94
+ x: 2.69,
95
+ y: -0.7000000000000011,
96
+ },
97
+ {
98
+ pinId: "U3.17",
99
+ x: 2.69,
100
+ y: -0.9000000000000012,
101
+ },
102
+ {
103
+ pinId: "U3.18",
104
+ x: 2.69,
105
+ y: -1.1000000000000014,
106
+ },
107
+ {
108
+ pinId: "U3.19",
109
+ x: 2.69,
110
+ y: -1.3000000000000014,
111
+ },
112
+ {
113
+ pinId: "U3.20",
114
+ x: 2.69,
115
+ y: -1.9000000000000015,
116
+ },
117
+ {
118
+ pinId: "U3.21",
119
+ x: 2.69,
120
+ y: -2.1000000000000014,
121
+ },
122
+ {
123
+ pinId: "U3.22",
124
+ x: -1.1099999999999999,
125
+ y: 0.8000000000000012,
126
+ },
127
+ {
128
+ pinId: "U3.23",
129
+ x: -1.1099999999999999,
130
+ y: 2.8000000000000016,
131
+ },
132
+ {
133
+ pinId: "U3.24",
134
+ x: 2.69,
135
+ y: -2.7000000000000015,
136
+ },
137
+ {
138
+ pinId: "U3.25",
139
+ x: 2.69,
140
+ y: -2.9000000000000012,
141
+ },
142
+ {
143
+ pinId: "U3.26",
144
+ x: 2.69,
145
+ y: -3.1000000000000014,
146
+ },
147
+ {
148
+ pinId: "U3.27",
149
+ x: 2.69,
150
+ y: 0.0999999999999992,
151
+ },
152
+ {
153
+ pinId: "U3.28",
154
+ x: 2.69,
155
+ y: 0.2999999999999994,
156
+ },
157
+ {
158
+ pinId: "U3.29",
159
+ x: 2.69,
160
+ y: 0.49999999999999956,
161
+ },
162
+ {
163
+ pinId: "U3.30",
164
+ x: 2.69,
165
+ y: 0.6999999999999997,
166
+ },
167
+ {
168
+ pinId: "U3.31",
169
+ x: 2.69,
170
+ y: 0.8999999999999995,
171
+ },
172
+ {
173
+ pinId: "U3.32",
174
+ x: 2.69,
175
+ y: 1.0999999999999996,
176
+ },
177
+ {
178
+ pinId: "U3.33",
179
+ x: -1.1099999999999999,
180
+ y: 0.600000000000001,
181
+ },
182
+ {
183
+ pinId: "U3.34",
184
+ x: 2.69,
185
+ y: 1.2999999999999998,
186
+ },
187
+ {
188
+ pinId: "U3.35",
189
+ x: 2.69,
190
+ y: 1.5,
191
+ },
192
+ {
193
+ pinId: "U3.36",
194
+ x: 2.69,
195
+ y: 1.7000000000000002,
196
+ },
197
+ {
198
+ pinId: "U3.37",
199
+ x: 2.69,
200
+ y: 1.9000000000000004,
201
+ },
202
+ {
203
+ pinId: "U3.38",
204
+ x: 2.69,
205
+ y: 2.500000000000001,
206
+ },
207
+ {
208
+ pinId: "U3.39",
209
+ x: 2.69,
210
+ y: 2.700000000000001,
211
+ },
212
+ {
213
+ pinId: "U3.40",
214
+ x: 2.69,
215
+ y: 2.9000000000000012,
216
+ },
217
+ {
218
+ pinId: "U3.41",
219
+ x: 2.69,
220
+ y: 3.1000000000000014,
221
+ },
222
+ {
223
+ pinId: "U3.42",
224
+ x: -1.1099999999999999,
225
+ y: 0.4000000000000008,
226
+ },
227
+ {
228
+ pinId: "U3.43",
229
+ x: -1.1099999999999999,
230
+ y: -1.6000000000000005,
231
+ },
232
+ {
233
+ pinId: "U3.44",
234
+ x: -1.1099999999999999,
235
+ y: 2.0000000000000018,
236
+ },
237
+ {
238
+ pinId: "U3.45",
239
+ x: -1.1099999999999999,
240
+ y: 1.8000000000000016,
241
+ },
242
+ {
243
+ pinId: "U3.46",
244
+ x: -1.1099999999999999,
245
+ y: -1.4000000000000004,
246
+ },
247
+ {
248
+ pinId: "U3.47",
249
+ x: -1.1099999999999999,
250
+ y: -1.2000000000000002,
251
+ },
252
+ {
253
+ pinId: "U3.48",
254
+ x: -1.1099999999999999,
255
+ y: -1,
256
+ },
257
+ {
258
+ pinId: "U3.49",
259
+ x: -1.1099999999999999,
260
+ y: 0.20000000000000062,
261
+ },
262
+ {
263
+ pinId: "U3.50",
264
+ x: -1.1099999999999999,
265
+ y: 2.600000000000002,
266
+ },
267
+ {
268
+ pinId: "U3.51",
269
+ x: -1.1099999999999999,
270
+ y: 3.0000000000000018,
271
+ },
272
+ {
273
+ pinId: "U3.52",
274
+ x: -1.1099999999999999,
275
+ y: 3.200000000000002,
276
+ },
277
+ {
278
+ pinId: "U3.53",
279
+ x: -1.1099999999999999,
280
+ y: 3.4000000000000017,
281
+ },
282
+ {
283
+ pinId: "U3.54",
284
+ x: -1.1099999999999999,
285
+ y: 3.600000000000002,
286
+ },
287
+ {
288
+ pinId: "U3.55",
289
+ x: -1.1099999999999999,
290
+ y: 3.8000000000000016,
291
+ },
292
+ {
293
+ pinId: "U3.56",
294
+ x: -1.1099999999999999,
295
+ y: 4.000000000000002,
296
+ },
297
+ {
298
+ pinId: "U3.57",
299
+ x: -1.1099999999999999,
300
+ y: -0.39999999999999947,
56
301
  },
57
302
  ],
58
303
  },
59
304
  {
60
305
  chipId: "schematic_component_1",
61
306
  center: {
62
- x: -2.3145833,
63
- y: 0,
307
+ x: -1.5675,
308
+ y: 5.955000000000002,
64
309
  },
65
- width: 0.5291665999999999,
66
- height: 1.0583333000000001,
310
+ width: 0.53,
311
+ height: 1.0999999999999996,
67
312
  pins: [
68
313
  {
69
- pinId: "C20.1",
70
- x: -2.3148566499999994,
71
- y: 0.5512093000000002,
314
+ pinId: "C12.1",
315
+ x: -1.5675,
316
+ y: 6.505000000000002,
72
317
  },
73
318
  {
74
- pinId: "C20.2",
75
- x: -2.31430995,
76
- y: -0.5512093000000002,
319
+ pinId: "C12.2",
320
+ x: -1.5675,
321
+ y: 5.405000000000002,
77
322
  },
78
323
  ],
79
324
  },
80
325
  {
81
326
  chipId: "schematic_component_2",
82
327
  center: {
83
- x: 1.7577928249999983,
84
- y: 1.7512907000000002,
328
+ x: -0.6374999999999998,
329
+ y: 5.955000000000002,
85
330
  },
86
- width: 0.3155856499999966,
87
- height: 1.0583332999999997,
331
+ width: 0.53,
332
+ height: 1.0999999999999996,
88
333
  pins: [
89
334
  {
90
- pinId: "R11.1",
91
- x: 1.7580660749999977,
92
- y: 2.3025814000000002,
335
+ pinId: "C14.1",
336
+ x: -0.6374999999999998,
337
+ y: 6.505000000000002,
93
338
  },
94
339
  {
95
- pinId: "R11.2",
96
- x: 1.757519574999999,
97
- y: 1.2,
340
+ pinId: "C14.2",
341
+ x: -0.6374999999999998,
342
+ y: 5.405000000000002,
98
343
  },
99
344
  ],
100
345
  },
101
346
  {
102
347
  chipId: "schematic_component_3",
103
348
  center: {
104
- x: -1.7577928249999983,
105
- y: -2.7512907000000002,
349
+ x: -2.4975,
350
+ y: 5.955000000000002,
106
351
  },
107
- width: 0.3155856499999966,
108
- height: 1.0583332999999997,
352
+ width: 0.53,
353
+ height: 1.0999999999999996,
109
354
  pins: [
110
355
  {
111
- pinId: "R12.1",
112
- x: -1.7580660749999977,
113
- y: -3.3025814000000002,
356
+ pinId: "C8.1",
357
+ x: -2.4975,
358
+ y: 6.505000000000002,
114
359
  },
115
360
  {
116
- pinId: "R12.2",
117
- x: -1.757519574999999,
118
- y: -2.2,
361
+ pinId: "C8.2",
362
+ x: -2.4975,
363
+ y: 5.405000000000002,
119
364
  },
120
365
  ],
121
366
  },
122
367
  {
123
368
  chipId: "schematic_component_4",
124
369
  center: {
125
- x: 1.7577928249999983,
126
- y: -2.7512907000000002,
370
+ x: 0.2925000000000004,
371
+ y: 5.955000000000002,
372
+ },
373
+ width: 0.53,
374
+ height: 1.0999999999999996,
375
+ pins: [
376
+ {
377
+ pinId: "C13.1",
378
+ x: 0.29250000000000037,
379
+ y: 6.505000000000002,
380
+ },
381
+ {
382
+ pinId: "C13.2",
383
+ x: 0.2925000000000005,
384
+ y: 5.405000000000002,
385
+ },
386
+ ],
387
+ },
388
+ {
389
+ chipId: "schematic_component_5",
390
+ center: {
391
+ x: 1.2225000000000006,
392
+ y: 5.955000000000002,
393
+ },
394
+ width: 0.53,
395
+ height: 1.0999999999999996,
396
+ pins: [
397
+ {
398
+ pinId: "C15.1",
399
+ x: 1.2225000000000006,
400
+ y: 6.505000000000002,
401
+ },
402
+ {
403
+ pinId: "C15.2",
404
+ x: 1.2225000000000006,
405
+ y: 5.405000000000002,
406
+ },
407
+ ],
408
+ },
409
+ {
410
+ chipId: "schematic_component_6",
411
+ center: {
412
+ x: 2.1525000000000007,
413
+ y: 5.955000000000002,
414
+ },
415
+ width: 0.53,
416
+ height: 1.0999999999999996,
417
+ pins: [
418
+ {
419
+ pinId: "C19.1",
420
+ x: 2.1525000000000007,
421
+ y: 6.505000000000002,
422
+ },
423
+ {
424
+ pinId: "C19.2",
425
+ x: 2.1525000000000007,
426
+ y: 5.405000000000002,
427
+ },
428
+ ],
429
+ },
430
+ {
431
+ chipId: "schematic_component_7",
432
+ center: {
433
+ x: -4.6850000000000005,
434
+ y: 3.218333333333335,
435
+ },
436
+ width: 0.53,
437
+ height: 1.1000000000000005,
438
+ pins: [
439
+ {
440
+ pinId: "C18.1",
441
+ x: -4.6850000000000005,
442
+ y: 3.7683333333333353,
443
+ },
444
+ {
445
+ pinId: "C18.2",
446
+ x: -4.6850000000000005,
447
+ y: 2.668333333333335,
448
+ },
449
+ ],
450
+ },
451
+ {
452
+ chipId: "schematic_component_8",
453
+ center: {
454
+ x: -3.7550000000000003,
455
+ y: 3.218333333333335,
456
+ },
457
+ width: 0.53,
458
+ height: 1.1000000000000005,
459
+ pins: [
460
+ {
461
+ pinId: "C7.1",
462
+ x: -3.7550000000000003,
463
+ y: 3.7683333333333353,
464
+ },
465
+ {
466
+ pinId: "C7.2",
467
+ x: -3.7550000000000003,
468
+ y: 2.668333333333335,
469
+ },
470
+ ],
471
+ },
472
+ {
473
+ chipId: "schematic_component_9",
474
+ center: {
475
+ x: -6.415,
476
+ y: 3.2183333333333355,
127
477
  },
128
- width: 0.3155856499999966,
129
- height: 1.0583332999999997,
478
+ width: 0.53,
479
+ height: 1.0999999999999996,
130
480
  pins: [
131
481
  {
132
- pinId: "R13.1",
133
- x: 1.7580660749999977,
134
- y: -3.3025814000000002,
482
+ pinId: "C9.1",
483
+ x: -6.415,
484
+ y: 3.7683333333333353,
135
485
  },
136
486
  {
137
- pinId: "R13.2",
138
- x: 1.757519574999999,
139
- y: -2.2,
487
+ pinId: "C9.2",
488
+ x: -6.415,
489
+ y: 2.6683333333333357,
490
+ },
491
+ ],
492
+ },
493
+ {
494
+ chipId: "schematic_component_10",
495
+ center: {
496
+ x: -2.025,
497
+ y: 1.450000000000001,
498
+ },
499
+ width: 0.53,
500
+ height: 1.1,
501
+ pins: [
502
+ {
503
+ pinId: "C10.1",
504
+ x: -2.025,
505
+ y: 2.000000000000001,
506
+ },
507
+ {
508
+ pinId: "C10.2",
509
+ x: -2.025,
510
+ y: 0.900000000000001,
511
+ },
512
+ ],
513
+ },
514
+ {
515
+ chipId: "schematic_component_11",
516
+ center: {
517
+ x: -2.025,
518
+ y: -2.1500000000000004,
519
+ },
520
+ width: 0.53,
521
+ height: 1.1,
522
+ pins: [
523
+ {
524
+ pinId: "C11.1",
525
+ x: -2.025,
526
+ y: -1.6000000000000003,
527
+ },
528
+ {
529
+ pinId: "C11.2",
530
+ x: -2.025,
531
+ y: -2.7,
140
532
  },
141
533
  ],
142
534
  },
143
535
  ],
144
536
  directConnections: [
145
537
  {
146
- pinIds: ["C20.1", "U3.8"],
147
- netId: "capacitor.C20 > port.pin1 to .U3 > .VDD",
538
+ pinIds: ["U3.1", "C12.1"],
539
+ netId: "chip.U3 > port.IOVDD1 to C12.pin1",
540
+ },
541
+ {
542
+ pinIds: ["U3.10", "C14.1"],
543
+ netId: "chip.U3 > port.IOVDD2 to C14.pin1",
544
+ },
545
+ {
546
+ pinIds: ["U3.22", "C8.1"],
547
+ netId: "chip.U3 > port.IOVDD3 to C8.pin1",
148
548
  },
149
549
  {
150
- pinIds: ["C20.2", "U3.4"],
151
- netId: "capacitor.C20 > port.pin2 to .U3 > .GND",
550
+ pinIds: ["U3.33", "C13.1"],
551
+ netId: "chip.U3 > port.IOVDD4 to C13.pin1",
152
552
  },
153
553
  {
154
- pinIds: ["R11.2", "U3.1"],
155
- netId: "resistor.R11 > port.pin2 to .U3 > .N_CS",
554
+ pinIds: ["U3.42", "C15.1"],
555
+ netId: "chip.U3 > port.IOVDD5 to C15.pin1",
156
556
  },
157
557
  {
158
- pinIds: ["R13.2", "R12.2"],
159
- netId: "resistor.R11 > port.pin1 to resistor.R12 > port.pin1",
558
+ pinIds: ["U3.49", "C19.1"],
559
+ netId: "chip.U3 > port.IOVDD6 to C19.pin1",
560
+ },
561
+ {
562
+ pinIds: ["U3.23", "C18.1"],
563
+ netId: "chip.U3 > port.DVDD1 to C18.1",
564
+ },
565
+ {
566
+ pinIds: ["U3.50", "C7.1"],
567
+ netId: "chip.U3 > port.DVDD2 to C7.1",
568
+ },
569
+ {
570
+ pinIds: ["C10.1", "U3.44"],
571
+ netId: "capacitor.C10 > port.pin1 to U3.VREG_VIN",
572
+ },
573
+ {
574
+ pinIds: ["C11.1", "U3.43"],
575
+ netId: "capacitor.C11 > port.pin1 to U3.ADC_AVDD",
160
576
  },
161
577
  ],
162
578
  netConnections: [
163
579
  {
164
580
  netId: "V3_3",
165
- pinIds: ["U3.8", "U3.3", "U3.7", "C20.1", "R11.1"],
581
+ pinIds: [
582
+ "U3.1",
583
+ "U3.10",
584
+ "U3.22",
585
+ "U3.33",
586
+ "U3.42",
587
+ "U3.49",
588
+ "C12.1",
589
+ "C14.1",
590
+ "C8.1",
591
+ "C13.1",
592
+ "C15.1",
593
+ "C19.1",
594
+ ],
166
595
  },
167
596
  {
168
- netId: "GND",
169
- pinIds: ["U3.4", "C20.2"],
597
+ netId: "V1_1",
598
+ pinIds: ["U3.23", "U3.50", "C18.1", "C7.1", "C9.1"],
170
599
  },
171
600
  {
172
- netId: "FLASH_N_CS",
173
- pinIds: ["U3.1", "R11.2"],
601
+ netId: "GND",
602
+ pinIds: [
603
+ "C12.2",
604
+ "C14.2",
605
+ "C8.2",
606
+ "C13.2",
607
+ "C15.2",
608
+ "C19.2",
609
+ "C18.2",
610
+ "C7.2",
611
+ "C9.2",
612
+ "C10.2",
613
+ "C11.2",
614
+ ],
174
615
  },
175
616
  ],
176
617
  availableNetLabelOrientations: {
177
618
  V3_3: ["y+"],
619
+ V1_1: ["y+"],
178
620
  GND: ["y-"],
179
621
  },
180
- maxMspPairDistance: 5,
181
- } as InputProblem
622
+ maxMspPairDistance: 2.4,
623
+ }
182
624
 
183
- test("example14", () => {
625
+ test("example15", () => {
184
626
  const solver = new SchematicTracePipelineSolver(inputProblem)
185
627
  solver.solve()
186
628
  expect(solver).toMatchSolverSnapshot(import.meta.path)