@tscircuit/matchpack 0.0.1 → 0.0.2
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 +6 -1
- package/dist/index.js +27 -16
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -70,6 +70,10 @@ type InputProblem = {
|
|
|
70
70
|
/** This is a two-way map */
|
|
71
71
|
pinStrongConnMap: Record<`${PinId}-${PinId}`, boolean>;
|
|
72
72
|
netConnMap: Record<`${PinId}-${NetId}`, boolean>;
|
|
73
|
+
/** The minimum gap between chips within a partition */
|
|
74
|
+
chipGap: number;
|
|
75
|
+
/** The minimum gap between two partitions */
|
|
76
|
+
partitionGap: number;
|
|
73
77
|
};
|
|
74
78
|
|
|
75
79
|
/**
|
|
@@ -118,10 +122,12 @@ type LaidOutPartition = InputProblem;
|
|
|
118
122
|
interface PartitionPackingSolverInput {
|
|
119
123
|
resolvedLayout: OutputLayout;
|
|
120
124
|
laidOutPartitions: LaidOutPartition[];
|
|
125
|
+
inputProblem: InputProblem;
|
|
121
126
|
}
|
|
122
127
|
declare class PartitionPackingSolver extends BaseSolver {
|
|
123
128
|
resolvedLayout: OutputLayout;
|
|
124
129
|
laidOutPartitions: LaidOutPartition[];
|
|
130
|
+
inputProblem: InputProblem;
|
|
125
131
|
finalLayout: OutputLayout | null;
|
|
126
132
|
phasedPackSolver: PhasedPackSolver | null;
|
|
127
133
|
constructor(input: PartitionPackingSolverInput);
|
|
@@ -174,7 +180,6 @@ declare class SinglePinRangeLayoutSolver extends BaseSolver {
|
|
|
174
180
|
inputProblem: InputProblem;
|
|
175
181
|
layoutApplied: boolean;
|
|
176
182
|
layout: OutputLayout | null;
|
|
177
|
-
debugPackInput: any;
|
|
178
183
|
constructor(pinRange: PinRange, inputProblem: InputProblem);
|
|
179
184
|
_step(): void;
|
|
180
185
|
/**
|
package/dist/index.js
CHANGED
|
@@ -20727,7 +20727,9 @@ var ChipPartitionsSolver = class extends BaseSolver {
|
|
|
20727
20727
|
groupPinMap,
|
|
20728
20728
|
netMap,
|
|
20729
20729
|
pinStrongConnMap,
|
|
20730
|
-
netConnMap
|
|
20730
|
+
netConnMap,
|
|
20731
|
+
chipGap: originalProblem.chipGap,
|
|
20732
|
+
partitionGap: originalProblem.partitionGap
|
|
20731
20733
|
};
|
|
20732
20734
|
}
|
|
20733
20735
|
visualize() {
|
|
@@ -20747,12 +20749,14 @@ var ChipPartitionsSolver = class extends BaseSolver {
|
|
|
20747
20749
|
var PartitionPackingSolver = class extends BaseSolver {
|
|
20748
20750
|
resolvedLayout;
|
|
20749
20751
|
laidOutPartitions;
|
|
20752
|
+
inputProblem;
|
|
20750
20753
|
finalLayout = null;
|
|
20751
20754
|
phasedPackSolver = null;
|
|
20752
20755
|
constructor(input) {
|
|
20753
20756
|
super();
|
|
20754
20757
|
this.resolvedLayout = input.resolvedLayout;
|
|
20755
20758
|
this.laidOutPartitions = input.laidOutPartitions;
|
|
20759
|
+
this.inputProblem = input.inputProblem;
|
|
20756
20760
|
}
|
|
20757
20761
|
_step() {
|
|
20758
20762
|
try {
|
|
@@ -20830,14 +20834,18 @@ var PartitionPackingSolver = class extends BaseSolver {
|
|
|
20830
20834
|
const resolvedLayout = this.resolvedLayout;
|
|
20831
20835
|
const pinToNetworkMap = /* @__PURE__ */ new Map();
|
|
20832
20836
|
for (const laidOutPartition of this.laidOutPartitions) {
|
|
20833
|
-
for (const [connKey, connected] of Object.entries(
|
|
20837
|
+
for (const [connKey, connected] of Object.entries(
|
|
20838
|
+
laidOutPartition.netConnMap
|
|
20839
|
+
)) {
|
|
20834
20840
|
if (!connected) continue;
|
|
20835
20841
|
const [pinId, netId] = connKey.split("-");
|
|
20836
20842
|
if (pinId && netId) {
|
|
20837
20843
|
pinToNetworkMap.set(pinId, netId);
|
|
20838
20844
|
}
|
|
20839
20845
|
}
|
|
20840
|
-
for (const [connKey, connected] of Object.entries(
|
|
20846
|
+
for (const [connKey, connected] of Object.entries(
|
|
20847
|
+
laidOutPartition.pinStrongConnMap
|
|
20848
|
+
)) {
|
|
20841
20849
|
if (!connected) continue;
|
|
20842
20850
|
const pins = connKey.split("-");
|
|
20843
20851
|
if (pins.length === 2 && pins[0] && pins[1]) {
|
|
@@ -20890,8 +20898,8 @@ var PartitionPackingSolver = class extends BaseSolver {
|
|
|
20890
20898
|
});
|
|
20891
20899
|
return {
|
|
20892
20900
|
components: packComponents,
|
|
20893
|
-
minGap:
|
|
20894
|
-
//
|
|
20901
|
+
minGap: this.inputProblem.partitionGap,
|
|
20902
|
+
// Use partitionGap from input problem
|
|
20895
20903
|
packOrderStrategy: "largest_to_smallest",
|
|
20896
20904
|
packPlacementStrategy: "minimum_sum_squared_distance_to_network"
|
|
20897
20905
|
};
|
|
@@ -20942,7 +20950,9 @@ var PartitionPackingSolver = class extends BaseSolver {
|
|
|
20942
20950
|
groupPinMap: {},
|
|
20943
20951
|
pinStrongConnMap: {},
|
|
20944
20952
|
netMap: {},
|
|
20945
|
-
netConnMap: {}
|
|
20953
|
+
netConnMap: {},
|
|
20954
|
+
chipGap: this.inputProblem.chipGap,
|
|
20955
|
+
partitionGap: this.inputProblem.partitionGap
|
|
20946
20956
|
};
|
|
20947
20957
|
for (const laidOutPartition of this.laidOutPartitions) {
|
|
20948
20958
|
Object.assign(combinedProblem.chipMap, laidOutPartition.chipMap);
|
|
@@ -20961,7 +20971,8 @@ var PartitionPackingSolver = class extends BaseSolver {
|
|
|
20961
20971
|
getConstructorParams() {
|
|
20962
20972
|
return {
|
|
20963
20973
|
resolvedLayout: this.resolvedLayout,
|
|
20964
|
-
laidOutPartitions: this.laidOutPartitions
|
|
20974
|
+
laidOutPartitions: this.laidOutPartitions,
|
|
20975
|
+
inputProblem: this.inputProblem
|
|
20965
20976
|
};
|
|
20966
20977
|
}
|
|
20967
20978
|
};
|
|
@@ -20972,8 +20983,6 @@ var SinglePinRangeLayoutSolver = class extends BaseSolver {
|
|
|
20972
20983
|
inputProblem;
|
|
20973
20984
|
layoutApplied = false;
|
|
20974
20985
|
layout = null;
|
|
20975
|
-
debugPackInput = null;
|
|
20976
|
-
// For debugging - captures the pack input
|
|
20977
20986
|
constructor(pinRange, inputProblem) {
|
|
20978
20987
|
super();
|
|
20979
20988
|
this.pinRange = pinRange;
|
|
@@ -21186,12 +21195,11 @@ var SinglePinRangeLayoutSolver = class extends BaseSolver {
|
|
|
21186
21195
|
}
|
|
21187
21196
|
const packInput = {
|
|
21188
21197
|
components,
|
|
21189
|
-
minGap:
|
|
21190
|
-
//
|
|
21198
|
+
minGap: this.inputProblem.chipGap,
|
|
21199
|
+
// Use chipGap from input problem
|
|
21191
21200
|
packOrderStrategy: "largest_to_smallest",
|
|
21192
21201
|
packPlacementStrategy: "minimum_sum_squared_distance_to_network"
|
|
21193
21202
|
};
|
|
21194
|
-
this.debugPackInput = packInput;
|
|
21195
21203
|
const packResult = pack(packInput);
|
|
21196
21204
|
const chipPlacements = {};
|
|
21197
21205
|
for (const component of packResult.components) {
|
|
@@ -22097,10 +22105,13 @@ var LayoutPipelineSolver = class extends BaseSolver {
|
|
|
22097
22105
|
definePipelineStep(
|
|
22098
22106
|
"partitionPackingSolver",
|
|
22099
22107
|
PartitionPackingSolver,
|
|
22100
|
-
() => [
|
|
22101
|
-
|
|
22102
|
-
|
|
22103
|
-
|
|
22108
|
+
() => [
|
|
22109
|
+
{
|
|
22110
|
+
resolvedLayout: this.pinRangeOverlapSolver.resolvedLayout,
|
|
22111
|
+
laidOutPartitions: this.chipPartitions || [this.inputProblem],
|
|
22112
|
+
inputProblem: this.inputProblem
|
|
22113
|
+
}
|
|
22114
|
+
],
|
|
22104
22115
|
{
|
|
22105
22116
|
onSolved: (_solver) => {
|
|
22106
22117
|
}
|