Mentor DFT实战:手把手教你搞定Wrapped Core的Scan Insertion(附完整TCL脚本)
Mentor DFT实战:Wrapped Core的Scan Insertion全流程解析与TCL脚本精讲
在芯片测试设计领域,Wrapped Core的Scan Insertion一直是工程师们面临的棘手难题。当设计规模不断扩大,核心间交互日益复杂时,传统的扫描链插入方法往往显得力不从心。本文将从一个真实的项目案例出发,带你逐步拆解Mentor DFT工具在处理Wrapped Core时的完整工作流程,特别是针对那些容易让人困惑的多模式配置场景。
1. Wrapped Core的基础概念与挑战
Wrapped Core(包裹核心)是现代SoC设计中常见的IP集成方式,它通过特定的Wrapper逻辑将核心与芯片其他部分隔离。这种设计带来了测试上的独特挑战——我们需要在不影响核心功能的前提下,实现高效的测试访问机制。
典型Wrapped Core的结构特点:
- 隔离逻辑(Isolation Logic):用于功能模式下的信号隔离
- 旁路路径(Bypass Path):测试模式下直接连接输入输出的通路
- 模式控制信号(Mode Control):决定当前是功能模式还是测试模式
# Wrapped Core接口示例 set core_wrapper [create_wrapper \ -name "DSP_CORE_WRAPPER" \ -input_ports {clk rst_n data_in[31:0]} \ -output_ports {data_out[31:0] ready} \ -control_ports {test_mode scan_en}]注意:Wrapper的接口定义直接影响后续Scan Insertion的配置方式,务必在项目初期就与设计团队确认清楚。
2. Scan Insertion前的准备工作
2.1 设计环境配置
在开始Scan Insertion之前,需要确保Mentor DFT工具环境正确配置。以下是一个典型的初始化脚本:
# 设置工作库和设计文件 set LIB_PATH "/project/libs/tech28hpc" set RTL_PATH "/project/rtl/dsp_core" # 加载必要库 load_library -technology $LIB_PATH/tech.lib # 读入设计文件 read_verilog $RTL_PATH/dsp_top.v read_verilog $RTL_PATH/dsp_wrapper.v # 设置当前设计 current_design DSP_TOP link_design2.2 扫描配置参数定义
不同的测试模式需要不同的扫描配置参数。我们可以使用set_scan_configuration命令进行全局设置:
# 基本扫描配置 set_scan_configuration \ -clock_mixing no_mix \ -style multiplexed_flip_flop \ -insert_clock_gating_aware true \ -chain_count 4 # 针对Wrapped Core的特殊配置 set_scan_configuration \ -wrapper_cell_analysis full \ -wrapper_boundary_scan true \ -shared_scan_out false关键参数解析:
| 参数 | 默认值 | 推荐值 | 说明 |
|---|---|---|---|
| -clock_mixing | no_mix | no_mix | Wrapped Core建议保持时钟域隔离 |
| -wrapper_cell_analysis | basic | full | 完整分析Wrapper单元 |
| -shared_scan_out | false | false | 避免输出端口共享 |
3. 多模式Scan Insertion实战
3.1 定义测试模式
Wrapped Core通常需要支持多种测试模式,每种模式对应不同的扫描链配置:
# 内部测试模式(测试核心逻辑) add_scan_mode -name int_mode \ -test_mode test_mode=1,scan_en=1 \ -scan_enable scan_en \ -create_ports auto # 外部测试模式(测试Wrapper逻辑) add_scan_mode -name ext_mode \ -test_mode test_mode=1,scan_en=0 \ -scan_enable scan_en \ -create_ports auto # 旁路模式 add_scan_mode -name bypass_mode \ -test_mode test_mode=0,scan_en=0 \ -create_ports auto3.2 扫描链插入与优化
完成模式定义后,可以开始实际的扫描链插入过程:
# 分析Wrapper单元 analyze_wrapper_cells -all -verbose # 设置Wrapper边界属性 set_attribute_value -type port -name "data_in*" -attribute scan_boundary -value input set_attribute_value -type port -name "data_out*" -attribute scan_boundary -value output # 执行扫描链插入 insert_scan \ -mode {int_mode ext_mode bypass_mode} \ -analyze_only false \ -optimize true \ -verbose 3常见问题排查清单:
- 检查Wrapper端口是否正确定义了scan_boundary属性
- 确认不同模式下的控制信号值没有冲突
- 验证时钟域交叉处理是否符合预期
- 检查扫描链长度是否均衡
4. 高级配置与调试技巧
4.1 EDT集成配置
当使用EDT(Embedded Deterministic Test)压缩技术时,需要特殊考虑Wrapper的配置:
# EDT配置示例 set_edt_configuration \ -wrapper_mode hierarchical \ -chain_count 4 \ -input_channels 2 \ -output_channels 2 create_edt -name DSP_EDT \ -input_signals {edt_in[1:0]} \ -output_signals {edt_out[1:0]} \ -connect_to_wrapper4.2 OCC集成注意事项
对于需要OCC(On-Chip Clocking)的复杂设计,Wrapper的时钟处理尤为关键:
# OCC时钟配置 set_occ_configuration \ -wrapper_clock_scheme separate \ -clock_gating_aware true \ -test_clock_divider 2 create_occ -name DSP_OCC \ -control_signals {occ_enable} \ -clock_sources {clk} \ -connect_to_wrapper4.3 验证与调试
完成Scan Insertion后,必须进行全面的验证:
# 扫描链验证 verify_scan_chain \ -mode all \ -report scan_chain.rpt \ -verbose 3 # 生成测试模式 create_test_patterns \ -mode {int_mode ext_mode} \ -format stil \ -output dsp_core_patterns.stil调试技巧:
- 使用
report_scan_configuration -mode all检查配置一致性 - 通过
debug_scan_connection -from core_inst/data_reg追踪特定寄存器连接 - 利用图形界面可视化扫描链路径,特别关注Wrapper边界
5. 完整TCL脚本示例
以下是一个整合了上述所有关键步骤的完整脚本框架:
# Wrapped Core Scan Insertion完整脚本 set script_version 1.0 # 1. 初始化设置 source setup.tcl current_design DSP_TOP # 2. 扫描配置 set_scan_configuration \ -clock_mixing no_mix \ -chain_count 4 \ -wrapper_cell_analysis full # 3. 定义测试模式 add_scan_mode -name int_mode -test_mode test_mode=1,scan_en=1 add_scan_mode -name ext_mode -test_mode test_mode=1,scan_en=0 # 4. Wrapper特定设置 analyze_wrapper_cells -all set_attribute_value -type port -name "data*" -attribute scan_boundary -value input # 5. 执行扫描插入 insert_scan -mode {int_mode ext_mode} -optimize true # 6. 特殊结构集成 if {$use_edt} { set_edt_configuration -wrapper_mode hierarchical create_edt -name DSP_EDT -connect_to_wrapper } # 7. 验证与输出 verify_scan_chain -mode all write_scan_def -output dsp_core_scan_def.gz在实际项目中应用这个脚本时,记得根据具体设计调整Wrapper端口名称、扫描链数量等参数。遇到问题时,可以逐步执行脚本并检查中间结果,这比一次性运行整个脚本更容易定位问题根源。
