DFT compiler

目录

SCAN

DFT Compiler

Getting Started

scan extraction

Hierarchical Scan Synthesis

Architecting Test Design

Configuring DFT Architecture

Architecting Scan Chains

Architecting Scan Signals

Architecting Test Clocks

Configuring Clock-Gating Cells


SCAN

DFT Compiler

Getting Started

        1. Setting up design environment

        定义库:包括link_library、target_library、symbol_library、search_path。如果是physical synthesis,还需要定义物理库文件,milkway library,以及定义tlu_plus_files

        变量:set_app_var hdlin_enable_rtldrc_info true,这个变量可以报告test design rules checking(DRC)每个违例对应的文件名字和行号,便于定位并解决问题。

        2. 读入design

                读入design文件,sdc文件,read_ddc、read_verilog、read_sdc等

        3. 设置scan type

                set_scan_configuration -style multiplexed_flip_flop(默认style)  

        4. 配置test cycle timing

                set_app_var test_default_delay 0

                set_app_var test_default_bidir_delay 0

                set_app_var test_default_strobe 40

                set_app_var test_default_period 100

        5. 定义dft信号

                set_dft_signal 

                -view existing_dft    # descriptive 描述性的,描述design中已经存在的信号。例如一个已经存在的functional 时钟信号,同时这个时钟在test mode下又作为scan时钟,就使用 existing_dft定义。

                -view spec    # prescriptive 指定的,描述一个在DFT插入时必须被执行的一个动作。它表明该信号或者连接还不存在,且insert_dft命令必须创建它。例如scan-enable信号网络必须在DFT insertion阶段被routed到所有scannable flip-flops。

                Define any clocks and asynchronous set and reset signals in the existing DFT view:
                dc_shell> set_dft_signal -view existing_dft -type ScanClock ...
                dc_shell> set_dft_signal -view existing_dft -type Reset ...
                If you have a dedicated scan-enable port, define it in the specification view:
                dc_shell> set_dft_signal -view spec -type ScanEnable \
                                                        -port scan_enable_port -active_state 1
                If no scan-enable port is identified, DFT Compiler creates a new scan-enable port.
        If you are using existing ports as scan-in and scan-out ports, define them in the specification view (even if they have existing functional logic connections):
                dc_shell> set_dft_signal -view spec -type ScanDataIn -port DAT_IN[7]
                dc_shell> ...
                dc_shell> set_dft_signal -view spec -type ScanDataIn -port DAT_IN[0]
                dc_shell> set_dft_signal -view spec -type ScanDataOut -port DAT_OUT[7]
                dc_shell> ...
                dc_shell> set_dft_signal -view spec -type ScanDataOut -port DAT_OUT[0]
                Otherwise, DFT Compiler creates new scan-in and scan-out ports as needed.

                定义DFT信号之后,创建一个test protocol

                dc_shell> create_test_protocol

        6. 执行scan综合

                             ​​​​​

        one-pass scan synthesis,使用 compile -scan或compile_ultra -scan,-scan 选项执行test-ready 编译,该过程直接映射为scan cells,这可以帮助排除逻辑上不可测电路,这是Synopsys 测试方法学的重要部分。综合出来的结果是unstiched scan cells的网表,称为unrouted scan design。

        scan cell替换,如果设计是HDL代码,scan 替换发生在初始mapping design到gates的阶段。如果设计已经是gate-level的网表,则scan 替换作为一个独立的过程触发。

        set_scan_element 当设置为false时,会影响scan替换和串链。

        如果scan_element false属性设置在unmapped sequential cell 或者是 一个mapped的nonscan cell,则该cell 永远不会被替换或者scan-stitched。

        如果scan_element false属性设置在test-ready cell (已经被替换为或者串链的scan cell)

        1. subsequent test-ready compile也不会把它unscan回来,保持scan cell状态。

        2. 在wire load mode 下,insert_dft命令会unscan it,把它变为nonscan cell,且不会     把它串到scan chain上。除非set_dft_insertion_configuraion -synthesis_optimization选项设置为none。

        3. 在topographical mode 下,insert_dft命令会保持该cell scan-replaced状态,不会把它变成nonscan cell,但是不会把它stitch到scan chains上。

        set_dont_touch 当设置true时。

        cell被保护起来,不允许改变,会间接的影响scan替换。

        1. 如果dont touch属性设置在test-ready cell上,cell 保持scan-replaced cell。如果该scan cell是一个有效的scan cell(DRC检查没有违例),则它会被stitch到 scan chains上去。如果不是,例如被 set_scan_element 设置为 fasle,则该cell 不会被stitch到chain上面。

        2. 如果dont touch属性设置在nonscan cell上,则该cell保持nonscan cell。它不会被 scan替换或者stitch到 scan chains上。Pre-DRC 会报出一个TEST-121的信息。但是如果nonscan cell 被认定作为shift register element,则可以被stitch到scan chains上面。

        3. 如果dont touch属性设置在unmapped sequential cell上,则工具会阻止该cell map。DFT insertion报错。Error: DFT insertion isn't supported on designs with unmapped cells.(TEST-269).

        The dont_touch attribute is ignored when an identified shift register is split by the scan architect; the head scan flip-flops of any new shift register segments are scan-replaced even if they have the dont_touch attribute applied.

        A dont_touch attribute on the top-level design does not affect scan replacement  of the design.

        注意:set_scan_configuration -exclude_elements选项可以排除scan stitching,但是不能阻止scan 替换,也不能造成excluded test-ready cells变成unscan cell。

        时钟或者异步复位不可控也会阻止nonscan cell替换为scan cell。

        compile -scan 命令执行映射sequential gates到scan flip-flops和latches。

        (insert_dft命令针对nonscan的网表执行nonscan cell到scan flip-flops和latches替换)。                set_scan_register_type设置影响compile -scan命令scan cell的选择和优化。该命令只会影响nonscan cell到scan cell的替换,它不会强制已经存在的scan cell被替换为指定的新的scan cell。

        所谓的test-ready compile 即是compile 命令加上 -scan 选项,在compile 阶段完成scan cell的替换,优点是优化阶段就把scan cell替换增加的面积考虑进来,同时也把预测的scan routing考虑进来,实现design的最大优化。在test-ready compile的时候,替换的scan cell SE 和 SI 引脚会被tie成0。

        Pre-DFT Test DRC

                 Pre-DFT test design rule checking(DRC)针对unrouted scan design 分析。

                (1)创建test protocol

                        可以使用先前用于RTL test DRC 定义的test protocol,但是仍然需要重新产生

                        dc_shell> create_test_protocol

                (2)运行pre-DFT test DRC

                        dc_shell> dft_drc

                        分析并解决violations,然后进入下一阶段scan insertion

        Preview Scan Insertion

        在进入scan insertion之前,执行preview_dft命令。This command generates a scan chain design that satisfies scan specifications on your current design and displays the scan chain design. 这可以帮助preview scan chain design而没有真正去综合它,如果必要的话这个时候还可以改变specifications。

                        dc_shell> preview_dft

                        产生的报告格式如下:

                        ****************************************
                        Preview DFT report
                        Design: P
                        Version: 1998.02
                        Date: Wed Apr 21 11:25:53 1999
                        ****************************************
                        Number of chains: 1
                        Test methodology: full scan
                        Scan style: multiplexed_flip_flop
                        Clock domain: no_mix
                        Scan chain '1' (test_so) contains 4 cells

        Inserting the DFT Logic

                        dc_shell> insert_dft

        Performing Post-DFT Optimization

        post-DFT 优化是在插入和映射新的DFT结构之后gate-level优化,insert_dft命令创 建scan chains是功能上基于zero-delay的设想,使用set_dft_signal命令描述的scan时钟波形。而post-DFT优化使用的是create_clock命令描述的时钟波形。为了在post-DFT优化时包含进scan clock timing,需要使用multicorner-multimode优化策略,在Design Compiler Graphical中定义一个mode,在这个模式中定义scan时钟。

        在Design Compiler wire load mode时,insert_dft命令默认自动执行gate-level post-DFT优化,可以通过配置如下命令关闭

                        dc_shell> set_dft_insertion_configuration -synthesis_optimization none

        在Design Compiler Topographical Mode时,insert_dft映射新的逻辑,但是不会执行post-DFT优化。这种模式下在insert_dft之后需要手动开启 incremental post-DFT。

                        dc_shell_topo> insert_dft

                        dc_shell_topo> compile_ultra -scan -incremental     ;# topographical

        Performing Post-DFT Design

        执行完DFT insertion之后,需要重新执行一遍DRC检查,用以确认没有新的违例一如到design中来。这称为post-DFT DRC。

                        (1) 保存design和test protocol

                        dc_shell> write -format ddc -hier -output my_design.ddc

                        dc_shell> write_test_protocol -output my_design_final.spf

                        (2) 执行post-DFT test DRC

                        dc_shell> dft_drc

                        (3) 报告scan结构

                        dc_shell> report_scan_path -view existing_dft -chain all

                        dc_shell> report_scan_path -view existing_dft -cell all

        Reporting

        所有的DFT设置命令都具有相应的reporting命令。如果想要报告哪些已经存在于design中,使用-view existing_dft选项。如果要报告哪些是insertion过程中指定设置的,使用-view spec选项。

                        dc_shell> report_dft_configuration

                        dc_shell> report_scan_configuration

                        dc_shell> report_dft_signal -view existing_dft

                        dc_shell> report_dft_signal -view spec

                        dc_shell> report_scan_path -view spec -chain all

                        dc_shell> report_autofix_configuration

scan extraction

        scan提取:读入一个已经插入scan之后的网表,分析并确定该design的scan chains结构,然后写出test model和test protocol。在执行scan extraction时,使用existing DFT view定义scan structure(使用-view existing_dft 选项),因为他们已经在design中存在了。

                1. 读入lib and design,配置scan style,定义basic DFT signals

                2. dc_shell> set_scan_state scan_existing

                3. 对已经存在的scan chain定义scan input 和 output

                dc_shell> set_dft_signal -view existing_dft -type ScanDataIn -port {T_SI1  T_SI2}

                dc_shell> set_dft_signal -view existing_dft -type ScanDataOut -port {T_SO1  T_SO2}

                dc_shell> set_dft_signal -view existing_dft -type ScanEnable -port TEST_SE

                dc_shell> set_scan_path chain1 -view existing_dft \

                                                                        -scan_data_in T_SI1 \

                                                                        -scan_data_out T_SO1

                dc_shell> set_scan_path chain2 -view existing_dft \

                                                                        -scan_data_in T_SI2 \

                                                                        -scan_data_out T_SO2

                4. 创建test protocol

                dc_shell> create_test_protocol

                5. 提取scan chain信息,使用dft_drc命令

                dc_shell> dft_drc

                6. 报告提取的scan chains的信息

                dc_shell> report_scan_path -view existing_dft -chain all
                dc_shell> report_scan_path -view existing_dft -cell all

Hierarchical Scan Synthesis

        在hierarchical scan综合flow,先完成block level的DFT insertion操作,然后合并这些已经完成的scan structure到更高的hierarchy level中。Test models代表已经完成dft插入的blocks。           

          hierarchical scan synthesis的优势:

        1. design较大,不适合single top-down DFT insertion

        2. 可以随时改变block内部的DFT structure而不依赖于higher level逻辑

        3. 可以作为独立的IP,复用在其他设计中

        已经插入DFT的较低层次的block称为core。core-level scan chains变成scan片段,将会被合并到top-level scan chain进行balance。

        在hierarchical scan synthesis flow中,工具为DFT-inserted core创建一个test model,其描述集成core到higher level design必要的信息。这些信息包括:

     port names,port directions,scan structure(scan chains,pipeline regs,terminal lockup latches),scan clock signals,asynchronous sets and reset signals,three-stae disable signals,other test-related signals,multiple test modes,test protocol information,such as  initialization,sequencing,and clock waveforms.

      Test models 可以使用core test language(CTL) 描述,因此test models一般被称为CTL models。CTL models可以有三种文件格式:

        .ddc 格式,这是一个二进制格式,通常是综合工具写出,其包含二进制的CTL models信息

        .ctl 格式,这是一个ASCII文件,包含ASCII Core Test Language 描述信息

        .ctlddc 格式,这是一个二进制格式,通常是综合工具写出,其只包含二进制CTL models描述

        注意:CTL model不包含SCANDEF信息,但是.ddc 文件可以同时包含CTL models信息和SCANDEF信息。CTL models不能用于测试向量生成,必须使用真实的网表用于生成向量。

        如下是一个Core-level的例子

        # configure libraries
        set link_library {* my_lib.db}
        set target_library {my_lib.db}
        # read and link the design
        read_verilog RTL/core.v
        current_design core
        link
        # perform test-ready compile
        compile -scan
        # configure DFT
        set_dft_signal -view existing_dft -type ScanClock -port clk -timing [list 45 55]
        # preview and insert DFT
        create_test_protocol
        dft_drc
        set_scan_configuration -chain_count 2
        preview_dft
        insert_dft
        # write out core-level design information
        write -format ddc -hierarchy -output DDC/core.ddc           ;# full design

        write_test_model -format ctl -output CTL/core.ctl              ;# ASCII CTL model
        write -format verilog -hierarchy -output GATES/core.vg    ;# ATPG netlist
        write_test_protocol -output SPF/core.spf                           ;# ATPG protocol                          

         在top level中读入并使用CTL models

        在top level design中,读入CTL-models core design以及其他design逻辑,然后执行scan insertion,工具自动合并core-level scan structures到top level scan structures。

        如下几种方式读入

        1. read_ddc core.ddc         ;# .ddc文件是core完整的二进制database,包含网表,约束,属性和CTL models信息

        2. read_test_model -format ctl -design core core.ctl   ;# ASCII CTL model信息

        3. read_verilog core.v

            read_test_model -format ctl -design core core.ctl

        4. read_test_model -fromat ddc core.ctlddc    ;# 二进制CTL model信息

        5. read_verilog core.v

            read_test_model -format ddc -design core core.ctlddc

        read_test_model命令会把CTL model信息附加到设计上。如果设计已经存在CTL model信息,则新读入的CTL model会取代已经存在的model。如果design不存在,则该命令会使用CTL model中的端口信息创建一个black-box design。在link top-level design时,工具会在search path中寻找.ddc文件来resolve任何unresolved references,而不会考虑.ctl或.ctlddc文件。

        可以使用list_test_model命令在linking之前或之后,来查看哪些designs具有CTL test model附加到他们上面。

        对于CTL-modeled cores,DFT和综合命令使用不同的信息。

        DFT 命令,比如 preview_dft 和 insert_dft 使用附加在CTL-modeled cores上的CTL model信息来取代网表信息。如果使用use_test_model -false命令,则CTL model信息就会被忽略,而使用nestlist 信息。

        综合命令,比如 report_timing 和 compile 使用CTL-modeled cores的网表,约束,属性信息。综合工具命令从不使用CTL model信息。

        警告:如果CTL-modeled core不包含netlist 信息,则该cores被当作black box对待,只能用于只有DFT insertion但没有综合优化的flow当中。

        下面是一个top-level core insertion的例子

        # configure libraries
        set link_library {* my_lib.db}
        set target_library {my_lib.db}
        # read two cores and top-level netlist, then link the design
        read_ddc DDC/core.ddc ;# contains netlist and CTL model information

        read_verilog GATES/IPBLK.vg ;# Verilog netlist for IP block
        read_test_model -format ctl -design IPBLK CTL/IPBLK.ctl      ;# attach CTL model to design
        read_verilog RTL/top.v
        current_design top
        link
        # perform test-ready compile
        compile -scan
        # configure DFT
        set_dft_signal -view existing_dft -type ScanClock -port clk -timing [list 45 55]
        # preview and insert DFT
        create_test_protocol
        dft_drc
        set_scan_configuration -chain_count 2
        preview_dft
        insert_dft
        # write out top-level design information
        write -format ddc -hierarchy -output DDC/top.ddc                 ;# full design
        write -format verilog -hierarchy -output GATES/top.vg          ;# ATPG netlist
        write_test_protocol -output SPF/top.spf                                ;# ATPG protocol

       常见的应用包括,IP供应商给的PHY,一般PHY物理媒介层PMA已经是插入scan之后的设计,而我们在应用时,会使用PHY的CTL model和顶层的逻辑重新做scan structure,包括scan chain的balance。

        Linking Test Model To Library Cells

     如果一个复杂的library cells具有内置好的scan chains,则Core Test Language(CTL) test models必须被link到该library cells,用于DFT Compiler在top level 连接scan chains。可以使 用如下命令将test model信息注释到library cells上,之后还可以写出包含test model信息的库.db文件。         

        read_lib lib_file.lib -test_model [lib_cell_name:]model_file.ctl

        write_lib lib -output lib_file.db  

        如果要link多个test model到多个cells在一个library文件中,支持-test_model选项后面的值为一个list,如下所示:

        read_lib lib_file.lib -test_model [list \
                [lib_cell_name:]model_file1.ctl \
                [lib_cell_name:]model_file2.ctl]

      如果只有编译库 .db 文件,则可以使用read_test_model命令来link test model到已经在memory中的library cell或者design上。如下所示:

        read_test_model -format ctl -design design_name model_file.ctl
        read_test_model -format ctl -design lib_cell_name model_file.ctl
        read_test_model -format ctl -design logic_lib/lib_cell_name model_file.ctl

     如果subdesigns是通过extracted timing models(ETMs)建模抽取的,同样可以link CTL test model到这个ETM library cells上面,就像是使用logic library cells一样。

        实例:有些memory就是把mbist 电路放在wrapper里面作为一个单独的macro使用,这时候就会在里面提前做好scan电路并串链,这时候就可以向上面那样利用这个lib的model文件,在顶层进行scan structure重建和scan chain balance。

Architecting Test Design

Configuring DFT Architecture

        set_scan_configuration 命令设置全局的scan特征,例如:

        scan类型和方法;scan链的长度和数量;如何处理多个时钟;内部和外部三态net;双向端口

        设置独立的scan path

        set_scan_element:设置特殊的时序器件不进行scan cell替换和串链。

        set_scan_path:针对某个特殊扫描链设置特殊属性,例如扫描链名字,资格,链长,时钟关系,顺序。

        set_autofix_element:使用这个命令控制顶层设计双向端口。

Architecting Scan Chains

        使用set_scan_configuration 命令设置扫描链。

        控制扫描链的长度:

        设置扫描链长度的限制,可以考虑到与引脚可用性或测试向量深度相关的设计约束。链长太长会增加移位周期数量,进而影响测试时间。

        -max_length:设置最大链长不超过某个阈值。

        -exact_length:设置确定的链长度。

        控制扫描链的数目:

        扫描链的个数会影响压缩率,进而影响测试时间。一般而言短链越多,压缩率就会越高,测试覆盖率就会越低。

        -chain_count:设置最大的扫描链个数。

        -count_per_domain:设置每个时钟域下最大的扫描链个数。 

        定制特殊扫描链特性:    

        使用set_scan_path命令针对个别扫描链设置一个或多个额外的需求。例如:1. 指定一个扫描链的名字;2. 分配扫描单元,扫描片段和子设计扫描链到扫描链中,并指定扫描链的顺序;3. 指定一个专门的扫描输出端口;4. 限制扫描链中只包含指定的元素或者使能DFT Compiler平衡扫描链;5. 指定各自确定的扫描链长度;6. 给时钟域分配扫描链。

        扫描链扫描单元不能属于多于一个扫描链。该命令的选项不是增量的。当set_scan_path出现冲突时,preview命令(preview_dft)和扫描插入命令(insert_dft)使用最近的命令。

        如下图所示,posedge CLK2触发的flip-flop到posedge CLK1触发的flip-flop 和 negedge CLK2触发的flip-flop到negedge CLK1触发的flip-flop 之间需要插入lock-up latch 来解决clock skew 问题(hold timing问题);negedge CLK1 到 posedge CLK1之间不需要插入lock-up latch,因为已经有半个周期的余量不会有hold问题;negedge CLK2 flip-flop 到posedge CLK1 flip-flop 是违例的顺序;只有共享codec I/O flow 结合pipeline registers情况下,posedge flip-flop(CLK1 or CLK2)到negedge flip-flop(CLK1) 才是有效的顺序。

        

          multibit寄存器,默认情况下insert_dft命令对于multibit组件内的cells当作分立的时序单元,如果必要的话,这些单元可以被重新排序,分离,重新平衡扫描链之间长度。如果需要将这些sequential multibit组件视为一个扫描段(不可拆分,排序)以便保持分组和顺序关系,需要使用如下命令设置:

        set_scan_configuration -preserve_multibit_segment true

        这种情况下,在multibit组件中的时序单元就不会为了平衡扫描链长度目的而被分离开。

        基于物理位置的重排序和再分配

        在DCG模式下,工具会根据物理位置重新排序扫描单元以便最小化线长,可以减少绕线阻塞问题。想要使用这个特性功能,需要在初始和增量compile_ultra命令中使用-spg和-scan两个选项。

        使用set_optimize_dft_options命令控制再分配的方法。默认使用 multi_directional 再分配方法。

        set_optimize_dft_options -repartitioning_method single_directional 

        执行重排序,但是不执行再分配:

        set_optimize_dft_options -repartitioning_method none

        禁止重排序和再分配:

        set_app_var test_enable_scan_reordering_in_compile_incremental false        

       控制路线排序

        使用set_scan_path命令来显式控制扫描链排序。可以指定nonscan单元或者scanned时序单元的路线顺序。每个命令产生一条扫描链。

        可以提供部分或则完整的扫描顺序,使用-complete true选项表明设置了一个完全的扫描链。DFT Compiler不会再添加任何单元到该扫描链上。如果指定的是部分扫描链排序,DFT Compiler会在指定的部分扫描链后面添加扫描单元。

        DFT Compiler针对设置的扫描顺序会进行验证,验证项包括:

        扫描单元归属:同一个扫描单元不能存在于多个扫描链中。

        Error: Scan chains ’%s’ and ’%s’ have common elements. (TESTDB-256)
        Common elements are: %s

        扫描单元时钟顺序:DFT Compiler verifies that the active clock edge of the next scan cell occurs concurrently or before the active clock edgeup latch. 如果多路复用寄存器不满足该要求,DFT Compiler会重新排序违例mixed-clock 扫描链,并且会在perview_dft命令执行阶段触发一个Warning信息 。

        Warning: User specification of chain ’%s’ has been reordered. (TEST-342)

        扫描链单元时钟混合:DFT Compiler验证所有的扫描单元具有相同的时钟,除非设置了时钟混合。如果出现违例,在preview_dft命令执行阶段报告如下warning信息。如果没有禁止扫描lock-up latch插入,DFT Compiler会在两个时钟域之间插入一个扫描latch-up latch。

        Warning: Chain ’%s’ has elements clocked by different clocks. (TEST-353)

        黑盒单元:DFT Compiler会验证设置的单元是否是有效的扫描单元。如果时序单元drc违例或者具有scan_element false属性,DFT Compiler认为这是一个黑盒单元,preview_dft命令执行过程中报告如下信息。

        Warning: Cannot add ’%s’ to chain ’%s’. The element is not being scanned. (TEST-376)

        DFT Compiler只会创建没有违例单元的要求的扫描链。

        Retiming Scan-Ins and Scan-Outs to the Leading Clock Edge

       有些情况下,在一个层次化的模块中包含混有上升沿触发和下降沿触发寄存器的扫描链。当这些模块扫描链包含在更高层次的设计中来形成更长的扫描链,半周期路径跨时钟沿在扫描链中就可能存在。难以满足高频时序收敛。

        在组合模块级扫描链时,为了避免这种半周期路径,使用set_scan_configuration -add_test_retiming_flops 选项。DFT Compiler会根据需要针对在扫描链的开始或结尾测试时钟使用trailing-edge-triggered 的寄存器,添加一个测试时钟leading-edge-triggered的寄存器。对于returen-to-zero 时钟,使用rising-edge 寄存器来重新定时leading edge。对于return-to-one时钟,使用falling-edge 寄存器来重定时leading edge。

        Mixed Edges

        如果扫描链中存在反向和非反向的情况。例如上游寄存器时上升沿触发的,下游寄存器是下降沿触发的,此时如果是一个positive时钟脉冲首先记录一个值到上游寄存器。然后,在相同的脉冲的下降沿,该时钟脉冲也会记录一个相同的值到下游寄存器,这样就会导致这两个寄存器在移位之后保持的值是相同的值,不符合预期结果。假如想要移入寄存器值为 “01” ,positive 时钟脉冲(return-to-zero clock)在两个脉冲之后,如图所示,在edge 3时把需要移位的序列值的倒数第二位值记录到上游寄存器中,但是在edge 4 下游寄存器又采样到上游寄存器保存的值,而没有采样到需要的值(需要的值是序列值的最后一位),之后两个寄存器的值均为 “00” ,不符合预期。改为negative时钟脉冲(return-to-one clock)之后,下游寄存器在edge 1 采样一个复位值(这个值忽略),在edge 3 采样到需要序列值的最后一位值,而edge 4 采样需要移位值序列的倒数第二位值。

        如果必须使用mix edges,扫描链中只能存在一处时钟相反且时钟上游寄存器在时钟trailing edge触发有效。下游寄存器必须是leading edge 触发有效,这样可以保证在相同时钟周期内的trailing edge不采样,从而保持其在当前周期的leading edge 采样到的值。移位过程中最后一个时钟周期的trailing edge会把序列值的最后一位值移入到上游寄存器中。对于positive pulse时钟,其leading edge为rising edge,下降沿触发的寄存器必须首先clocked;对于negative pulse时钟,其leading edge为falling edge,上升沿触发的寄存器必须首先clocked。

        一般而言,项目中使用的是positive pulse clock,因此leading edge为rising edge,如果扫描链使用mix edge方式,下降沿触发的寄存器都放在扫描链前半部分,上升沿触发的寄存器放在扫描链后半部分。

Architecting Scan Signals

        使用set_dft_signal命令指定scan信号。

        1. 使用这个命令用于扫描插入和设计规则检查。当执行完insert_dft命令完成这些端口的连接,DFT Compiler会在这些端口上放置必要的signal_type属性以便post-insertion设计规则检查。

        2. 如果读入的是ASCII的网表并需要执行设计规则检查,可以使用 set_dft_signal -view existing_dft 命令。

        3. 如果设计中端口已经存在并被连接,可以使用 set_dft_signal -view existing_dft 命令,DFT Compiler不会再进行连接操作。

        4. 如果设计中连接不存在,并且期望DFT Compiler进行连接操作,使用 set_dft_signal -view spec 命令。

        通常clock,test_mode 和 reset端口都是代码或网表中已经存在的,使用-veiw exsiting_dft

        通常scan-in/out 端口都是代码或网表中不存在的,使用-view spec

        一般情况下,

        如果需要的信息是用于pre-insertion DRC,那么需要使用-view exsiting_dft 指定;

        如果需要的信息是用于构建DFT结构,那么需要使用-view spec 指定。

        

        Using -type Constant versus Using -type TestMode

        1. Constant信号定义仅仅明确指出在 Test Mode下的信号值,它不会指明关于该信号值在功能摸下的任何信息。如下图所示,在Test Mode下,CLK_EN必须为1,否则时钟就不通,但是在Functional mode下不关注此信号值状态,因此使用Constant type指明。

        2. TestMode信号定义明确指出在test mode和functional mode下的值。如下图所示,在 Test Mode 下RST_DIS必须为1,可以禁止复位操作;在Functional Mode下需要为0,保证复位正常通过。

         这种差异影响verification setup file的产生,该文件通过set_svf命令指定。验证设置文件包含关于功能模式中任何定义DFT信号值的信息。这允许在等价性验证时关闭掉DFT Compiler添加的测试逻辑。

        Constant信号定义不会导致任何验证设置文件指令,因为它不包含关于功能模式下该信号的值,例如CLK_EN的值在功能模式下并未指明。

        TestMode信号定义会触发验证设置文件指令,因为它指明了功能模式下该信号的值。这会导致如下验证设置文件指令:

        guide_scan_input \
                -design { top } \
                -disable_value 0 \
                -ports { RST_DIS }

       可以让工具创建专门的scan_in/out 端口,也可以共享功能的端口作为scan_in/out,必要时插入control或mux逻辑。

Architecting Test Clocks

        定义 Test Clocks

        dc_shell> set_dft_signal -view existing_dft -type ScanClock -port CLK -timing {45 55}  

        对于所有的test clocks,时钟周期都是通过变量 test_default_period 来定义。     

        在某些情况下,DFT插入时编译器可能需要连接到一个现有的扫描时钟网络。例如:

                • Pipeline clock connections for automatically inserted pipelined scan data registers
                • Test point clock connections for test points with flip-flops
                • ATE clock connections for DFT-inserted OCC controllers
                • Codec clock connections for serialized and streaming scan compression
                • Self-test clock connections to the LogicBIST self-test controller and codec

        默认情况下,DFT Compiler连接使用-view exisiting_dft 指明的端口定义的时钟信号。可以使用-hookup_pin 选项连接一个内部的引脚。例如:

        dc_shell> set_dft_signal -view existing_dft -type ScanClock -port CLK -timing {45 55}
        dc_shell> set_dft_signal -view spec -type ScanClock -port CLK -hookup_pin UCLKBUF/Z

        有效扫描链顺序要求

        Cells clocked by later clock edges are placed before cells clocked by earlier clock edges. 这可以保证扫描链经过移位操作之后所有的扫描单元能够得到期望的值。

        

        

         如上图所示,扫描链上earliest edge(4)触发的寄存器放在最后面,latest edge(1)触发的寄存器放在最前面,这样经过一个时钟周期后,每个寄存器采样到期望的值。(上面都是基于ideal timing waveform来分析的)。

        跨时钟域之间插入Lock-Up Latch

        如果使用clock mixing 或者 clock-edge mixing 串链,跨时钟域的接口不同时钟之间可能有skew问题。如下图所示:

        

        如果CLK2的时钟latency较大,FF1到FF2可能有hold问题,FF2采样到当前周期的数据,而不是前一个周期的数据。                              

         可以在两个寄存器之间插入一个由前一个扫描单元时钟反相触发的lock-up latch解决hold问题。

         

        如下图所示,CLK1高电平期间,lock-up latch锁存住前一个周期的扫描数据,有效地延长了输出数据到源时钟(CLK1)的下一个沿。       

        

         Trailing-edge扫描单元之间插入lock-up latch,类似于leading-edge扫描单元之间插入lock-up latch,如下图所示:

        

         不同时钟沿触发的扫描链处理方式:

        当扫描单元存在使用时钟不同边缘触发时,DFT编译器不插入锁存锁存器。第二个扫描单元使用较早的时钟边缘捕获数据,DFT Compiler假设理想时钟边缘计时的差异足以避免保持时间冲突。 

        当扫描单元以相同的时钟边缘触发时,DFT编译器插入一个锁存锁存器,以避免由于时钟偏斜而造成的潜在保持时间冲突。

        在大多数设计中,所有的测试时钟使用完全相同的returen-to-zero时钟波形,这种情况下,扫描链里扫描单元的顺序就简单多了。扫描单元排序方式为,所有下降沿触发的扫描单元都放在前面,所有上升沿触发的扫描单元都放在后面。Lock-up latch插入到不同时钟域之间的上升沿到上升沿的扫描单元之间和下降沿到下降沿的扫描单元之间,下降沿到上升沿之间不插入lock-up latch,虽然两个扫描单元之间来自不同的时钟域,因为DFT Compiler假设理想时钟边沿计时的差异足以避免保持时间冲突。如下图所示,CLK1和CLK2为不同时钟域时钟,但是在shift阶段,使用完全相同的测试时钟,(1)和(2)寄存器均为trailing edge触发的flip-flops,因此放在leading edge触发的flip-flops(3)和(4)之前面,又因为(1)和(2)来自不同的时钟域,因此插入一个latch来决绝clock skew问题,同理(3)和(4)。(2)和(3)之间因为有半cycle余量,容易满足hold timing问题,所以不插入latch。

           

         

        默认情况下,跨时钟域,DFT Compiler会自动执行在扫描中插入lock-up latch。如果不想要插入,使用如下命令关闭插入lock-up latch功能。set_scan_configuration -add_lockup false

        可以在每条扫描链的尾部插入lock-up latch,可以帮助解决core整合的时候潜在的block-to-block 时序问题。set_scan_configuration -insert_terminal_lockup true。比如codec在single chain模式下,每条扫描短链串行连接在一起,这个时候这个terminal lockup 就可以很好的解决hold timing 问题。terminal lockup的时钟使用链尾flip-flop时钟取反后时钟。

        默认情况下,lockup 类型是一个电平敏感的lock-up latch。如果想要使用lock-up flip-flop,通过如下命令设置:set_scan_configuration -lockup_type flip_flop

                

        为了锁存操作成功,当前扫描单元的下降边沿必须在下一个扫描单元上升边沿之后或同时发生。当DFT编译器在扫描链单元之间插入锁存器时,这个要求总是需要内在地满足。

        Automatically Creating Skew Subdomains Within Clock Domains

        默认情况下,工具对于一个给定的时钟源驱动的所有时钟网络当成same-skew时钟信号,这个时钟下面的所有扫描单元之间属于同一个时钟域,不会插入lock-up latch。如下图所示,test mode下FF1,FF2,FF3,FF4同属于CLK时钟域,四个寄存器串链到一起。

             

         需要注意的是,mux本身就增加了时钟网络延时。如果在时钟树综合平衡时测试模式时钟延时等价的到四个寄存器,则没有时序问题。然而,在时钟树综合时可能不会考虑测试模式下用于扫描移位的时钟延时,潜在的hold违例可能出现在FF3/SI上面。

        为了避免这种潜在的hold time违例,可以将来自于mux单元之后下游的扫描单元视为一个skew不同于当前时钟域的子域(subdomain)。

        set_scan_configuration -internal_clocks multi

        该命令会指示insert_dft命令做如下操作:

        1. 识别时钟网络上所有的多输入门单元(例如 MUX 单元)。ICG不被考虑。

        2. 在这些门单元输出端口创建内部时钟。

        3. 将这些内部时钟视为父时钟的skew subdomain。

        这个特性只是影响扫描链的结构,对于所有其他DFT操作时钟网络仍然是单独的测试时钟域,包括写test protocol。

        上述命令之后的结果取决于当前clock-mixing设置,如果设置为no_mix或者mix_edges clock-mixing模式,insert_dft命令会分离扫描链到各个内部时钟。如下图所示:

        

         如果设置为mix_clocks或者mix_clocks_not_edges clock-mixing模式,insert_dft 命令可能会在扫描单元之间插入lock-up latch来保证来自于不同内部时钟触发的扫描单元可以在相同的扫描链上。如下图所示:

        

         如果禁止全局的clock mixing,仍然可以通过使用-mix_internal_clock_driver选项针对每个父时钟域为其内部时钟使能clock mixing。

        dc_shell> set_scan_configuration \
                                -internal_clocks multi \
                                -clock_mixing no_mix | mix_edges \
                                -mix_internal_clock_driver true

          可以使用set_dft_signal命令创建skew subdomain。该命令优先级更高,如下在扫描配置命令中关闭internal clocks,但是后面使用set_dft_signal设置的仍然有效。

        dc_shell> set_scan_configuration -internal_clocks none
        dc_shell> set_dft_signal -view existing_dft \
                                -type ScanClock -timing [list 45 55] \
                                -internal_clocks multi -port CLK  

       Manually Creating Skew Subdomains at Associated Internal Pins

       Manually Creating Skew Subdomains With Scan Skew Groups  

       Defining Scan Chains by Scan Clock

        可以使用set_scan_path命令中-scan_master_clock选项定制扫描链只特定于某一个扫描时钟域。如下命令设置扫描链 c1 只包含 clk1 上升沿触发的寄存器。

        dc_shell> set_scan_path c1 -view spec -scan_master_clock clk1 -edge rising

Configuring Clock-Gating Cells

        In a clock-gating cell, a control point is a testability logic gate that allows the clock to be
forced always-active when a test control signal is asserted.

        • The control point can be placed before or after the latch element.
        • The control signal can be driven by the scan-enable or test-mode signal.

        

        使用set_clock_gating_style 命令配置:

        1. -control_point:指定相对于latch在哪里插入控制点,none,before,after选项,默认none

        2. -control_signal:指定使用什么控制信号,test_mode或san_enable

        • The “before” control point ensures that no combinational path exists from the control signal input port to the downstream clock pins of the scan cells.
        • If the “after” control point is used and both phases of the clock are gated in the design, there is no time at which the control signal can cleanly toggle without truncating an active clock pulse.
        • Most integrated clock-gating (ICG) cells are implemented using control points before the latch.

        • Scan-enable控制信号可以保证门控时钟在shift阶段一直有效,但是在capture时功能时钟门控路径仍然可以被测试到。

        • Test-mode控制信号阻碍了功能时钟门控路径测试,需要插入额外的测试逻辑来保证覆盖到。其优势是可以提高测试覆盖率,降低了向量复杂度。

        Scan-Enable Signal Versus Test-Mode Control Signal

        • A scan-enable signal is asserted only during scan shift.
        • A test-mode signal is asserted during the entire test (scan shift and scan capture). 

        使用scan-enable信号作为时钟门控比使用test-mode信号可以提供更高的覆盖率,因为功能门控路径在扫描capture模式下进行了练习(练习的目的就是实现打开/关闭时钟)。

        

        如果使用test_mode信号作为门控时钟控制信号,test-mode信号在整个测试期间一直有效(shift和capture阶段),这就完全旁路了功能门控时钟路径,阻碍了这部分电路在capture模式被测试到,如图所示。此外,被test-mode 起作用的门控时钟使能信号使能测试stuck-at 0 故障(假设test_mode信号高有效)。

        

         假如使用tes-mode信号作为门控时钟使能信号,需要添加额外的测试逻辑来覆盖这部分电路,如下图所示:

        

         在测试模式下,XOR tree观测来自于一个或多个功能门控信号;使用专门的观测寄存器来capture XOR tree的输出。该观测寄存器需要串到扫描链上,观测寄存器的输出不会连接功能电路。使用AND或NAND 门可以防止观测电路逻辑在mission模式下消耗功耗。

        使能时钟门控观测逻辑插入使用如下命令:

        dc_shell> set_clock_gating_style \
                                -control_signal test_mode \
                                -observation_point true

        默认情况下,XOR tree的最大深度为5,表示最大可以有32(2的5次幂)个时钟门控控制信号通过一个观测寄存器可以被观测到。可以使用如下命令设置XOR tree的最大深度:

        dc_shell> set_clock_gating_style \
                                -observation_logic_depth logic_depth       

        如果depth设置的太小,工具就会创建更多的XOR tree和相应的寄存器,以便提供足够多的XOR 输入端口来容纳所有的门控信号。这会增加不小的面积和功耗开销。

        如果depth设置ide太大,XOR tree可以提供大量的输入端口用于门控信号观测,但是这会导致逻辑延时较大,不利于时序收敛。

        Inferred and Instantiated Clock-Gating Cells

        1. 使用Power Compiler在RTL综合阶段插入时钟门控,细粒度时钟门控。工具会把ICG插在靠近leaf-reg的clock tree上,并且会把ICG标记上属性,在DFT-insertion时,hookup ICG的TE端到相应的控制信号上面。compile命令中使用-gate_clock选项,工具插入ICG,并把ICG的TE端tie为0。

        2. 可以在RTL中例化一些全局的ICG,这些ICG可以控制某时钟域局部或全局的时钟开关来降低功耗,例化的ICG的TE端需要手动连接到全局测试模式时钟门控信号。比如dft_mode、dft_glb_gt_se端口上面。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值