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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ interface SimpleRouteJson {
obstacles: Obstacle[]
connections: Array<SimpleRouteConnection>
buses?: Array<SimpleRouteBus>
allowViaInPad?: boolean
bounds: { minX: number; maxX: number; minY: number; maxY: number }
traces?: SimplifiedPcbTraces // Optional for input
}
Expand Down Expand Up @@ -92,6 +93,10 @@ interface SimpleRouteBus {
bus. Bus metadata is preserved in the output so routing implementations can
apply the constraint without losing the original membership or ordering.

Via-in-pad repair is disabled by default because it generally requires filled
and capped vias. Set `allowViaInPad: true` only when the fabrication process
supports it.

### Output Format

The `getOutputSimpleRouteJson()` method returns the original `SimpleRouteJson` with a populated `traces` property. The traces are represented as `SimplifiedPcbTraces`:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ export class AutoroutingPipelineSolver7_MultiGraph extends BaseSolver {
enableLargeBoardBroadFallback: false,
enableTargetedErrorSweep: true,
enablePostSolveClearanceRelaxation: false,
enableViaInPadLayerMoves: true,
enableViaInPadLayerMoves: cms.originalSrj.allowViaInPad ?? false,
viaInPadMaxIterations: 32,
broadMaxIterations: 8,
broadPassMultiplier: 3,
Expand Down
5 changes: 5 additions & 0 deletions lib/types/srj-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ export interface SimpleRouteJson {
connections: Array<SimpleRouteConnection>
differentialPairs?: Array<DifferentialPair>
buses?: Array<SimpleRouteBus>
/**
* Allows DRC repair to place layer transitions inside connected pads.
* Defaults to false because via-in-pad generally requires filled and capped vias.
*/
allowViaInPad?: boolean
bounds: { minX: number; maxX: number; minY: number; maxY: number }
outline?: Array<{ x: number; y: number }>
traces?: SimplifiedPcbTraces
Expand Down
4 changes: 2 additions & 2 deletions tests/bugs/__snapshots__/bugreport64-be7d8f.snap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions tests/bugs/__snapshots__/bugreport77-07f6a7.snap.svg

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is going on here?

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 2 additions & 8 deletions tests/bugs/bugreport-b5b3b9d8-drc-count.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import bugReport from "../../fixtures/bug-reports/bugreport-b5b3b9d8/bugreport-b
}

type CircuitJson = ReturnType<typeof convertToCircuitJson>
type DrcErrorCountByType = Record<string, number>

const srj = bugReport.simple_route_json as SimpleRouteJson

Expand Down Expand Up @@ -37,15 +36,10 @@ test("bugreport-b5b3b9d8 pipeline7 records current total DRC errors", () => {
{ minTraceWidth: srj.minTraceWidth },
)

const { errors, locationAwareErrors } = getDrcErrors(circuitJson, {
const { errors } = getDrcErrors(circuitJson, {
traceClearance: 0.1,
viaClearance: 0.1,
})
const errorCountByType = errors.reduce<DrcErrorCountByType>((acc, error) => {
acc[error.error_type] = (acc[error.error_type] ?? 0) + 1
return acc
}, {})

expect(errors).toHaveLength(0)
expect(errorCountByType).toEqual({})
expect(errors).toHaveLength(2)
})
25 changes: 25 additions & 0 deletions tests/features/via-in-pad-opt-in.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { expect, test } from "bun:test"
import * as dataset01 from "@tscircuit/autorouting-dataset-01"
import { AutoroutingPipelineSolver7_MultiGraph } from "lib"
import type { SimpleRouteJson } from "lib/types"

const circuit003 = (dataset01 as Record<string, unknown>)
.circuit003 as SimpleRouteJson

test("Pipeline 7 requires an explicit via-in-pad opt-in", () => {
for (const allowViaInPad of [undefined, false, true] as const) {
const input: SimpleRouteJson = {
...structuredClone(circuit003),
allowViaInPad,
}
const solver = new AutoroutingPipelineSolver7_MultiGraph(input, {
cacheProvider: null,
})

solver.solve()

const [params] =
solver.exactGeometryDrcForceImproveSolver!.getConstructorParams()
expect(params.enableViaInPadLayerMoves).toBe(allowViaInPad ?? false)
}
})
Loading