@tscircuit/matchpack 0.0.6 → 0.0.7
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 +98 -26
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -454,6 +454,103 @@ var ChipPartitionsSolver = class extends BaseSolver {
|
|
|
454
454
|
|
|
455
455
|
// lib/solvers/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver.ts
|
|
456
456
|
import { PhasedPackSolver } from "calculate-packing";
|
|
457
|
+
|
|
458
|
+
// lib/utils/networkFiltering.ts
|
|
459
|
+
function createFilteredNetworkMapping(inputProblem) {
|
|
460
|
+
const pinToNetworkMap = /* @__PURE__ */ new Map();
|
|
461
|
+
const filteredPins = /* @__PURE__ */ new Set();
|
|
462
|
+
const strongConnectedChipSides = /* @__PURE__ */ new Map();
|
|
463
|
+
for (const [connKey, connected] of Object.entries(
|
|
464
|
+
inputProblem.pinStrongConnMap
|
|
465
|
+
)) {
|
|
466
|
+
if (!connected) continue;
|
|
467
|
+
const pins = connKey.split("-");
|
|
468
|
+
if (pins.length === 2 && pins[0] && pins[1]) {
|
|
469
|
+
const pin1 = inputProblem.chipPinMap[pins[0]];
|
|
470
|
+
const pin2 = inputProblem.chipPinMap[pins[1]];
|
|
471
|
+
if (pin1 && pin2) {
|
|
472
|
+
const chip1Id = pins[0].split(".")[0];
|
|
473
|
+
const chip2Id = pins[1].split(".")[0];
|
|
474
|
+
if (chip1Id && chip2Id && chip1Id !== chip2Id) {
|
|
475
|
+
const key1 = `${chip1Id}-${chip2Id}`;
|
|
476
|
+
const key2 = `${chip2Id}-${chip1Id}`;
|
|
477
|
+
if (!strongConnectedChipSides.has(key1)) {
|
|
478
|
+
strongConnectedChipSides.set(key1, /* @__PURE__ */ new Set());
|
|
479
|
+
}
|
|
480
|
+
if (!strongConnectedChipSides.has(key2)) {
|
|
481
|
+
strongConnectedChipSides.set(key2, /* @__PURE__ */ new Set());
|
|
482
|
+
}
|
|
483
|
+
strongConnectedChipSides.get(key1).add(pin1.side);
|
|
484
|
+
strongConnectedChipSides.get(key2).add(pin2.side);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
for (const [connKey, connected] of Object.entries(inputProblem.netConnMap)) {
|
|
490
|
+
if (!connected) continue;
|
|
491
|
+
const [pinId, netId] = connKey.split("-");
|
|
492
|
+
if (pinId && netId) {
|
|
493
|
+
const pin = inputProblem.chipPinMap[pinId];
|
|
494
|
+
if (!pin) continue;
|
|
495
|
+
const chipId = pinId.split(".")[0];
|
|
496
|
+
let shouldIncludeInNetwork = true;
|
|
497
|
+
for (const [
|
|
498
|
+
strongKey,
|
|
499
|
+
strongSides
|
|
500
|
+
] of strongConnectedChipSides.entries()) {
|
|
501
|
+
const [fromChip, toChip] = strongKey.split("-");
|
|
502
|
+
if (fromChip === chipId) {
|
|
503
|
+
for (const [otherConnKey, otherConnected] of Object.entries(
|
|
504
|
+
inputProblem.netConnMap
|
|
505
|
+
)) {
|
|
506
|
+
if (!otherConnected) continue;
|
|
507
|
+
const [otherPinId, otherNetId] = otherConnKey.split("-");
|
|
508
|
+
if (otherNetId === netId && otherPinId && otherPinId !== pinId) {
|
|
509
|
+
const otherPin = inputProblem.chipPinMap[otherPinId];
|
|
510
|
+
if (!otherPin) continue;
|
|
511
|
+
const otherChipId = otherPinId.split(".")[0];
|
|
512
|
+
if (otherChipId === toChip) {
|
|
513
|
+
if (!strongSides.has(otherPin.side)) {
|
|
514
|
+
shouldIncludeInNetwork = false;
|
|
515
|
+
break;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
if (shouldIncludeInNetwork) {
|
|
523
|
+
pinToNetworkMap.set(pinId, netId);
|
|
524
|
+
} else {
|
|
525
|
+
const disconnectedNetworkId = `${pinId}_opposite-strong-side-disconnected`;
|
|
526
|
+
pinToNetworkMap.set(pinId, disconnectedNetworkId);
|
|
527
|
+
filteredPins.add(pinId);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
for (const [connKey, connected] of Object.entries(
|
|
532
|
+
inputProblem.pinStrongConnMap
|
|
533
|
+
)) {
|
|
534
|
+
if (!connected) continue;
|
|
535
|
+
const pins = connKey.split("-");
|
|
536
|
+
if (pins.length === 2 && pins[0] && pins[1]) {
|
|
537
|
+
const existingNet = pinToNetworkMap.get(pins[0]) || pinToNetworkMap.get(pins[1]);
|
|
538
|
+
if (existingNet) {
|
|
539
|
+
pinToNetworkMap.set(pins[0], existingNet);
|
|
540
|
+
pinToNetworkMap.set(pins[1], existingNet);
|
|
541
|
+
} else {
|
|
542
|
+
pinToNetworkMap.set(pins[0], connKey);
|
|
543
|
+
pinToNetworkMap.set(pins[1], connKey);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
return {
|
|
548
|
+
pinToNetworkMap,
|
|
549
|
+
filteredPins
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
// lib/solvers/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver.ts
|
|
457
554
|
var SingleInnerPartitionPackingSolver = class extends BaseSolver {
|
|
458
555
|
inputProblem;
|
|
459
556
|
layout = null;
|
|
@@ -488,32 +585,7 @@ var SingleInnerPartitionPackingSolver = class extends BaseSolver {
|
|
|
488
585
|
}
|
|
489
586
|
}
|
|
490
587
|
createPackInput() {
|
|
491
|
-
const pinToNetworkMap =
|
|
492
|
-
for (const [connKey, connected] of Object.entries(
|
|
493
|
-
this.inputProblem.netConnMap
|
|
494
|
-
)) {
|
|
495
|
-
if (!connected) continue;
|
|
496
|
-
const [pinId, netId] = connKey.split("-");
|
|
497
|
-
if (pinId && netId) {
|
|
498
|
-
pinToNetworkMap.set(pinId, netId);
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
for (const [connKey, connected] of Object.entries(
|
|
502
|
-
this.inputProblem.pinStrongConnMap
|
|
503
|
-
)) {
|
|
504
|
-
if (!connected) continue;
|
|
505
|
-
const pins = connKey.split("-");
|
|
506
|
-
if (pins.length === 2 && pins[0] && pins[1]) {
|
|
507
|
-
const existingNet = pinToNetworkMap.get(pins[0]) || pinToNetworkMap.get(pins[1]);
|
|
508
|
-
if (existingNet) {
|
|
509
|
-
pinToNetworkMap.set(pins[0], existingNet);
|
|
510
|
-
pinToNetworkMap.set(pins[1], existingNet);
|
|
511
|
-
} else {
|
|
512
|
-
pinToNetworkMap.set(pins[0], connKey);
|
|
513
|
-
pinToNetworkMap.set(pins[1], connKey);
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
}
|
|
588
|
+
const { pinToNetworkMap } = createFilteredNetworkMapping(this.inputProblem);
|
|
517
589
|
const packComponents = Object.entries(this.inputProblem.chipMap).map(
|
|
518
590
|
([chipId, chip]) => {
|
|
519
591
|
const pads = [];
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@tscircuit/matchpack",
|
|
3
3
|
"main": "dist/index.js",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.7",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
8
8
|
],
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"start": "cosmos",
|
|
11
11
|
"build": "tsup-node --format esm --dts --clean ./lib/index.ts",
|
|
12
12
|
"format": "biome format --write .",
|
|
13
|
-
"format:check": "biome format ."
|
|
13
|
+
"format:check": "biome format .",
|
|
14
|
+
"build:site": "cosmos-export"
|
|
14
15
|
},
|
|
15
16
|
"devDependencies": {
|
|
16
17
|
"@biomejs/biome": "^2.1.3",
|