---
title: Testability and fault tolerance
heading: Fault models, scan chains, coverage and defect level, BIST, ECC and redundancy
eyebrow: S3 · Lesson 38 · Testability and fault tolerance
xp: 50
---

::: hook
Every chip that comes off a wafer has to be tested before it ships, in seconds, on a tester that can only reach its pins. Testing millions of internal gates through a few hundred pins is only possible because the design was built for it: every flip-flop can be strung into scan chains that shift test patterns in and results out. Whatever the tests miss ships to customers as a defect, at a rate that depends steeply on how much of the design the tests cover. And once the chip is in the field, radiation flips bits in memories and registers, so designs add codes and redundancy that catch and correct errors as they happen.
:::

::: play
- The defect level, the fraction of chips that pass the test but are actually faulty, in parts per million, against the test's fault coverage, by the Williams–Brown model $DL = 1 - Y^{1-T}$.
- At 90% yield, 99% coverage still ships about a thousand bad parts per million. Each extra nine of coverage cuts the defect level about tenfold.
- Lower the yield (a new process): the same coverage lets more bad parts through, so automotive and medical parts, which need defect levels near 1 ppm, demand coverage near 100%.
:::
:::

```sim plot
view: graph
x: T = 50..99.99 %
y: D = 1..1000000 log
slider: Y = 0.3..0.99 = 0.9
plot: 1e6*(1 - Y^(1 - T/100)) | samples: 500 | label: defect level, ppm
marker: y = 1 | label: 1 ppm
readout: defect level at 99% coverage, ppm = 1e6*(1 - Y^0.01)
readout: defect level at 99.9% coverage, ppm = 1e6*(1 - Y^0.001)
```

::: predict
## A test finds 99% of a chip's possible faults, and 90% of chips are good. Out of a million chips that pass the test, about how many are actually faulty?

- [ ] About 10
- [ ] About 100
- [x] About 1,000
- [ ] About 10,000

::: reveal
About 1,050 ppm: $1 - 0.9^{0.01}$ = 0.00105. One percent of the faults go untested, and a faulty chip escapes if all its faults are in that untested part. That's far too many for most customers; raising coverage to 99.9% brings it down to about 105 ppm. Test engineers fight for every tenth of a percent of coverage.
:::
:::

::: nameit
## Fault models and coverage

The **stuck-at** model treats each net as possibly stuck at 0 or at 1: two faults per net. Automatic test pattern generation (ATPG) finds input patterns that make each fault visible at an output. **Fault coverage** T is the fraction of modeled faults the patterns detect. Transition faults (too slow) and bridging faults extend the model. With process yield Y, the Williams–Brown defect level is

$$DL = 1 - Y^{1 - T}$$

## Scan design

Every flip-flop gets a multiplexer that, in test mode, connects it into a shift register. A test shifts a pattern in, applies one functional clock, and shifts the response out while the next pattern shifts in. With F flip-flops in C chains of length $L = \lceil F/C \rceil$, P patterns at shift clock f take about

$$t = \frac{P(L + 1)}{f}$$

Test compression shrinks the data and time further, by expanding a few tester channels into many short internal chains.

## BIST and boundary scan

- **Built-in self-test:** an LFSR generates pseudo-random patterns and a multiple-input signature register (MISR) compacts the responses into one n-bit signature. A faulty response maps to the good signature with probability about $2^{-n}$ (aliasing). Memories use march tests in BIST.
- **JTAG (IEEE 1149.1):** a boundary-scan chain around the pins tests board connections and gives debug access.

## Fault tolerance

- **Parity** detects any odd number of bit errors. A **Hamming code** with r check bits corrects one error among m data bits when $2^r \ge m + r + 1$; one more bit makes it SECDED (single-error correct, double-error detect), as in the (72, 64) code on server memory.
- **Triple modular redundancy:** three copies and a majority voter. With each copy working with probability R, $R_\text{TMR} = 3R^2 - 2R^3$, better than R only when R > 0.5.
- **Soft errors** are measured in FIT, failures per $10^9$ device-hours; MTTF = $10^9$/FIT hours.
:::

::: example
## A design has 200,000 flip-flops in 32 scan chains and needs 5,000 patterns, shifted at 50 MHz. How long does the scan test take, and what defect level do 99% and 99.9% coverage give at 90% yield?

::: solution
1. **Chain length.**
   $$\frac{200{,}000}{32} = 6250$$
2. **Test time.** Each pattern shifts through the chain plus one capture cycle:
   $$\begin{aligned} t &= \frac{5000 \times 6251}{50\ \text{MHz}} \\ &= 0.625\ \text{s} \end{aligned}$$
3. **Defect level at 99% coverage.**
   $$1 - 0.9^{0.01} = 1053\ \text{ppm}$$
4. **Defect level at 99.9% coverage.**
   $$1 - 0.9^{0.001} = 105\ \text{ppm}$$
5. **More chains.** Twice as many chains would halve the test time, at the cost of twice the tester channels (or a compressor).

**Answer:** the scan test takes 0.625 s; 99% coverage leaves 1,053 ppm defective and 99.9% leaves 105 ppm.
:::
:::

::: example
## A chip has 16 Mbit of SRAM with a soft-error rate of 1,000 FIT per Mbit. What's the mean time between upsets for one chip, and for a fleet of 10,000? How many check bits does SECDED need for 64-bit words?

::: solution
1. **Failure rate.**
   $$16 \times 1000 = 16{,}000\ \text{FIT}$$
2. **One chip.**
   $$\begin{aligned} \text{MTTF} &= \frac{10^9}{16{,}000} \\ &= 62{,}500\ \text{hours} \end{aligned}$$
   about 7 years.
3. **A fleet of 10,000.** It sees an upset every 6.25 hours, so the memory needs ECC.
4. **Check bits.** For 64 data bits, $2^7 = 128 \geq 64 + 7 + 1$, so Hamming needs 7 check bits and SECDED 8: the (72, 64) code.

**Answer:** about 62,500 hours (7 years) for one chip and 6.25 hours for the fleet; SECDED needs 8 check bits.
:::
:::

::: example
## Each of three redundant copies survives a mission with probability 0.99. What does triple modular redundancy give, and what if each copy only had 0.4?

::: solution
1. **TMR reliability.** At least two of the three copies must survive:
   $$\begin{aligned} R_\text{TMR} &= 3R^2 - 2R^3 \\ &= 0.999702 \end{aligned}$$
   The chance of failure falls from 1% to 0.03%.
2. **At R = 0.4.**
   $$\begin{aligned} R_\text{TMR} &= 3(0.16) - 2(0.064) \\ &= 0.352 \end{aligned}$$
   worse than one copy: with unreliable parts, the voter mostly outvotes the one that still works.

**Answer:** 0.999702 with good copies; with copies of 0.4 it gives 0.352, worse than one copy.
:::
:::

::: check
given: F = 50000 | 400000; C = 16 | 64; P = 2000 | 20000; f = 25 | 100
answer: P*(ceil(F/C - 0.0001) + 1)/(f*1e6)
unit: s
tolerance: 0.5%

## A design has {F} flip-flops in {C} scan chains. How long do {P} patterns take at a {f} MHz shift clock?

::: right
Right. $P(L + 1)/f$ with L = $\lceil F/C \rceil$: {answer} s.
:::

::: misses
- [P*F/(f*1e6)] Split the flip-flops across the chains: the chains shift in parallel.
- [any] Not yet. Each pattern shifts through one chain's length plus a capture cycle.
:::
:::

::: check
given: Y = 0.5 | 0.8 | 0.95; T = 0.95 | 0.99 | 0.999
answer: 1e6*(1 - Y^(1 - T))
unit: ppm
tolerance: 0.5%

## A process yields {Y} good chips, and the test's fault coverage is {T}. What's the defect level, by Williams–Brown?

::: right
Right. $1 - Y^{1-T}$ = {answer} ppm.
:::

::: misses
- [1e6*(1 - Y)*(1 - T)] The model is exponential: $1 - Y^{1-T}$.
- [any] Not yet. $DL = 1 - Y^{1 - T}$.
:::
:::

::: check
given: m = 8 | 16 | 32 | 64 | 128
answer: 2 + step(m - 0.5) + step(m - 1.5) + step(m - 4.5) + step(m - 11.5) + step(m - 26.5) + step(m - 57.5) + step(m - 120.5)
tolerance: 0

## How many check bits does a SECDED code need for {m} data bits?

::: right
Right. {answer}: the smallest r with $2^r \ge m + r + 1$, plus one.
:::

::: misses
- [1 + step(m - 0.5) + step(m - 1.5) + step(m - 4.5) + step(m - 11.5) + step(m - 26.5) + step(m - 57.5) + step(m - 120.5)] That corrects single errors; add one bit to detect doubles.
- [any] Not yet. Find the smallest r with $2^r \ge m + r + 1$.
:::
:::

::: check
given: R = 0.6 | 0.9 | 0.99
answer: 3*R^2 - 2*R^3
tolerance: 0.01%

## Each of three redundant copies works with probability {R}. What's the reliability of the TMR system with a perfect voter?

::: right
Right. $3R^2 - 2R^3$ = {answer}.
:::

::: misses
- [R^3] The voter needs only two of the three working.
- [1 - (1 - R)^3] The voter outvotes one wrong copy, but not two.
- [any] Not yet. Probability that at least two work.
:::
:::

::: check
given: n = 8 | 16 | 32
answer: 2^(-n)
tolerance: 0.5%

## A BIST signature register is {n} bits wide. About what's the probability that a faulty circuit's responses alias to the good signature?

::: right
Right. $2^{-n}$ = {answer}.
:::

::: misses
- [1/n] Each extra bit halves it.
- [any] Not yet. A random wrong signature hits the good one 1 time in $2^n$.
:::
:::

::: check
given: M = 4 | 32 | 256; r = 200 | 1000; N = 100 | 1000 | 50000
answer: 1e9/(M*r*N)
unit: h
tolerance: 0.5%

## {N} chips each hold {M} Mbit of SRAM with {r} FIT per Mbit. What's the mean time between soft errors across them?

::: right
Right. $10^9$/(total FIT) = {answer} hours.
:::

::: misses
- [1e9/(M*r)] Count every chip.
- [any] Not yet. Add up the FIT, then invert.
:::
:::

::: check
kind: parts
given: F = 50000 | 200000; C = 16 | 64; P = 2000 | 10000; f = 25 | 100; Y = 0.8 | 0.95; T = 0.95 | 0.99

## A chip has {F} flip-flops in {C} scan chains and needs {P} patterns shifted at {f} MHz. Its yield is {Y}, and the patterns cover a fraction {T} of the faults.

::: part
answer: ceil(F/C)
tolerance: 0

### How long is each chain?

::: misses
- [any] $\lceil F/C\rceil$.
:::
:::

::: part
answer: P*(ceil(F/C) + 1)/(f*1e6)*1000
unit: ms
tolerance: 0.5%

### How long does the test take?

::: misses
- [any] $P(L + 1)/f$.
:::
:::

::: part
answer: (1 - Y^(1 - T))*1e6
unit: ppm
tolerance: 0.5%

### What fraction of shipped parts are bad?

::: misses
- [any] $DL = 1 - Y^{1 - T}$.
:::
:::
:::

::: check
kind: derivation
vars: R = 0.5..0.9999

## Each copy in a triple-modular-redundant system works with probability R.

::: step
answer: 3*R^2 - 2*R^3

### What is the system's reliability?
:::

::: step
answer: 1 - 3*R^2 + 2*R^3

### What is its probability of failure?
:::

::: step
answer: (1 - 3*R^2 + 2*R^3)/(1 - R)

### What is that as a fraction of one copy's probability of failure?
:::

::: right
Right. For R near 1 the ratio is about $3(1 - R)$: TMR turns a small failure probability into a much smaller one.
:::
:::

::: explain
## Why does a design need scan chains to be testable, when its outputs can already be observed at the pins?

::: model
A chip's internal state is buried behind many levels of logic and registers. To test whether one gate deep inside is stuck, a tester has to put the right values on that gate's inputs and then make the result show up at a pin, and through the normal pins that can take long sequences of carefully chosen inputs, if it's possible at all. Scan turns every flip-flop into a stage of a shift register in test mode, so the tester can load any state directly and read every flip-flop's response directly. The sequential test problem becomes a combinational one between scan registers, which ATPG tools can solve automatically, and the patterns shift in and out in a fraction of a second.
:::
:::

::: practice

::: check
given: F = 100000 | 800000; C = 32 | 128; P = 4000 | 10000; f = 40 | 100
answer: P*(ceil(F/C - 0.0001) + 1)/(f*1e6)
unit: s
tolerance: 0.5%

## Scan time: {F} flops, {C} chains, {P} patterns, {f} MHz?

::: misses
- [any] $P(\lceil F/C \rceil + 1)/f$.
:::
:::

::: check
given: Y = 0.6 | 0.9; T = 0.98 | 0.9995
answer: 1e6*(1 - Y^(1 - T))
unit: ppm
tolerance: 0.5%

## Defect level: yield {Y}, coverage {T}?

::: misses
- [any] $1 - Y^{1-T}$.
:::
:::

::: check
given: R = 0.6 | 0.7 | 0.8 | 0.9 | 0.95 | 0.99
answer: 3*R^2 - 2*R^3
tolerance: 0.01%

## TMR reliability with copies at {R}?

::: misses
- [any] $3R^2 - 2R^3$.
:::
:::
:::
