Академический Документы
Профессиональный Документы
Культура Документы
October 2012
Independent control by ATPG of each clock domain to improve coverage, reduce pattern count, and
achieve safe clocking with minimal user intervention
Enable slow or fast clocks during capture for application of slow and at-speed patterns
Scan-programmable clock waveforms generated within a wrapped core are ideal for generating
patterns at the core level that can be retargeted to the top level while simultaneously testing
multiple cores without conflicts in how clocks are controlled within each core
This application note describes a practical PLL clock control circuit design and demonstrates its use in a
test case using Tessent® ATPG tools.
A complete test case that demonstrates the use of this clock control design in a circuit is described in the
last section. The test case is available from Mentor Graphics by downloading it from the following
SupportNet page: http://supportnet.mentor.com/reference/tutorials/index.cfm?id=MG576857
The mux should be controlled by the test mode signal as shown in Figure 1.
The clock control design described in this application note should supply the clock when in test mode
while using the clock output of the PLL as the fast clock for at-speed capture. A top-level slow clock will
be used for shift and slow capture. The reference clock supplied to the PLL is a free-running clock.
It is also recommended not to flatten the clock control blocks during layout in order to keep the test
procedure file definition easier post layout.
The following table describes the functionality of pins at the top of the clock control block as well as some
of the internal signals:
Static signals that do not change during the test session can be controlled through on-chip controllers
(such as JTAG) or other means in order to reduce the need for top-level pins.
In version 1.1 of the clock controller RTL, a flop was added on the input side of the synchronization cell
and clocked by SLOW_CLK. Since SCAN_EN normally fans out to the entire circuit and may arrive after
FAST_CLK, the flop on SLOW_CLK ensures that SCAN_EN is not synchronized by the fast clock until
SLOW_CLK is pulsed thus reducing the risk of a race condition.
Note that the scan enable synchronization logic is not used for slow capture mode which uses
SLOW_CLK for shift and capture.
In the RTL description, the synchronization cell is described as module “tessent_sync_cell” so that it can
be replaced with a technology specific synchronization cell from the appropriate library.
module tessent_sync_cell (d, clk, q);
input d, clk;
output q;
reg [1:0] R;
In order to ensure proper DRC analysis and simulation, the output of the clock gater cell driven by the
synchronization logic should be defined as a free-running internal clock. This is indicated by an arrow in
Figure 2 and ensures correct simulation of the logic during load_unload and avoids DRC violations.
wire te_fe;
reg latch;
The shift register block contains the programmable scan cells which will be loaded during shift in order to
pulse the internal clock during the cycle required by ATPG.
The AND gate on the input of the shift register loads zeros into the register during capture to clear it. The
EN output signal of the shift register block is used in the clock control block (Figure 2) to turn off the fast
clock to the shift register once the shift register has been unloaded. This ensures switching from the fast
capture clock to slow shift clock without risk of glitches and disturbing the values present in the shift
register. It also ensures that the shift register flip-flops have stable values when the ATPG tool simulates
the load_unload procedure and eliminates unnecessary DRC violations.
A lockup cell on the SCAN_OUT output of the shift register block ensures proper shift operation when
several clock control blocks are concatenated into a scan chain or when scan cells from chains with
different clocks are combined with the shift register flops. This is important because as described in
section 2.1, each clock control block forms a locally balanced clock tree which is not balanced with any
other chain segment.
A key feature of the shift register block is the ability to bypass up to 3 shift registers in order to reduce the
number of bits that must be specified in the patterns. This is done by setting the CAP_CYCLE_CONFIG
signals per the following table:
0 0 1
0 1 2
1 0 3
1 1 4
Limiting the number of condition bits to only those needed for the longest capture sequence reduces the
overall shift cycles as well as the number of scan bits that must be specified for each pattern. Minimizing
In addition to limiting the overall number of specified scan cells, it is also important to limit the number of
scan cells that must be specified in each shift cycle. When using compression, the output of the
decompressor loads all chains simultaneously one shift cycle at a time. When stitching the shift register
sub-chains into the design scan chains, care should be taken to avoid the alignment of multiple condition
bits into the same shift cycle. One approach is to stitch the condition registers into an uncompressed scan
chain which is directly loaded. For designs in which all scan chains are compressed, placing condition bits
at the beginning, end or similar cell number of all scan chains should be avoided so that it is not
necessary to load many specified bits in the same shift cycle.
When operating in functional mode (TEST_MODE = 0), all clock gaters are disabled to reduce
power.
In shift mode (SCAN_EN = 1), SLOW_CLOCK is used to load/unload scan chains which
include the condition bits in ShiftReg.
In slow capture mode (FAST_CAP_MODE = 0), SLOW_CLOCK is used to capture data into
scan cells and to shift the condition bits in ShiftReg
In fast capture mode (FAST_CAP_MODE = 1), FAST_CLOCK is used to capture data into scan
cells and to shift the condition bits in ShiftReg
(* version=1.1 *)
module tessent_atpg_clock_controller (FAST_CLK, SLOW_CLK, TEST_MODE, SCAN_IN, SCAN_EN,
FAST_CAP_MODE, CAP_CYCLE_CONFIG, SCAN_OUT, CLK_OUT);
input FAST_CLK, SLOW_CLK, TEST_MODE, SCAN_IN, SCAN_EN, FAST_CAP_MODE;
input [1:0] CAP_CYCLE_CONFIG;
output SCAN_OUT, CLK_OUT;
wire SCAN_EN_sync;
wire ShiftReg_EN;
wire ShiftReg_SCAN_OUT;
wire SHIFT_REG_CLK_en;
wire SHIFT_REG_CLK_G;
wire SHIFT_REG_CLK;
wire CLK_OUT_source;
wire CLK_OUT_en;
wire CLK_OUT_G;
reg SCAN_OUT;
reg SE_SLOW_CLK;
tessent_cgc cgc_SHIFT_REG_CLK
(.clk(FAST_CLK), .fe(SHIFT_REG_CLK_en), .te(1'b0), .clkg(SHIFT_REG_CLK_G));
tessent_clk_mux clock_mux_SHIFT_REG_CLK
(.a(SHIFT_REG_CLK_G), .b(SLOW_CLK), .s(SCAN_EN | ~FAST_CAP_MODE), .y(SHIFT_REG_CLK));
tessent_clk_mux clock_mux_CLK_OUT_source
(.a(FAST_CLK), .b(SLOW_CLK), .s(TEST_MODE & ~FAST_CAP_MODE), .y(CLK_OUT_source));
tessent_cgc cgc_CLK_OUT
(.clk(CLK_OUT_source), .fe(CLK_OUT_en), .te(1'b0), .clkg(CLK_OUT_G));
tessent_atpg_cc_shift_reg ShiftReg
(.CLK(SHIFT_REG_CLK), .SCAN_EN(SCAN_EN), .CAP_CYCLE_CONFIG(CAP_CYCLE_CONFIG),
.EN(ShiftReg_EN), .SCAN_IN(SCAN_IN), .SCAN_OUT(ShiftReg_SCAN_OUT));
endmodule
wire te_fe;
reg latch;
reg [1:0] R;
assign y = (s) ? b : a;
endmodule
assign EN = |FF;
assign SCAN_OUT = FF[0];
endmodule
Gates: 10k
Clocks: 3 internal clocks
Scan chains: 12
o 11 design chains
o 1 clock control condition bits
Scan flops: 446
Total faults: 48k
Test Coverage:
o Stuck-at: ~99%
o Transition: ~93%
design
o gates
Gate-level netlist
Synthesized clock controller
o rtl
clock_controller
Clock controller RTL
Simulation test benches and scripts
Synthesis script
pll
Simple RTL simulation model
dofiles
o Command dofile
o Test procedure file
o Clock control definitions for slow and fast capture
library
o atpg
ATPG library
o liberty
Liberty file
o synopsys
Synthesis library (not available in test case)
o verilog
Simulation library
logfiles
o Generated ATPG logfiles
patterns
o Generated pattern files
o Simulation scripts for slow and fast capture
Step 2
o Insert clock control logic and PLL
Steps 3 & 4
o Create patterns with internal clocks (slow and fast capture)
Steps 5 & 6
o Create and insert EDT hardware
o Synthesize EDT hardware
Steps 7 & 8
o Create compressed patterns with internal clocks (slow and fast capture)
run_vsim_slow_capture
run_vsim_fast_capture
For slow capture test, the test bench in the referenced directory sets the CAP_CYCLE_CONFIG signals
to 01 and loads the condition bits to generate a single clock pulse during capture. The waveform for slow
capture test is shown in Figure 6.
run_synthesis
This will run a simple synthesis based on the ADK library and create the following gate-level netlist:
design/gates/clock_controller_gate.v
1.run_atpg_pre_clock_control
The baseline stuck-at test coverage is ~99% while transition fault test coverage is ~99%.
2.run_clock_control_insertion
See the insertion dofile for details of various commands in Tessent Shell for insertion and design editing.
3.run_atpg_slow_capture
read_verilog design/gates/cpu.v
read_cell_library library/atpg/adk.atpg
set_current_design cpu 1
# Define scan chains
add_scan_group grp1 atpg.testproc
dofile scan_setup.dofile
dofile pre_drc.dofile 2
# Run Design Rule Checks
set_system_mode analysis 3
# Read Clock Control Definitions
read_procfile $env(atpg_mode).ccd
# Run ATPG
create_patterns 4
# Save pattern
report_patterns > patterns/patterns_report_$env(atpg_mode).txt
write_patterns patterns/pat1_$env(atpg_mode)_serial.v -verilog -serial -replace
write_patterns patterns/pat1_$env(atpg_mode)_parallel.v -verilog -parallel -replace
exit
scan_setup.dofile
# Define external clocks
add_clocks 1 rst_in
2.1
# Define input constraints
add_input_constraints -c1 rst_in
pre_drc.dofile
add_black_box -module pll
if {$env(atpg_mode) == "slow_capture"} {
# Slow-Speed Capture Test Mode
add_input_constraints -c0 fast_capture_mode
} elseif {$env(atpg_mode) == "fast_capture"} {
3.1
# At-Speed Capture Test Mode
add_input_constraints -c1 fast_capture_mode
set_fault_type transition -no_shift_launch
set_output_masks on 3.2
add_input_constraints -all -hold
set_external_capture_options -capture_procedure ext_fast_cap_proc
add_clocks 0 clock_control_i1/cgc_SHIFT_REG_CLK/clkg -internal -free_running \
-pin_name int_clkg_1
add_clocks 0 clock_control_i2/cgc_SHIFT_REG_CLK/clkg -internal -free_running \
-pin_name int_clkg_2
add_clocks 0 clock_control_i3/cgc_SHIFT_REG_CLK/clkg -internal -free_running \
The dofile first reads the netlist and cell library files [1] and sets the current design to the “cpu” module.
The next step [2] is to define the original scan structure of the design (prior to clock control logic
insertion). In section [2.1], the external reset is defined and constrained and section [2.2] defines the
original scan chains in the design.
Command [3] calls the dofile that was generated during clock control logic insertion to setup the new scan
chain as well as ATPG commands for slow and fast capture.
The conditional section at the top of the generated dofile [3.1] defines setting specific to each test mode.
For slow capture test, only the proper constraint for at_speed_capture_mode is needed. For fast capture
[3.2], transition test ATPG commands (fault type, mask PO, hold PI) are defined. Additionally, an external
capture procedure (ext_fast_cap_proc) is defined to ensure proper pulses on external clocks are written
to the pattern file. This step also defines the output of the internal clock gates used for fast capture as
free-running internal clocks. Note that internal clocks are defined with the –pin_name switch in order to
create short aliases for use in the test procedure file.
Section [3.3] defines the internal clocks on the output pin of the clock control logic (CLK_OUT) as shown
in Figure 2. Additionally, the output of the PLL must be defined as a free-running internal clock as this
signal supplies the fast clock input of the clock controllers. As seen on the first line of the dofile, the PLL
module is defined as a black box which is typically how PLL blocks are defined for ATPG.
Section [3.4] adds constraints on primary input pins such as test mode and scan enable signals. The scan
enable signal must be constrained to its off state to ensure the two clock muxes that select
SHIFT_REG_CLK and CLK_OUT are controlled properly except during the load_unload procedure which
overrides this constraint.
The next section [3.5] adds constraints to the pins that select how many condition bits will be used and
how many will be bypassed. See section 2.6 for more details. For the purpose of this test case, the select
pins are constrained to 11 to allow use of all 4 condition bits.
The last command in pre_drc.dofile [3.6] defines the new scan chain added during clock control insertion
that contains all condition bits from the 3 clock control blocks.
After issuing the set_system_mode analysis command to run design rules checks, section [4] reads the
clock control definitions for the appropriate test mode. The clock control definitions will be discussed in
more detail when the test procedure file is described.
The dofile then generates patterns, writes them to a file, and exits the tool.
//
// Test Procedure File
//
set time scale 1.000000 ns ;
timeplate tmp1 =
force_pi 0 ;
measure_po 2 ;
///external clocks//////
pulse rst_in 16 32;
pulse slow_clock 16 32;
pulse reference_clock 16 32;
///internal clocks//////
pulse int_clk1 16 32;
pulse int_clk2 16 32;
pulse int_clk3 16 32;
pulse int_pll 16 32;
if {$env(atpg_mode) == "fast_capture"} {
pulse int_clkg_1 16 32;
pulse int_clkg_2 16 32;
pulse int_clkg_3 16 32;
}
period 64 ;
end;
procedure test_setup =
timeplate tmp1 ;
cycle =
force test_mode 1;
pulse rst_in;
pulse slow_clock;
end;
end;
procedure shift =
timeplate tmp1 ;
cycle =
force_sci ;
measure_sco ;
pulse slow_clock;
pulse int_clk1;
pulse int_clk2;
pulse int_clk3;
end;
end;
procedure load_unload =
scan_group grp1 ;
timeplate tmp1 ;
cycle =
force test_se 1;
end;
apply shift 44;
end;
Most of the test procedure file is typical to most design. An “if” statement in the timplate checks the ATPG
mode variable and selectively defines the timing for the internal clocks which are only used for fast
Since this designs uses clock control blocks with specific condition bits to control each clock, a clock
control definition must be defined for each internal clock. This is the portion of the test procedure file
which is loaded in section [4] of the dofile using the read_procfile command. The clock control
definitions for slow capture test are shown here:
//
// Clock Control Definitions for Slow Speed Capture Test
//
clock_control "int_clk1" =
source_clock "slow_clock";
atpg_cycle 0 =
condition /clock_control_i1/ShiftReg/FF_reg[0] 1; 1
end; 2
atpg_cycle 1 =
condition /clock_control_i1/ShiftReg/FF_reg[1] 1;
end;
atpg_cycle 2 =
condition /clock_control_i1/ShiftReg/FF_reg[2] 1;
end;
atpg_cycle 3 =
condition /clock_control_i1/ShiftReg/FF_reg[3] 1; 3
end;
end;
clock_control "int_clk2" =
source_clock "slow_clock";
atpg_cycle 0 =
condition /clock_control_i2/ShiftReg/FF_reg[0] 1;
end;
atpg_cycle 1 =
condition /clock_control_i2/ShiftReg/FF_reg[1] 1;
end;
atpg_cycle 2 =
condition /clock_control_i2/ShiftReg/FF_reg[2] 1;
end;
atpg_cycle 3 =
condition /clock_control_i2/ShiftReg/FF_reg[3] 1;
end;
end;
clock_control "int_clk3" =
source_clock "slow_clock";
atpg_cycle 0 =
condition /clock_control_i3/ShiftReg/FF_reg[0] 1;
end;
atpg_cycle 1 =
condition /clock_control_i3/ShiftReg/FF_reg[1] 1;
end;
atpg_cycle 2 =
condition /clock_control_i3/ShiftReg/FF_reg[2] 1;
end;
atpg_cycle 3 =
condition /clock_control_i3/ShiftReg/FF_reg[3] 1;
end;
end;
A clock control definition is needed for each internal clock. The first line of the clock control definition [1]
refers to the internal clock port defined using the add_clocks command. Note the short aliases defined
with the –pin_name switch are used here.
The second line [2] refers to the top-level source clock which must be pulsed during each capture cycle
when the internal clock is being pulsed.
4.run_atpg_fast_capture
The conditional statement at the beginning of the dofile will execute the following commands
# At-Speed Capture Test Mode
add_input_constraints -c1 fast_capture_mode
set_fault_type transition -no_shift_launch 1
set_output_masks on
add_input_constraints -all -hold
set_external_capture_options -capture_procedure ext_fast_cap_proc
add_clocks 0 clock_control_i1/cgc_SHIFT_REG_CLK/clkg \
-internal -free_running -pin_name int_clkg_1
add_clocks 0 clock_control_i2/cgc_SHIFT_REG_CLK/clkg \
-internal -free_running -pin_name int_clkg_2
add_clocks 0 clock_control_i3/cgc_SHIFT_REG_CLK/clkg \ 2
-internal -free_running -pin_name int_clkg_3
After constraining the fast capture mode pin and setting the fault type, the dofile masks primary output
pins and holds the primary input pins. This is typical since most testers cannot change or observe I/O
value fast enough for fast capture test.
The set_external_capture_cycles command is issued [1] to ensure all patterns will pulse SLOW_CLK.
This ensures the scan enable synchronization circuitry described in section 2.3 is properly initialized thus
correctly controlling the clock for the condition bits. Note that this command only impacts how patterns are
saved and does not change the simulation during DRC or ATPG. This approach reduces simulation run
time while ensuring the patterns work correctly during Verilog simulation.
The last section [2] adds internal free-running clocks on the output of the clock gater cell that generates
SHIFT_REG_CLK for the shift regiser (see Figure 2). This elimniates stability issues during DRC which
result from the scan enable synchronization circuit described in section 2.3.
As noted in the previous section, the same test procedure file is used for slow and fast capture test with
the exception of the clock control definitions. The clock control definitions for fast clock capture are shown
below:
//
// Clock Control Definitions for Fast Speed Capture Test
//
clock_control "int_clk1" =
atpg_cycle 0 =
condition /clock_control_i1/ShiftReg/FF_reg[0] 1;
end;
atpg_cycle 1 =
condition /clock_control_i1/ShiftReg/FF_reg[1] 1;
end;
atpg_cycle 2 =
condition /clock_control_i1/ShiftReg/FF_reg[2] 1;
end;
atpg_cycle 3 =
condition /clock_control_i1/ShiftReg/FF_reg[3] 1;
end;
end;
Note that the only difference is the lack of the source_clock statements at the beginning of each clock
control defintion. A source clock is not necessary because the source clock for fast capture mode
(reference_clock) is already defined as a free-running clock and will be pulsed in every capture cycle.
For more information on definition and use of clock control definitions in Tessent ATPG tools, see the
Tessent Shell User’s Manual.
runsim_slow_capture
runsim_fast_capture
The scripts compile the design, library, and patterns using ModelSim and verify that all patterns (serial
and parallel) simulate with no mismatches. The simulation waveform for slow capture pattern number 1 is
shown in Figure 12:
The last 3 signals are the output of the clock control blocks which show a single pulse on the output of
clock_control_i2/CLK_OUT. This can also be seen in the output of the report_patterns command
As shown in the waveform, the pattern pulses the top level slow_clock and reference_clock, output of
the PLL, and internal clock 2.
Similar observations can be made for fast capture pattern number 3 which pulses in_clk3 followed by
int_clk2. The waveform for this pattern is shown in Figure 13:
5.run_edt_ip_creation
6.run_edt_ip_synthesis
The final step is to create compressed patterns using the slow and fast capture clocks [steps 7 & 8]:
7.run_edt_atpg_slow_capture
8.run_edt_atpg_fast_capture
To obtain the complete test case for the flow described in this application note, use the download link in
section 1 of this document.