Scan chain basics: a scan chain is formed by replacing ordinary flip-flops with scan flip-flops and connecting them into a shift register for test purposes. Each scan flip-flop has two inputs — its normal functional data input and a scan input — selected by a test-mode control signal, so the same storage element serves double duty: normal operation when the chip runs functionally, and a shift-register stage when the chip is placed in scan-shift mode. A test pattern is shifted serially into the chain bit by bit, the chip is clocked once to capture a functional response, and that response is shifted back out for comparison against the expected value — the fundamental read/write mechanism underneath essentially all modern scan-based test.