The idea: model each defect as one line stuck at 0 or 1

A new chip can come out of the factory with a short to ground, a short to power or a broken wire. Nobody can look inside, so the chip is tested from its pins: put a vector on the inputs, compare the outputs with the right answer. To decide which vectors to apply, test engineers use a simple fault model, the single stuck-at fault: exactly one line of the circuit is stuck at 0 (written s-a-0, or e/0) or stuck at 1 (s-a-1, e/1), and everything else works.

The circuit: e = AND(a, b) fans out into branches e1 and e2; h = NOT(e1); f = AND(h, c); z = OR(e2, f). Its 9 lines a, b, c, e, e1, e2, h, f, z are marked; each can be stuck at 0 or 1, giving 18 faults
9 lines, two faults each: 18 single stuck-at faults. The stem e and its branches e1, e2 count as three lines.

The canvas uses one small circuit, z = ab + c·(ab)'. Its function is just z = ab + c, which matters later. The right panel holds the fault list, then the coverage results. Press Collapse Faults, pick a fault and press D-Algorithm, or pick a vector and press Simulate Vector.

How the gates themselves work is on Combinational Logic. Here the circuit is fixed and the question is only: is it built right?

The fault list

Every line gets two faults. A line that feeds two gates is a stem with two branches, and each is a line of its own: a break in branch e2 only cuts the path to the OR, while a fault on the stem e hits both paths. With 9 lines the list has 18 faults. A real chip has millions, which is why the next step matters.

Fault collapsing

Two faults are equivalent when every vector sees them the same way. Then one test covers both, and the list keeps one fault of each class. The rules come from the gates. A 0 on any input of an AND forces its output to 0, so "input stuck at 0" and "output stuck at 0" cannot be told apart. 0 is the controlling value of AND (and NAND); 1 is the controlling value of OR (and NOR). A NOT swaps the two: input s-a-0 is output s-a-1. Demo: 18 faults collapse to 10.

GateEquivalent faultsKept
G1 ANDa/0 = b/0 = e/0e/0
G2 NOTe1/0 = h/1; e1/1 = h/0h/1, h/0
G3 ANDh/0 = c/0 = f/0 (and so e1/1)f/0
G4 ORe2/1 = f/1 = z/1z/1

18 faults become 10 classes: e/0, a/1, b/1, e/1, c/1, h/1, f/0, e2/0, z/1 and z/0. Faults on a stem and its branches are never merged this way. The rules only look at one gate at a time, so a few equivalences are missed: e/1, c/1 and z/1 all make z = 1 for every vector, but they sit on different gates.

Activate, then propagate

A vector detects a fault only if two things happen. First it must activate the fault: to see e stuck at 0, the good circuit must put a 1 on e. Second, it must propagate the difference to an output: every gate on the way needs its other inputs at the non-controlling value, so that the difference decides the gate's output. To write both machines at once the D-algorithm uses five values: 0, 1, x (unknown), D (1 in the good circuit, 0 in the faulty one) and D' (0 good, 1 faulty).

The circuit with e stuck-at-0 marked. Inputs a = 1, b = 1, c = 0. e = D, e1 = D, e2 = D, h = D', f = 0, z = D. The path e, e2, z is red. Step labels: 1 activate e = D, 2 side input f = 0 for the OR, 3 justify a = b = 1 and c = 0
e s-a-0: activate with ab = 11, keep the OR's other input f at 0 with c = 0, and z shows D. The test is abc = 110.

The D-algorithm

The D-algorithm (Roth, 1966) searches for such a vector with four moves:

  • Activate: set the faulty line to D (for s-a-0) or D'.
  • Imply: let every gate force what it can, forwards and backwards. An AND with output 1 needs both inputs 1; a NOT flips; a branch copies its stem.
  • Propagate: the D-frontier is the set of gates with a D or D' on an input and an unknown output. Pick one (the page tries the one closest to the output first) and set its other inputs to the non-controlling value.
  • Justify: once z holds D or D', every value set on the way must be explained from the inputs. Where a gate gives a choice (an AND output 0 needs only one input 0), try one option; on a conflict, backtrack and try the next.

For e/0: activation sets e = D, and implication gives a = b = 1, e1 = e2 = D and h = D'. The D-frontier is {G4, G3}. Through G4 the side input f must be 0. f = AND(h, c), and h is 1 in the faulty circuit, so implication sets c = 0. Now z = D, nothing is left to justify, and the test is abc = 110. Demo: D-algorithm, e s-a-0 → abc = 110.

For c/1 the path goes through G3 with h = 1, which forces e = 0. An AND output of 0 can be explained by a = 0 or by b = 0: the algorithm picks a = 0, the test is abc = 0x0, and the x is filled with 0. Demo: D-algorithm with a choice, c s-a-1. The guess, imply, backtrack loop is the same one a SAT solver runs on clauses; see DPLL. Modern test tools (ATPG, automatic test pattern generation) indeed often hand the problem to a SAT solver, or use PODEM, which only ever assigns primary inputs.

Fault simulation and fault coverage

Test generation finds vectors one fault at a time. Fault simulation goes the other way: take a vector, simulate the circuit once with each fault still in the list, and mark every fault whose z differs. Detected faults are dropped, so later vectors simulate fewer of them (fault dropping). Fault coverage = detected faults / faults in the list. Demo: 4 vectors fill the coverage table.

Vector abcNew faults detectedCoverage of 10
110e/0, e2/0, z/03 = 30%
010a/1, c/1, e/1, z/17 = 70%
100b/18 = 80%
001f/09 = 90%

Each of the four vectors is the only one that detects some fault (e/0 needs 110, a/1 needs 010, b/1 needs 100, f/0 needs one of 001, 011, 101), so no set of 3 vectors can do it. On the full list of 18 the same vectors detect 16. The coverage stops at 90% because the tenth fault, h/1, cannot be detected by any vector: of the testable faults the coverage is 9/9 = 100%.

Redundant faults

Run the D-algorithm on h s-a-1. Activation needs h = 0 in the good circuit, so e = 1, and then e2 = 1. But 1 is the controlling value of the OR: z is 1 in both circuits whatever f does. Propagating through G3 with c = 1 gives f = D', and the D-frontier is then empty. There is no other choice to undo, so no test exists. Demo: h s-a-1 has no test (redundant).

A fault with no test is redundant (undetectable): the circuit computes the same function with the fault in it. Here h may as well be the constant 1. Then f = AND(1, c) = c, G3 becomes a wire, and the NOT G2 drives nothing. Two gates go and z = ab + c, with the same 8 rows of truth table. Demo: remove the redundant gates.

Before: four gates, AND, NOT, AND and OR, with h stuck-at-1 marked as having no test. After: two gates, z = OR(AND(a, b), c). Both have the same truth table on all 8 rows
h s-a-1 has no test, so h can be the constant 1: four gates become two, with the same truth table.

Redundancy is not always a mistake. A consensus term added to stop a glitch (see the hazard section of Combinational Logic) is redundant on purpose, and its stuck-at faults cannot be tested. Logic tools can also prove such redundancy with binary decision diagrams or SAT.

Where test fits

Test patterns are made after synthesis and technology mapping, on the final gate netlist, as one of the signoff steps of the ASIC design flow. The page's circuit has no flip-flops; a real chip does, and scan chains turn its flip-flops into inputs and outputs the tester can reach, so the same combinational methods apply.

See also Binary Decision Diagrams for finding an input on which two circuits disagree.

See also Scan Chains and Design for Test, which applies test patterns to a state machine through a scan chain and counts the test clocks.

What the page leaves out

  • Multiple faults at once, bridging faults, delay (transition) faults, and the cell-aware fault models used for modern processes.
  • Fault dominance, a second collapsing rule that shrinks the list further for detection.
  • PODEM, FAN and SAT-based ATPG in detail, and the X-path check that prunes the D-algorithm earlier.
  • Parallel and deductive fault simulation, which handle many faults per pass.
  • Sequential circuits and scan insertion, test compression, and built-in self-test (BIST).

On the mind map

Open the Computer Architecture mind mapComputerArchitectureAbstraction and numbers: layers and bit patternsAbstraction and numbersCombinational logic: output depends only on inputsCombinational logicSequential logic: state held by a clockSequential logicMIPS software: how C becomes machine wordsMIPS softwareThe processor: datapath plus controlThe processorPipelines and parallelism: more instructions at oncePipelines and parallelismMemory and I/O: small fast near, big slow farMemory and I/OLatches and flip-flopsLatches and flip-flopslatch is level, flip-flop is edgeFlip-flops and counter designFlip-flops and counter designexcitation = characteristic backwardsLatch from transistorsLatch from transistorstransmission gates plus inverter loopCMOS layout, DRC, LVSCMOS layout, DRC, LVSDRC: can it be built? LVS: right circuit?Timing analysisTiming analysissetup limits clock, hold limits short pathsAsync FIFO (CDC)Async FIFO (CDC)Gray pointers cross; flags clear lateStuck-at fault testingActivate, propagate, justify: D-algorithmStatic Timing AnalysisStatic Timing AnalysisSlack = required − arrival, every nodeLogical effort sizingLogical effort sizingd = gh + p; equal effort F^(1/N)Scan chainsScan chainsShift in, capture once, shift outFinite state machinesFinite state machinesMoore: output from state; Mealy: +inputsASMD chart and datapathASMD chart and datapathTransfers land at the edge leaving the state1011 Sequence Detector1011 Sequence DetectorA wrong bit keeps the longest prefixFSM in SystemVerilogFSM in SystemVerilogenum, always_ff, always_comb; default!Shift registers and countersShift registers and countersChained flip-flops shift or count each clockOpen the Computer Architecture mind mapComputer Architecturestate held by a clockSequential logicLatches and flip-flopsLatches and flip-flopslatch is level, flip-flop is edgeFlip-flops and counter designFlip-flops and counter designexcitation = characteristic backwardsLatch from transistorsLatch from transistorstransmission gates plus inverter loopCMOS layout, DRC, LVSCMOS layout, DRC, LVSDRC: can it be built? LVS: right circuit?Timing analysisTiming analysissetup limits clock, hold limits short pathsAsync FIFO (CDC)Async FIFO (CDC)Gray pointers cross; flags clear lateStuck-at fault testingActivate, propagate, justify: D-algorithmStatic Timing AnalysisStatic Timing AnalysisSlack = required − arrival, every nodeLogical effort sizingLogical effort sizingd = gh + p; equal effort F^(1/N)Scan chainsScan chainsShift in, capture once, shift outFinite state machinesFinite state machinesMoore: output from state; Mealy: +inputsASMD chart and datapathASMD chart and datapathTransfers land at the edge leaving the state1011 Sequence Detector1011 Sequence DetectorA wrong bit keeps the longest prefixFSM in SystemVerilogFSM in SystemVerilogenum, always_ff, always_comb; default!Shift registers and countersShift registers and countersChained flip-flops shift or count each clock
This page on the Computer Architecture mind map · 76 pages in 7 branches · open it to see the whole map and test yourself in recall mode.