@tscircuit/matchpack 0.0.9 → 0.0.11
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.js +34 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -550,7 +550,25 @@ function createFilteredNetworkMapping(inputProblem) {
|
|
|
550
550
|
};
|
|
551
551
|
}
|
|
552
552
|
|
|
553
|
+
// lib/solvers/PackInnerPartitionsSolver/getPadsBoundingBox.ts
|
|
554
|
+
var getPadsBoundingBox = (pads) => {
|
|
555
|
+
const xs = pads.flatMap((p) => [
|
|
556
|
+
p.offset.x - p.size.x / 2,
|
|
557
|
+
p.offset.x + p.size.x / 2
|
|
558
|
+
]);
|
|
559
|
+
const ys = pads.flatMap((p) => [
|
|
560
|
+
p.offset.y - p.size.y / 2,
|
|
561
|
+
p.offset.y + p.size.y / 2
|
|
562
|
+
]);
|
|
563
|
+
const minX = xs.length ? Math.min(...xs) : 0;
|
|
564
|
+
const maxX = xs.length ? Math.max(...xs) : 0;
|
|
565
|
+
const minY = ys.length ? Math.min(...ys) : 0;
|
|
566
|
+
const maxY = ys.length ? Math.max(...ys) : 0;
|
|
567
|
+
return { minX, maxX, minY, maxY };
|
|
568
|
+
};
|
|
569
|
+
|
|
553
570
|
// lib/solvers/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver.ts
|
|
571
|
+
var PIN_SIZE = 0.1;
|
|
554
572
|
var SingleInnerPartitionPackingSolver = class extends BaseSolver {
|
|
555
573
|
inputProblem;
|
|
556
574
|
layout = null;
|
|
@@ -583,13 +601,6 @@ var SingleInnerPartitionPackingSolver = class extends BaseSolver {
|
|
|
583
601
|
const packComponents = Object.entries(this.inputProblem.chipMap).map(
|
|
584
602
|
([chipId, chip]) => {
|
|
585
603
|
const pads = [];
|
|
586
|
-
pads.push({
|
|
587
|
-
padId: `${chipId}_body`,
|
|
588
|
-
networkId: `${chipId}_body_disconnected`,
|
|
589
|
-
type: "rect",
|
|
590
|
-
offset: { x: 0, y: 0 },
|
|
591
|
-
size: { x: chip.size.x, y: chip.size.y }
|
|
592
|
-
});
|
|
593
604
|
for (const pinId of chip.pins) {
|
|
594
605
|
const pin = this.inputProblem.chipPinMap[pinId];
|
|
595
606
|
if (!pin) continue;
|
|
@@ -599,10 +610,25 @@ var SingleInnerPartitionPackingSolver = class extends BaseSolver {
|
|
|
599
610
|
networkId,
|
|
600
611
|
type: "rect",
|
|
601
612
|
offset: { x: pin.offset.x, y: pin.offset.y },
|
|
602
|
-
size: { x:
|
|
613
|
+
size: { x: PIN_SIZE, y: PIN_SIZE }
|
|
603
614
|
// Small size for pins
|
|
604
615
|
});
|
|
605
616
|
}
|
|
617
|
+
const padsBoundingBox = getPadsBoundingBox(pads);
|
|
618
|
+
const padsBoundingBoxSize = {
|
|
619
|
+
x: padsBoundingBox.maxX - padsBoundingBox.minX,
|
|
620
|
+
y: padsBoundingBox.maxY - padsBoundingBox.minY
|
|
621
|
+
};
|
|
622
|
+
pads.push({
|
|
623
|
+
padId: `${chipId}_body`,
|
|
624
|
+
networkId: `${chipId}_body_disconnected`,
|
|
625
|
+
type: "rect",
|
|
626
|
+
offset: { x: 0, y: 0 },
|
|
627
|
+
size: {
|
|
628
|
+
x: Math.max(padsBoundingBoxSize.x, chip.size.x),
|
|
629
|
+
y: Math.max(padsBoundingBoxSize.y, chip.size.y)
|
|
630
|
+
}
|
|
631
|
+
});
|
|
606
632
|
return {
|
|
607
633
|
componentId: chipId,
|
|
608
634
|
pads,
|