Fix #15: Add specialized layout solver for decoupling capacitors#34
Open
1234-ad wants to merge 4 commits intotscircuit:mainfrom
Open
Fix #15: Add specialized layout solver for decoupling capacitors#341234-ad wants to merge 4 commits intotscircuit:mainfrom
1234-ad wants to merge 4 commits intotscircuit:mainfrom
Conversation
…yout strategies
|
@1234-ad is attempting to deploy a commit to the tscircuit Team on Vercel. A member of the Team first needs to authorize it. |
rushabhcodes
requested changes
Feb 15, 2026
rushabhcodes
left a comment
There was a problem hiding this comment.
Please add a snapshot test as proof
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR addresses issue #15 by implementing a specialized layout solver for decoupling capacitor partitions that creates clean, organized layouts instead of the messy arrangements shown in the issue.
Problem
The current packing algorithm treats decoupling capacitors the same as other components, resulting in messy, disorganized layouts with:
Solution
Implemented
DecouplingCapsLayoutSolver- a specialized solver that:decouplingCapsGapparameter for clean separationChanges Made
New Files
lib/solvers/PackInnerPartitionsSolver/DecouplingCapsLayoutSolver.tstests/DecouplingCapsLayoutSolver.test.tsModified Files
lib/solvers/PackInnerPartitionsSolver/PackInnerPartitionsSolver.tsDecouplingCapsLayoutSolverinto the packing pipelinepartitionType === "decoupling_caps"and uses specialized solverSingleInnerPartitionPackingSolverfor other partitionsTechnical Details
Grid Layout Algorithm
Layout Strategy Selection
Rotation Handling
availableRotationsconstraint from chip definitionBenefits
✅ Cleaner schematics - organized, professional-looking layouts
✅ Easier debugging - clear visual organization of decoupling caps
✅ Better routing - minimized trace crossings
✅ Consistent orientation - all caps face the same direction
✅ Flexible strategies - choose layout based on number of caps
✅ Maintains existing behavior - only affects decoupling cap partitions
Testing
All tests pass:
bun test tests/DecouplingCapsLayoutSolver.test.tsTests cover:
Example Output
Before (messy, random placement):
After (clean grid layout):
Bounty
This PR addresses the $300 bounty issue #15.
Future Enhancements
Potential improvements for future PRs:
Closes #15