feat(topo,pnr,trunk):修剪了TG032-WH2主线无限延长的问题,并处理部分元器件引脚悬空#304
Open
rhaingenix wants to merge 27 commits into
Open
feat(topo,pnr,trunk):修剪了TG032-WH2主线无限延长的问题,并处理部分元器件引脚悬空#304rhaingenix wants to merge 27 commits into
rhaingenix wants to merge 27 commits into
Conversation
feat(pnr): 增加 human_readable 布局与走线稳定化
feat(schematic): 新增小组弱对齐模块并修正 human_readable 布局过强对齐
Feat/pnr optimization
feat(sch): 支持配置原理图布线疏松程度
feat(pnr):修复凸起,直连线并且运行大图例子
Feat/pnr optimization
保留本地 phased remove_jogs 循环与进度日志,并入远端的 route_straight_nets、straighten_aligned_pin_connection 与 local_detour_visited。 Co-authored-by: Cursor <cursoragent@cursor.com>
Feat/pnr optimization
feat(schematic): human_readable 下 generic driver 拓扑识别、rail 布局与预布线
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.
改动背景
这批改动主要解决 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 的直化行为
效果展示: