Skip to content

feat(topo,pnr,trunk):修剪了TG032-WH2主线无限延长的问题,并处理部分元器件引脚悬空#304

Open
rhaingenix wants to merge 27 commits into
devbisme:masterfrom
Doris619619:semantic-rail-fix
Open

feat(topo,pnr,trunk):修剪了TG032-WH2主线无限延长的问题,并处理部分元器件引脚悬空#304
rhaingenix wants to merge 27 commits into
devbisme:masterfrom
Doris619619:semantic-rail-fix

Conversation

@rhaingenix
Copy link
Copy Markdown

改动背景
这批改动主要解决 human-readable schematic 下两类问题:

driver rail / trunk 主线经常比实际连接范围更长,末端会多出没有意义的尾巴。
预布线或 cleanup 后,部分被动器件引脚虽然“同网”,但视觉上仍像没接上,或者被绕成很小的 L/jog。
主要改动

在 src/skidl/schematics/route.py 中增强了 driver 预布线。
route_driver_rails() 现在会先对 driver rail 和主链局部网做 pre-route,并把这些网标记为已处理,避免再被后续 global/switchbox routing 改写。
增加了主线尾段裁剪逻辑。
_prune_linear_endpoint_tails() 和 _prune_driver_preroute_tails() 会根据真实 attach 点裁掉多余主线,只保留连接所需范围和一格安全边距,避免 rail/trunk 超出最后一个元器件很远。
cleanup / humanize 阶段对 pre-routed net 做了更保守的处理。
对已预布线的 driver net,不再反复 split/remove_jogs,而是只做必要的尾段裁剪,避免把原本干净的水平主线重新拆成折线。
补强了同网引脚的 attach repair。
repair_unattached_same_net_pins() 现在会在安全时:
给未接上的 pin 补一条短直 stub
或直接把 pin 下方/上方的同网主线切分后接上
同时会避免跨到别的 net,也不会重复添加已有连接。
增加了被动器件 pin 附近小 jog 的简化。
simplify_passive_attach_jogs() 会把两段很小的 L 形连接折回成一条直连 stub;try_collinear_passive_attach() 则优先把 pin 对齐到附近同网主轴。对应会产生日志如 [aligned_attach]、[passive_attach_jog_removed]。
在 src/skidl/schematics/topology.py 中补强了 generic driver 语义分组。
_part_is_control_branch_passive() 会把接在 PWM/DIM/EN 等控制支路上的 R/C 识别进 control_parts,并配合 build_driver_rail_plan() / apply_driver_rail_safe_placement(),让这些控制支路元件在布局和布线时被单独对待,不被普通 rail 逻辑拖偏。
覆盖到的回归点

rail span clipping:主线只覆盖真实连接范围,不再无限延长。
junction-aware pruning:有真实分支/junction 的端点不会被误裁。
same-net pin attach repair:预布线后悬空的被动器件 pin 会被补接。
passive attach de-jog:R/C/L 等两脚器件附近的小折线会被直化。
cleanup anti-oscillation:避免 cleanup 在 split / 去 jog 之间来回振荡。
相关文件

src/skidl/schematics/route.py
src/skidl/schematics/topology.py
tests/unit_tests/test_topology_generic_driver.py
tests/unit_tests/ai_tests/test_route_cleanup.py
测试补充
新增/补强的单测主要覆盖:

driver rail span 裁剪
preroute 主线 tail prune
preserve prerouted nets
rail preroute 后的 pin attach repair
cleanup 对 detour/jog 的直化行为

效果展示:

Doris619619 and others added 27 commits May 13, 2026 20:36
feat(pnr): 增加 human_readable 布局与走线稳定化
feat(schematic): 新增小组弱对齐模块并修正 human_readable 布局过强对齐
feat(sch): 支持配置原理图布线疏松程度
feat(pnr):修复凸起,直连线并且运行大图例子
保留本地 phased remove_jogs 循环与进度日志,并入远端的
route_straight_nets、straighten_aligned_pin_connection 与
local_detour_visited。

Co-authored-by: Cursor <cursoragent@cursor.com>
feat(schematic): human_readable 下 generic driver 拓扑识别、rail 布局与预布线
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants