深入Tessent Shell数据模型:Flat、Hierarchical和ICL,你的脚本该用哪个?

张开发
2026/5/3 18:20:26 15 分钟阅读
深入Tessent Shell数据模型:Flat、Hierarchical和ICL,你的脚本该用哪个?
深入解析Tessent Shell三大数据模型Flat、Hierarchical与ICL的实战选择指南当你在深夜调试一个复杂的Tcl脚本时突然发现get_pins命令返回的对象ID与昨天完全不同——这不是幻觉而是选错了数据模型导致的典型问题。作为Tessent Shell的中高级用户我们经常需要在三种数据模型间做出选择Flat的物理视角、Hierarchical的架构视角以及ICL的抽象连接视角。理解它们的本质差异将直接决定你的脚本是高效稳定还是漏洞百出。1. 数据模型基础三种视角的本质差异想象你面前有一栋摩天大楼。Flat模型就像把整栋楼拆解成砖块和钢筋完全无视原有的楼层结构Hierarchical模型则保留了每层的房间布局而ICL模型只关心电梯和消防通道的连接关系。这三种视角没有优劣之分只有适用场景的不同。1.1 Flat模型门级网表的物理真相进入analysis模式时Tessent会自动生成Flat模型——这是对设计进行彻底展平后的门级表示。它的核心特点包括原子化结构所有层次被打破仅剩标准单元standard cells及其连接关系不稳定的ID体系每个gate_pin用gate_id.pin_index格式标识但这两个数字会在以下情况全部改变# 典型错误硬编码gate_pin ID set fault_site [get_gate_pins -id 123.4] # 下次运行可能失效 # 正确做法使用层次路径或属性过滤 set fault_site [filter_collection [get_pins] full_name~*/sigA]最佳适用场景物理缺陷分析如stuck-at故障定位时序关键路径检查与工艺库直接相关的优化警告Flat模型中gate_pin的ID永远不要出现在持久化脚本里它们就像沙滩上的字迹——每次潮水工具重启或网表更新都会将其抹去。1.2 Hierarchical模型保留设计的基因图谱通过read_verilog加载设计时Tessent构建的就是Hierarchical模型。这是我们最熟悉的原生视图关键特征有完整的对象层次对象类型描述示例命令module设计的基本构建块get_modulesinstancemodule的具体例化get_cells -hierarchicalpin实例的接口端点get_pins -of [get_cells u1]稳定的命名体系# 可靠的层次路径访问即使网表更新也保持有效 set clock_pin [get_pins top/submodule/reg1/CLK] # 模块间的相对路径查询 set current_design [get_object_name [get_current_design]] set sub_instances [get_cells -hier -filter ref_name~DFF*]典型应用场景架构级DFT规则检查跨模块信号追踪层次化约束管理1.3 ICL模型IJTAG网络的抽象蓝图当处理IEEE 1687IJTAG网络时ICL模型提供了独特的价值连接性抽象只关注仪器instrument间的逻辑关系不涉及物理实现四类核心对象icl_module: 相当于Verilog中的moduleicl_instance: module的实例化icl_port: 模块接口icl_pin: 实例的具体接口点典型操作模式# 查询IJTAG网络中的访问路径 set access_path [get_icl_paths -from [get_icl_instances inst1] \ -to [get_icl_instances inst2]] # 验证连接完整性 check_icl_connectivity -model my_icl_model2. 模型切换与上下文管理实战在同一个脚本中灵活切换数据模型是高效工作的关键。以下是在不同系统模式system mode下的典型操作流程2.1 从Setup到Analysis的模式转换# 启动环境设置 set_context dft -scan set_system_mode setup # 加载层次化设计 read_verilog -golden top.v set_current_design top # 切换到analysis模式自动生成Flat模型 set_system_mode analysis create_flat_model -name physical_view # 双模型协同分析示例 set hier_pins [get_pins -hier */scan_in] set flat_pins [get_gate_pins -of $hier_pins] report_clock_tree -flat_pins $flat_pins2.2 模型间数据关联技巧当需要在不同模型间传递数据时属性attributes是最可靠的桥梁为关键对象添加自定义属性# 在Hierarchical模型中标记关键实例 set_dft_signal -type ScanEnable -port [get_ports se] -active_state 1 set_attr [get_cells -hier *scan*] is_scan_cell 1 # 这些属性会自动继承到Flat模型 set scan_gates [filter_collection [get_gates] is_scan_cell1]跨模型查询对照表Hierarchical对象Flat对象对应关系转换命令示例module无直接对应N/Ainstancegateget_gates -of [get_cells u1]pingate_pinget_gate_pins -of [get_pins u1/A]3. 高级脚本设计模式避免模型选择失误需要建立系统化的脚本架构。以下是三种经过验证的设计模式3.1 模型适配器模式proc get_stable_pin_ref {pin_name} { set current_mode [get_system_mode] if {$current_mode analysis} { # Flat模型下通过层次属性定位 set pin_collection [filter_collection [get_gate_pins] \ hier_path~*/$pin_name] } else { # Hierarchical模型直接使用路径 set pin_collection [get_pins -hier */$pin_name] } if {[sizeof_collection $pin_collection] 0} { error Pin $pin_name not found in $current_mode mode } return $pin_collection }3.2 多模型验证框架# 验证关键信号在三种模型中的一致性 proc verify_signal_consistency {signal_name} { # Hierarchical检查 set hier_paths [get_nets -hier */$signal_name] # Flat检查 set_system_mode analysis set flat_paths [get_physical_nets -of $hier_paths] # ICL检查如果适用 if {[info exists ::icl_model]} { set icl_paths [get_icl_ports -name $signal_name] } # 对比结果... }4. 性能优化与排错指南不同数据模型对内存和运行效率的影响差异显著4.1 内存占用对比测试数据模型1M实例设计内存占用典型命令执行时间Hierarchical2.8GB0.4s (get_cells)Flat4.5GB1.2s (get_gates)ICL0.3GB0.1s (get_icl_paths)4.2 常见陷阱与解决方案幽灵对象问题# 错误在不同模型间直接混用对象 set hier_cell [get_cells u1] set flat_pins [get_gate_pins -of $hier_cell] # 可能返回空 # 正确显式转换 set gate_ids [get_attribute $hier_cell flat_gate_ids] set flat_pins [get_gate_pins -id $gate_ids]模型缓存策略# 对大型设计主动管理模型加载 if {[sizeof_collection [get_designs -quiet]] 0} { remove_design -all } read_verilog -golden new_version.v在实际项目中最耗时的往往不是脚本编写本身而是模型选择错误导致的调试过程。最近处理的一个案例中工程师花了三天追踪一个消失的时钟信号最终发现是因为在Flat模型中错误地使用了层次路径查询。记住这个经验法则当查询返回意外空结果时首先检查当前数据模型是否匹配你的查询方式。

更多文章