go to a tunable 5um grid

This commit is contained in:
jan 2026-03-11 09:37:54 -07:00
commit 91256cbcf9
21 changed files with 222 additions and 233 deletions

View file

@ -11,42 +11,31 @@ def main() -> None:
print("Running Example 05: Orientation Stress Test...")
# 1. Setup Environment
# Give some breathing room (-20 to 120) for U-turns and flips (R=10)
bounds = (-20, -20, 120, 120)
bounds = (0, 0, 200, 200)
engine = CollisionEngine(clearance=2.0)
danger_map = DangerMap(bounds=bounds)
danger_map.precompute([])
evaluator = CostEvaluator(engine, danger_map, greedy_h_weight=1.1)
router = AStarRouter(evaluator, node_limit=100000)
router.config.bend_collision_type = "clipped_bbox"
router.config.bend_clip_margin = 1.0
evaluator = CostEvaluator(engine, danger_map, bend_penalty=50.0, sbend_penalty=150.0)
router = AStarRouter(evaluator, snap_size=1.0, straight_lengths=[1.0, 5.0, 25.0], bend_radii=[10.0])
pf = PathFinder(router, evaluator)
# 2. Define Netlist with various orientation challenges
# 2. Define Netlist: Complex orientation challenges
netlist = {
# Opposite directions: requires two 90-degree bends to flip orientation
"opposite": (Port(10, 80, 0), Port(90, 80, 180)),
# 90-degree turn: standard L-shape
"turn_90": (Port(10, 60, 0), Port(40, 90, 90)),
# Output behind input: requires a full U-turn
"behind": (Port(80, 40, 0), Port(20, 40, 0)),
# Sharp return: output is behind and oriented towards the input
"return_loop": (Port(80, 20, 0), Port(40, 10, 180)),
"u_turn": (Port(50, 100, 0), Port(30, 100, 180)),
"loop": (Port(150, 50, 90), Port(150, 40, 90)),
"zig_zag": (Port(20, 20, 0), Port(180, 180, 0)),
}
net_widths = dict.fromkeys(netlist, 2.0)
net_widths = {nid: 2.0 for nid in netlist}
# 3. Route
print("Routing complex orientation nets...")
results = pf.route_all(netlist, net_widths)
# 4. Check Results
for nid, res in results.items():
status = "Success" if res.is_valid else "Failed"
total_len = sum(comp.length for comp in res.path) if res.path else 0
print(f" {nid:12}: {status}, total_length={total_len:.1f}")
print(f" {nid}: {status}")
# 5. Visualize
fig, ax = plot_routing_results(results, [], bounds, netlist=netlist)