DFT_practical_Synopsys DFT Compiler 完整使用指南:从 RTL 到 Scan Insertion 📅 2026/6/26 6:51:39 Synopsys DFT Compiler 完整使用指南从 RTL 到 Scan Insertion 阅读本文你将收获掌握 Synopsys DFT Compiler 的完整操作流程从 RTL 输入到 Scan Insertion 网表输出学会编写 DFT 约束脚本Tcl配置 Scan Chain、Test Clock、Test Mode了解 DRC 违例的排查思路和常见修复方法获得可直接复用的 DFT Compiler 自动化脚本模板一、DFT Compiler 是什么Synopsys DFT Compiler现整合到 TestMAX 套件中但业界仍习惯称 DFT Compiler是芯片 DFT 流程中最核心的 EDA 工具。它的主要职责是YESNORTL 设计DFT CompilerScan-Replaced NetlistSPF 文件Scan Protocol FileDFT DRC ReportTetraMAX ATPGDRC Clean?修复 DRC一句话概括DFT Compiler 把设计中的普通寄存器替换为可扫描的寄存器Scan Flip-Flop并串成扫描链Scan Chain让测试机可以通过 Shift-In/Shift-Out 操作来控制和观察芯片内部状态。二、环境准备与工具启动2.1 必需的输入文件文件说明示例RTL 文件Verilog/VHDL 设计源文件cpu_core.v,top.v工艺库.db标准单元库含 Scan Cellsaed90nm_max.dbDFT 约束脚本.tcl测试时钟、复位、测试模式配置dft_setup.tclSDC 约束.sdc时序约束至少定义时钟chip.sdc2.2 启动 DFT Compiler# dft_compile.tcl —— 启动脚本模板 # # 1. 设置搜索路径和库 set_app_var search_path . ../rtl ../lib ../scripts set_app_var target_library saed90nm_max.db set_app_var link_library * $target_library set_app_var synthetic_library dw_foundation.sldb # 2. 读入 RTL analyze -format verilog { ../rtl/top.v ../rtl/cpu_core.v ../rtl/alu.v ../rtl/control_unit.v } elaborate top # 3. 读入 SDC 约束 read_sdc ../constraints/chip.sdc # 4. 检查设计 check_design report_clock# Linux 终端启动命令dc_shell-fdft_compile.tcl|teedft_compile.log三、DFT 约束配置核心步骤3.1 配置测试时钟# 测试时钟配置 # 定义测试时钟必须与 SDC 中的时钟对应 set_dft_signal -type TestClock -port clk -timing {45 55} # 如果芯片有多个时钟域 set_dft_signal -type TestClock -port clk_core -timing {45 55} set_dft_signal -type TestClock -port clk_peri -timing {45 55}3.2 配置复位和测试模式# 测试控制信号 # 复位信号必须设为非活跃状态 set_dft_signal -type Reset -port rst_n -active_state 0 # 测试模式使能信号 set_dft_signal -type TestMode -port test_mode -active_state 1 # 测试使能信号Scan Enable set_dft_signal -type ScanEnable -port scan_enable -active_state 1 # 常数信号 set_dft_signal -type Constant -port pll_bypass -active_state 13.3 配置扫描链# 扫描链配置 # 方法1自动创建扫描链推荐新手使用 set_scan_configuration -chain_count 8 # 方法2手动指定扫描链的输入输出端口 set_scan_configuration -chain_count 4 set_dft_signal -type ScanDataIn -port sdi_0 -view spec set_dft_signal -type ScanDataOut -port sdo_0 -view spec set_dft_signal -type ScanDataIn -port sdi_1 -view spec set_dft_signal -type ScanDataOut -port sdo_1 -view spec set_dft_signal -type ScanDataIn -port sdi_2 -view spec set_dft_signal -type ScanDataOut -port sdo_2 -view spec set_dft_signal -type ScanDataIn -port sdi_3 -view spec set_dft_signal -type ScanDataOut -port sdo_3 -view spec # 扫描链长度平衡关键不平衡会导致测试效率低 set_scan_configuration -max_length 500四、执行 DFT 插入与验证4.1 Preview 模式推荐先跑# Preview DFT —— 只检查不实际插入 set_dft_configuration -preview_dft enable # 运行 DFT DRC设计规则检查 dft_drc # 报告 DRC 结果 report_dft_drc -violations -significant4.2 正式插入 DFT# 正式 DFT 插入 set_dft_configuration -preview_dft disable # 执行 DFT 综合 compile -scan # 插入 DFT 逻辑 insert_dft # 再次运行 DRC 确认干净 dft_drc report_dft_drc reports/drc_final.rpt4.3 输出文件# 导出 DFT 结果 # 修改后的网表 write -format verilog -hierarchy -output netlist/top_scan.v # SPF 文件Scan Protocol File给 TetraMAX 用 write_test_protocol -output dft/top.spf # 扫描链报告 report_scan_path -view existing -chain all reports/scan_chain.rpt # 测试覆盖率估算Preview ATPG estimate_test_coverage reports/test_coverage_est.rpt五、DRC 常见违例与修复D1: Clock MixingD2: Uncontrollable ClockD3: Gated ClockD6: Asynchronous Set/Resetdft_drc 报错违例类型不同时钟驱动的寄存器混在同一条链测试时钟无法被TestClock 控制门控时钟未旁路异步复位未在测试模式禁用修复: 按时钟域分组set_scan_configuration -clock_mixing no_mix修复: 检查 SDC 定义确保 TestClock 可达修复: 在测试模式下旁路 Clock Gating修复: set_dft_signal-type Reset -active_state5.1 D1 违例时钟混合# 现象不同时钟域的寄存器被串到同一条链 # 修复禁止混合时钟 set_scan_configuration -clock_mixing no_mix # 或使用 Lockup Latch 隔离 set_scan_configuration -add_lockup true5.2 D3 违例门控时钟# 在测试模式下旁路所有 Clock Gating set_dft_signal -type TestMode -port test_mode -active_state 1 # 或使用 Autofix set_dft_configuration -fix_clock enable set_dft_configuration -fix_reset enable set_dft_configuration -fix_set enable5.3 覆盖率偏低 95%# 方法1添加 Test Point set_test_point_element -type observe -element {critical_reg/Q} set_test_point_element -type control -element {hard_to_control/Q} # 方法2检查并排除不可测模块 set_scan_element false [get_cells -hier analog_block/*]六、自动化脚本模板开箱即用#!/usr/bin/env dc_shell # # DFT_Flow_Auto.tcl —— Synopsys DFT Compiler 全自动脚本 # 用法: dc_shell -f DFT_Flow_Auto.tcl # set DESIGN_NAME top set RTL_DIR ../rtl set LIB_DIR ../lib set OUT_DIR ../outputs # --- 库设置 --- set_app_var search_path $RTL_DIR $LIB_DIR $OUT_DIR set_app_var target_library saed90nm_max.db set_app_var link_library * $target_library set_app_var hdlin_enable_presto true # --- 读入设计 --- analyze -format verilog [glob $RTL_DIR/*.v] elaborate $DESIGN_NAME current_design $DESIGN_NAME check_design $OUT_DIR/check_design.rpt # --- 时钟与约束 --- source ../constraints/chip.sdc set_dft_signal -type TestClock -port clk -timing {45 55} set_dft_signal -type Reset -port rst_n -active_state 0 set_dft_signal -type TestMode -port test_mode -active_state 1 set_dft_signal -type ScanEnable -port scan_en -active_state 1 set_dft_signal -type Constant -port pll_bypass -active_state 1 # --- 扫描链配置 --- set_scan_configuration -chain_count 8 -max_length 500 set_dft_configuration -fix_clock enable -fix_reset enable # --- Preview --- set_dft_configuration -preview_dft enable dft_drc $OUT_DIR/drc_preview.rpt # --- 正式插入 --- set_dft_configuration -preview_dft disable compile -scan insert_dft # --- 后检查 --- dft_drc $OUT_DIR/drc_final.rpt report_scan_path -view existing -chain all $OUT_DIR/scan_chain.rpt # --- 导出 --- write -format verilog -hierarchy -output $OUT_DIR/${DESIGN_NAME}_scan.v write_test_protocol -output $OUT_DIR/${DESIGN_NAME}.spf echo DFT Flow Completed! echo Check: $OUT_DIR/drc_final.rpt七、常见错误与解决方法错误信息原因解决方法Error: Clock not foundSDC 未定义或时钟名不匹配检查report_clock输出确认时钟名正确D1 Violation: clock mixing不同时钟域混在同一链set_scan_configuration -clock_mixing no_mixNo scan equivalent for cell X工艺库缺少该单元的 Scan 版本检查库文件确认*_scan类型单元存在insert_dft failed: DRC violations remainDRC 未清干净仔细读 DRC 报告逐条修复不要跳过 PreviewCompile runs forever设计太大或约束冲突先用compile_ultra -scan -boundary_optimization增量编译 一句话总结DFT Compiler 的核心就三件事配好时钟和测试信号 → 过 DRC → 批量替换寄存器为 Scan Cell。脚本化这个流程是 DFT 工程师的基本功本文的自动化模板可以直接拿到项目里改改就用。进阶推荐掌握 DFT Compiler 后下一步学习 TetraMAX ATPG 生成测试向量再进一步用 Tessent Diagnosis 做失效诊断形成完整的 DFT→ATPG→Diagnosis 技能闭环。