@tscircuit/core 0.0.1803 → 0.0.1804

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.
Files changed (2) hide show
  1. package/dist/index.js +60 -10
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -28276,20 +28276,43 @@ function busUsesCoordinatedWinding(bus) {
28276
28276
  );
28277
28277
  }
28278
28278
  function shouldUseJointBoundaryViaReservation(boundaryBusConnectionCounts) {
28279
- return boundaryBusConnectionCounts.length === 5 || boundaryBusConnectionCounts.length === 6 || boundaryBusConnectionCounts.length === 4 && new Set(boundaryBusConnectionCounts).size > 1;
28279
+ return boundaryBusConnectionCounts.length === 5 || boundaryBusConnectionCounts.length === 6 || boundaryBusConnectionCounts.length === 7 || boundaryBusConnectionCounts.length === 4 && new Set(boundaryBusConnectionCounts).size > 1;
28280
28280
  }
28281
28281
  function shouldDeferSingletonBoundaryViaReservation(boundaryBusConnectionCounts) {
28282
- return (boundaryBusConnectionCounts.length === 5 || boundaryBusConnectionCounts.length === 6) && boundaryBusConnectionCounts.filter((count) => count === 1).length === 1;
28282
+ return (boundaryBusConnectionCounts.length === 5 || boundaryBusConnectionCounts.length === 6 || boundaryBusConnectionCounts.length === 7) && boundaryBusConnectionCounts.filter((count) => count === 1).length === 1;
28283
28283
  }
28284
28284
  function shouldSearchAdditionalBoundaryRouteTopologies(params) {
28285
- if (params.boundaryBusCount === 5 || params.boundaryBusCount > 6) {
28285
+ if (params.boundaryBusCount === 5 || params.boundaryBusCount > 7) {
28286
28286
  return false;
28287
28287
  }
28288
- if (params.boundaryBusCount === 6) {
28288
+ if (params.boundaryBusCount === 6 || params.boundaryBusCount === 7) {
28289
28289
  return params.connectionCount > 2 && params.rawSkew - params.maximumSkew > Math.max(1, params.maximumSkew * 0.5);
28290
28290
  }
28291
28291
  return params.rawSkew - params.maximumSkew > Math.max(1, params.maximumSkew * 0.25);
28292
28292
  }
28293
+ function getDenseSevenBusPairRoutingPriorityKeys(params) {
28294
+ const { pairBuses } = params;
28295
+ const firstBus = pairBuses[0];
28296
+ const firstSourceLayer = firstBus?.connections[0]?.sourceLayer;
28297
+ if (params.boundaryBusCount !== 7 || pairBuses.length !== 3 || firstBus === void 0 || firstBus.exitEdge === void 0 || firstBus.assignedLayer === void 0 || firstSourceLayer === void 0 || pairBuses.some(
28298
+ (bus) => bus.connections.length !== 2 || bus.componentId !== firstBus.componentId || bus.exitEdge !== firstBus.exitEdge || bus.assignedLayer !== firstBus.assignedLayer || bus.connections.some((connection) => {
28299
+ const exitTarget = connection.exitTargetPoint;
28300
+ return connection.sourceLayer !== firstSourceLayer || exitTarget?.layer !== firstBus.assignedLayer || !Number.isFinite(connection.sourcePoint.x) || !Number.isFinite(connection.sourcePoint.y) || !Number.isFinite(exitTarget?.x) || !Number.isFinite(exitTarget?.y);
28301
+ })
28302
+ )) {
28303
+ return null;
28304
+ }
28305
+ const getMeanSourceToExitTargetDistance = (bus) => bus.connections.reduce((total, connection) => {
28306
+ const exitTarget = connection.exitTargetPoint;
28307
+ return total + Math.hypot(
28308
+ exitTarget.x - connection.sourcePoint.x,
28309
+ exitTarget.y - connection.sourcePoint.y
28310
+ );
28311
+ }, 0) / bus.connections.length;
28312
+ return pairBuses.map(
28313
+ (bus) => Number(getMeanSourceToExitTargetDistance(bus).toFixed(9))
28314
+ );
28315
+ }
28293
28316
  function getCandidateEscapeLayersForBus(params) {
28294
28317
  const { bus, srj, config, staticClearanceCache } = params;
28295
28318
  const busAllowedLayers = bus.allowedLayers;
@@ -28509,11 +28532,38 @@ var FanoutSolver = class extends BaseSolver {
28509
28532
  const useJointBoundaryViaReservation = shouldUseJointBoundaryViaReservation(
28510
28533
  unsortedBoundaryBuses.map((bus) => bus.connections.length)
28511
28534
  );
28535
+ const twoConnectionBoundaryBuses = unsortedBoundaryBuses.filter(
28536
+ (bus) => bus.connections.length === 2
28537
+ );
28538
+ const pairRoutingPriorityKeys = getDenseSevenBusPairRoutingPriorityKeys({
28539
+ boundaryBusCount: unsortedBoundaryBuses.length,
28540
+ pairBuses: twoConnectionBoundaryBuses.map((bus) => ({
28541
+ ...bus,
28542
+ assignedLayer: params.busLayerAssignments[bus.busId]
28543
+ }))
28544
+ });
28545
+ const pairRoutingPriorityKeyByBusId = pairRoutingPriorityKeys ? new Map(
28546
+ twoConnectionBoundaryBuses.map((bus, index) => [
28547
+ bus.busId,
28548
+ pairRoutingPriorityKeys[index]
28549
+ ])
28550
+ ) : null;
28512
28551
  const boundaryBuses = unsortedBoundaryBuses.toSorted((first, second) => {
28513
28552
  if (useJointBoundaryViaReservation) {
28514
28553
  const connectionCountDifference = second.connections.length - first.connections.length;
28515
28554
  if (connectionCountDifference !== 0) return connectionCountDifference;
28516
28555
  }
28556
+ const firstLayer = params.busLayerAssignments[first.busId];
28557
+ const secondLayer = params.busLayerAssignments[second.busId];
28558
+ const firstPairRoutingPriority = pairRoutingPriorityKeyByBusId?.get(
28559
+ first.busId
28560
+ );
28561
+ const secondPairRoutingPriority = pairRoutingPriorityKeyByBusId?.get(
28562
+ second.busId
28563
+ );
28564
+ if (firstPairRoutingPriority !== void 0 && secondPairRoutingPriority !== void 0 && firstPairRoutingPriority !== secondPairRoutingPriority) {
28565
+ return firstPairRoutingPriority - secondPairRoutingPriority;
28566
+ }
28517
28567
  const cornerBandDifference = Number(
28518
28568
  Boolean(getCornerBandSide(second.exitEdge, second.preferredExit))
28519
28569
  ) - Number(Boolean(getCornerBandSide(first.exitEdge, first.preferredExit)));
@@ -28536,17 +28586,17 @@ var FanoutSolver = class extends BaseSolver {
28536
28586
  return sourceSpanDifference;
28537
28587
  }
28538
28588
  }
28539
- const firstLayer = params.busLayerAssignments[first.busId];
28540
- const secondLayer = params.busLayerAssignments[second.busId];
28541
28589
  const layerDifference = this.config.layerNames.indexOf(firstLayer ?? "") - this.config.layerNames.indexOf(secondLayer ?? "");
28542
28590
  if (layerDifference !== 0) return -layerDifference;
28543
- if (unsortedBoundaryBuses.length !== 6) return 0;
28591
+ if (unsortedBoundaryBuses.length !== 6 && unsortedBoundaryBuses.length !== 7) {
28592
+ return 0;
28593
+ }
28544
28594
  return first.busId.localeCompare(second.busId);
28545
28595
  });
28546
28596
  const planeBuses = this.preparedBuses.filter(
28547
28597
  (bus) => bus.termination.type === "plane"
28548
28598
  );
28549
- if (boundaryBuses.length === 0 || boundaryBuses.length > 6 || planeBuses.length < 8 || boundaryBuses.some((bus) => !busUsesCoordinatedWinding(bus)) || planeBuses.some((bus) => bus.connections.length !== 1) || boundaryBuses.length + planeBuses.length !== params.busesInRoutingOrder.length) {
28599
+ if (boundaryBuses.length === 0 || boundaryBuses.length > 7 || planeBuses.length < 8 || boundaryBuses.some((bus) => !busUsesCoordinatedWinding(bus)) || planeBuses.some((bus) => bus.connections.length !== 1) || boundaryBuses.length + planeBuses.length !== params.busesInRoutingOrder.length) {
28550
28600
  return null;
28551
28601
  }
28552
28602
  const connectionNameByIndex = new Map(
@@ -41870,7 +41920,7 @@ function Group_getRoutingPhasePlans(group) {
41870
41920
  var package_default = {
41871
41921
  name: "@tscircuit/core",
41872
41922
  type: "module",
41873
- version: "0.0.1802",
41923
+ version: "0.0.1803",
41874
41924
  types: "dist/index.d.ts",
41875
41925
  main: "dist/index.js",
41876
41926
  module: "dist/index.js",
@@ -41910,7 +41960,7 @@ var package_default = {
41910
41960
  "@tscircuit/common": "^0.0.20",
41911
41961
  "@tscircuit/copper-pour-solver": "^0.0.51",
41912
41962
  "@tscircuit/create-fdm-enclosure": "0.0.4",
41913
- "@tscircuit/fanout-solver": "0.0.43",
41963
+ "@tscircuit/fanout-solver": "0.0.45",
41914
41964
  "@tscircuit/footprinter": "^0.0.426",
41915
41965
  "@tscircuit/image-utils": "^0.0.8",
41916
41966
  "@tscircuit/implicit-copper-pour-solver": "github:tscircuit/implicit-copper-pour-solver#47f930139fe969550e049aa7fb741bbcb1f08569",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1803",
4
+ "version": "0.0.1804",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -41,7 +41,7 @@
41
41
  "@tscircuit/common": "^0.0.20",
42
42
  "@tscircuit/copper-pour-solver": "^0.0.51",
43
43
  "@tscircuit/create-fdm-enclosure": "0.0.4",
44
- "@tscircuit/fanout-solver": "0.0.43",
44
+ "@tscircuit/fanout-solver": "0.0.45",
45
45
  "@tscircuit/footprinter": "^0.0.426",
46
46
  "@tscircuit/image-utils": "^0.0.8",
47
47
  "@tscircuit/implicit-copper-pour-solver": "github:tscircuit/implicit-copper-pour-solver#47f930139fe969550e049aa7fb741bbcb1f08569",