what are scan chains
Every (scanable) flop has two additional inputs for scan (scan_in and scan_enable). The scan_in is muxed inside the flop with the D input and controlled by scan_enable. During synthesis, flop outputs are also connected directly to the scan_in input of a different flop creating a long chain. The first flop in the chain is connected to a primary input and the last flop in the chain is connected to an output. When scan_enable is set high, you can the shift in values through the scan chain in order to set every flop in a known state.
You can then perform a scan test like this...
1) set scan_enable high and shift in values for every flop through the chain.
2) set scan_enable low and give the design one clock. This will allow flops to capture values through their functional paths (D pins on the flops).
3) set scan_enable high and shift out all values. Then check to see if values are as expected.
During placement the scan chain can end up zip-zagging around the whole chip, so we re-order the flops in the chain based on their relative placement.