0.5.2 · 推荐:JSON 控制的 region 流程
正常运行优先使用 ucs_tsv_region_flow。它负责 JSON、region 选择与尺寸管理,底层 proc 继续只接收具体 bbox、layer 和对象。旧 ucs_tsv_plan 入口保持原有行为。
source ./ucs_tsv_region_flow.tcl
set result [ucs_tsv_region_flow -config ./examples/region_incremental.json]示例 reference、pin pattern、layer 和 buffer lib cell 必须按实际设计修改。site_row_height 已从示例中去掉:derive_plan_geometry 自动读取设计第一条 site row 的 site_height;显式配置仅用于覆盖。取不到有效正数会报错,不猜测。混合 row-height 设计须确认采用的高度。
JSON 场景一 · incremental assign
先完成相关 cell placement。读取 JSON → extract_region → selected_regions → cross nets → 按 skip_clock_nets 过滤 → plan_objects → 多层 occupancy → plan_nets。当前新入口不自动剔除已有 planned nets。
{
"flow_mode": "incremental",
"selected_regions": [
"region_1"
],
"out_dir": "./out/incremental",
"debug_level": 4,
"default": {
"signal_tsv_ref_names": [
"TSV_SIGNAL*"
],
"power_tsv_ref_names": [
"TSV_PG*"
],
"tsv_region_merge_upsize": 50.0,
"tsv_region_merge_downsize": 50.0,
"guide_buffer_lib_cell": "YOUR_BUFFER_LIB_CELL",
"cross_net_mode": "pre_route",
"skip_clock_nets": true,
"incremental_search_height_multiplier": 2.0,
"assignment_strategy": "nearest",
"shielding_mode": "compact",
"shape_offset": -2.5,
"cell_down_y_offset": 0.0,
"cell_up_y_offset": 0.0,
"ratio_period_tracks": 100,
"ratio_reserved_tracks": 5,
"gap_reserved_tracks": 10,
"force_gap_every_n_nets": 500,
"power_tsv_x_guardband": 0.2,
"shield_net": "VSS",
"allow_compact_fallback": false,
"inter_set_gap_multiplier": 5,
"special_guard_tracks": 1
},
"global": {
"available_layers": [
"T3M*",
"T2M*"
]
},
"regions": {
"region_1": {
"search_height": 200,
"plan_sets": [
{
"name": "auto_cross"
}
]
}
}
}# Run in FC from the package directory, after editing the JSON for your design.
source ./ucs_tsv_region_flow.tcl
set result [ucs_tsv_region_flow -config ./examples/region_incremental.json]
# Generation only. Inspect logs, assignments and failures before execution.
dict for {region details} $result {
puts "Region: $region"
puts "Geometry log: [dict get $details geometry_log]"
puts "Assignments: [llength [dict get $details plan assignments]]"
puts "Failures: [llength [dict get $details plan failures]]"
}
# Separately preview the generated Tcl (replace region_1 if changed in JSON):
# set ::UCS_TSV_DRYRUN 1
# source ./out/incremental/region_1/implement.tclsearch_height 表示 region 上下各搜索的绝对距离;CLI 覆盖 JSON,未配置时用 region 高度 × incremental_search_height_multiplier。候选 cell 搜索范围不改变跨越判断 bbox;routing shapes 可补充搜索带之外的端点。
JSON 场景二 · 多 set pin replan
replan 跳过 cross 提取和普通目标 cell 的放置侧别检查。各 set 独立控制 start_x、layer、ratio reserve 和 gap;TSV region 本身仍需要有效几何。固定 macro pin/port 按既有规则优先 nearest。
{
"flow_mode": "replan",
"selected_regions": [
"region_1"
],
"default": {
"signal_tsv_ref_names": [
"TSV_SIGNAL*"
],
"power_tsv_ref_names": [
"TSV_PG*"
],
"guide_buffer_lib_cell": "YOUR_BUFFER_LIB_CELL",
"assignment_strategy": "sequential",
"shielding_mode": "compact",
"ratio_period_tracks": 100,
"ratio_reserved_tracks": 5,
"gap_reserved_tracks": 10,
"force_gap_every_n_nets": 500,
"shape_offset": -2.5,
"cell_down_y_offset": 0.0,
"cell_up_y_offset": 0.0,
"power_tsv_x_guardband": 0.2,
"skip_clock_nets": true,
"incremental_search_height_multiplier": 2.0,
"shield_net": "VSS",
"allow_compact_fallback": false,
"inter_set_gap_multiplier": 5,
"special_guard_tracks": 1,
"tsv_region_merge_upsize": 50.0,
"tsv_region_merge_downsize": 50.0
},
"global": {
"available_layers": [
"T3M*",
"T2M*"
]
},
"regions": {
"region_1": {
"plan_sets": [
{
"name": "pins",
"start_x": 10,
"plan_objects": [
[
"pin",
"u_data*/D",
"top_to_bottom"
]
]
},
{
"name": "control",
"start_x": 100,
"ratio_period_tracks": 8,
"ratio_reserved_tracks": 2,
"gap_reserved_tracks": 2,
"force_gap_every_n_nets": 3,
"plan_objects": [
[
"pin",
"a*b",
"bottom_to_top"
]
]
}
]
}
},
"out_dir": "./out/replan",
"debug_level": 4
}# Run in FC from the package directory, after editing the JSON for your design.
source ./ucs_tsv_region_flow.tcl
set result [ucs_tsv_region_flow -config ./examples/region_replan.json]
# Generation only. Inspect logs, assignments and failures before execution.
dict for {region details} $result {
puts "Region: $region"
puts "Geometry log: [dict get $details geometry_log]"
puts "Assignments: [llength [dict get $details plan assignments]]"
puts "Failures: [llength [dict get $details plan failures]]"
}
# Separately preview the generated Tcl (replace region_1 if changed in JSON):
# set ::UCS_TSV_DRYRUN 1
# source ./out/replan/region_1/implement.tcl2.0.13 JSON 默认值
新 region 流程参考 2.0.13 incremental_assign.json:ratio_period_tracks=100、ratio_reserved_tracks=5、gap_reserved_tracks=10、force_gap_every_n_nets=500、inter_set_gap_multiplier=5、shielding_mode=compact、shape_offset=-2.5、power_tsv_x_guardband=0.2、search multiplier=2。显式 JSON/set 值优先;replan 示例使用 sequential,incremental 使用 nearest。nearest 下的周期 gap 不按 sequential 的方式触发,参数支持范围以对应 proc 为准。
site_row_height、width、pitch 默认从设计推导。buffer marker 未指定尺寸时使用 row height。旧 2.0.13 中尚未实现的策略没有加入新流程默认值。
Pin 过滤与 vertical layer 选择
pin 的 a*b 或 ? pattern 原样交给 FC get_pins,遍历返回 collection 得到具体对象。精确 pin 和匹配 pin 都要求 port_type == signal。net 的 all_connected -leaf 结果按下列表达式过滤,再要求 sizeof_collection >= 2,否则按 floating 跳过。
filter_collection $connected "object_class == pin && port_type == signal || object_class == port"layer pattern 原样交给 get_layers,去重后按 routing_direction 分组。只有 vertical 层进入 occupancy/plan;horizontal 层保留在 layer_selection 中供未来 shielding 使用,目前不生成横向 shielding。无匹配、未知方向、没有 vertical 层会报错。width/pitch 分别由目标 layer 推导。
中间 bbox 与结果日志
debug_level > 0 时,每个 region 输出 geometry.log:region、上下搜索、cross-check、各 set occupancy/plan bbox,以及成功分配后的 signal/shield shape 和 buffer marker bbox。每行有 region、set、用途、layer、四个边界、宽、高和来源;整数不补小数,float 最多四位。replan 不打印未使用的搜索 bbox。
另有 pin_filter.log、layers_<set>.log、plan_objects_<set>.txt、assignments.txt 和 implement.tcl。result 按 region 名索引,含 bbox、search_height、cross_nets、skipped_clock_nets、plan_objects、layer_selection、occupancy、plan、geometry_log。全部对象过滤为空时可能没有实现文件。
set ::UCS_TSV_DRYRUN 1
source ./out/replan/region_1/implement.tcl
# 检查后另行执行:
set ::UCS_TSV_DRYRUN 0
source ./out/replan/region_1/implement.tcl邮件早期附件中 multi_implement*.tcl 是 mock 测试产物,不是设计执行入口;请使用上述 run_json_*.tcl,最新整理包已排除这些文件。
ucs_tsv_region_flow 参数
| 参数 | 要求 | 类型 | 说明 |
|---|---|---|---|
| -config | required | string | 2.0.13-style JSON configuration |
| -regions | optional | string | names returned by extract_region |
| -layer | optional | string | override available_layers |
| -search_height | optional | float | absolute search distance above and below region; overrides JSON multiplier |
| -check_mode | optional | string | pre_route or post_route |
| -flow_mode | optional | string | incremental: extract cross nets; replan: explicit objects |
| -out_dir | optional | string | output directory |
| -debug | optional | int | 0-4 |
regions 可省略:CLI -regions > JSON selected_regions > JSON regions 的全部键。flow_mode、out_dir、debug_level 可在 JSON 顶层控制,相应 CLI 优先。plan_nets -occupancy 接收上层已有快照,避免重复扫描;检查与规划间不得改变设计和扫描配置。
01 · 从这里开始
本页对应 ucs_tsv_plan-0.5.2 当前修改版。用于 Fusion Compiler 中的 TSV 跨区信号规划:识别区域、判断连接、检查 track、分配 signal/shield、生成插入 buffer 和绘线命令。日期:2026-09-14。
先生成计划、查看日志和 error marker,再 source 生成的实现脚本。生成文件不执行 buffer 插入;debug marker 会创建/更新 error data。所有例子的对象名、layer、bbox、lib cell 与 site row height 均需替换成当前设计值。
# 在包目录下,加载一个已经打开设计的 FC session
source ./ucs_tsv_plan_proc.tcl
# 若需要 JSON 批处理入口,改为加载下面这个文件(它会加载 proc 文件)
source ./ucs_tsv_plan.tcl
plan_nets -help
check_track_occupancy -help| 目标 | 建议入口 | 返回形式 |
|---|---|---|
| 配置内容 | parse_json | 解析后的 Tcl dict/list |
| 推导公共设置 | derive_plan_geometry | 包含来源信息的 dict |
| incremental / replan assign | plan_nets -plan_objects … 或 -sets … | 计划 dict |
| 批量 region | ucs_tsv_plan -config … | 批处理结果 dict |
| 执行计划 | source <generated implement.tcl> | 全局 DONE / SKIPPED / FAILED 状态 |
本页面基于源代码中的参数声明与当前调用路径编写。注册接口的完整参数表在每个 proc 下展开。内部 helper 在最后的维护索引中列出,不需要在业务流程中逐个手动调用。
02 · 模式、坐标与对象
| 项目 | 含义 |
|---|---|
flow_mode | incremental / replan:决定如何判断连接和插入。typed 输入默认 replan。 |
mode | sequential / nearest:决定如何挑选 track,与 flow_mode 独立。旧单层 net-list 路径还支持 global_balance。 |
bbox | 平坦列表 {x1 y1 x2 y2},不是 {{x1 y1} {x2 y2}}。几何使用设计坐标单位,通常为 μm。 |
direction | top_to_bottom 从上向下;bottom_to_top 从下向上。 |
type / name | type 为 net / pin / port;name 保留用户指定的准确对象。pin 可以是 leaf pin 或 hier pin。 |
| 固定对象 | 显式给定的 port 或 macro pin,使用 pin/port 自身 bbox 中心 X;在同一个 set 内优先分配,并采用 nearest 选点。 |
| width / pitch | 不传时分别从所给 layer 推导;多层逐层读取。显式传 width/pitch 是统一覆盖值,不是每层 dict。 |
offset | 当前 typed 路径用于 shape 的 Y 延伸;不控制在哪个 pin 插 buffer。buffer 的基准 Y 用 cell_down_offset / cell_up_offset。 |
incremental 的 net/driver 请求要求相关 cell 已放置,并按 direction 检查 driver 所处的一侧。显式 load pin/port 直接在该 load 上插入,不扫描其他 loads。replan 不检查 fanout 上下侧;普通 cell 可以尚未放置,但固定对象仍需有效几何来确定 anchor。
set objects {
{net data_bus[0] top_to_bottom}
{pin u_hier/data_in top_to_bottom}
{port DATA_OUT bottom_to_top}
}
# 花括号内的 bus [0] 是字面名字,不会发生 Tcl 命令替换。对象文件采用三个 Tcl-list 列,空格或 tab 均可。支持 type name direction 表头、空行以及整行 # 注释。有空格的名字需用花括号包住。不能同时传 inline objects 和 object file;不能同时传顶层 objects 和 typed sets。
# objects.txt
type name direction
net {data_bus[0]} top_to_bottom
pin u_hier/data_in top_to_bottom
port DATA_OUT bottom_to_top03 · 完整场景:incremental assign
适用:place 已完成,针对选定对象重新分配跨区资源。下面假设 data_down 的 driver 在 y > 1100,上下边界之间是 TSV 区域;data_up 的 driver 在 y < 1000。u_load/A 是一个 load pin。
| 请求情况 | 判断与构造 |
|---|---|
| net 或 driver,所有 loads 在对面 | 返回 all_far=1;在 driver 上 insert_buffer,再根据新连接插第二级 buffer。 |
| net 或 driver,仅部分 loads 在对面 | 返回 far_loads 和 near_loads;create_cell,按实际层次 net 断开对面 loads,再 connect_pin;同侧 loads 保留。 |
| 显式 load pin / 输出 port | 直接在指定 load 对象上 insert_buffer;不扫描其他 fanout。 |
| 没有对面 loads/driver 与 direction 冲突 | 报错,不作为可正常执行的计划。 |
这份示例不会自动排除“已经 planned”的对象。如果要保留已有合格布线,先使用后文的 extract_unplan_nets 进行筛选;或者直接给出确实需要本轮处理的对象。
# Source from the package directory in an FC design session.
# Replace all object names, layers, bbox, lib_cell and row_height first.
# Generating the plan does not execute connectivity/placement edits.
source ./ucs_tsv_plan_proc.tcl
# The relevant cells must already be placed.
# data_down: driver above y=1100; far loads below y=1000.
# data_up: driver below y=1000; far loads above y=1100.
# u_load/A is an input/load pin: insert directly on this pin.
# Supply selected objects needing assignment; this example does not filter
# already-planned objects automatically.
set incremental_objects {
{net data_down top_to_bottom}
{net data_up bottom_to_top}
{pin u_load/A top_to_bottom}
}
# To use a three-column file instead, replace plan_objects below with:
# plan_objects_file ./objects_incremental.txt
# The file contains: type name direction (one object per line).
set incremental_sets [list [dict create \
name incremental_set \
plan_objects $incremental_objects \
layer {T3M1 T3M2} \
start_x 10 offset -2.5 \
ratio_period 10 ratio_reserved 2 \
force_gap_every 4 gap_tracks 1]]
file mkdir ./out_incremental
set incremental_plan [plan_nets \
-bbox {0 1000 500 1100} \
-sets $incremental_sets \
-flow_mode incremental -mode nearest \
-shield_mode strict -fallback off \
-lib_cell YOUR_BUFFER_LIB_CELL -row_height 0.2 \
-cell_down_offset 0 -cell_up_offset 0 \
-row_pitch 2 -row_reset per_x \
-buffer_marker_size {1 1} \
-out_file ./out_incremental/assignments.txt \
-tcl_file ./out_incremental/implement.tcl \
-debug 4]
puts "Report: [dict get $incremental_plan file]"
puts "Log: [dict get $incremental_plan log_file]"
puts "Tcl: [dict get $incremental_plan tcl_file]"
if {[llength [dict get $incremental_plan failures]]} {
error "Some objects could not be assigned. Inspect the plan failures before executing."
}
# STEP 2: run these interactively to preview the generated operations:
# set ::UCS_TSV_DRYRUN 1
# source ./out_incremental/implement.tcl
# puts $::UCS_TSV_FAILED
#
# STEP 3: after checking the preview, run these to change the current design:
# set ::UCS_TSV_DRYRUN 0
# source ./out_incremental/implement.tcl
# puts $::UCS_TSV_FAILED
#
# Width and track pitch derive separately from each layer.
# No routing is excluded by default; add -ignore_nets / -ignore_nets_file
# only for routing shapes that should not count as blockers.实际运行:先 source 示例完成生成,再按其中 STEP 2 执行 dry-run;检查失败列表为空、日志中 far/near loads 正确、marker 位置合理,然后执行 STEP 3。默认保留现有 routing,因此现有 routing 会参与占用检查;不要把 ignore 当成删除命令。
04 · 完整场景:replan assign
适用:用户明确指定 net/pin/port 和方向,希望在指定对象上直接插入。replan 不从当前 loads 分布作跨区判断,也不依赖普通未放置 cell 的 driver X;示例采用 sequential。显式固定 port/macro pin 仍优先靠近其自身 X。
# Source from the package directory in an FC design session.
# Replace all object names, layers, bbox, lib_cell and row_height first.
# Generating the plan does not execute connectivity/placement edits.
source ./ucs_tsv_plan_proc.tcl
# Ordinary cells may be unplaced. Direction is explicitly supplied.
# No fanout/side check: insert directly on the requested net/pin/port.
# PORT DATA_OUT is fixed; plan nearest its actual port X before ordinary nets.
# This mode does not delete old guide buffers from previous implementations.
set replan_objects {
{net data_down top_to_bottom}
{pin u_hier/data_in top_to_bottom}
{port DATA_OUT bottom_to_top}
}
# To use a three-column file instead, replace plan_objects below with:
# plan_objects_file ./objects_replan.txt
# The file contains: type name direction (one object per line).
set replan_sets [list [dict create \
name replan_set \
plan_objects $replan_objects \
layer {T3M1 T3M2} \
start_x 10 offset -2.5 \
ratio_period 10 ratio_reserved 2 \
force_gap_every 4 gap_tracks 1]]
file mkdir ./out_replan
set replan_plan [plan_nets \
-bbox {0 1000 500 1100} \
-sets $replan_sets \
-flow_mode replan -mode sequential \
-shield_mode strict -fallback off \
-lib_cell YOUR_BUFFER_LIB_CELL -row_height 0.2 \
-cell_down_offset 0 -cell_up_offset 0 \
-row_pitch 2 -row_reset per_x \
-buffer_marker_size {1 1} \
-out_file ./out_replan/assignments.txt \
-tcl_file ./out_replan/implement.tcl \
-debug 4]
puts "Report: [dict get $replan_plan file]"
puts "Log: [dict get $replan_plan log_file]"
puts "Tcl: [dict get $replan_plan tcl_file]"
if {[llength [dict get $replan_plan failures]]} {
error "Some objects could not be assigned. Inspect the plan failures before executing."
}
# STEP 2: run these interactively to preview the generated operations:
# set ::UCS_TSV_DRYRUN 1
# source ./out_replan/implement.tcl
# puts $::UCS_TSV_FAILED
#
# STEP 3: after checking the preview, run these to change the current design:
# set ::UCS_TSV_DRYRUN 0
# source ./out_replan/implement.tcl
# puts $::UCS_TSV_FAILED
#
# Width and track pitch derive separately from each layer.
# No routing is excluded by default; add -ignore_nets / -ignore_nets_file
# only for routing shapes that should not count as blockers.replan 不等于清理旧实现。它不会自动删除上次插入的 buffer。不要在同一已修改设计上重复 source 同一实现脚本来当作“刷新”;已有 guide cell 名称会被检查。若要重做,应使用明确选定的设计基线或单独处理旧实现。
05 · 分步使用:extract → check → assign
以下演示从设计提取 crossing nets,再在指定层上筛掉已经满足 planned 条件的 nets,保留提取时得到的 direction。每个 proc 可单独运行;不需要依赖其他 proc 的全局结果。
set BBOX {0 1000 500 1100}
set cross [extract_cross_nets -region_bbox $BBOX -search_height 200 \
-check_mode pre_route -plan_objects_file ./cross_objects.txt -debug 4]
# cross 是 list of dict,不是包含 file/names 的 dict。
set candidates {}
foreach record $cross {
set clk [check_net_clock -net [dict get $record net] -debug 0]
if {![dict get $clk clock]} {lappend candidates [dict get $record net]}
}
set layer T3M1
set width [get_attribute [get_layers $layer] min_width]
set unplan [extract_unplan_nets -nets $candidates -bbox $BBOX \
-layer $layer -width $width -lower_y 1002.5 -upper_y 1097.5 \
-shield_mode strict -out_file ./unplanned.txt -debug 4]
set selected {}
foreach record $cross {
if {[dict get $record net] in [dict get $unplan unplanned]} {
lappend selected $record
}
}
# selected 可直接交给 plan_nets -plan_objects $selected
# 注意:这里的 planned 筛选只针对 T3M1;若允许多个已规划层,
# 应逐层 check_net_planned,并按你的“任一层合格即保留”规则合并判断。pre_route/post_route 是 crossing 检查的模式;incremental/replan 是插入语义;sequential/nearest 是 track 选择策略。三者不要混为同一个开关。
06 · 多 set、多 layer 和 reserve
一个 set 是一个 dict,至少给 name 及 plan_objects 或 plan_objects_file。set 参数覆盖公共参数。track 资源用 {layer x} 区分:相同 X 在不同 layer 是不同 routing 资源;物理 buffer 的 Y 累计则跨 layer 共用相同 X 的计数。
set sets [list \
[dict create name data layer {T3M1 T3M2} start_x 10 offset -2.5 \
plan_objects {{net n_data top_to_bottom}} \
ratio_period 10 ratio_reserved 2 force_gap_every 4 gap_tracks 1] \
[dict create name control layer {T3M2 T3M3} start_x 100 offset -2 \
plan_objects_file ./control_objects.txt inter_set_gap 2]]
set plan [plan_nets -bbox {0 1000 500 1100} -sets $sets \
-flow_mode incremental -mode sequential -shield_mode strict -fallback off \
-lib_cell YOUR_BUFFER_LIB_CELL -row_height 0.2 \
-buffer_marker_size {1 1} -tcl_file ./implement_sets.tcl -debug 4]| 参数 | 实际含义 |
|---|---|
| layer | 一次给 list,先检查各层 availability,再合成全局 X 排序池。相同 X 按传入 layer 顺序打破平局。 |
| shield_mode strict | signal 两边各一条同层 shield;允许复用已有 shield。 |
| shield_mode compact | 当前 allocator 使用左侧相邻 shield;check_net_planned 的 compact 判定允许任一侧。 |
| shield_mode none | 无 shield;guard 由 guard_tracks 单独控制。 |
| fallback none / off | none 允许降级成不带 shield/guard;off 不允许降级,找不到就记 failure。none 不是“禁止 fallback”。 |
| ratio_period / ratio_reserved | sequential:累计消费达到 period 后保留 reserved 根;nearest:按全局 pool 的位置周期预留。 |
| force_gap_every / gap_tracks | sequential 每分配 N 个对象后留 gap_tracks 根;包括被优先分配的固定端点。nearest 不采用这种按序 gap 规则。 |
| inter_set_gap | typed 后续 set 从它的 starting cursor 起保留指定数量的可用 pooled resources。 |
| special_ranges | 带 name、x_range、可选 guard_tracks 的 dict list。该范围与两侧 guard 不参与 signal 分配。 |
| guard_tracks | 在 bundle 外侧保护 track;不能用别的 routing layer 的 track 来代替本层 shield/guard。 |
set ranges [list [dict create name keep_clock_channel \
x_range {120 150} guard_tracks 2]]
check_track_occupancy -bbox {0 1000 500 1100} -layer {T3M1 T3M2} \
-special_ranges $ranges -ignore_nets {ignored_route_net} -debug 4ignore_nets 与 ignore_nets_file 合并,只排除相应 nets 的 global_route/detail_route/user_route routing shapes。pin、via、TSV cell 自身 blocker/guard 仍参与检查。free_nets 是同类排除接口;typed 默认不隐式 free 自己,旧 net-list planner 默认把本轮 nets 的 routing 视作将被清理。
07 · Y 累计与 error browser
默认 row_reset per_x:相同数值 X 连续累计;新 X 从零开始;再次遇到旧 X 沿用旧累计。10、10.0、10e0 归为同一组。row_reset none 则全局累计,不在新 X 重置。
# 第一个对象的附加偏移为 0。
# 下一对 buffer 的附加偏移 = 上一对偏移 + 上一对 row_pitch * row_height。
down_y = bbox_y1 - cell_down_offset - y_extra
up_y = bbox_y2 + cell_up_offset + y_extra
# 与 create_shape 一致,width = 该 layer 实际使用的线宽:
x_left = signal_or_shield_x - width/2
x_right = signal_or_shield_x + width/2
y_low = bbox_y1 - offset - width/2
y_high = bbox_y2 + offset + width/2| Error type(以 T3M1 为例) | 内容 |
|---|---|
| T3M1_PLAN_SIGNAL / PLAN_SHIELD | signal/shield track 的占用 envelope,Y 范围为区域 bbox;不是实际线宽轮廓。 |
| T3M1_PLAN_RATIO_RESERVED / PLAN_SPECIAL_RESERVED | ratio / special 预留。 |
| T3M1_PLAN_FORCED_GAP / PLAN_INTER_SET_GAP | 对象间周期 gap / set 间 gap。 |
| T3M1_PLAN_GUARD / PLAN_SPECIAL_GUARD / PLAN_BLOCKED_* / PLAN_FREE | 保护、特殊范围保护、阻挡及可用 tracks。 |
| T3M1_SIGNAL_SHAPE / T3M1_SHIELD_SHAPE | 精确 create_shape 边界,包含线宽和端部半线宽。 |
| T3M1_BUFFER_UPPER / T3M1_BUFFER_LOWER | 有尺寸的矩形,中心是计划 set_cell_location 坐标;不是 cell 的物理 bbox。 |
plan_nets -bbox $BBOX -plan_objects $objects -layer {T3M1 T3M2} \
-flow_mode replan -row_height 0.2 -buffer_marker_size {1 1} -debug 4
# 没有 -tcl_file 也会画 marker。
# 缺少 row_height 时只能画精确 routing shape,不能计算 buffer Y marker。上述最终计划与几何 marker 放在同一份 UCS_TSV_PLAN.err 中,按 layer/type 分开。独立 occupancy 检查另外生成 UCS_TSV_TRACKS_<layer>.err。debug 0 不画 marker。同 X 跨层 buffer 累计同样体现在矩形位置中;这些是计划坐标,不是 legalization 后的实测位置。
08 · debug、日志和结果检查
| 级别 | 用途 |
|---|---|
| 0 | 关闭常规 debug 表格/marker;ERROR/WARN 仍可能输出。 |
| 1 | 屏幕摘要、当前接口的报告表,以及可用的 error marker。 |
| 2 | 打开日志,记录阶段信息、typed 对象结果和生成脚本的 Y 坐标表。 |
| 3 | 更多 pin/shape/判定细节;具体内容由 proc 决定。 |
| 4 | 逐 track occupancy、最终 track 用途、详细查询和完整调试信息。 |
typed plan_nets 返回 log_file;默认日志位于当前工作目录,文件名带时间、PID 和序号,避免同秒覆盖。不是所有旧 proc 都把路径放入返回 dict:它们通常在屏幕输出 log: …。日志是显式 ucs_log 记录,不是整个 FC 控制台的自动重定向。
set plan [plan_nets -bbox $BBOX -plan_objects $objects \
-layer {T3M1 T3M2} -flow_mode incremental -mode nearest -debug 4]
puts [dict get $plan log_file]
puts [dict get $plan placed]
puts [dict get $plan failures]
foreach a [dict get $plan assignments] {
puts "[dict get $a object_name]: [dict get $a insertion_method]"
puts "opposite loads: [dict get $a far_loads]"
puts "remaining loads: [dict get $a near_loads]"
}最终 track 表列为 layer / track_x / state / set / objects / detail。shared shield 会列出关联对象;special reserve 显示名称。所有人读数值最多四位小数,整数直接显示;用于计算、返回数值以及生成的可执行坐标保留所需精度。
09 · JSON 批处理入口
typed JSON 在 region 下设置 bbox 和 plan_sets。默认值放 default,set 覆盖公共值。下面可直接保存为 config.json;把示例名字换成真实设计对象。
{
"default": {
"flow_mode": "replan",
"mode": "sequential",
"layer": ["T3M1", "T3M2"],
"shield_mode": "none",
"lib_cell": "YOUR_BUFFER_LIB_CELL",
"row_height": 0.2,
"offset": -2.5
},
"regions": {
"region_1": {
"bbox": [0, 1000, 500, 1100],
"plan_sets": [
{
"name": "data",
"start_x": 10,
"plan_objects": [
["net", "data_bus[0]", "top_to_bottom"],
["pin", "u_macro/D", "bottom_to_top"]
]
},
{
"name": "ports",
"offset": -2,
"plan_objects": [["port", "DATA_IN", "top_to_bottom"]]
}
]
}
}
}source ./ucs_tsv_plan.tcl
set result [ucs_tsv_plan -config ./config.json -out_dir ./out_json \
-debug 4 -keep_going 0]
puts [dict get $result errors]
foreach entry [dict get $result regions] {
set plan [dict get $entry plan]
puts "[dict get $entry region]: [dict get $plan tcl_file]"
}typed JSON 返回 regions 与 errors。相对 plan_objects_file、ignore_nets_file、free_nets_file 路径相对于 JSON 文件目录。typed 入口直接调用 plan_nets,不执行旧式 automatic extract/unplanned/better-plan comparison。-stop_after 和 -modes 属于旧 batch 工作流,不应用它们控制 typed 工作流;需要分步调试时直接调用各 proc。
10 · Proc 使用手册
19 个注册接口都有完整参数表。表中“必填”来自当前 define_proc_attributes;某些互斥/条件必填要求由实现检查,须结合每节正文。ucs_log 和 ucs_plan_better 为位置参数接口,单列在后。
| Proc | 用途 |
|---|---|
parse_json | 读取 JSON,不执行设计查询 |
derive_plan_geometry | 根据配置、region/set 与技术层推导参数 |
extract_region | 由 TSV cells 提取合并区域 |
check_net_clock | 仅用 net_type 判断是否是 clock |
check_net_cross | 检查一根 net 是否跨越 bbox |
extract_cross_nets | 批量提取跨区 nets,并生成方向 |
check_net_planned | 用显式上下边界检查已有 signal 与 shield |
extract_unplan_nets | 从 net 列表保留未满足 planned 的 nets |
check_track_occupancy | 检查一层或多层所有 tracks 的阻挡 |
parse_plan_objects | 读取并校验 type/name/direction |
resolve_plan_object | 单个对象解析与 incremental 对面 loads 判断 |
plan_nets | 统一的 track assign 与 typed 实现文件生成 |
evaluate_plan | 只评估现成计划,不查询设计 |
remove_plan_routing | 显式清除选定 nets 的 routing |
write_plan_tcl | 旧 net-list 路径的独立 Tcl emitter |
ucs_net_list | 把 inline net 名或文件转为 net 名列表 |
ucs_error_mark | 将 polygon 列表写入 error data |
ucs_tsv_plan | JSON 全流程入口 |
parse_json
读取 JSON,不执行设计查询。逐字符解析 JSON;object 转为 dict,array 转为 list。读取结果不等于几何推导;该 proc 不自动选择 layer,也不返回 file/status 包装层。
set cfg [parse_json -json_file ./config.json -debug 4]
puts [dict get $cfg default]
puts [dict keys [dict get $cfg regions]]返回值与读取方式
| 字段/结构 | 含义 |
|---|---|
| 返回值 | 整个 JSON 解析结果;例如 dict get $cfg default / regions。 |
debug 1 展示叶子路径和值;debug 2 以上记录读取/解析日志。需要访问具体字段时使用 dict get / lindex,不要把结果当成文件名。
完整参数表 · 2 项
| 参数 | 要求 | 类型 | 说明(附源码声明) |
|---|---|---|---|
-json_file | 必填 | string | the JSON file to read |
-debug | 可选 | int | 调试级别,推荐独立定位问题时显式给 4。0 silent, 1 every key: value, 4 tokens |
derive_plan_geometry
根据配置、region/set 与技术层推导参数。给 -json_file 时内部调用 parse_json。覆盖优先级以显式参数为最高,再查当前 set、region 和公共配置;具体配置 key 由内置 spec 映射。读取 layer 的 min_width/pitch、site row height 等信息,并保留数值来源。
set g [derive_plan_geometry -json_file ./incremental_assign.json \
-region region_1 -layer T3M1 -region_bbox {0 1000 500 1100} -debug 4]
puts [dict get $g route_width]
puts [dict get $g row_height]
puts [dict get $g special_ranges]返回值与读取方式
| 字段/结构 | 含义 |
|---|---|
| route_width / row_height | 实际推导的线宽、行高。 |
| shape_offset / cell_down_offset / cell_up_offset | shape 与 buffer 的偏移设置。 |
| regions / plan_sets / set_names / set_spec | 当前配置作用域和 set 信息。 |
| special_ranges / signal_tsv_refs / pg_tsv_refs | 预留范围与 TSV reference 配置。 |
| 其他字段 | 返回 dict keys 可查看完整的配置映射和推导结果;不直接更改设计。 |
用于配置归一化;独立 check proc 接收显式数值,不需要预先把结果存入全局变量。不要把 derive 的 region_merge_up 等字段误作 buffer offset。
完整参数表 · 37 项
| 参数 | 要求 | 类型 | 说明(附源码声明) |
|---|---|---|---|
-json_file | 可选 | string | the config to read |
-region_bbox | 可选 | string | the region, as {x1 y1 x2 y2} |
-row_height | 可选 | float | site row height;单位与设计一致。site row height; read from the design if omitted |
-cell_down_offset | 可选 | float | how far below the region row 0 sits |
-cell_up_offset | 可选 | float | how far above the region row 0 sits |
-shape_offset | 可选 | float | how far the shape runs past the region |
-shield_down_offset | 可选 | float | the same for the shields, below |
-shield_up_offset | 可选 | float | the same for the shields, above |
-region_merge_up | 可选 | float | grow for the TSV region merge |
-region_merge_down | 可选 | float | shrink for the TSV region merge |
-pg_tsv_guard | 可选 | float | x guardband around a PG TSV |
-search_multiplier | 可选 | float | search height, in region heights |
-fallback_distance | 可选 | float | relax to none when the bundle only fits further than this from the driver |
-tolerance | 可选 | float | geometry tolerance for the planned check |
-skip_clock_nets | 可选 | string | 0 keeps clock nets in the demand list |
-allow_compact_fallback | 可选 | string | 1 places a net unshielded rather than failing it |
-route_width | 可选 | float | the routing width; from the layer if omitted |
-layer | 可选 | string | 目标 routing layer;是否支持 list 见该 proc 说明。the routing layer, to read its min_width |
-ratio_period | 可选 | int | reserve after this many tracks |
-ratio_reserved | 可选 | int | how many to hold back each period |
-gap_tracks | 可选 | int | tracks a forced gap takes |
-force_gap_every | 可选 | int | insert a gap after this many nets |
-inter_set_gap | 可选 | int | gap between plan sets |
-guard_tracks | 可选 | int | tracks held clear each side of a bundle |
-special_guard_tracks | 可选 | int | special range 未自行设置 guard_tracks 时的默认保护数。default guard each side of a special range |
-region | 可选 | string | the region to read region-specific values from |
-set | 可选 | string | the plan set within that region; its values win |
-shield_net | 可选 | string | shield 所属 net,默认 VSS。which net the shields belong to |
-lib_cell | 可选 | string | 用于插入 guide buffer 的 lib cell。the guide buffer master |
-shield_mode | 可选 | string | strict / compact / none。strict, compact or none |
-cross_net_mode | 可选 | string | pre_route or post_route |
-mode | 可选 | string | track 选择策略;typed / 多层支持 sequential / nearest。sequential, nearest or global_balance |
-layers | 可选 | string | the layers the plan may use |
-generate_modes | 可选 | string | shield modes to generate a plan for |
-pg_tsv_refs | 可选 | string | ref_names of the power/ground TSVs |
-signal_tsv_refs | 可选 | string | ref_names of the signal TSVs |
-debug | 可选 | int | 调试级别,推荐独立定位问题时显式给 4。0 silent, 1 the table, 3 the missing keys |
extract_region
由 TSV cells 提取合并区域。signal_tsv_patterns 与 pg_tsv_patterns 可分别给 list,组合成 ref_name =~ pattern 的 OR filter 获取 cells,并去重。按 size_value 对区域进行几何合并,返回区域列表。
set regions [extract_region \
-signal_tsv_patterns {TSV_SIG_* TSV_SIGNAL_*} \
-pg_tsv_patterns {TSV_PG_*} -size_value 5 -debug 4]
foreach r $regions {puts "[dict get $r name]: [dict get $r bbox]"}返回值与读取方式
| 字段/结构 | 含义 |
|---|---|
| 返回值 | list of region dicts,至少用 name、bbox 访问;不是单个 region dict。 |
| bbox | {x1 y1 x2 y2}。 |
旧 -tsv_pattern 仍可用。表格各列 name/TSVs/x1/y1/x2/y2/width/height 对齐;debug marker 表示合并区域。请按 name 查找区域,不要假定列表下标永远对应固定 region。
完整参数表 · 5 项
| 参数 | 要求 | 类型 | 说明(附源码声明) |
|---|---|---|---|
-tsv_pattern | 可选 | string | ref_name glob for the TSV cells |
-signal_tsv_patterns | 可选 | string | signal TSV ref_name glob list |
-pg_tsv_patterns | 可选 | string | PG TSV ref_name glob list |
-size_value | 必填 | float | grow/shrink for the merge, in microns |
-debug | 可选 | int | 调试级别,推荐独立定位问题时显式给 4。0 silent, 1 the table and DRC markers, 3 each TSV |
check_net_clock
仅用 net_type 判断是否是 clock。解析 net 后检查 net_type 是否为 clock。当前不使用 related_clock 或 clock 对象关联作为替代判据。
set r [check_net_clock -net data_bus -debug 2]
if {[dict get $r clock]} {puts "skip clock net"}
puts [dict get $r reason]返回值与读取方式
| 字段/结构 | 含义 |
|---|---|
| clock | 1/0,是否 clock net。 |
| net / reason | 输入及判定说明;无法解析不是“正常非 clock”的充分证据,需检查 reason。 |
debug 默认 1。用于 extract 后显式过滤 clock;typed 示例不会自动替你过滤 clock。
完整参数表 · 2 项
| 参数 | 要求 | 类型 | 说明(附源码声明) |
|---|---|---|---|
-net | 必填 | string | the net to test |
-debug | 可选 | int | 调试级别,推荐独立定位问题时显式给 4。0 silent, 1 the gates, 2 why each said no |
check_net_cross
检查一根 net 是否跨越 bbox。先 get_nets,再将得到的 collection 交给 get_flat_nets。pre_route 要求上下两侧各至少一个 cell 中心 X 落在 [x1,x2] 内;中心 Y 在区域内不计为上下两侧。post_route 要求满足跨越 Y 的 routing shape,其中心 X 也在 X 范围内。
set r [check_net_cross -net data_bus -region_box {0 1000 500 1100} \
-check_mode pre_route -debug 4]
puts [dict get $r cross]
puts [dict get $r reason]
# 对已有 routing 再运行 post_route:
set routed [check_net_cross -net data_bus -region_box {0 1000 500 1100} \
-check_mode post_route -debug 4]返回值与读取方式
| 字段/结构 | 含义 |
|---|---|
| cross / reason | 1/0 与失败原因。 |
| driver_pin / driver_side / driver_x / driver_y | driver 信息;有效性取决于已通过的检查阶段。 |
| above / below / inside | cell 中心分侧计数。 |
| above_in_x / below_in_x | 上下侧且 X 在区域内的计数。 |
| pins | 每行 {pin centre_y side direction centre_x in_x}。 |
| far_pins / far_side | 对面连接信息。 |
注意参数拼写是 -region_box;extract_cross_nets 用的是 -region_bbox。常见原因包括 NET_NOT_UNIQUE、NO_PINS、NOT_BOTH_SIDES、NOT_BOTH_SIDES_IN_X。早期失败时应先查看 dict keys,再读取后续阶段字段。
完整参数表 · 4 项
| 参数 | 要求 | 类型 | 说明(附源码声明) |
|---|---|---|---|
-region_box | 必填 | string | the region to cross, as {x1 y1 x2 y2} |
-net | 必填 | string | the net to check |
-check_mode | 可选 | string | pre_route asks the connectivity, post_route the routing |
-debug | 可选 | int | 调试级别,推荐独立定位问题时显式给 4。0 silent, 1 the gates, 3 every pin, 4 every query |
extract_cross_nets
批量提取跨区 nets,并生成方向。根据邻近 cells 和覆盖区域的 shapes 收集候选,逐个调用 check_net_cross,避免批量和单 net 判定逻辑分叉。按 driver X 排序;driver 上侧映射 top_to_bottom,下侧映射 bottom_to_top。
set cross [extract_cross_nets -region_bbox {0 1000 500 1100} \
-search_height 200 -check_mode pre_route \
-out_file ./cross_nets.txt -plan_objects_file ./cross_objects.txt -debug 4]
foreach r $cross {
puts "[dict get $r type] [dict get $r name] [dict get $r direction]"
}返回值与读取方式
| 字段/结构 | 含义 |
|---|---|
| 返回值 | list of dict;不是 dict get $cross file。 |
| net / type / name / direction | 可直接作为 typed plan_objects 的每条记录。 |
| source / driver_pin / driver_x / driver_y | 候选来源和排序坐标。 |
| driver_side / far_side / far_pins / above / below | cross 检查信息;extractor 对侧别使用 upper/lower 命名。 |
| -out_file / -plan_objects_file | 分别写纯 net 名列表/三列 typed 对象文件;路径由调用者给定。 |
只负责 crossing 提取,不保证“未计划”、不是 clock 或具备足够 track。后续应按任务需要继续 check/filter。
完整参数表 · 6 项
| 参数 | 要求 | 类型 | 说明(附源码声明) |
|---|---|---|---|
-region_bbox | 必填 | string | the region, as {x1 y1 x2 y2} |
-search_height | 必填 | float | how far above/below to look for cells |
-check_mode | 可选 | string | pre_route connectivity or post_route shapes |
-debug | 可选 | int | 调试级别,推荐独立定位问题时显式给 4。0 silent, 1 the table, 3 every pin |
-plan_objects_file | 可选 | string | 输出三列 type/name/direction 对象文件。also write type/name/direction rows |
-out_file | 可选 | string | 人读报告或列表输出文件,具体格式见返回值。sorted net list; "" to skip writing |
check_net_planned
用显式上下边界检查已有 signal 与 shield。检查指定 layer 上的 signal shape 宽度、X 与覆盖范围,再检查邻近 shield。lower_y、upper_y 是直接数值,不依赖 offset。strict 两侧 shield,compact 至少一侧,none 不要求 shield。
set r [check_net_planned -net data_bus -bbox {0 1000 500 1100} \
-layer T3M1 -lower_y 1002.5 -upper_y 1097.5 \
-shield_mode strict -shield_net VSS -debug 4]
puts [dict get $r planned]
puts [dict get $r reason]返回值与读取方式
| 字段/结构 | 含义 |
|---|---|
| planned / reason | 是否满足已 planned 条件及原因。 |
| signal | 选中的 signal shape 信息。 |
| shields | left/right 侧候选。 |
| near_misses | 接近但不满足距离/net 条件的 shield 信息。 |
| want_lo / want_hi / lower_y / upper_y | 本次实际检查的边界。 |
单层检查;多层“任一层合格”应由调用方循环合并。width/pitch 未传时由该 layer 推导。-tracks 在这里是 shield 允许距离的 track 数,不是显式 X 列表。
完整参数表 · 12 项
| 参数 | 要求 | 类型 | 说明(附源码声明) |
|---|---|---|---|
-net | 必填 | string | the net to check |
-bbox | 必填 | string | 平坦区域坐标 {x1 y1 x2 y2}。the window, as {x1 y1 x2 y2} |
-layer | 必填 | string | 目标 routing layer;是否支持 list 见该 proc 说明。the routing layer |
-width | 可选 | float | 显式线宽;是否必填以本表为准。the minimum shape width; wider still counts |
-lower_y | 必填 | float | 直接给 signal 中心线需要达到的下边界。required centreline lower Y boundary |
-upper_y | 必填 | float | 直接给 signal 中心线需要达到的上边界。required centreline upper Y boundary |
-shield_mode | 必填 | string | strict / compact / none。strict, compact or none |
-debug | 可选 | int | 调试级别,推荐独立定位问题时显式给 4。0 silent, 1 the gates, 3 every shape |
-shield_net | 可选 | string | shield 所属 net,默认 VSS。which net counts as a shield, default VSS; "" for any |
-tracks | 可选 | int | how many tracks away a shield may be, default 1 |
-pitch | 可选 | float | 显式 track pitch;不传时按对应层推导。track pitch; derived from layer if omitted |
-tolerance | 可选 | float | geometry tolerance, default 0.001 |
extract_unplan_nets
从 net 列表保留未满足 planned 的 nets。逐个调用 check_net_planned。可先执行 crossing 检查(check_cross),再把 planned/unplanned/not_cross 分开。显式边界需成对传入;旧 offset 仍可由调用方换算边界。
set r [extract_unplan_nets -nets {n1 n2} -bbox {0 1000 500 1100} \
-layer T3M1 -width 0.04 -lower_y 1002.5 -upper_y 1097.5 \
-shield_mode strict -out_file ./unplanned.txt -debug 4]
puts [dict get $r unplanned]
puts [dict get $r file]返回值与读取方式
| 字段/结构 | 含义 |
|---|---|
| unplanned / planned / not_cross | 各类 net 名列表。 |
| rows | 每 net 的 verdict / reason。 |
| file | 实际写出的 unplanned 文件路径。 |
这个包装 proc 当前仍要求 -width,和 check_net_planned 的可选 -width 不同。-layer 是单层;输入是 net 名列表或 net_file,不接受三列 object 文件。
完整参数表 · 16 项
| 参数 | 要求 | 类型 | 说明(附源码声明) |
|---|---|---|---|
-bbox | 必填 | string | 平坦区域坐标 {x1 y1 x2 y2}。the window, as {x1 y1 x2 y2} |
-layer | 必填 | string | 目标 routing layer;是否支持 list 见该 proc 说明。the routing layer |
-width | 必填 | float | 显式线宽;是否必填以本表为准。the expected shape width |
-lower_y | 可选 | float | 直接给 signal 中心线需要达到的下边界。required centreline lower Y boundary |
-upper_y | 可选 | float | 直接给 signal 中心线需要达到的上边界。required centreline upper Y boundary |
-offset | 可选 | float | typed shape 的 Y 延伸量;负值向区域内收缩。legacy fallback when explicit boundaries are absent |
-shield_mode | 必填 | string | strict / compact / none。strict, compact or none |
-nets | 可选 | string | 纯 net 名列表;不能放 type/name/direction 三列。net names to check |
-net_file | 可选 | string | 纯 net 名文件。file of net names, one per line |
-check_cross | 可选 | int | 1 to confirm each net crosses the bbox first |
-out_file | 可选 | string | 人读报告或列表输出文件,具体格式见返回值。unplanned list; "" to skip writing |
-debug | 可选 | int | 调试级别,推荐独立定位问题时显式给 4。0 silent, 1 the table, 3 the inner gates |
-shield_net | 可选 | string | shield 所属 net,默认 VSS。which net counts as a shield, default VSS |
-tracks | 可选 | int | how many tracks away a shield may be, default 1 |
-pitch | 可选 | float | 显式 track pitch;不传时按对应层推导。track pitch; derived from layer if omitted |
-tolerance | 可选 | float | geometry tolerance, default 0.001 |
check_track_occupancy
检查一层或多层所有 tracks 的阻挡。从 layer 推导 tracks 或使用显式 X 列表,以 width/2+spacing 的半 envelope 检查 routing、pin/via、TSV cell 与 guard,再应用 special reserve。输入多层一次处理,返回 by_layer。
set occ [check_track_occupancy -bbox {0 1000 500 1100} \
-layer {T3M1 T3M2} -ignore_nets {test_route} \
-ignore_nets_file ./ignored_nets.txt \
-signal_tsv_pattern TSV_SIG_* -pg_tsv_pattern TSV_PG_* \
-pg_tsv_guard 0.2 -debug 4]
foreach layer [dict get $occ layers] {
puts "$layer available=[dict get $occ by_layer $layer available]"
}返回值与读取方式
| 字段/结构 | 含义 |
|---|---|
| 单层 tracks | 每行 {x status blocker_name blocker_kind bbox}。 |
| 单层 available / occupied | 可用/不可用 track 数;special reserve 也计为不可用。 |
| 单层 width / spacing / envelope / guards / special / special_guard | 几何和保护信息。 |
| 多层 layers / by_layer | by_layer 的值是单层结果。 |
| 多层 available / occupied | 各层合计数量。 |
不把结果写成每根 track 的 user_attribute。debug 4 的 occupancy 表是分配之前的状态;plan_nets 的 final track 表是分配之后的用途。-tracks 在这里是 X 值列表。
完整参数表 · 18 项
| 参数 | 要求 | 类型 | 说明(附源码声明) |
|---|---|---|---|
-bbox | 必填 | string | 平坦区域坐标 {x1 y1 x2 y2}。the window, as {x1 y1 x2 y2} |
-layer | 必填 | string | 目标 routing layer;是否支持 list 见该 proc 说明。one routing layer or a Tcl list of layers |
-tracks | 可选 | string | explicit track x positions; else derived from the pitch |
-pitch | 可选 | float | 显式 track pitch;不传时按对应层推导。track pitch; derived from layer if omitted |
-origin | 可选 | float | track origin for the derived positions, default 0 |
-width | 可选 | float | 显式线宽;是否必填以本表为准。wire width; taken from the layer if omitted |
-spacing | 可选 | float | spacing rule; taken from the layer if omitted |
-ignore_nets | 可选 | string | 仅排除指定 nets 的 routing shapes,不删除设计对象。nets whose routing shapes do not block |
-ignore_nets_file | 可选 | string | 与 ignore_nets 合并;typed JSON 中相对路径基于配置目录。routing exclusions, one net per line |
-free_nets | 可选 | string | nets about to be ripped up; their routing does not block |
-free_nets_file | 可选 | string | the same, read from a file |
-pg_tsv_pattern | 可选 | string | ref_name glob for power/ground TSVs |
-pg_tsv_guard | 可选 | float | x guardband around a PG TSV |
-signal_tsv_pattern | 可选 | string | ref_name glob for signal TSVs |
-signal_tsv_guard | 可选 | float | x guardband around a signal TSV |
-special_ranges | 可选 | string | named range dict list,如 {name keep x_range {100 120} guard_tracks 2}。x ranges to keep free, each {name .. x_range {..} guard_tracks n} |
-special_guard_tracks | 可选 | int | special range 未自行设置 guard_tracks 时的默认保护数。default guard each side of a special range |
-debug | 可选 | int | 调试级别,推荐独立定位问题时显式给 4。0 silent, 1 summary, 3 shapes, 4 every track |
parse_plan_objects
读取并校验 type/name/direction。支持 inline triples、extract 返回的带 type/name/direction dict,或者三列文件。归一化为干净的三字段 dict;同 type/name 重复报错。只解析输入,不查询设计。
set rows [parse_plan_objects -plan_objects {
{net data_bus[0] top_to_bottom}
{pin u_hier/A bottom_to_top}
}]
# 或:set rows [parse_plan_objects -plan_objects_file ./objects.txt]
puts [dict get [lindex $rows 0] name]返回值与读取方式
| 字段/结构 | 含义 |
|---|---|
| 返回值 | list of {type … name … direction …} dicts。 |
没有 -debug 参数。exactly one source;非法 type、direction、重复记录或错误列数会报错。
完整参数表 · 2 项
| 参数 | 要求 | 类型 | 说明(附源码声明) |
|---|---|---|---|
-plan_objects | 可选 | string | 三列对象列表,或含 type/name/direction 的 dict list。rows of type name direction |
-plan_objects_file | 可选 | string | 三列对象文件,与 inline 输入互斥。file containing three-column rows |
resolve_plan_object
单个对象解析与 incremental 对面 loads 判断。解析准确对象,取得所属 flat net。识别 pin/port 角色及固定宏端点。replan 和显式 load 直接返回,不扫描其他 fanout;incremental net/driver 检查 driver 和 loads 的位置并给出插入策略。
set record [lindex [parse_plan_objects -plan_objects {
{net data_bus top_to_bottom}
}] 0]
set r [resolve_plan_object -object $record -flow_mode incremental \
-bbox {0 1000 500 1100}]
puts [dict get $r insertion_method]
puts [dict get $r insertion_name]
puts [dict get $r far_loads]
puts [dict get $r near_loads]返回值与读取方式
| 字段/结构 | 含义 |
|---|---|
| object_type / object_name / net | 原始对象及解析 flat net。 |
| role / fixed / anchor_x / driver_x | net/driver/load 角色,固定端点标识与 X。 |
| far_loads / near_loads | typed endpoint 列表,如 {{pin u1/A} {port OUT}};near 包含同侧和区域内部/边界 loads。 |
| all_far | incremental net/driver 的所有 loads 是否均在对面。 |
| driver_type / driver_name | 仅执行了 driver/fanout 分析的路径返回。 |
| insertion_method | insert_buffer 或 create_cell_connect_pin。 |
| insertion_type / insertion_name | 直接插入的对象,或 partial reconnect 的来源 driver。 |
没有 -debug 参数,独立测试可 puts 返回字段。早期返回的 far/near 为空表示没有扫描,不表示电路真的没有 loads。上侧条件 y>upper,下侧 y完整参数表 · 3 项
参数 要求 类型 说明(附源码声明) -object必填 string type/name/direction dict -flow_mode必填 string incremental / replan;与 mode 独立。incremental or replan -bbox必填 string 平坦区域坐标 {x1 y1 x2 y2}。region bounds
plan_nets
统一的 track assign 与 typed 实现文件生成。先调用 occupancy;跨层候选按 X 合并。按 set 处理,保留已消费资源。显式 fixed pin/port 在本 set 内优先 nearest。分配 signal、同层 shield/guard,再应用 ratio/gap。typed 实现保留准确对象和 direction。
set p [plan_nets -bbox {0 1000 500 1100} \
-plan_objects {{net n_data top_to_bottom}} \
-layer {T3M1 T3M2} -flow_mode incremental -mode nearest \
-shield_mode strict -fallback off -lib_cell YOUR_BUFFER_LIB_CELL \
-row_height 0.2 -buffer_marker_size {1 1} \
-out_file ./assignments.txt -tcl_file ./implement.tcl -debug 4]
puts [dict get $p failures]
puts [dict get $p state]
puts [dict get $p log_file]返回值与读取方式
| 字段/结构 | 含义 |
|---|---|
| assignments / failures / placed | 成功对象 dict 列表、失败原因 dict 列表、成功数。 |
| assignment 字段 | object_type/name、net、direction、flow_mode、set、layer、signal_x、shield_xs、width、far/near loads、insertion_method/target 等。 |
| state | typed/多层为 layer → X → role;旧单层为 X → role。 |
| used_resources | typed/多层用 {layer x} 列表表示消费与预留资源。 |
| sets | typed 各 set 的嵌套 plan,内部 assignments 已保留真实对象信息。 |
| file / tcl_file / log_file | 报告、实现 Tcl、typed 自动日志路径;log_file 仅在本调用自动打开日志时提供。 |
typed 生成文件请使用此入口的 -tcl_file,不要把 typed assignments 直接交给旧 write_plan_tcl。-layer/-shield_mode 在注册表可选,是为了允许 set 内配置;实际分配仍需有效 layer。-object_metadata 和 -leading_gap 是内部参数,不应由业务调用设置。nearest 的非固定 replan net 若没有 anchor 会失败为 NO_DRIVER_X。
完整参数表 · 56 项
| 参数 | 要求 | 类型 | 说明(附源码声明) |
|---|---|---|---|
-occupancy | 可选 | string | prechecked snapshot: bbox and by_layer; caller must keep design and scan settings unchanged |
-buffer_marker_size | 可选 | string | {宽 高},正数;默认各为一个 row_height。buffer marker width and height; default one row each |
-leading_gap | 可选 | int | 内部参数,不建议直接使用。internal typed-set gap |
-bbox | 必填 | string | 平坦区域坐标 {x1 y1 x2 y2}。the region, as {x1 y1 x2 y2} |
-layer | 可选 | string | 目标 routing layer;是否支持 list 见该 proc 说明。one layer or a Tcl list of layers |
-shield_mode | 可选 | string | strict / compact / none。strict, compact or none |
-mode | 可选 | string | track 选择策略;typed / 多层支持 sequential / nearest。sequential from -start_x, or nearest to each driver |
-plan_objects | 可选 | string | 三列对象列表,或含 type/name/direction 的 dict list。typed rows: type name direction |
-plan_objects_file | 可选 | string | 三列对象文件,与 inline 输入互斥。three-column object file |
-flow_mode | 可选 | string | incremental / replan;与 mode 独立。replan or incremental; independent of track strategy |
-offset | 可选 | float | typed shape 的 Y 延伸量;负值向区域内收缩。set shape offset; applied outside check procs |
-object_metadata | 可选 | string | 内部参数,不建议直接使用。internal resolved object metadata |
-nets | 可选 | string | 纯 net 名列表;不能放 type/name/direction 三列。net names to plan, in order |
-net_file | 可选 | string | 纯 net 名文件。file of net names, one per line |
-start_x | 可选 | float | where to begin; default the first track |
-sets | 可选 | string | typed 为 dict list;旧式为 {name start_x nets_or_file} list。plan several sets: {name start_x nets_or_file} each |
-inter_set_gap | 可选 | int | tracks held back between one set and the next |
-guard_tracks | 可选 | int | tracks held clear each side of a bundle |
-fallback | 可选 | string | none 允许降级,off 禁止降级。none: place unshielded rather than fail; off: fail |
-fallback_distance | 可选 | float | fall back to a bare track when the bundle only fits further than this from the driver |
-ratio_period | 可选 | int | reserve after this many tracks are consumed |
-ratio_reserved | 可选 | int | how many to hold back each period |
-force_gap_every | 可选 | int | insert a gap after this many nets |
-gap_tracks | 可选 | int | how many tracks the forced gap takes |
-out_file | 可选 | string | 人读报告或列表输出文件,具体格式见返回值。assignment list; "" to skip writing |
-tracks | 可选 | string | explicit track x positions |
-pitch | 可选 | float | 显式 track pitch;不传时按对应层推导。track pitch; from the layer if omitted |
-origin | 可选 | float | track origin for derived positions |
-width | 可选 | float | 显式线宽;是否必填以本表为准。wire width; from the layer if omitted |
-spacing | 可选 | float | spacing; from the layer if omitted |
-ignore_nets | 可选 | string | 仅排除指定 nets 的 routing shapes,不删除设计对象。nets whose routing shapes do not block |
-ignore_nets_file | 可选 | string | 与 ignore_nets 合并;typed JSON 中相对路径基于配置目录。routing exclusions from file |
-reserved_resources | 可选 | string | 已经消费的 {layer x} 资源。prior resources as {layer x} pairs |
-free_nets | 可选 | string | nets to treat as already ripped up; default is the plan's own nets |
-free_nets_file | 可选 | string | the same, from a file |
-pg_tsv_pattern | 可选 | string | ref_name glob for power/ground TSVs |
-pg_tsv_guard | 可选 | float | x guardband around a PG TSV |
-signal_tsv_pattern | 可选 | string | ref_name glob for signal TSVs |
-signal_tsv_guard | 可选 | float | x guardband around a signal TSV |
-shield_net | 可选 | string | shield 所属 net,默认 VSS。which net the shields belong to, default VSS |
-tcl_file | 可选 | string | 生成实现 Tcl 的目标文件;不会自动执行。also write the implementation Tcl here |
-lib_cell | 可选 | string | 用于插入 guide buffer 的 lib cell。guide buffer master; needed with -tcl_file |
-row_height | 可选 | float | site row height;单位与设计一致。site row height, from derive_plan_geometry |
-cell_down_offset | 可选 | float | how far below the region cell row 0 sits |
-cell_up_offset | 可选 | float | how far above the region cell row 0 sits |
-shape_offset | 可选 | float | how far the shape runs past the region |
-row_pitch | 可选 | int | 相同 X 的 buffer 对之间间隔几行,typed 默认 2,必须正整数。rows between stacked cell pairs, default 2 |
-row_reset | 可选 | string | per_x 或 none;默认 per_x。per_x resets the cell row at each x; none does not |
-hier_mode | 可选 | string | auto, never, driver_rooted or punch |
-region_name | 可选 | string | recorded on each net as ucs_tsv_region |
-user_attributes | 可选 | int | 0 to skip the net and cell user attributes |
-max_nets | 可选 | int | 生成脚本的执行数量门控;已有全局 UCS_TSV_MAX_NETS 可覆盖默认。the rehearsal gate written into the Tcl |
-reserved_x | 可选 | string | x positions an earlier net set already took |
-special_ranges | 可选 | string | named range dict list,如 {name keep x_range {100 120} guard_tracks 2}。x ranges to keep free, from derive_plan_geometry |
-special_guard_tracks | 可选 | int | special range 未自行设置 guard_tracks 时的默认保护数。default guard each side of a special range |
-debug | 可选 | int | 调试级别,推荐独立定位问题时显式给 4。0 silent, 1 the table and markers, 3 the occupancy |
evaluate_plan
只评估现成计划,不查询设计。根据 assignments/failures 统计成功数、跨度、新消费 signal/shield tracks,以及 driver-to-track 距离。不重新分配,不比较或修改设计。
set e [evaluate_plan -plan $p -label incremental_candidate -debug 2]
puts [dict get $e status]
puts [dict get $e objective]返回值与读取方式
| 字段/结构 | 含义 |
|---|---|
| status | FIT:有成功对象且无 failure;PARTIAL:部分成功;NOT_FIT:没有成功。 |
| planned / unplanned / demand | 数量。 |
| start_x / end_x / span / tracks / shared | 资源跨度、消费的 signal/shield 数与共享情况;不是总 reserve 数。 |
| max_distance / total_distance / mean_distance / worst_net | 可测 driver 的距离指标。 |
| measured / unmeasured | 有/无可用 driver_x 的对象计数。 |
| reasons / objective | 失败原因直方图;objective={planned max_distance total_distance}。 |
replan 的未放置对象可能无 driver X,应看 unmeasured;不能把无可测距离当成真实距离为零的好方案。保留完整计划并与评价结果一起查看。
完整参数表 · 4 项
| 参数 | 要求 | 类型 | 说明(附源码声明) |
|---|---|---|---|
-plan | 必填 | string | what plan_nets returned |
-label | 可选 | string | a name for this plan, shown in the report |
-demand | 可选 | int | how many nets were asked for; default planned+unplanned |
-debug | 可选 | int | 调试级别,推荐独立定位问题时显式给 4。0 silent, 1 the metrics, 2 every distance |
remove_plan_routing
显式清除选定 nets 的 routing。默认 confirm=0 只报告。解析并拒绝 power/ground,确认后将合格 net collection 一起交给 remove_routes,删除 global/detail/user routing。
set preview [remove_plan_routing -nets {n1 n2} -confirm 0 -debug 4]
puts [dict get $preview rows]
# 只有确实需要清理这些完整 nets 时才执行:
# set done [remove_plan_routing -nets {n1 n2} -confirm 1 -debug 4]返回值与读取方式
| 字段/结构 | 含义 |
|---|---|
| removed / confirmed | 实际处理 net 数和确认开关。 |
| nets / shapes | 符合条件的 nets 和统计到的 routing shape 数。 |
| unresolved / refused / rows | 无法解析、拒绝的 nets 和逐 net 结果。 |
这是整个 net 的 routing 删除,不是“只清理对面分支”。partial incremental 默认保留 routing,不要为其直接套用整网 remove_routes。ignore_nets 不会调用本 proc。
完整参数表 · 4 项
| 参数 | 要求 | 类型 | 说明(附源码声明) |
|---|---|---|---|
-nets | 可选 | string | 纯 net 名列表;不能放 type/name/direction 三列。net names whose routing to remove |
-net_file | 可选 | string | 纯 net 名文件。file of net names, one per line |
-confirm | 可选 | int | 0 只报告,1 实际删除 routing。1 to actually remove; without it this only reports |
-debug | 可选 | int | 调试级别,推荐独立定位问题时显式给 4。0 silent, 1 the table, 2 every net |
write_plan_tcl
旧 net-list 路径的独立 Tcl emitter。接收旧 assignments、bbox、layer、width、lib/site 参数,计算每个 X 的 buffer 行号,写出 standalone 实现文件和运行门控。它不替代 typed plan_nets 的 emitter。
set written [write_plan_tcl -assignments [list \
[dict create net n_data signal_x 10 shield_xs {9.9 10.1}]] \
-bbox {0 1000 500 1100} -layer T3M1 -width 0.04 \
-lib_cell YOUR_BUFFER_LIB_CELL -row_height 0.2 \
-cell_down_offset 0 -cell_up_offset 0 -shape_offset -2.5 \
-row_pitch 2 -row_reset per_x -remove_routing 0 \
-tcl_file ./legacy_implement.tcl -debug 3]
puts $written返回值与读取方式
| 字段/结构 | 含义 |
|---|---|
| 返回值 | 生成文件的规范化路径。 |
| assignments 输入 | 每项至少 net、signal_x、shield_xs。 |
单次对应一层。remove_routing 默认与旧流程行为绑定,示例显式给 0 保留 routing。typed 精确对象/方向语义不要通过此入口传递;使用 plan_nets 的 typed -tcl_file。
完整参数表 · 19 项
| 参数 | 要求 | 类型 | 说明(附源码声明) |
|---|---|---|---|
-assignments | 必填 | string | the plan's assignments |
-bbox | 必填 | string | 平坦区域坐标 {x1 y1 x2 y2}。the region, as {x1 y1 x2 y2} |
-lib_cell | 必填 | string | 用于插入 guide buffer 的 lib cell。the guide buffer master |
-layer | 必填 | string | 目标 routing layer;是否支持 list 见该 proc 说明。the routing layer |
-width | 必填 | float | 显式线宽;是否必填以本表为准。the shape width |
-tcl_file | 可选 | string | 生成实现 Tcl 的目标文件;不会自动执行。where to write it |
-row_height | 必填 | float | site row height;单位与设计一致。site row height, from derive_plan_geometry |
-row_pitch | 可选 | int | 相同 X 的 buffer 对之间间隔几行,typed 默认 2,必须正整数。rows between stacked pairs, default 2 |
-row_reset | 可选 | string | per_x 或 none;默认 per_x。per_x resets the row at each x; none counts over the run |
-cell_down_offset | 必填 | float | how far below the region row 0 sits |
-cell_up_offset | 必填 | float | how far above the region row 0 sits |
-shape_offset | 必填 | float | how far the shape runs past the region |
-shield_net | 可选 | string | shield 所属 net,默认 VSS。which net the shields belong to, default VSS |
-remove_routing | 可选 | int | 0 leaves the old routing in place |
-hier_mode | 可选 | string | auto, never, driver_rooted or punch |
-region_name | 可选 | string | recorded on each net as ucs_tsv_region |
-user_attributes | 可选 | int | 0 to skip the net user attributes |
-max_nets | 可选 | int | 生成脚本的执行数量门控;已有全局 UCS_TSV_MAX_NETS 可覆盖默认。the gate written into the file, default 99999 |
-debug | 可选 | int | 调试级别,推荐独立定位问题时显式给 4。0 silent, 1 the table, 3 the row bookkeeping |
ucs_net_list
把 inline net 名或文件转为 net 名列表。两种输入互斥;返回名字和来源信息,不把三列 typed object file 解释成 net 文件。
set r [ucs_net_list -nets {n1 n2 n3}]
# 或:set r [ucs_net_list -net_file ./nets.txt]
puts [dict get $r names]
puts [dict get $r source]返回值与读取方式
| 字段/结构 | 含义 |
|---|---|
| names | 按输入顺序得到的 net 名列表。 |
| source | 输入来源说明。 |
不做 FC 连接判定;需要解析对象时继续调用 check/resolve。
完整参数表 · 2 项
| 参数 | 要求 | 类型 | 说明(附源码声明) |
|---|---|---|---|
-nets | 可选 | string | 纯 net 名列表;不能放 type/name/direction 三列。net names |
-net_file | 可选 | string | 纯 net 名文件。file of net names, one per line |
ucs_error_mark
将 polygon 列表写入 error data。incremental=0 建立本轮 error data,必要时替换同名旧 data;incremental=1 追加 error type。缺少 FC DRC API 时警告并返回 0。
set rectangle {{9 999} {11 999} {11 1001} {9 1001}}
set n [ucs_error_mark -cell UCS_CUSTOM_DEBUG -name BUFFER_LOCATION \
-info "rectangle center is planned location" \
-error_list [list $rectangle] -incremental 0]返回值与读取方式
| 字段/结构 | 含义 |
|---|---|
| 返回值 | 创建的 polygon 数;API 不可用时为 0。 |
| error data 名称 | cell 参数后面加 .err,例如 UCS_CUSTOM_DEBUG.err。 |
业务 plan_nets 已负责同一个 UCS_TSV_PLAN data 内的类型组织;不要手动 incremental=0 覆盖它。buffer 要用非零面积 rectangle,中心表示坐标。
完整参数表 · 5 项
| 参数 | 要求 | 类型 | 说明(附源码声明) |
|---|---|---|---|
-error_list | 必填 | string | list of polygons, each a list of {x y} |
-cell | 可选 | string | error data name, default UCS_CHECK_ERROR |
-name | 可选 | string | error type; one per category so each toggles alone |
-info | 可选 | string | brief info shown in the browser |
-incremental | 可选 | int | add to the existing set instead of replacing it |
ucs_tsv_plan
JSON 全流程入口。source 此文件只定义命令;调用后读取配置。检测到 typed plan_sets 时走 typed region/bbox 路径;旧配置保留 derive→extract→unplanned→plan/evaluate 的工作流。
source ./ucs_tsv_plan.tcl
set result [ucs_tsv_plan -config ./examples/typed_plan_objects.json \
-out_dir ./out -debug 4 -keep_going 0]返回值与读取方式
| 字段/结构 | 含义 |
|---|---|
| typed result | regions:{region 名 plan 计划dict} 的列表;errors:region/错误列表。 |
| 旧 result | 旧 region/set/mode 的批处理结果,结构不同;使用 dict keys 确认,不与 typed schema 混用。 |
优先使用本页 typed JSON 范例。CLI -layer 等显式覆盖会下传到 set;per-set 专用参数应直接写在 JSON plan_sets。生成不执行,实现文件需另行 source。
完整参数表 · 29 项
| 参数 | 要求 | 类型 | 说明(附源码声明) |
|---|---|---|---|
-flow_mode | 可选 | string | incremental / replan;与 mode 独立。typed objects: replan or incremental |
-config | 必填 | string | the JSON config, as the vendor tool takes it |
-regions | 可选 | string | which regions; default is every one the config names |
-layer | 可选 | string | 目标 routing layer;是否支持 list 见该 proc 说明。the routing layer |
-tsv_pattern | 可选 | string | ref_name glob for the TSV cells |
-modes | 可选 | string | shield modes to plan; default from the config |
-out_dir | 可选 | string | where the lists and the Tcl go |
-stop_after | 可选 | int | end after this step, 1-6 |
-keep_going | 可选 | int | 0 stops at the first region that fails |
-debug | 可选 | int | 调试级别,推荐独立定位问题时显式给 4。0 silent, 1 the tables and markers, 3 the detail |
-shield_mode | 可选 | string | strict / compact / none。override the config's shielding_mode |
-shield_net | 可选 | string | shield 所属 net,默认 VSS。override the shield net |
-mode | 可选 | string | track 选择策略;typed / 多层支持 sequential / nearest。sequential, nearest or global_balance |
-start_x | 可选 | float | override the plan set's start_x |
-width | 可选 | float | 显式线宽;是否必填以本表为准。override the routing width |
-lib_cell | 可选 | string | 用于插入 guide buffer 的 lib cell。override the guide buffer master |
-guard_tracks | 可选 | int | tracks held clear each side of a bundle |
-ratio_period | 可选 | int | override ratio_period_tracks |
-ratio_reserved | 可选 | int | override ratio_reserved_tracks |
-gap_tracks | 可选 | int | override gap_reserved_tracks |
-force_gap_every | 可选 | int | override force_gap_every_n_nets |
-inter_set_gap | 可选 | int | override inter_set_gap_multiplier |
-fallback | 可选 | string | none 允许降级,off 禁止降级。none: place unshielded rather than fail; off: fail it |
-fallback_distance | 可选 | float | relax to none past this distance from the driver |
-skip_clock | 可选 | int | override skip_clock_nets |
-row_pitch | 可选 | int | 相同 X 的 buffer 对之间间隔几行,typed 默认 2,必须正整数。site rows between stacked cell pairs |
-row_reset | 可选 | string | per_x 或 none;默认 per_x。per_x resets the cell row at each x |
-hier_mode | 可选 | string | auto, never, driver_rooted or punch |
-max_nets | 可选 | int | 生成脚本的执行数量门控;已有全局 UCS_TSV_MAX_NETS 可覆盖默认。the rehearsal gate written into each Tcl |
ucs_log
日志工具,位置参数接口。使用 open / close / level,以及 INFO / WARN / ERROR / DEBUG 写阶段消息。调用者已打开日志时,嵌套 proc 可复用同一 logger。
set path [ucs_log open manual_flow 4 .]
ucs_log INFO input "start region_1"
ucs_log DEBUG geometry "bbox={0 1000 500 1100}" 4
# 在这里调用各个检查 proc。
puts [ucs_log level]
set saved [ucs_log close]
puts $saved| 调用 | 返回/作用 |
|---|---|
| ucs_log open purpose level ?dir? | 创建日志并返回路径;重复 open 会先关前一个日志。 |
| ucs_log level | 当前 logger 级别,未打开为 0。 |
| ucs_log close | 关闭日志,返回路径。 |
| ucs_log DEBUG stage message ?need? | need 为最低日志等级。 |
| ucs_log INFO/WARN/ERROR stage message | 写相应级别消息;屏幕与文件格式不同。 |
typed plan_nets 自动日志的 log_file 仅在它自己打开日志时加入返回结果。自己包了一层 ucs_log open 时,请保存 open 返回的 path。
ucs_plan_better
比较两个 evaluate_plan 返回值。先比较成功数,更多更好;成功数相同,比最大距离,更小更好;再比总距离。完全相同返回 0。不会执行重新规划。
set ea [evaluate_plan -plan $plan_a]
set eb [evaluate_plan -plan $plan_b]
if {[ucs_plan_better $ea $eb]} {
set chosen $plan_a
} else {
set chosen $plan_b
}它只读取 objective,不知道流程是不是 replan。业务上通常用于 incremental 的候选方案比较;不要用未放置 replan 对象的缺失 driver 距离排名。
11 · 生成 Tcl 的执行与批量行为
实现文件是可执行设计修改。进入新一轮预览前显式设置 dry-run;若 session 曾修改过门控变量,也显式设置 max。
set ::UCS_TSV_DRYRUN 1
set ::UCS_TSV_MAX_NETS 10
source ./implement.tcl
puts "done=$::UCS_TSV_DONE skipped=$::UCS_TSV_SKIPPED"
puts $::UCS_TSV_FAILED
# 核对命令、对象与坐标后再实际执行:
set ::UCS_TSV_DRYRUN 0
set ::UCS_TSV_MAX_NETS 99999
source ./implement.tcl
puts $::UCS_TSV_FAILED| 运行时 proc | 调用方式与职责 |
|---|---|
| ucs_tsv_implement_object assignment_dict | typed 文件自动逐对象调用;门控、异常捕获和 DONE/FAILED 计数。不建议手工构造完整 assignment dict。 |
| ucs_tsv_implement_net net x row down_y up_y shield_xs | 旧文件自动逐 net 调用的入口。 |
| ucs_tsv_implement_net_body … ?context? | 实际连接构造;typed partial/all-far 路径传入已解析 context。 |
| ucs_tsv_free_routing net… | 旧 emitter 根据 REMOVE_ROUTING 和 MAX_NETS 门控,收集合格 nets 后一起 remove_routes。 |
| ucs_tsv_gen::place / draw | 实际 set_cell_location/create_shape helper,dry-run 时只输出命令描述。 |
当前批量边界:独立 remove_plan_routing 已把选中 nets 合并为一次 remove_routes;typed 默认保留 routing。insert_buffer 目前仍按对象及两级依赖顺序执行,没有实现跨对象统一批量插入。本文没有把此前讨论的批量 insert 优化标记为已完成。
DONE 在 dry-run 中表示预览成功的对象数,不代表已经插入。FAILED 非空时应逐项检查;实际执行可能在一个对象部分操作后失败,不能仅通过再次 source 就假定会自动回滚。
12 · 内部/运行时 proc 维护索引
以下列出源码内每个非公共 proc 的签名和职责,包括写入实现 Tcl 的运行时定义。这些不是另一套需要用户逐个调用的流程。带 upvar、parsed 或全局 UCS_TSV_* 上下文的 helper 不适合脱离父调用单独执行;业务独立测试应从对应公共 proc 入手。
| Proc | 签名 | 职责 | 源码位置 |
|---|---|---|---|
::ucs_display_text | {text} | 格式化人读数字:最多四位小数,并保留既有表格宽度。 | ucs_tsv_plan_proc.tcl:4 |
::ucs_display | {args} | puts 包装;对屏幕或指定 channel 进行数值显示格式化。 | ucs_tsv_plan_proc.tcl:23 |
::ucs_geom_key | {cfg key {scopes {}}} | 按配置作用域查找值及来源。 | ucs_tsv_plan_proc.tcl:798 |
::ucs_geom_check | {name type v from} | 校验配置值类型。 | ucs_tsv_plan_proc.tcl:817 |
::ucs_clock_report | {r gates debug own_run} | 汇总 clock gates 与日志,返回 clock dict。 | ucs_tsv_plan_proc.tcl:1473 |
::ucs_check_report | {r gates reason debug {own_run 0}} | 汇总 crossing gates、reason 和 pin 信息。 | ucs_tsv_plan_proc.tcl:2012 |
::ucs_planned_side | {sh side} | 提取 shield 某一侧的候选列表。 | ucs_tsv_plan_proc.tcl:2308 |
::ucs_planned_report | {r gates reason debug {own_run 0}} | 汇总 planned 判定和几何证据。 | ucs_tsv_plan_proc.tcl:2312 |
::ucs_plan_getdef | {d k dflt} | dict 中存在键时取值,否则返回默认值。 | ucs_tsv_plan_proc.tcl:3492 |
::ucs_plan_round | {v} | 将 track 运算值归一化到内部精度。 | ucs_tsv_plan_proc.tcl:3496 |
::ucs_plan_driver_x | {net} | 从设计查询旧 net-list 模式的 driver X。 | ucs_tsv_plan_proc.tcl:3500 |
::ucs_plan_fits | {xs_var state_var i shields {guard 0}} | 检查同层 signal/shield/guard bundle 能否放入 state。 | ucs_tsv_plan_proc.tcl:3527 |
::ucs_plan_best_slot | {xs_var state_var dx shields guard {from 0} {limit {}} {first 0}} | 寻找符合限制的最优单层候选。 | ucs_tsv_plan_proc.tcl:3573 |
::ucs_plan_choose | {shielded bare limit} | 选择受保护方案或允许的 fallback。 | ucs_tsv_plan_proc.tcl:3614 |
::ucs_plan_place | {xs_var state_var i shields {guard 0}} | 更新单层 state 并返回 signal/shields/shared。 | ucs_tsv_plan_proc.tcl:3622 |
::ucs_plan_multi_reserve | {pool states_var cursor_var number role} | 从合并池的 cursor 开始保留 N 个可用资源。 | ucs_tsv_plan_proc.tcl:3652 |
::ucs_plan_multi | {} | 跨层统一分配器;upvar 使用 plan_nets 的上下文。 | ucs_tsv_plan_proc.tcl:3665 |
::ucs_emit_row | {seen_var mode sequence signal_x} | 旧 emitter 的 per_x/global 行号管理。 | ucs_tsv_plan_proc.tcl:5213 |
::ucs_emit_round | {v} | 旧 emitter 的坐标归一化。 | ucs_tsv_plan_proc.tcl:5223 |
::ucs_emit_getdef | {var opt def} | 从调用方变量读取可选 emitter 参数。 | ucs_tsv_plan_proc.tcl:5440 |
::ucs_emit_attr_defs | {fh} | 向实现文件写出 user attribute 定义与 tag helper。 | ucs_tsv_plan_proc.tcl:5448 |
::ucs_tsv_gen::mark | {obj pairs} | 写 user attributes,失败时给出提示。 | ucs_tsv_plan_proc.tcl:5490 |
::ucs_tsv_gen::tag_net | {net role signal_x shield_xs method} | 记录 net 的 TSV role/坐标等属性。 | ucs_tsv_plan_proc.tcl:5506 |
::ucs_tsv_gen::tag_cell | {cell net_name side signal_x planned_y row method} | 记录 cell 计划坐标、row 和构造方法。 | ucs_tsv_plan_proc.tcl:5516 |
::ucs_emit_helper | {fh} | 向实现文件写出构造和绘线 helper。 | ucs_tsv_plan_proc.tcl:5532 |
::ucs_tsv_gen::run | {what args} | 执行一条设计命令;dry-run 时只打印。 | ucs_tsv_plan_proc.tcl:5538 |
::ucs_tsv_gen::pin_block | {pin_name} | 提取 pin 名的层次 block 部分。 | ucs_tsv_plan_proc.tcl:5548 |
::ucs_tsv_gen::hier_groups | {pins} | 按 loads 的层次 net/block 分组。 | ucs_tsv_plan_proc.tcl:5565 |
::ucs_tsv_gen::one_pin | {cell dir what net_name} | 要求唯一 buffer input/output pin。 | ucs_tsv_plan_proc.tcl:5581 |
::ucs_tsv_gen::make_cell | {name lib net_name} | create_cell 后确认 cell 唯一存在。 | ucs_tsv_plan_proc.tcl:5591 |
::ucs_tsv_gen::place | {cell x y net_name side row method} | 放置并标注 guide buffer。 | ucs_tsv_plan_proc.tcl:5599 |
::ucs_tsv_gen::draw | {net x} | 创建精确矩形 routing shape。 | ucs_tsv_plan_proc.tcl:5609 |
ucs_tsv_free_routing | {args} | 运行时批量 routing 删除入口。 | ucs_tsv_plan_proc.tcl:5627 |
ucs_tsv_implement_net | {net signal_x row down_y up_y shield_xs} | 旧式运行时入口与门控。 | ucs_tsv_plan_proc.tcl:5673 |
ucs_tsv_implement_net_body | {net_name signal_x row down_y up_y shield_xs {context {}}} | driver-rooted / load-side / partial punch 构造实现。 | ucs_tsv_plan_proc.tcl:5683 |
::ucs_object_collection | {type name} | 根据 type 精确取得唯一对象 collection。 | ucs_tsv_plan_proc.tcl:6051 |
::ucs_object_xy | {object {require_placed 0}} | 取 bbox 中心并校验几何。 | ucs_tsv_plan_proc.tcl:6061 |
::ucs_object_endpoint | {type object} | 根据 pin/port direction 判断 driver/load 角色。 | ucs_tsv_plan_proc.tcl:6071 |
::ucs_resolve_record | {record flow bbox} | resolve_plan_object 的解析实现,亦写入生成脚本。 | ucs_tsv_plan_proc.tcl:6086 |
::ucs_plan_typed_body | {options} | typed set 配置、解析、跨层分配、汇总与 emitter/marker 编排。 | ucs_tsv_plan_proc.tcl:6185 |
::ucs_object_endpoints | {items} | 将 {type name} 列表组合为 collection。 | ucs_tsv_plan_proc.tcl:6337 |
::ucs_tsv_object_body | {a} | 精确对象的实际插入与放置实现。 | ucs_tsv_plan_proc.tcl:6346 |
ucs_tsv_implement_object | {a} | typed 运行时入口与门控。 | ucs_tsv_plan_proc.tcl:6410 |
::ucs_write_object_plan | {assignments path {debug 0} {options {}}} | typed 独立脚本 emitter;由 plan_nets 调用。 | ucs_tsv_plan_proc.tcl:6418 |
::ucs_object_table | {channel rows} | 对齐 typed 人读报告并连接 logger。 | ucs_tsv_plan_proc.tcl:6468 |
::ucs_plan_typed | {options} | typed 日志生命周期和异常传播包装。 | ucs_tsv_plan_proc.tcl:6489 |
::ucs_final_track_rows | {states assignments sources details} | 从最终 state 生成逐 track 用途表。 | ucs_tsv_plan_proc.tcl:6506 |
::ucs_object_plan_rows | {assignments} | marker 和 emitter 共用的 Y 累计几何计算。 | ucs_tsv_plan_proc.tcl:6536 |
::ucs_object_geometry_markers | {rows} | 写入有尺寸 buffer 矩形与精确 signal/shield polygons。 | ucs_tsv_plan_proc.tcl:6571 |
::ucs_tsv_plan_glob | {names} | 旧通用前缀 pattern 辅助逻辑。 | ucs_tsv_plan.tcl:132 |
::ucs_tsv_plan_val | {ovar g name {key {}}} | 取 CLI override 或 derive 结果。 | ucs_tsv_plan.tcl:145 |
::ucs_tsv_plan_step | {ovar n title} | 旧 batch stop_after 阶段控制。 | ucs_tsv_plan.tcl:152 |
::ucs_tsv_plan_set | {ovar region setname bbox f_cross n_cross taken_var} | 旧 batch 单个 net set 的提取、规划和比较。 | ucs_tsv_plan.tcl:164 |
::ucs_tsv_plan_region | {ovar region bbox} | 旧 batch 单 region 编排。 | ucs_tsv_plan.tcl:345 |
::ucs_tsv_plan_summary | {ovar results broken} | 旧 batch 汇总输出。 | ucs_tsv_plan.tcl:553 |
::ucs_tsv_plan_objects_config | {cfg options} | typed JSON region/set 到 plan_nets 参数的映射。 | ucs_tsv_plan.tcl:690 |
::ucs_region_settings | {cfg region {spec {}}} | 内部流程 helper;由对应公共接口调用。 | ucs_tsv_region_flow.tcl:5 |
::ucs_region_expand_objects | {records {debug 0} {log_file {}}} | 内部流程 helper;由对应公共接口调用。 | ucs_tsv_region_flow.tcl:16 |
::ucs_region_bbox_log | {path region set_name role layer bbox source} | 内部流程 helper;由对应公共接口调用。 | ucs_tsv_region_flow.tcl:63 |
::ucs_region_layers | {patterns {log_file {}}} | 内部流程 helper;由对应公共接口调用。 | ucs_tsv_region_flow.tcl:79 |
::ucs_region_derive | {args} | 内部流程 helper;由对应公共接口调用。 | ucs_tsv_region_flow.tcl:107 |
13 · 排错与独立验证
| 症状 | 检查方法 |
|---|---|
| 找不到对象/NET_NOT_UNIQUE | 确认 type/name、当前 design scope 和 net/flat-net 解析;不是先改 offset。 |
| NO_DRIVER_X | nearest 缺少 anchor;未放置 replan net 改用 sequential,显式固定对象则需要有效几何。 |
| direction 冲突 | 核对 driver 的实际侧别与 top_to_bottom/bottom_to_top;区域内或边界上的 driver 不满足外侧条件。 |
| 没有对面 loads | 查看 bbox 和方向;显式 load 应作为 pin/port 输入,而不是把其 net 当 driver 请求。 |
| NOT_BOTH_SIDES_IN_X | 上下侧 cell 中心必须分别至少一个落在 X 范围;仅 Y 分侧不够。 |
| NO_SLOT / 大量不可用 tracks | debug 4 查看 BLOCKED_*、TSV guards、special reserve、ratio、gap 与 width/spacing envelope。 |
| strict 结果没有 shield | 检查是否允许 -fallback none;要强制保留 strict,使用 -fallback off 并检查 failures。 |
| marker 看不见 | 确认 debug≥1、FC DRC API 可用、正确 error data/type 已打开;buffer 还需要 row_height。 |
| 只画线,没有 buffer marker | 缺少 row_height,或者没有成功 assignments。 |
| 日志中有对象,但设计没变 | 确认是否只生成了 Tcl,或 UCS_TSV_DRYRUN=1;DONE 在预览中不表示实际修改。 |
| 执行少于计划 | 检查 UCS_TSV_MAX_NETS;现有 session 全局值可能覆盖生成的默认 gate。 |
| 二次执行失败或出现已有 cell | 不要假定重复执行可回滚;使用干净设计基线验证生成脚本。 |
# 开发树内的 mock 回归(邮件包不含测试目录;不是 FC 功能验收)
for f in t/test_*.tcl; do tclsh "$f"; done
# FC 中逐层定位:
# 1. parse_plan_objects -> 查看名字和方向
# 2. resolve_plan_object -> 查看 driver / far_loads / near_loads
# 3. check_track_occupancy -debug 4 -> 检查资源
# 4. plan_nets -debug 4 -> 检查用途和几何 marker
# 5. UCS_TSV_DRYRUN=1 -> 检查生成命令
# 6. 在选定基线上真实执行并检查 FAILED、连接和位置当前源代码回归:原有完整回归已通过;最新 region flow 专项 32 项断言通过;包含生成 Tcl 的 mock/dry-run 检查。真实 Fusion Compiler 的 collection、层次连接、插入和 legalization、error browser 显示仍需设计会话验证。文档和示例不等于编译后的 TBC 或已经验证的设计交付。
14 · 文档与源码对应关系
本 HTML 为独立文件,无外部字体、脚本或样式依赖;可以从服务器打开,也可以保存到本地。参数表来自当前源代码的 define_proc_attributes,不是另一版本的手工帮助。
| 文件 | SHA-256(生成本 usage 时) |
|---|---|
| ucs_tsv_plan_proc.tcl | 8478fc06c46c72af535dd3a79477b4a7d7649da99797862744e2711a1886212a |
| ucs_tsv_plan.tcl | 769643c9421d4438c5002f81bab745dbf1834f2d8f4a1f9ff889c3b01748003e |
| ucs_tsv_region_flow.tcl | 421555cb2368c25a8ff68a1ad817a5696ec8108f79e1b8ab54b2ca6e0265b8a7 |
本次原始下载包版本名仍为 0.5.2;本文描述的是本任务修改后的源码快照。与旧 TSV Customize Planner / Toolkit 2.x 的接口不同,不应混用 proc 参数。