1. A computer program product for implementing a scan chain to test a semiconductor, the computer program product comprising: one or more computer-readable storage media and program instructions stored on the one or more computer-readable storage media, the program instructions comprising: program instructions to obtain an initial structure of the scan chain; program instructions to determine, according to function modules of the semiconductor corresponding to scan registers on the scan chain, at least one scan register pair with backward dependency; program instructions to adjust the initial structure of the scan chain such that the at least one scan register pair with backward dependency becomes a scan register pair with forward dependency; program instructions to determine a key subset of a fan-out scan register in the at least one scan register pair with backward dependency, wherein a fan-in scan register in the at least one scan register pair with backward dependency belongs to the key subset of the fan-out scan register, wherein logic values of all fan-in scan registers in the key subset and a logic value of an output of a function module connected to the fan-out scan register are the same, no matter which logic values are taken by fan-in scan registers outside the key subset.