Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/components/primitive-components/Group/Group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {
import { getLocalAutoroutingStages } from "lib/utils/autorouting/localAutorouterStrategies"
import { shouldSkipAutoroutingBecauseOfPlacementErrors } from "lib/utils/autorouting/should-skip-autorouting-because-of-placement-errors"
import { getBoundsOfPcbComponents } from "lib/utils/get-bounds-of-pcb-components"
import { getViaBoardLayers } from "lib/utils/getViaSpanLayers"
import { getViaSpanLayers } from "lib/utils/getViaSpanLayers"
import {
GROUND_NET_REGEX,
POWER_NET_REGEX,
Expand Down Expand Up @@ -1648,7 +1648,11 @@ export class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
routedViaPoint.via_diameter ??
routedViaPoint.outer_diameter ??
routedViaPadDiameter,
layers: getViaBoardLayers(this._getSubcircuitLayerCount()),
layers: getViaSpanLayers({
fromLayer,
toLayer,
layerCount: this._getSubcircuitLayerCount(),
}),
from_layer: fromLayer,
to_layer: toLayer,
subcircuit_id: this.subcircuit_id!,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import type { LayerRef } from "circuit-json"
import type {
Obstacle,
SimpleRouteDifferentialPair,
SimpleRouteConnection,
SimpleRouteJson,
SimplifiedPcbTrace,
} from "lib/utils/autorouting/SimpleRouteJson"
import { getViaBoardLayers } from "lib/utils/getViaSpanLayers"
import { getViaSpanLayers } from "lib/utils/getViaSpanLayers"
import type {
RoutingPhaseDrcTolerances,
RoutingPhasePlan,
Expand Down Expand Up @@ -126,7 +127,11 @@ function createViaObstacle(
return {
obstacleId: `${connectedTo}_phase_via_obstacle_${obstacleIndex}`,
type: "rect",
layers: getViaBoardLayers(layerCount),
layers: getViaSpanLayers({
fromLayer: point.from_layer as LayerRef,
toLayer: point.to_layer as LayerRef,
layerCount,
}),
center: { x: point.x, y: point.y },
width: 0.6,
height: 0.6,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,11 @@ test("unbroken inner-layer copper pours participate in autorouting", async () =>
.list()
.every((via) => via.subcircuit_connectivity_map_key),
).toBe(true)
expect(topToInner2Vias.every((via) => via.layers.includes("inner1"))).toBe(
true,
)
expect(topToInner2Vias.every((via) => via.layers.includes("bottom"))).toBe(
true,
)
expect(topToInner2Vias.every((via) => via.layers.length === 4)).toBe(true)
expect(
topToInner2Vias.every(
(via) => via.layers.join(",") === "top,inner1,inner2",
),
).toBe(true)

const vccNet = circuit.db.source_net.list().find((net) => net.name === "VCC")
expect(vccNet?.subcircuit_connectivity_map_key).toBeDefined()
Expand Down
9 changes: 9 additions & 0 deletions tests/features/autorouter-fanout-plane-termination.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@ test("fanout drops source-only power and ground connections to internal planes",
const vias = circuit.db.pcb_via.list()
expect(vias.some((via) => via.to_layer === "inner1")).toBe(true)
expect(vias.some((via) => via.to_layer === "inner2")).toBe(true)
expect(vias.find((via) => via.to_layer === "inner1")?.layers).toEqual([
"top",
"inner1",
])
expect(vias.find((via) => via.to_layer === "inner2")?.layers).toEqual([
"top",
"inner1",
"inner2",
])

const signalSourceTraceIds = new Set(
["SIGNAL", "SIGNAL_RETURN"].map(
Expand Down
14 changes: 5 additions & 9 deletions tests/features/ten-layer-custom-autorouting.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ test("Core carries an inner8 route through the full autorouting pipeline", async
),
).toBe(true)

const allCopperLayers: LayerRef[] = [
const topToInner8Layers: LayerRef[] = [
"top",
"inner1",
"inner2",
Expand All @@ -106,14 +106,10 @@ test("Core carries an inner8 route through the full autorouting pipeline", async
"inner6",
"inner7",
"inner8",
"bottom",
]
expect(circuit.db.pcb_via.list()).toHaveLength(2)
expect(
circuit.db.pcb_via
.list()
.every((via) =>
allCopperLayers.every((layer) => via.layers.includes(layer)),
),
).toBe(true)
expect(circuit.db.pcb_via.list().map((via) => via.layers)).toEqual([
topToInner8Layers,
[...topToInner8Layers].reverse(),
])
})
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect, test } from "bun:test"
import { Group_getObstaclesFromRoutedTraces } from "lib/components/primitive-components/Group/Group_phasedAutoroutingUtils"
import type { SimplifiedPcbTrace } from "lib/utils/autorouting/SimpleRouteJson"

test("phased autorouting blocks every layer crossed by a through via", () => {
test("phased autorouting blocks only the layers crossed by a blind via", () => {
const trace: SimplifiedPcbTrace = {
type: "pcb_trace",
pcb_trace_id: "pcb_trace_0",
Expand All @@ -20,7 +20,6 @@ test("phased autorouting blocks every layer crossed by a through via", () => {
const [viaObstacle] = Group_getObstaclesFromRoutedTraces([trace], 10)

expect(viaObstacle.layers).toEqual([
"top",
"inner1",
"inner2",
"inner3",
Expand All @@ -29,6 +28,5 @@ test("phased autorouting blocks every layer crossed by a through via", () => {
"inner6",
"inner7",
"inner8",
"bottom",
])
})
Loading