Hi everyone,
This is the first post of a very long DFT knowledge series.
A modern digital chip has millions of flip-flops buried deep inside its logic. To test whether the chip was manufactured correctly, we need to set those flip-flops to known values and read them back after the logic has done its work. Driving them only through the chip's functional pins would take far too many cycles, or be impossible. Scan design solves this.
The scan flip-flop
During scan insertion, every ordinary D flip-flop is replaced by a scan flip-flop: a flip-flop with a 2-to-1 multiplexer in front of its D input.
- D: the normal functional input
- scan_in (often written SI): an extra input used only during test
- scan_en (scan enable, often written SE): selects between the two
When scan_en = 0 the flip-flop behaves exactly as designed. When scan_en = 1 it takes its value from scan_in.
Building the chain
The Q output of each scan flip-flop is connected to the scan_in input of the next one. With scan_en = 1, all of them together form one long shift register, the scan chain, between a scan_in pin and a scan_out pin.
A design normally has many chains in parallel, so each chain stays short and shifting stays fast.
Shift and capture
Testing with scan repeats three steps:
- Shift in (
scan_en = 1): clock a test pattern into the chains, one bit per clock cycle per chain. Every flip-flop now holds a value chosen by the ATPG tool. - Capture (
scan_en = 0): pulse the clock once in functional mode. The combinational logic between the flip-flops computes its outputs, and the flip-flops capture the result. - Shift out (
scan_en = 1): shift the captured response out and compare it with the expected values. The next pattern is shifted in at the same time.
Because every flip-flop is now directly controllable and observable, the hard sequential test problem becomes a much easier combinational one. That is what makes automatic test pattern generation (ATPG) practical.
Launch and capture
Any two scan flip-flops with logic between them form a pair: the launch flip-flop drives a value into the logic, and the capture flip-flop stores what comes out. For a stuck-at test only the value matters, not how fast it gets there. Press Run test below to watch a whole test: 4 shifts to load the chain, 1 capture, and 4 shifts to unload it. Or step through it yourself:
- With
scan_en = 1, pulse CLK to shift a value into the launch flip-flop. - Switch to
scan_en = 0and pulse CLK once. The capture flip-flop now takes its value through the logic (here an inverter) instead of from the scan path. - Switch back to
scan_en = 1and keep shifting. The captured bit leaves atscan_out, where the tester compares it with the expected value.
Suppose the inverter's output is stuck at 0. Shift a 0 into the launch flip-flop: a good chip captures 1, the faulty one captures 0. The mismatch at scan_out reveals the fault. To catch the output stuck at 1 instead, the pattern needs a 1 in the launch flip-flop.
What the patterns look for
The most common fault model is the stuck-at fault: a net that is permanently stuck at logic 0 or logic 1. ATPG generates patterns that set a net to the opposite value and propagate any difference to a scan flip-flop or an output pin.
Transition (at-speed) faults model nets that switch too slowly. They are tested with two capture pulses at the functional clock frequency instead of one.
Fault coverage is the percentage of modelled faults that the pattern set detects. Targets of 99% or more for stuck-at faults are common.
The cost
Scan is not free:
- Area: every flip-flop gains a multiplexer, and extra routing is needed for the chains.
- Timing: the multiplexer adds delay on the functional D path.
- Test time: shifting long chains takes many cycles per pattern.
Test time is the main reason for scan compression. A small number of tester channels feed a decompressor that drives many short internal chains, and a compactor squeezes the responses back down. That is a topic for another note.