netlist_carpentry.routines.dft.scan_chain_insertion
¶
A very basic scan chain insertion algorithm implementation.
Functions:
-
create_scan_ports–Creates the ports required for implementing scan chains in the given module.
-
replace_ff_with_scan_ff–Replaces all Flip-Flops inside the given module with their Scan-Variant.
-
connect_all_scan_elements–Connect the given instances inside the module to a chain of scan elements, and connect them to the module's scan ports.
-
skip_module–Whether this module should be skipped from the scan chain insertion process.
-
implement_scan_chain–Main entry point for scan chain implementation.
create_scan_ports
¶
create_scan_ports(
m: Module,
scan_enable: str = "SE",
scan_in: str = "SI",
scan_out: str = "SO",
) -> None
Creates the ports required for implementing scan chains in the given module.
These ports are Scan-Enable (to enable the scan shift process), Scan-In,
(to shift scan values into the chain) and Scan-Out (to shift scan values out of the chain).
After adding the ports to the given module, all module instances are updated accordingly,
so that they all also have these three ports, that are unconnected initially and must be
connected during the scan-chain creation process.
Parameters:
-
(m¶Module) –The module, which should receive the scan ports.
-
(scan_enable¶str, default:'SE') –The desired name of the Scan-Enable port. Defaults to 'SE'.
-
(scan_in¶str, default:'SI') –The desired name of the Scan-In port. Defaults to 'SI'.
-
(scan_out¶str, default:'SO') –The desired name of the Scan-Out port. Defaults to 'SO'.
replace_ff_with_scan_ff
¶
Replaces all Flip-Flops inside the given module with their Scan-Variant.
Each normal DFF becomes a Scan-DFF (with the additional ports SE, SI and SO,
each 1-bit wide), an ADFF becomes a Scan-ADFF and so on.
Also, all n-bit wide Flip-Flops are split into n 1-bit Flip-Flops, before the replacement. This is due to the Shifting mechanism, which can always only shift a single bit in or out during a single clock cycle.
Parameters:
Returns:
-
List[ScanDFF]–List[ScanDFF]: A list containing all newly implemented Scan-Flip-Flops.
connect_all_scan_elements
¶
connect_all_scan_elements(
m: Module,
list_of_scan_elements: List[Instance],
scan_in: str,
scan_out: str,
scan_enable: str,
) -> None
Connect the given instances inside the module to a chain of scan elements, and connect them to the module's scan ports.
Parameters:
-
(m¶Module) –The current module.
-
(list_of_scan_elements¶List[Instance]) –A list of instances, which should be connected to a chain, connecting each output "SO" to the subsequent "SI" port.
-
(scan_in¶str) –The name of the "scan-in" module port.
-
(scan_out¶str) –The name of the "scan-out" module port.
-
(scan_enable¶str) –The name of the "scan-enable" module port.
skip_module
¶
Whether this module should be skipped from the scan chain insertion process.
One case is if neither the given module nor its submodules have flip-flops.
Another case is if the module was already modified previously (i.e. another instance of this module was encountered, and the module was modified back then already). This is tracked via module metadata.
Parameters:
Returns:
-
bool(bool) –True, if this module should not receive a scan chain. False otherwise.
implement_scan_chain
¶
Main entry point for scan chain implementation.
Takes the given module and checks if scan chain insertion is applicable. If applicable, replaces all flip-flops with their scan variants. This is also done recursively for submodules inside the given module. The scan ports of the flip-flops (and the submodules, if they contain flip-flops) are then connected into a chain via their "SI" and "SO" ports. Also, the scan-enable signal ("SE") is forwarded to all scan instances and submodules.
Parameters: