Problemadvanced
Scan chain ordering
Also called scan chain reordering, scan stitching.
Order the flip-flops of each scan chain after placement so that the scan wiring is shortest, a travelling salesman problem with ends and hold constraints.
Scan chain ordering chooses, after placement, the order in which the flip-flops of a scan design are linked into chains. For test, any order works: the tester shifts the patterns through whatever order is chosen. For the layout, the order fixes the scan wires, one from the scan-in pin to the first flip-flop, one from each flip-flop to the next, and one from the last to the scan-out pin. Making their total length least is a shortest Hamiltonian path between two fixed ends, so the problem is a form of the traveling salesman problem and is NP-hard even with Manhattan distances on a grid. Real instances add constraints: chains of equal length, flip-flops of one clock domain together, and no hold-time violation on any scan wire.
In plain words
After the chip is laid out, every storage cell that is part of a test chain sits at a fixed spot. The test chain must visit every cell once, start at the input pin and end at the output pin. The order does not matter for testing, so we pick the order whose wires are shortest. This is like a delivery route that must start at one depot, end at another and visit every customer once, with the customers being the cells. Finding the very best route is hard when there are many cells, so tools use good routes found quickly.
Definition
Input. Points (the scan-in pin), (the scan-out pin) and (the placed scan flip-flops), and a distance for the wire from to . On a chip is usually the Manhattan distance , which is a lower bound on a routed two-pin wire.
Output. A permutation of , the order of the chain.
Goal. Minimize the wire length
This is a shortest Hamiltonian path with fixed ends. Let be the complete graph on with edge weights . A permutation is the same thing as a Hamiltonian path of from to , namely , since such a path visits each exactly once between its fixed ends, and is the weight of that path. So the orders of least wire length are exactly the shortest Hamiltonian - paths of .
And a traveling salesman tour. Merge and into one depot with the costs for leaving and for returning, and . A tour costs exactly , and every tour has this form after rotating it to start at . So the problem is an asymmetric TSP on cities. A symmetric form keeps and apart and sets the weight of the edge - to for a large , so that every optimal tour uses that edge, and removing it leaves the path.
Variants
- Several chains. With chains, each with its own pins, the flip-flops must also be split into groups. Test time grows with the longest chain, so the groups must have equal size, within one. This is close to the vehicle routing problem with equal loads.
- Clock domains and edges. Flip-flops on different clocks, or on rising and falling edges of one clock, should be kept in separate chains or separate segments, with a lockup latch at each crossing. The order is then a path inside each group, plus an order of the groups.
- Hold constraints. A scan wire has no logic, so a short wire between two flip-flops whose clocks arrive with skew can violate the hold constraint. Some pairs must not be neighbors, or need a delay buffer, which turns some edge weights into infinite or penalized ones.
- Reordering with partial freedom. Some flip-flops must keep a fixed order, for example those of a shift register already wired in the logic, which are treated as one city with an entry and an exit point.
- Routing congestion. The scan wires compete with the functional wires for routing tracks, so the cost may weight wires through crowded regions more.
Examples
Take the pins and and five flip-flops , , , and , with Manhattan distance.
| order | wire lengths | total |
|---|---|---|
| (the netlist order) | 5 + 8 + 6 + 6 + 9 + 8 | 42 |
| (the best) | 3 + 4 + 4 + 3 + 5 + 3 | 22 |
Of the orders, is the only one of length 22, and the worst one is 52. The netlist order, as written by synthesis, ignores the layout, so its wires cross the block several times.
Known algorithms
- Nearest neighbor heuristic
- 2-opt, 3-opt and Or-opt
- Lin-Kernighan
- Christofides' algorithm, adapted to paths
- Held-Karp, exact for small groups
Bounds
- Hardness. Deciding whether the wire length can be at most a given number is NP-complete, even when the points lie on an integer grid and is the Manhattan distance. Let be a grid graph, that is a finite set of grid points with edges between points at distance 1, and let be two of its points. Put , and one flip-flop at every other point of . Every distance between distinct grid points is at least 1, and an order has wires, so , with equality exactly when every wire joins neighbors of , that is when the order is a Hamiltonian path of from to . A graph with at least 3 points has a Hamilton circuit exactly when, for some edge , it has a Hamiltonian path from to . Itai, Papadimitriou and Szwarcfiter (1982) showed that the Hamilton circuit problem is NP-complete for grid graphs, so a polynomial algorithm for scan ordering, run once per edge, would decide an NP-complete problem.
- Lower bounds. The path is a spanning tree of all points, so is at least the weight of a minimum spanning tree of . This bound is quick to compute and shows how far a heuristic order can be from the best.
- Approximation. With a metric , Hoogeveen (1991) showed that Christofides' method adapted to a path with two fixed ends is within a factor , and Zenklusen (2019) gave a factor , as for tours. In practice, tools use local search, whose results are compared with the lower bound above.
- Exact. Dynamic programming over subsets solves flip-flops in time, so only for small groups, such as the cells of one region after partitioning.
Reductions
- Scan chain ordering is a shortest Hamiltonian path with fixed ends, and an asymmetric TSP with one depot, as shown in the definition. Every TSP method applies.
- The Hamiltonian path problem in grid graphs reduces to it, as in the hardness bound, so it is not easier than general metric path TSP in the worst case.
- With chains of equal length it contains a balanced partition of the points, as in vehicle routing.
Applications
- Physical design flows. Synthesis inserts scan in an arbitrary order. After placement, the tool removes the scan connections, orders the flip-flops by region, and reconnects them. The result is checked again for hold time after clock tree synthesis.
- Test compression. With scan compression, the chains are short and many, so ordering is mostly a partition of the flip-flops into nearby groups of equal size, with a short path inside each group.
- Low-power test. Some methods order the flip-flops so that neighbors in the chain often hold equal values in the test patterns, which reduces switching during shift. The cost then mixes wire length with a count of transitions.
References
- Samy Makar, A layout-based approach for ordering scan chain flip-flops, Proceedings of the International Test Conference, 341 to 347, 1998, the ordering of scan flip-flops from their placed positions as a traveling salesman path, with heuristics and the constraints of clock domains
- M. Hirech, J. Beausang and X. Gu, A new approach to scan chain reordering using physical design information, Proceedings of the International Test Conference, 348 to 355, 1998, reordering scan chains after placement, with the scan-in and scan-out pins as fixed ends
- A. Itai, C. H. Papadimitriou and J. L. Szwarcfiter, Hamilton paths in grid graphs, SIAM Journal on Computing 11(4), 676 to 686, 1982, the NP-completeness of the Hamilton circuit problem for grid graphs
- Laung-Terng Wang, Cheng-Wen Wu and Xiaoqing Wen, VLSI Test Principles and Architectures, Morgan Kaufmann, 2006, the chapter on design for testability (scan chain stitching and reordering after placement)
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag TZQ375 Edit this page History Report an error Markdown