@tscircuit/schematic-trace-solver 0.0.13 → 0.0.15
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.
- package/dist/index.d.ts +15 -0
- package/dist/index.js +18 -2
- package/lib/solvers/NetLabelPlacementSolver/NetLabelPlacementSolver.ts +14 -1
- package/lib/solvers/NetLabelPlacementSolver/SingleNetLabelPlacementSolver/SingleNetLabelPlacementSolver.ts +11 -1
- package/lib/solvers/NetLabelPlacementSolver/SingleNetLabelPlacementSolver/solvePortOnlyPin.ts +3 -0
- package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceLinesSolver.ts +8 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -180,6 +180,8 @@ declare class SchematicTraceSingleLineSolver extends BaseSolver {
|
|
|
180
180
|
|
|
181
181
|
interface SolvedTracePath extends MspConnectionPair {
|
|
182
182
|
tracePath: Point[];
|
|
183
|
+
mspConnectionPairIds: MspConnectionPairId[];
|
|
184
|
+
pinIds: PinId[];
|
|
183
185
|
}
|
|
184
186
|
declare class SchematicTraceLinesSolver extends BaseSolver {
|
|
185
187
|
inputProblem: InputProblem;
|
|
@@ -345,6 +347,19 @@ type OverlappingSameNetTraceGroup = {
|
|
|
345
347
|
interface NetLabelPlacement {
|
|
346
348
|
globalConnNetId: string;
|
|
347
349
|
dcConnNetId?: string;
|
|
350
|
+
/**
|
|
351
|
+
* Optional user-provided net identifier (if present in the input problem).
|
|
352
|
+
*/
|
|
353
|
+
netId?: string;
|
|
354
|
+
/**
|
|
355
|
+
* MSP pair ids that the label is associated with. Port-only labels use [].
|
|
356
|
+
*/
|
|
357
|
+
mspConnectionPairIds: MspConnectionPairId[];
|
|
358
|
+
/**
|
|
359
|
+
* Pin ids relevant to this label. For a host trace, the two pins of that pair;
|
|
360
|
+
* for a port-only label, the single port pin id.
|
|
361
|
+
*/
|
|
362
|
+
pinIds: PinId[];
|
|
348
363
|
orientation: FacingDirection;
|
|
349
364
|
/**
|
|
350
365
|
* The anchor point is the point on the trace where the net label connects
|
package/dist/index.js
CHANGED
|
@@ -6853,7 +6853,12 @@ var SchematicTraceLinesSolver = class extends BaseSolver {
|
|
|
6853
6853
|
if (this.activeSubSolver?.solved) {
|
|
6854
6854
|
this.solvedTracePaths.push({
|
|
6855
6855
|
...this.currentConnectionPair,
|
|
6856
|
-
tracePath: this.activeSubSolver.solvedTracePath
|
|
6856
|
+
tracePath: this.activeSubSolver.solvedTracePath,
|
|
6857
|
+
mspConnectionPairIds: [this.currentConnectionPair.mspPairId],
|
|
6858
|
+
pinIds: [
|
|
6859
|
+
this.currentConnectionPair.pins[0].pinId,
|
|
6860
|
+
this.currentConnectionPair.pins[1].pinId
|
|
6861
|
+
]
|
|
6857
6862
|
});
|
|
6858
6863
|
this.activeSubSolver = null;
|
|
6859
6864
|
this.currentConnectionPair = null;
|
|
@@ -7426,6 +7431,9 @@ function solveNetLabelPlacementForPortOnlyPin(params) {
|
|
|
7426
7431
|
const placement = {
|
|
7427
7432
|
globalConnNetId: overlappingSameNetTraceGroup.globalConnNetId,
|
|
7428
7433
|
dcConnNetId: void 0,
|
|
7434
|
+
netId: overlappingSameNetTraceGroup.netId,
|
|
7435
|
+
mspConnectionPairIds: [],
|
|
7436
|
+
pinIds: [pinId],
|
|
7429
7437
|
orientation,
|
|
7430
7438
|
anchorPoint: anchor,
|
|
7431
7439
|
width,
|
|
@@ -7659,7 +7667,9 @@ var SingleNetLabelPlacementSolver = class extends BaseSolver {
|
|
|
7659
7667
|
height,
|
|
7660
7668
|
center,
|
|
7661
7669
|
hostSegIndex: si,
|
|
7662
|
-
dcConnNetId: curr.dcConnNetId
|
|
7670
|
+
dcConnNetId: curr.dcConnNetId,
|
|
7671
|
+
mspPairId: curr.mspPairId,
|
|
7672
|
+
pinIds: [curr.pins[0].pinId, curr.pins[1].pinId]
|
|
7663
7673
|
};
|
|
7664
7674
|
}
|
|
7665
7675
|
continue;
|
|
@@ -7667,6 +7677,9 @@ var SingleNetLabelPlacementSolver = class extends BaseSolver {
|
|
|
7667
7677
|
this.netLabelPlacement = {
|
|
7668
7678
|
globalConnNetId: this.overlappingSameNetTraceGroup.globalConnNetId,
|
|
7669
7679
|
dcConnNetId: curr.dcConnNetId,
|
|
7680
|
+
netId: this.overlappingSameNetTraceGroup.netId,
|
|
7681
|
+
mspConnectionPairIds: [curr.mspPairId],
|
|
7682
|
+
pinIds: [curr.pins[0].pinId, curr.pins[1].pinId],
|
|
7670
7683
|
orientation,
|
|
7671
7684
|
anchorPoint: anchor,
|
|
7672
7685
|
width,
|
|
@@ -7683,6 +7696,9 @@ var SingleNetLabelPlacementSolver = class extends BaseSolver {
|
|
|
7683
7696
|
this.netLabelPlacement = {
|
|
7684
7697
|
globalConnNetId: this.overlappingSameNetTraceGroup.globalConnNetId,
|
|
7685
7698
|
dcConnNetId: bestCandidate.dcConnNetId,
|
|
7699
|
+
netId: this.overlappingSameNetTraceGroup.netId,
|
|
7700
|
+
mspConnectionPairIds: [bestCandidate.mspPairId],
|
|
7701
|
+
pinIds: bestCandidate.pinIds,
|
|
7686
7702
|
orientation: bestCandidate.orientation,
|
|
7687
7703
|
anchorPoint: bestCandidate.anchor,
|
|
7688
7704
|
width: bestCandidate.width,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseSolver } from "lib/solvers/BaseSolver/BaseSolver"
|
|
2
|
-
import type { InputProblem } from "lib/types/InputProblem"
|
|
2
|
+
import type { InputProblem, PinId } from "lib/types/InputProblem"
|
|
3
3
|
import type { SolvedTracePath } from "../SchematicTraceLinesSolver/SchematicTraceLinesSolver"
|
|
4
4
|
import type { MspConnectionPairId } from "../MspConnectionPairSolver/MspConnectionPairSolver"
|
|
5
5
|
import { SingleNetLabelPlacementSolver } from "./SingleNetLabelPlacementSolver/SingleNetLabelPlacementSolver"
|
|
@@ -24,6 +24,19 @@ export type OverlappingSameNetTraceGroup = {
|
|
|
24
24
|
export interface NetLabelPlacement {
|
|
25
25
|
globalConnNetId: string
|
|
26
26
|
dcConnNetId?: string
|
|
27
|
+
/**
|
|
28
|
+
* Optional user-provided net identifier (if present in the input problem).
|
|
29
|
+
*/
|
|
30
|
+
netId?: string
|
|
31
|
+
/**
|
|
32
|
+
* MSP pair ids that the label is associated with. Port-only labels use [].
|
|
33
|
+
*/
|
|
34
|
+
mspConnectionPairIds: MspConnectionPairId[]
|
|
35
|
+
/**
|
|
36
|
+
* Pin ids relevant to this label. For a host trace, the two pins of that pair;
|
|
37
|
+
* for a port-only label, the single port pin id.
|
|
38
|
+
*/
|
|
39
|
+
pinIds: PinId[]
|
|
27
40
|
orientation: FacingDirection
|
|
28
41
|
|
|
29
42
|
/**
|
|
@@ -3,7 +3,7 @@ import type {
|
|
|
3
3
|
NetLabelPlacement,
|
|
4
4
|
OverlappingSameNetTraceGroup,
|
|
5
5
|
} from "../NetLabelPlacementSolver"
|
|
6
|
-
import type { InputProblem } from "lib/types/InputProblem"
|
|
6
|
+
import type { InputProblem, PinId } from "lib/types/InputProblem"
|
|
7
7
|
import type { SolvedTracePath } from "lib/solvers/SchematicTraceLinesSolver/SchematicTraceLinesSolver"
|
|
8
8
|
import type { MspConnectionPairId } from "lib/solvers/MspConnectionPairSolver/MspConnectionPairSolver"
|
|
9
9
|
import type { FacingDirection } from "lib/utils/dir"
|
|
@@ -172,6 +172,8 @@ export class SingleNetLabelPlacementSolver extends BaseSolver {
|
|
|
172
172
|
center: { x: number; y: number }
|
|
173
173
|
hostSegIndex: number
|
|
174
174
|
dcConnNetId: string
|
|
175
|
+
mspPairId: MspConnectionPairId
|
|
176
|
+
pinIds: PinId[]
|
|
175
177
|
} | null = null
|
|
176
178
|
let bestScore = -Infinity
|
|
177
179
|
|
|
@@ -285,6 +287,8 @@ export class SingleNetLabelPlacementSolver extends BaseSolver {
|
|
|
285
287
|
center,
|
|
286
288
|
hostSegIndex: si,
|
|
287
289
|
dcConnNetId: curr.dcConnNetId,
|
|
290
|
+
mspPairId: curr.mspPairId,
|
|
291
|
+
pinIds: [curr.pins[0].pinId, curr.pins[1].pinId],
|
|
288
292
|
}
|
|
289
293
|
}
|
|
290
294
|
// Continue traversing to prioritize the furthest valid point
|
|
@@ -295,6 +299,9 @@ export class SingleNetLabelPlacementSolver extends BaseSolver {
|
|
|
295
299
|
globalConnNetId:
|
|
296
300
|
this.overlappingSameNetTraceGroup.globalConnNetId,
|
|
297
301
|
dcConnNetId: curr.dcConnNetId,
|
|
302
|
+
netId: this.overlappingSameNetTraceGroup.netId,
|
|
303
|
+
mspConnectionPairIds: [curr.mspPairId],
|
|
304
|
+
pinIds: [curr.pins[0].pinId, curr.pins[1].pinId],
|
|
298
305
|
orientation,
|
|
299
306
|
anchorPoint: anchor,
|
|
300
307
|
width,
|
|
@@ -312,6 +319,9 @@ export class SingleNetLabelPlacementSolver extends BaseSolver {
|
|
|
312
319
|
this.netLabelPlacement = {
|
|
313
320
|
globalConnNetId: this.overlappingSameNetTraceGroup.globalConnNetId,
|
|
314
321
|
dcConnNetId: bestCandidate.dcConnNetId,
|
|
322
|
+
netId: this.overlappingSameNetTraceGroup.netId,
|
|
323
|
+
mspConnectionPairIds: [bestCandidate.mspPairId],
|
|
324
|
+
pinIds: bestCandidate.pinIds,
|
|
315
325
|
orientation: bestCandidate.orientation,
|
|
316
326
|
anchorPoint: bestCandidate.anchor,
|
|
317
327
|
width: bestCandidate.width,
|
package/lib/solvers/NetLabelPlacementSolver/SingleNetLabelPlacementSolver/solvePortOnlyPin.ts
CHANGED
|
@@ -159,6 +159,9 @@ export function solveNetLabelPlacementForPortOnlyPin(params: {
|
|
|
159
159
|
const placement: NetLabelPlacement = {
|
|
160
160
|
globalConnNetId: overlappingSameNetTraceGroup.globalConnNetId,
|
|
161
161
|
dcConnNetId: undefined,
|
|
162
|
+
netId: overlappingSameNetTraceGroup.netId,
|
|
163
|
+
mspConnectionPairIds: [],
|
|
164
|
+
pinIds: [pinId],
|
|
162
165
|
orientation,
|
|
163
166
|
anchorPoint: anchor,
|
|
164
167
|
width,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseSolver } from "lib/solvers/BaseSolver/BaseSolver"
|
|
2
2
|
import { visualizeInputProblem } from "../SchematicTracePipelineSolver/visualizeInputProblem"
|
|
3
3
|
import { getBounds, type GraphicsObject } from "graphics-debug"
|
|
4
|
-
import type { InputChip, InputProblem } from "lib/types/InputProblem"
|
|
4
|
+
import type { InputChip, InputProblem, PinId } from "lib/types/InputProblem"
|
|
5
5
|
import type {
|
|
6
6
|
MspConnectionPair,
|
|
7
7
|
MspConnectionPairId,
|
|
@@ -14,6 +14,8 @@ import type { Point } from "@tscircuit/math-utils"
|
|
|
14
14
|
|
|
15
15
|
export interface SolvedTracePath extends MspConnectionPair {
|
|
16
16
|
tracePath: Point[]
|
|
17
|
+
mspConnectionPairIds: MspConnectionPairId[]
|
|
18
|
+
pinIds: PinId[]
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
export class SchematicTraceLinesSolver extends BaseSolver {
|
|
@@ -71,6 +73,11 @@ export class SchematicTraceLinesSolver extends BaseSolver {
|
|
|
71
73
|
this.solvedTracePaths.push({
|
|
72
74
|
...this.currentConnectionPair!,
|
|
73
75
|
tracePath: this.activeSubSolver!.solvedTracePath!,
|
|
76
|
+
mspConnectionPairIds: [this.currentConnectionPair!.mspPairId],
|
|
77
|
+
pinIds: [
|
|
78
|
+
this.currentConnectionPair!.pins[0].pinId,
|
|
79
|
+
this.currentConnectionPair!.pins[1].pinId,
|
|
80
|
+
],
|
|
74
81
|
})
|
|
75
82
|
this.activeSubSolver = null
|
|
76
83
|
this.currentConnectionPair = null
|