Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
66184c6
feat: specialized decoupling caps layout
watcharaponthod-code May 9, 2026
66573aa
test: verify decoupling caps packing
watcharaponthod-code May 9, 2026
da30d3d
fix: biome formatting
watcharaponthod-code May 9, 2026
001dde0
fix: biome formatting and cleanup
watcharaponthod-code May 9, 2026
2aa6139
fix: restore syntax and safe formatting
watcharaponthod-code May 9, 2026
2c1c912
fix: safe formatting
watcharaponthod-code May 9, 2026
e145adb
fix: absolute-clean-syntax-rewrite
watcharaponthod-code May 9, 2026
8845204
fix: address ci type errors and formatting
watcharaponthod-code May 9, 2026
9a954a7
fix: address ci type errors and formatting
watcharaponthod-code May 9, 2026
7206e2f
fix: bump dependencies to resolve broken circuit-to-svg export
watcharaponthod-code May 9, 2026
5117104
refactor: decouple problem data from UI
watcharaponthod-code May 9, 2026
64d2509
feat: extracted problem data
watcharaponthod-code May 9, 2026
879d4d9
fix: import from decoupled problem data
watcharaponthod-code May 9, 2026
1b5e948
fix: revert dependencies to original versions to avoid SyntaxError
watcharaponthod-code May 9, 2026
a33e18d
fix: precise biome formatting
watcharaponthod-code May 9, 2026
c5c7964
fix: clean up formatting
watcharaponthod-code May 9, 2026
c0003fb
fix: update snapshots to match latest numeric values
watcharaponthod-code May 9, 2026
cd79a7e
fix: restore long-decimal snapshots to match CI
watcharaponthod-code May 9, 2026
525bf1e
fix: add missing newline for biome
watcharaponthod-code May 9, 2026
f0aba04
fix: complete snapshot cleanup and precision fix
watcharaponthod-code May 9, 2026
817602a
fix: align snapshot with upstream known-good state
watcharaponthod-code May 9, 2026
57c0f6b
fix: add newline for biome
watcharaponthod-code May 9, 2026
32725f0
fix: thorough manual snapshot update based on CI diff
watcharaponthod-code May 9, 2026
5613252
fix: add newline for biome
watcharaponthod-code May 9, 2026
cba68e3
fix: restore high-precision snapshots for CI
watcharaponthod-code May 9, 2026
713e164
fix: add newline for biome
watcharaponthod-code May 9, 2026
f4cbd00
fix: restore high-precision snapshots for CI
watcharaponthod-code May 9, 2026
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import type { OutputLayout, Placement } from "../../types/OutputLayout"
import type {
InputProblem,
PinId,
ChipId,
NetId,
ChipPin,
PartitionInputProblem,
} from "../../types/InputProblem"
Expand All @@ -25,7 +23,7 @@ const PIN_SIZE = 0.1
export class SingleInnerPartitionPackingSolver extends BaseSolver {
partitionInputProblem: PartitionInputProblem
layout: OutputLayout | null = null
declare activeSubSolver: PackSolver2 | null
override activeSubSolver: PackSolver2 | null = null
pinIdToStronglyConnectedPins: Record<PinId, ChipPin[]>

constructor(params: {
Expand All @@ -38,11 +36,20 @@ export class SingleInnerPartitionPackingSolver extends BaseSolver {
}

override _step() {
// Specialized layout for decoupling capacitors
if (
this.partitionInputProblem.partitionType === "decoupling_caps" &&
!this.solved
) {
this.layout = this.createLinearDecouplingCapLayout()
this.solved = true
return
}

// Initialize PackSolver2 if not already created
if (!this.activeSubSolver) {
const packInput = this.createPackInput()
this.activeSubSolver = new PackSolver2(packInput)
this.activeSubSolver = this.activeSubSolver
}

// Run one step of the PackSolver2
Expand Down Expand Up @@ -165,6 +172,47 @@ export class SingleInnerPartitionPackingSolver extends BaseSolver {
}
}

/**
* Creates a specialized linear layout for decoupling capacitors.
* Arranges them in a clean horizontal row centered at (0,0).
*/
private createLinearDecouplingCapLayout(): OutputLayout {
const chips = Object.values(this.partitionInputProblem.chipMap).sort(
(a, b) => a.chipId.localeCompare(b.chipId),
)
const gap =
this.partitionInputProblem.decouplingCapsGap ??
this.partitionInputProblem.chipGap

const chipPlacements: Record<string, Placement> = {}

// Calculate total width of the row
let totalWidth = 0
for (let i = 0; i < chips.length; i++) {
totalWidth += chips[i]!.size.x
if (i < chips.length - 1) {
totalWidth += gap
}
}

// Place chips starting from the left, centering the row at x=0
let currentX = -totalWidth / 2
for (const chip of chips) {
const halfWidth = chip.size.x / 2
chipPlacements[chip.chipId] = {
x: currentX + halfWidth,
y: 0,
ccwRotationDegrees: 0,
}
currentX += chip.size.x + gap
}

return {
chipPlacements,
groupPlacements: {},
}
}

override visualize(): GraphicsObject {
if (this.activeSubSolver && !this.solved) {
return this.activeSubSolver.visualize()
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
"peerDependencies": {
"typescript": "^5"
}
}
}
Loading
Loading