3.6 KiB
3.6 KiB
Implementation Plan
This plan outlines the step-by-step implementation of the inire auto-router. For detailed test cases, refer to Testing Plan.
Phase 1: Core Geometry & Move Generation
Goal: Implement Ports, Polygons, and Component Library with high geometric fidelity.
- Project Setup: Initialize
inire/structure andpytestconfiguration. Includehypothesisfor property-based testing. geometry.primitives:Portwith 1nm snapping.- Basic 2D transformations (rotate, translate).
- Property-Based Tests: Verify transform invariants (e.g.,
90^\circrotation cycles).
geometry.components:Straight,Bend90,SBend.- Search Grid Snapping: Implement 1µm snapping for expanded ports.
- Small S-Bends (
O < 2R): Logic for parametric generation. - Edge Cases: Handle
O=2RandL < 1\mu m.
- Tests:
- Verify geometric correctness (refer to Testing Plan Section 1).
- Unit tests for
Portsnapping and component transformations.
Phase 2: Collision Engine & Cost
Goal: Build the R-Tree wrapper and the analytic cost function.
geometry.collision: ImplementCollisionEngine.- Pre-dilation: Obstacles/Paths dilated by
Clearance/2. - Safety Zone: Ignore collisions within 2nm of start/end ports.
- Pre-dilation: Obstacles/Paths dilated by
router.danger_map:- Implement 1µm pre-computed proximity grid.
- Optimize for design sizes up to 20x20mm (< 2GB memory).
router.cost: ImplementCostEvaluator.- Bend cost:
10 \times (\text{Manhattan distance between ports}). - Integrate R-Tree for strict checks and Danger Map for heuristic.
- Bend cost:
- Tests:
- Verify collision detection with simple overlapping shapes (Testing Plan Section 2.1).
- Verify Danger Map accuracy and memory footprint (Testing Plan Section 2.2).
- Post-Route Validator: Implement the independent
validate_pathutility.
Phase 3: Single-Net A* Search
Goal: Route a single net from A to B with 1nm precision.
router.astar: Implement the priority queue loop.- State representation:
(x_µm, y_µm, theta). - Move expansion loop with 1µm grid.
- Natural S-Bends: Ensure search can find
O \ge 2Rshifts by combining moves. - Look-ahead Snapping: Actively bridge to the 1nm target when in the capture radius (10µm).
- State representation:
- Heuristic: Manhattan distance
h(n)+ orientation penalty + Danger Map lookup. - Tests:
- Solve simple maze problems and verify path optimality (Testing Plan Section 3).
- Verify snap-to-target precision at 1nm resolution.
- Determinism: Verify same seed = same path.
Phase 4: Multi-Net PathFinder
Goal: Implement the "Negotiated Congestion" loop for multiple nets.
router.pathfinder:- Sequential routing -> Identify congestion -> Inflate cost -> Reroute.
- R-Tree Congestion: Store dilated path geometries.
- Explicit Results: Return
RoutingResultobjects withis_validandcollisionsmetadata. - Tests:
- Full multi-net benchmarks (Testing Plan Section 4).
- Verify rerouting behavior in crowded environments.
Phase 5: Visualization, Benchmarking & Fuzzing
utils.visualization: Plot paths usingmatplotlib. Highlight collisions in red.- Benchmarks: Stress test with 50+ nets. Verify performance and node limits (Testing Plan Section 5).
- Fuzzing: Run A* on randomized layouts to ensure stability.
- Final Validation: Ensure all
is_valid=Trueresults pass the independentvalidate_pathcheck.