<i>That sounds incredibly expensive to route. Every flip flop?</i><p>Almost all ICs nowadays already have scan chains connecting to 99+% of their internal flip flops.<p>This is because it literally has been <i>decades</i> since  chips have gotten too complex to do reasonable &quot;functional&quot; tests on chips in production. These tests are used not to verify that a design is correct, but to verify that the chip has been fabricated as designed, that there are no defective gates or wires.<p>By functional I mean (e.g. in the case of a CPU) to write instructions that exercise most of the combinatorial logic and most of the flip flops on the chip. Often times it takes many millions of test vectors to achieve less than 50% coverage.<p>Which is where scan comes in. A few external pins are needed. All the flip flops in the chip are the wired in series in groups of scan chains. Data can be shifted in serially to the chip via these chains, then the mode switched to exercise the &quot;normal&quot; logic between flip flops, then flipped again and result data can be shifted out of the flip flops and verified by a tester.<p>It&#x27;s still quite complex, especially when multiple clocks and multiple chains are involved. But it allows for 90%+ test coverage of the logic in a chip without requiring verification engineers to write functional test vectors. Instead, there are tools that automate the process of connecting flip flops in chains and in generating the patterns that exercise the logic between flip flops.<p>The following Wiki touches on the process: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Scan_chain" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Scan_chain</a>