@tscircuit/core 0.0.1329 → 0.0.1331
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 +66 -34
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -18021,6 +18021,13 @@ import "@tscircuit/circuit-json-util";
|
|
|
18021
18021
|
import { LayoutPipelineSolver } from "@tscircuit/matchpack";
|
|
18022
18022
|
import Debug8 from "debug";
|
|
18023
18023
|
var debug6 = Debug8("Group_doInitialSchematicLayoutMatchpack");
|
|
18024
|
+
var DEFAULT_AVAILABLE_ROTATIONS = [0, 90, 180, 270];
|
|
18025
|
+
var ROTATION_TO_PLACE_SIDE_ON_TOP = {
|
|
18026
|
+
"y+": 0,
|
|
18027
|
+
"x+": 90,
|
|
18028
|
+
"y-": 180,
|
|
18029
|
+
"x-": 270
|
|
18030
|
+
};
|
|
18024
18031
|
function facingDirectionToSide(facingDirection) {
|
|
18025
18032
|
switch (facingDirection) {
|
|
18026
18033
|
case "up":
|
|
@@ -18035,6 +18042,28 @@ function facingDirectionToSide(facingDirection) {
|
|
|
18035
18042
|
return "y+";
|
|
18036
18043
|
}
|
|
18037
18044
|
}
|
|
18045
|
+
function applyPowerGroundRotationConstraints(problem) {
|
|
18046
|
+
for (const chip of Object.values(problem.chipMap)) {
|
|
18047
|
+
if (chip.pins.length !== 2) continue;
|
|
18048
|
+
if (chip.availableRotations?.length !== DEFAULT_AVAILABLE_ROTATIONS.length)
|
|
18049
|
+
continue;
|
|
18050
|
+
const powerGroundRotations = /* @__PURE__ */ new Set();
|
|
18051
|
+
for (const pinId of chip.pins) {
|
|
18052
|
+
const pin = problem.chipPinMap[pinId];
|
|
18053
|
+
if (!pin) continue;
|
|
18054
|
+
for (const [netId, net] of Object.entries(problem.netMap)) {
|
|
18055
|
+
if (!problem.netConnMap[`${pinId}-${netId}`]) continue;
|
|
18056
|
+
if (net.isPositiveVoltageSource === net.isGround) continue;
|
|
18057
|
+
const rotationToPlacePinOnTop = ROTATION_TO_PLACE_SIDE_ON_TOP[pin.side];
|
|
18058
|
+
const rotation4 = net.isPositiveVoltageSource ? rotationToPlacePinOnTop : (rotationToPlacePinOnTop + 180) % 360;
|
|
18059
|
+
powerGroundRotations.add(rotation4);
|
|
18060
|
+
}
|
|
18061
|
+
}
|
|
18062
|
+
if (powerGroundRotations.size === 1) {
|
|
18063
|
+
chip.availableRotations = [powerGroundRotations.values().next().value];
|
|
18064
|
+
}
|
|
18065
|
+
}
|
|
18066
|
+
}
|
|
18038
18067
|
function rotateDirection(direction, degrees) {
|
|
18039
18068
|
const directions = [
|
|
18040
18069
|
"right",
|
|
@@ -18112,7 +18141,9 @@ function convertTreeToMatchPackInputProblem(tree, db, group) {
|
|
|
18112
18141
|
const component = group.children.find(
|
|
18113
18142
|
(groupChild) => groupChild.source_component_id === child.sourceComponent?.source_component_id
|
|
18114
18143
|
);
|
|
18115
|
-
let availableRotations = [
|
|
18144
|
+
let availableRotations = [
|
|
18145
|
+
...DEFAULT_AVAILABLE_ROTATIONS
|
|
18146
|
+
];
|
|
18116
18147
|
if (component?._parsedProps?.schOrientation) {
|
|
18117
18148
|
availableRotations = [0];
|
|
18118
18149
|
}
|
|
@@ -18329,19 +18360,19 @@ function convertTreeToMatchPackInputProblem(tree, db, group) {
|
|
|
18329
18360
|
}))
|
|
18330
18361
|
);
|
|
18331
18362
|
for (const [connectivityKey, pins] of connectivityGroups) {
|
|
18363
|
+
const tracesWithThisKey = db.source_trace.list().filter(
|
|
18364
|
+
(trace) => trace.subcircuit_connectivity_map_key === connectivityKey
|
|
18365
|
+
);
|
|
18366
|
+
const hasNetConnections = tracesWithThisKey.some(
|
|
18367
|
+
(trace) => trace.connected_source_net_ids && trace.connected_source_net_ids.length > 0
|
|
18368
|
+
);
|
|
18369
|
+
const hasDirectConnections = tracesWithThisKey.some(
|
|
18370
|
+
(trace) => trace.connected_source_port_ids && trace.connected_source_port_ids.length >= 2
|
|
18371
|
+
);
|
|
18372
|
+
debug6(
|
|
18373
|
+
`[${group.name}] Connectivity ${connectivityKey}: hasNetConnections=${hasNetConnections}, hasDirectConnections=${hasDirectConnections}`
|
|
18374
|
+
);
|
|
18332
18375
|
if (pins.length >= 2) {
|
|
18333
|
-
const tracesWithThisKey = db.source_trace.list().filter(
|
|
18334
|
-
(trace) => trace.subcircuit_connectivity_map_key === connectivityKey
|
|
18335
|
-
);
|
|
18336
|
-
const hasNetConnections = tracesWithThisKey.some(
|
|
18337
|
-
(trace) => trace.connected_source_net_ids && trace.connected_source_net_ids.length > 0
|
|
18338
|
-
);
|
|
18339
|
-
const hasDirectConnections = tracesWithThisKey.some(
|
|
18340
|
-
(trace) => trace.connected_source_port_ids && trace.connected_source_port_ids.length >= 2
|
|
18341
|
-
);
|
|
18342
|
-
debug6(
|
|
18343
|
-
`[${group.name}] Connectivity ${connectivityKey}: hasNetConnections=${hasNetConnections}, hasDirectConnections=${hasDirectConnections}`
|
|
18344
|
-
);
|
|
18345
18376
|
if (hasDirectConnections) {
|
|
18346
18377
|
for (const trace of tracesWithThisKey) {
|
|
18347
18378
|
if (trace.connected_source_port_ids && trace.connected_source_port_ids.length >= 2) {
|
|
@@ -18383,27 +18414,28 @@ function convertTreeToMatchPackInputProblem(tree, db, group) {
|
|
|
18383
18414
|
}
|
|
18384
18415
|
}
|
|
18385
18416
|
}
|
|
18386
|
-
|
|
18387
|
-
|
|
18388
|
-
|
|
18389
|
-
|
|
18390
|
-
|
|
18391
|
-
|
|
18392
|
-
|
|
18393
|
-
|
|
18394
|
-
|
|
18395
|
-
|
|
18396
|
-
|
|
18397
|
-
|
|
18398
|
-
|
|
18399
|
-
}
|
|
18400
|
-
debug6(
|
|
18401
|
-
`[${group.name}] Created net ${connectivityKey} with ${pins.length} pins:`,
|
|
18402
|
-
pins
|
|
18403
|
-
);
|
|
18417
|
+
}
|
|
18418
|
+
if (hasNetConnections) {
|
|
18419
|
+
const source_net = db.source_net.getWhere({
|
|
18420
|
+
subcircuit_connectivity_map_key: connectivityKey
|
|
18421
|
+
});
|
|
18422
|
+
const isGround = source_net?.is_ground ?? false;
|
|
18423
|
+
const isPositiveVoltageSource = source_net?.is_power === true || source_net?.is_positive_voltage_source === true;
|
|
18424
|
+
problem.netMap[connectivityKey] = {
|
|
18425
|
+
netId: connectivityKey,
|
|
18426
|
+
isGround,
|
|
18427
|
+
isPositiveVoltageSource
|
|
18428
|
+
};
|
|
18429
|
+
for (const pinId of pins) {
|
|
18430
|
+
problem.netConnMap[`${pinId}-${connectivityKey}`] = true;
|
|
18404
18431
|
}
|
|
18432
|
+
debug6(
|
|
18433
|
+
`[${group.name}] Created net ${connectivityKey} with ${pins.length} pins:`,
|
|
18434
|
+
pins
|
|
18435
|
+
);
|
|
18405
18436
|
}
|
|
18406
18437
|
}
|
|
18438
|
+
applyPowerGroundRotationConstraints(problem);
|
|
18407
18439
|
return problem;
|
|
18408
18440
|
}
|
|
18409
18441
|
function applySchematicMatchPackLayoutToTree(group, tree) {
|
|
@@ -23728,7 +23760,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
23728
23760
|
var package_default = {
|
|
23729
23761
|
name: "@tscircuit/core",
|
|
23730
23762
|
type: "module",
|
|
23731
|
-
version: "0.0.
|
|
23763
|
+
version: "0.0.1330",
|
|
23732
23764
|
types: "dist/index.d.ts",
|
|
23733
23765
|
main: "dist/index.js",
|
|
23734
23766
|
module: "dist/index.js",
|
|
@@ -23776,7 +23808,7 @@ var package_default = {
|
|
|
23776
23808
|
"@tscircuit/math-utils": "^0.0.36",
|
|
23777
23809
|
"@tscircuit/miniflex": "^0.0.4",
|
|
23778
23810
|
"@tscircuit/props": "^0.0.549",
|
|
23779
|
-
"@tscircuit/ngspice-spice-engine": "^0.0.
|
|
23811
|
+
"@tscircuit/ngspice-spice-engine": "^0.0.16",
|
|
23780
23812
|
"@tscircuit/schematic-match-adapt": "^0.0.18",
|
|
23781
23813
|
"@tscircuit/solver-utils": "^0.0.16",
|
|
23782
23814
|
"@tscircuit/schematic-trace-solver": "^0.0.69",
|
|
@@ -23841,7 +23873,7 @@ var package_default = {
|
|
|
23841
23873
|
"@flatten-js/core": "^1.6.2",
|
|
23842
23874
|
"@lume/kiwi": "^0.4.3",
|
|
23843
23875
|
"calculate-cell-boundaries": "^0.0.13",
|
|
23844
|
-
"calculate-packing": "0.0.
|
|
23876
|
+
"calculate-packing": "0.0.75",
|
|
23845
23877
|
"css-select": "5.1.0",
|
|
23846
23878
|
"format-si-unit": "^0.0.7",
|
|
23847
23879
|
nanoid: "^5.0.7",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.1331",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@tscircuit/math-utils": "^0.0.36",
|
|
50
50
|
"@tscircuit/miniflex": "^0.0.4",
|
|
51
51
|
"@tscircuit/props": "^0.0.549",
|
|
52
|
-
"@tscircuit/ngspice-spice-engine": "^0.0.
|
|
52
|
+
"@tscircuit/ngspice-spice-engine": "^0.0.16",
|
|
53
53
|
"@tscircuit/schematic-match-adapt": "^0.0.18",
|
|
54
54
|
"@tscircuit/solver-utils": "^0.0.16",
|
|
55
55
|
"@tscircuit/schematic-trace-solver": "^0.0.69",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"@flatten-js/core": "^1.6.2",
|
|
115
115
|
"@lume/kiwi": "^0.4.3",
|
|
116
116
|
"calculate-cell-boundaries": "^0.0.13",
|
|
117
|
-
"calculate-packing": "0.0.
|
|
117
|
+
"calculate-packing": "0.0.75",
|
|
118
118
|
"css-select": "5.1.0",
|
|
119
119
|
"format-si-unit": "^0.0.7",
|
|
120
120
|
"nanoid": "^5.0.7",
|