@tscircuit/core 0.0.2301 → 0.0.2302

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 +87 -32
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -70671,11 +70671,14 @@ function extractTraceCopper3(trace, layerNames) {
70671
70671
  type: "via",
70672
70672
  center: { x: routePoint.x, y: routePoint.y },
70673
70673
  diameter: routePoint.via_diameter ?? 0,
70674
- layers: getLayerSpan3(
70675
- routePoint.from_layer,
70676
- routePoint.to_layer,
70677
- layerNames
70678
- )
70674
+ layers: getRouteViaSpanLayers3({
70675
+ fromLayer: routePoint.from_layer,
70676
+ toLayer: routePoint.to_layer,
70677
+ layers: "layers" in routePoint && Array.isArray(routePoint.layers) ? routePoint.layers : void 0,
70678
+ layerNames,
70679
+ // Preserve endpoint-derived spans when physical metadata is absent.
70680
+ allowBlindAndBuriedVias: true
70681
+ })
70679
70682
  });
70680
70683
  previousWire = void 0;
70681
70684
  continue;
@@ -85524,7 +85527,12 @@ function routeAlternateSignalDogbones(input, options, attempt) {
85524
85527
  },
85525
85528
  connections: input.connections.map((c2) => ({
85526
85529
  ...c2,
85527
- pointsToConnect: c2.pointsToConnect.map((p2) => rotate22(p2, turns))
85530
+ pointsToConnect: c2.pointsToConnect.map((p2) => {
85531
+ const point52 = rotate22(p2, turns);
85532
+ if (!point52.layers) return point52;
85533
+ const { layer: _layer, ...handoff } = point52;
85534
+ return handoff;
85535
+ })
85528
85536
  })),
85529
85537
  obstacles: input.obstacles.map((o2) => ({
85530
85538
  ...o2,
@@ -88295,7 +88303,7 @@ function initialSignalDogbones(input, options, attempt) {
88295
88303
  throw error;
88296
88304
  const targets = new Map(options.targetLayers);
88297
88305
  const available = (c2, layer) => (!input.allowedLayers || input.allowedLayers.includes(layer)) && c2.pointsToConnect.every(
88298
- (p2) => p2.layer === layer && isUnroutedComponentPad(input, c2, p2)
88306
+ (p2) => (p2.layers ?? [p2.layer]).includes(layer) && (p2.layers !== void 0 || isUnroutedComponentPad(input, c2, p2))
88299
88307
  ) && (input.buses ?? []).every(
88300
88308
  (b2) => !b2.connectionNames.includes(c2.name) || !b2.allowedLayers || b2.allowedLayers.includes(layer)
88301
88309
  );
@@ -88438,6 +88446,7 @@ function* routeMultiTerminalBuses(input, options) {
88438
88446
  }).sort((a2, b2) => b2.padCount - a2.padCount).map(({ terminal }) => terminal)
88439
88447
  }));
88440
88448
  const completed = [];
88449
+ const physicalLayers = getCopperLayerNames3(input.layerCount);
88441
88450
  let groups = [
88442
88451
  connections.map((connection) => ({
88443
88452
  ...connection,
@@ -88464,8 +88473,6 @@ function* routeMultiTerminalBuses(input, options) {
88464
88473
  (pair) => pair.connectionNames.every((name) => names.has(name))
88465
88474
  )
88466
88475
  };
88467
- if (terminalIndex > 1)
88468
- request.allowedLayers = [group[0].pointsToConnect[1].layer];
88469
88476
  const solver = new BusLanesPipelineSolver(request, options);
88470
88477
  while (!solver.solved && !solver.failed) {
88471
88478
  solver.step();
@@ -88486,18 +88493,36 @@ function* routeMultiTerminalBuses(input, options) {
88486
88493
  if (!terminal) continue;
88487
88494
  if (!effectiveCarrierLayers(input, connection).includes(terminal.layer))
88488
88495
  throw Error("No permitted surface layer for a multi-terminal branch");
88489
- const attachments = completed.filter((trace) => trace.connection_name === connection.name).flatMap(
88490
- (trace) => trace.route.flatMap((point52) => {
88491
- if (point52.route_type === "wire" && point52.layer === terminal.layer)
88492
- return [point52];
88493
- if (point52.route_type === "via" && (point52.layers?.includes(terminal.layer) || point52.from_layer === terminal.layer || point52.to_layer === terminal.layer))
88494
- return [{ x: point52.x, y: point52.y, layer: terminal.layer }];
88495
- return [];
88496
- })
88497
- );
88498
- attachments.sort(
88499
- (a2, b2) => Math.hypot(a2.x - terminal.x, a2.y - terminal.y) - Math.hypot(b2.x - terminal.x, b2.y - terminal.y)
88500
- );
88496
+ const attachments = completed.filter((trace) => trace.connection_name === connection.name).flatMap((trace) => {
88497
+ const vias = trace.route.flatMap((point52) => {
88498
+ if (point52.route_type !== "via") return [];
88499
+ const layers = getRouteViaSpanLayers3({
88500
+ fromLayer: point52.from_layer,
88501
+ toLayer: point52.to_layer,
88502
+ layers: point52.layers,
88503
+ layerNames: physicalLayers,
88504
+ allowBlindAndBuriedVias: input.allowBlindAndBuriedVias ?? false
88505
+ });
88506
+ if (!layers.includes(terminal.layer)) return [];
88507
+ return [{ x: point52.x, y: point52.y, layer: terminal.layer, layers }];
88508
+ });
88509
+ return [
88510
+ ...vias,
88511
+ ...trace.route.flatMap(
88512
+ (point52) => point52.route_type === "wire" && point52.layer === terminal.layer ? [point52] : []
88513
+ )
88514
+ ];
88515
+ });
88516
+ const carrierLayers = effectiveCarrierLayers(input, connection);
88517
+ attachments.sort((a2, b2) => {
88518
+ const reachesAnotherCarrierA = !!a2.layers?.some(
88519
+ (layer) => layer !== terminal.layer && carrierLayers.includes(layer)
88520
+ );
88521
+ const reachesAnotherCarrierB = !!b2.layers?.some(
88522
+ (layer) => layer !== terminal.layer && carrierLayers.includes(layer)
88523
+ );
88524
+ return Number(reachesAnotherCarrierB) - Number(reachesAnotherCarrierA) || Math.hypot(a2.x - terminal.x, a2.y - terminal.y) - Math.hypot(b2.x - terminal.x, b2.y - terminal.y);
88525
+ });
88501
88526
  if (!attachments.length)
88502
88527
  throw Error("No routed copper for a multi-terminal branch");
88503
88528
  const branch = {
@@ -115364,16 +115389,18 @@ function* expandedSignalSites({
115364
115389
  );
115365
115390
  for (const end of [0, 1]) {
115366
115391
  const pad = connection.pointsToConnect[end];
115367
- if (pad.layer === targetLayer2) {
115392
+ if ((pad.layers ?? [pad.layer]).includes(targetLayer2)) {
115393
+ const { layers: _layers, ...fixedPad } = pad;
115394
+ const point52 = { ...fixedPad, layer: targetLayer2 };
115368
115395
  ends[end].push({
115369
- point: pad,
115396
+ point: point52,
115370
115397
  length: 0,
115371
115398
  escape: {
115372
115399
  type: "pcb_trace",
115373
115400
  pcb_trace_id: `expanded_surface_${connection.name}_${end}`,
115374
115401
  connection_name: connection.name,
115375
115402
  source_trace_id: connection.source_trace_id ?? connection.name,
115376
- route: [{ ...pad, route_type: "wire", width }]
115403
+ route: [{ ...point52, route_type: "wire", width }]
115377
115404
  }
115378
115405
  });
115379
115406
  continue;
@@ -116914,9 +116941,12 @@ function* negotiateSignalSites(state, remove, stopWithOneRemaining = false, expa
116914
116941
  const carrierLayers = signalLayers(native, connection);
116915
116942
  for (let end = 0; end < 2; end++) {
116916
116943
  const point52 = connection.pointsToConnect[end];
116917
- if (carrierLayers.includes(point52.layer))
116944
+ for (const layer of carrierLayers) {
116945
+ if (!(point52.layers ?? [point52.layer]).includes(layer)) continue;
116946
+ const { layers: _layers, ...fixedPoint } = point52;
116947
+ const handoff = { ...fixedPoint, layer };
116918
116948
  ends[end].push({
116919
- point: point52,
116949
+ point: handoff,
116920
116950
  escape: {
116921
116951
  type: "pcb_trace",
116922
116952
  pcb_trace_id: `local_surface_${connection.name}_${end}`,
@@ -116924,14 +116954,14 @@ function* negotiateSignalSites(state, remove, stopWithOneRemaining = false, expa
116924
116954
  source_trace_id: connection.source_trace_id ?? connection.name,
116925
116955
  route: [
116926
116956
  {
116927
- ...point52,
116957
+ ...handoff,
116928
116958
  route_type: "wire",
116929
- layer: point52.layer,
116930
116959
  width: signalWidth(native, connection)
116931
116960
  }
116932
116961
  ]
116933
116962
  }
116934
116963
  });
116964
+ }
116935
116965
  }
116936
116966
  for (let variant = 0; variant < 4; variant++) {
116937
116967
  try {
@@ -122829,6 +122859,29 @@ var BusLanesPipelineSolver = class extends BaseSolver9 {
122829
122859
  this.phase = "native_pair_approaches";
122830
122860
  }
122831
122861
  }
122862
+ isNegotiableTerminal(connection, point52) {
122863
+ if (isUnroutedComponentPad(this.routingInput, connection, point52))
122864
+ return true;
122865
+ if (!point52.layers?.length || !point52.layers.includes(point52.layer))
122866
+ return false;
122867
+ const physical = getCopperLayerNames3(this.routingInput.layerCount);
122868
+ return !!this.routingInput.traces?.some(
122869
+ (trace) => (trace.connection_name === connection.name || connection.source_trace_id !== void 0 && trace.source_trace_id === connection.source_trace_id) && trace.route.some((via) => {
122870
+ if (via.route_type !== "via" || Math.hypot(via.x - point52.x, via.y - point52.y) > 1e-8)
122871
+ return false;
122872
+ const span = getRouteViaSpanLayers3({
122873
+ fromLayer: via.from_layer,
122874
+ toLayer: via.to_layer,
122875
+ layers: via.layers,
122876
+ layerNames: physical,
122877
+ allowBlindAndBuriedVias: this.routingInput.allowBlindAndBuriedVias ?? false
122878
+ });
122879
+ return point52.layers.every(
122880
+ (layer) => physical.includes(layer) && span.includes(layer)
122881
+ );
122882
+ })
122883
+ );
122884
+ }
122832
122885
  getConstructorParams() {
122833
122886
  return [this.input, this.options];
122834
122887
  }
@@ -123148,8 +123201,10 @@ var BusLanesPipelineSolver = class extends BaseSolver9 {
123148
123201
  )
123149
123202
  );
123150
123203
  this.canNegotiateGeneratedSites = !!(usedNativeFallback && this.routingInput.traces?.length && this.options.denseSearch && this.options.smoothTuning && !this.routingInput.differentialPairs?.length && this.routingInput.connections.every(
123151
- (connection) => connection.pointsToConnect.every(
123204
+ (connection) => connection.pointsToConnect.some(
123152
123205
  (point52) => isUnroutedComponentPad(this.routingInput, connection, point52)
123206
+ ) && connection.pointsToConnect.every(
123207
+ (point52) => this.isNegotiableTerminal(connection, point52)
123153
123208
  )
123154
123209
  ));
123155
123210
  const terminalLayers = /* @__PURE__ */ new Map();
@@ -159305,7 +159360,7 @@ var RoutingPhasePreparationError = class extends Error {
159305
159360
  var package_default = {
159306
159361
  name: "@tscircuit/core",
159307
159362
  type: "module",
159308
- version: "0.0.2300",
159363
+ version: "0.0.2301",
159309
159364
  types: "dist/index.d.ts",
159310
159365
  main: "dist/index.js",
159311
159366
  module: "dist/index.js",
@@ -159343,9 +159398,9 @@ var package_default = {
159343
159398
  "@tsci/tscircuit.ti": "github:tscircuit/ti#57e314be4b2b06bc546d4def7453e619604d1157",
159344
159399
  "@tscircuit/alphabet": "0.0.25",
159345
159400
  "@tscircuit/bga-fanout-solver": "github:tscircuit/bga-fanout-solver#247c835cb8d69b65e53891dcf869731079415b39",
159346
- "@tscircuit/bus-lanes-solver": "https://jscdn.tscircuit.com/@tscircuit/bus-lanes-solver/0.0.48.tgz",
159401
+ "@tscircuit/bus-lanes-solver": "https://jscdn.tscircuit.com/@tscircuit/bus-lanes-solver/0.0.49.tgz",
159347
159402
  "@tscircuit/cableprinter": "^0.0.6",
159348
- "@tscircuit/capacity-autorouter": "^0.0.1059",
159403
+ "@tscircuit/capacity-autorouter": "^0.0.1060",
159349
159404
  "@tscircuit/checks": "^0.0.270",
159350
159405
  "@tscircuit/circuit-json-util": "^0.0.128",
159351
159406
  "@tscircuit/common": "^0.0.20",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.2301",
4
+ "version": "0.0.2302",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -39,9 +39,9 @@
39
39
  "@tsci/tscircuit.ti": "github:tscircuit/ti#57e314be4b2b06bc546d4def7453e619604d1157",
40
40
  "@tscircuit/alphabet": "0.0.25",
41
41
  "@tscircuit/bga-fanout-solver": "github:tscircuit/bga-fanout-solver#247c835cb8d69b65e53891dcf869731079415b39",
42
- "@tscircuit/bus-lanes-solver": "https://jscdn.tscircuit.com/@tscircuit/bus-lanes-solver/0.0.48.tgz",
42
+ "@tscircuit/bus-lanes-solver": "https://jscdn.tscircuit.com/@tscircuit/bus-lanes-solver/0.0.49.tgz",
43
43
  "@tscircuit/cableprinter": "^0.0.6",
44
- "@tscircuit/capacity-autorouter": "^0.0.1059",
44
+ "@tscircuit/capacity-autorouter": "^0.0.1060",
45
45
  "@tscircuit/checks": "^0.0.270",
46
46
  "@tscircuit/circuit-json-util": "^0.0.128",
47
47
  "@tscircuit/common": "^0.0.20",