@tscircuit/schematic-trace-solver 0.0.30 → 0.0.32

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,490 @@
1
+ import type { InputProblem } from "lib/types/InputProblem"
2
+ import { test, expect } from "bun:test"
3
+ import { SchematicTracePipelineSolver } from "lib/index"
4
+
5
+ const inputProblem: InputProblem = {
6
+ chips: [
7
+ {
8
+ chipId: "schematic_component_0",
9
+ center: {
10
+ x: 0,
11
+ y: 0,
12
+ },
13
+ width: 2.3,
14
+ height: 1.4,
15
+ pins: [
16
+ {
17
+ pinId: "J1.1",
18
+ x: 1.15,
19
+ y: 0.5,
20
+ },
21
+ {
22
+ pinId: "J1.2",
23
+ x: 1.15,
24
+ y: 0.30000000000000004,
25
+ },
26
+ {
27
+ pinId: "J1.3",
28
+ x: 1.15,
29
+ y: 0.10000000000000009,
30
+ },
31
+ {
32
+ pinId: "J1.4",
33
+ x: 1.15,
34
+ y: -0.09999999999999998,
35
+ },
36
+ {
37
+ pinId: "J1.5",
38
+ x: 1.15,
39
+ y: -0.3,
40
+ },
41
+ {
42
+ pinId: "J1.6",
43
+ x: 1.15,
44
+ y: -0.5,
45
+ },
46
+ ],
47
+ },
48
+ {
49
+ chipId: "schematic_component_1",
50
+ center: {
51
+ x: 1.56,
52
+ y: 4.308333333333334,
53
+ },
54
+ width: 1,
55
+ height: 0.45,
56
+ pins: [
57
+ {
58
+ pinId: "SW1.1",
59
+ x: 1.06,
60
+ y: 4.258333333333334,
61
+ },
62
+ {
63
+ pinId: "SW1.2",
64
+ x: 2.06,
65
+ y: 4.258333333333334,
66
+ },
67
+ ],
68
+ },
69
+ {
70
+ chipId: "schematic_component_2",
71
+ center: {
72
+ x: 0.3599999999999999,
73
+ y: 4.308333333333334,
74
+ },
75
+ width: 1.04,
76
+ height: 0.54,
77
+ pins: [
78
+ {
79
+ pinId: "D1.1",
80
+ x: -0.16000000000000014,
81
+ y: 4.308333333333334,
82
+ },
83
+ {
84
+ pinId: "D1.2",
85
+ x: 0.8799999999999999,
86
+ y: 4.308333333333334,
87
+ },
88
+ ],
89
+ },
90
+ {
91
+ chipId: "schematic_component_3",
92
+ center: {
93
+ x: 5.06,
94
+ y: 0.3583333333333334,
95
+ },
96
+ width: 1,
97
+ height: 0.45,
98
+ pins: [
99
+ {
100
+ pinId: "SW2.1",
101
+ x: 4.56,
102
+ y: 0.30833333333333357,
103
+ },
104
+ {
105
+ pinId: "SW2.2",
106
+ x: 5.56,
107
+ y: 0.30833333333333357,
108
+ },
109
+ ],
110
+ },
111
+ {
112
+ chipId: "schematic_component_4",
113
+ center: {
114
+ x: 3.8599999999999994,
115
+ y: 0.3583333333333334,
116
+ },
117
+ width: 1.040000000000001,
118
+ height: 0.54,
119
+ pins: [
120
+ {
121
+ pinId: "D2.1",
122
+ x: 3.339999999999999,
123
+ y: 0.3583333333333334,
124
+ },
125
+ {
126
+ pinId: "D2.2",
127
+ x: 4.38,
128
+ y: 0.3583333333333334,
129
+ },
130
+ ],
131
+ },
132
+ {
133
+ chipId: "schematic_component_5",
134
+ center: {
135
+ x: 3.163333333333334,
136
+ y: 10.185,
137
+ },
138
+ width: 1,
139
+ height: 0.45,
140
+ pins: [
141
+ {
142
+ pinId: "SW3.1",
143
+ x: 2.663333333333334,
144
+ y: 10.135,
145
+ },
146
+ {
147
+ pinId: "SW3.2",
148
+ x: 3.663333333333334,
149
+ y: 10.135,
150
+ },
151
+ ],
152
+ },
153
+ {
154
+ chipId: "schematic_component_6",
155
+ center: {
156
+ x: 1.9633333333333338,
157
+ y: 10.185,
158
+ },
159
+ width: 1.040000000000001,
160
+ height: 0.54,
161
+ pins: [
162
+ {
163
+ pinId: "D3.1",
164
+ x: 1.4433333333333334,
165
+ y: 10.185,
166
+ },
167
+ {
168
+ pinId: "D3.2",
169
+ x: 2.4833333333333343,
170
+ y: 10.185,
171
+ },
172
+ ],
173
+ },
174
+ {
175
+ chipId: "schematic_component_7",
176
+ center: {
177
+ x: 3.8100000000000005,
178
+ y: 3.715,
179
+ },
180
+ width: 1,
181
+ height: 0.45,
182
+ pins: [
183
+ {
184
+ pinId: "SW4.1",
185
+ x: 3.3100000000000005,
186
+ y: 3.665,
187
+ },
188
+ {
189
+ pinId: "SW4.2",
190
+ x: 4.3100000000000005,
191
+ y: 3.665,
192
+ },
193
+ ],
194
+ },
195
+ {
196
+ chipId: "schematic_component_8",
197
+ center: {
198
+ x: 2.6100000000000003,
199
+ y: 3.715,
200
+ },
201
+ width: 1.04,
202
+ height: 0.54,
203
+ pins: [
204
+ {
205
+ pinId: "D4.1",
206
+ x: 2.0900000000000003,
207
+ y: 3.715,
208
+ },
209
+ {
210
+ pinId: "D4.2",
211
+ x: 3.1300000000000003,
212
+ y: 3.715,
213
+ },
214
+ ],
215
+ },
216
+ {
217
+ chipId: "schematic_component_9",
218
+ center: {
219
+ x: 3.34,
220
+ y: 5.783333333333333,
221
+ },
222
+ width: 1,
223
+ height: 0.45,
224
+ pins: [
225
+ {
226
+ pinId: "SW5.1",
227
+ x: 2.84,
228
+ y: 5.733333333333333,
229
+ },
230
+ {
231
+ pinId: "SW5.2",
232
+ x: 3.84,
233
+ y: 5.733333333333333,
234
+ },
235
+ ],
236
+ },
237
+ {
238
+ chipId: "schematic_component_10",
239
+ center: {
240
+ x: 2.1399999999999997,
241
+ y: 5.783333333333333,
242
+ },
243
+ width: 1.040000000000001,
244
+ height: 0.54,
245
+ pins: [
246
+ {
247
+ pinId: "D5.1",
248
+ x: 1.6199999999999992,
249
+ y: 5.783333333333333,
250
+ },
251
+ {
252
+ pinId: "D5.2",
253
+ x: 2.66,
254
+ y: 5.783333333333333,
255
+ },
256
+ ],
257
+ },
258
+ {
259
+ chipId: "schematic_component_11",
260
+ center: {
261
+ x: 1.4249999999999998,
262
+ y: 2.17,
263
+ },
264
+ width: 1,
265
+ height: 0.45,
266
+ pins: [
267
+ {
268
+ pinId: "SW6.1",
269
+ x: 0.9249999999999998,
270
+ y: 2.12,
271
+ },
272
+ {
273
+ pinId: "SW6.2",
274
+ x: 1.9249999999999998,
275
+ y: 2.12,
276
+ },
277
+ ],
278
+ },
279
+ {
280
+ chipId: "schematic_component_12",
281
+ center: {
282
+ x: 0.22499999999999964,
283
+ y: 2.17,
284
+ },
285
+ width: 1.040000000000001,
286
+ height: 0.54,
287
+ pins: [
288
+ {
289
+ pinId: "D6.1",
290
+ x: -0.2950000000000008,
291
+ y: 2.17,
292
+ },
293
+ {
294
+ pinId: "D6.2",
295
+ x: 0.7450000000000001,
296
+ y: 2.17,
297
+ },
298
+ ],
299
+ },
300
+ {
301
+ chipId: "schematic_component_13",
302
+ center: {
303
+ x: 4.9799999999999995,
304
+ y: -3.4499999999999997,
305
+ },
306
+ width: 1,
307
+ height: 0.45,
308
+ pins: [
309
+ {
310
+ pinId: "SW7.1",
311
+ x: 4.4799999999999995,
312
+ y: -3.4999999999999996,
313
+ },
314
+ {
315
+ pinId: "SW7.2",
316
+ x: 5.4799999999999995,
317
+ y: -3.4999999999999996,
318
+ },
319
+ ],
320
+ },
321
+ {
322
+ chipId: "schematic_component_14",
323
+ center: {
324
+ x: 3.7799999999999994,
325
+ y: -3.4499999999999997,
326
+ },
327
+ width: 1.04,
328
+ height: 0.54,
329
+ pins: [
330
+ {
331
+ pinId: "D7.1",
332
+ x: 3.2599999999999993,
333
+ y: -3.4499999999999997,
334
+ },
335
+ {
336
+ pinId: "D7.2",
337
+ x: 4.299999999999999,
338
+ y: -3.4499999999999997,
339
+ },
340
+ ],
341
+ },
342
+ {
343
+ chipId: "schematic_component_15",
344
+ center: {
345
+ x: 2.944999999999998,
346
+ y: -6.048333333333334,
347
+ },
348
+ width: 1,
349
+ height: 0.45,
350
+ pins: [
351
+ {
352
+ pinId: "SW8.1",
353
+ x: 2.444999999999998,
354
+ y: -6.098333333333334,
355
+ },
356
+ {
357
+ pinId: "SW8.2",
358
+ x: 3.444999999999998,
359
+ y: -6.098333333333334,
360
+ },
361
+ ],
362
+ },
363
+ {
364
+ chipId: "schematic_component_16",
365
+ center: {
366
+ x: 1.744999999999998,
367
+ y: -6.048333333333334,
368
+ },
369
+ width: 1.04,
370
+ height: 0.54,
371
+ pins: [
372
+ {
373
+ pinId: "D8.1",
374
+ x: 1.224999999999998,
375
+ y: -6.048333333333334,
376
+ },
377
+ {
378
+ pinId: "D8.2",
379
+ x: 2.264999999999998,
380
+ y: -6.048333333333334,
381
+ },
382
+ ],
383
+ },
384
+ {
385
+ chipId: "schematic_component_17",
386
+ center: {
387
+ x: 4.409999999999998,
388
+ y: -7.788333333333336,
389
+ },
390
+ width: 1,
391
+ height: 0.45,
392
+ pins: [
393
+ {
394
+ pinId: "SW9.1",
395
+ x: 3.9099999999999984,
396
+ y: -7.838333333333335,
397
+ },
398
+ {
399
+ pinId: "SW9.2",
400
+ x: 4.909999999999998,
401
+ y: -7.838333333333335,
402
+ },
403
+ ],
404
+ },
405
+ {
406
+ chipId: "schematic_component_18",
407
+ center: {
408
+ x: 3.209999999999998,
409
+ y: -7.788333333333336,
410
+ },
411
+ width: 1.040000000000001,
412
+ height: 0.54,
413
+ pins: [
414
+ {
415
+ pinId: "D9.1",
416
+ x: 2.6899999999999977,
417
+ y: -7.788333333333336,
418
+ },
419
+ {
420
+ pinId: "D9.2",
421
+ x: 3.7299999999999986,
422
+ y: -7.788333333333336,
423
+ },
424
+ ],
425
+ },
426
+ ],
427
+ directConnections: [
428
+ {
429
+ pinIds: ["D1.2", "SW1.1"],
430
+ netId: ".D1 > .cathode to .SW1 > .pin1",
431
+ },
432
+ {
433
+ pinIds: ["D2.2", "SW2.1"],
434
+ netId: ".D2 > .cathode to .SW2 > .pin1",
435
+ },
436
+ {
437
+ pinIds: ["D3.2", "SW3.1"],
438
+ netId: ".D3 > .cathode to .SW3 > .pin1",
439
+ },
440
+ {
441
+ pinIds: ["D4.2", "SW4.1"],
442
+ netId: ".D4 > .cathode to .SW4 > .pin1",
443
+ },
444
+ {
445
+ pinIds: ["D5.2", "SW5.1"],
446
+ netId: ".D5 > .cathode to .SW5 > .pin1",
447
+ },
448
+ {
449
+ pinIds: ["D6.2", "SW6.1"],
450
+ netId: ".D6 > .cathode to .SW6 > .pin1",
451
+ },
452
+ {
453
+ pinIds: ["D7.2", "SW7.1"],
454
+ netId: ".D7 > .cathode to .SW7 > .pin1",
455
+ },
456
+ {
457
+ pinIds: ["D8.2", "SW8.1"],
458
+ netId: ".D8 > .cathode to .SW8 > .pin1",
459
+ },
460
+ {
461
+ pinIds: ["D9.2", "SW9.1"],
462
+ netId: ".D9 > .cathode to .SW9 > .pin1",
463
+ },
464
+ ],
465
+ netConnections: [
466
+ {
467
+ netId: "ROW0",
468
+ pinIds: ["J1.1", "D1.1", "D2.1", "D3.1"],
469
+ },
470
+ {
471
+ netId: "ROW1",
472
+ pinIds: ["J1.2", "D4.1", "D5.1", "D6.1"],
473
+ },
474
+ {
475
+ netId: "ROW2",
476
+ pinIds: ["J1.3", "D7.1", "D8.1", "D9.1"],
477
+ },
478
+ ],
479
+ availableNetLabelOrientations: {
480
+ ROW0: ["x-", "x+"],
481
+ ROW1: ["x-", "x+"],
482
+ ROW2: ["x-", "x+"],
483
+ },
484
+ maxMspPairDistance: 5,
485
+ }
486
+
487
+ test("SchematicTracePipelineSolver_repro03 - infinite loop fixed", () => {
488
+ const solver = new SchematicTracePipelineSolver(inputProblem)
489
+ solver.solve()
490
+ })