Skip to content

netlist_carpentry.routines.check.fanout_analysis

A module to track fanout of all wires inside a module or the whole circuit.

Functions:

  • fanout

    Analyzes the fanout of the given module or circuit and returns a dictionary containing all wires and their fanout.

  • fanout_module

    Analyzes the fanout of the given module and returns a dictionary containing all wires and their fanout.

  • fanout_by_path

    Analyzes the fanout of the given module and returns a dictionary containing all wires and their fanout.

  • fanout_by_number

    Analyzes the fanout of the given module and returns a dictionary containing all wires and their fanout.

Attributes:

  • FANOUT_BY_NUMBER

    A fanout dictionary, where the keys are the fanout numbers, and the values are lists of wire (segment) paths, where the wire has a fanout count equal to the key.

  • FANOUT_BY_PATH

    A fanout dictionary, where the keys are the wire (segment) paths, and the value is the fanout count.

FANOUT_BY_NUMBER module-attribute

FANOUT_BY_NUMBER = Dict[NonNegativeInt, List[Union[WirePath, WireSegmentPath]]]

A fanout dictionary, where the keys are the fanout numbers, and the values are lists of wire (segment) paths, where the wire has a fanout count equal to the key.

FANOUT_BY_PATH module-attribute

FANOUT_BY_PATH = Dict[Union[WirePath, WireSegmentPath], NonNegativeInt]

A fanout dictionary, where the keys are the wire (segment) paths, and the value is the fanout count.

fanout

Analyzes the fanout of the given module or circuit and returns a dictionary containing all wires and their fanout.

If circuit_or_module is a module, analyze all wires within the given module. If circuit_or_module is a circuit, analyze all wires across the whole circuit. The dictionary will then contain the paths of all wires in the whole circuit.

If sort_by is 'path', the keys of the returned dictionary are the wire paths, and the value is the fanout count. If this value is 0, the wire does not have any loads. If sort_by is 'number', the keys of the returned dictionary are the fanout numbers, and the value is a list of wire paths, where the wire has a fanout count equal to the key. All entries in the list for key 0 are wires without any loads.

If a wire is more than 1 bit wide, and the segments have different fanout numbers, the wire segment paths are used (instead of the wire path) with the corresponding fanout numbers.

Parameters:

  • circuit_or_module

    (Union[Circuit, Module]) –

    The module or whole circuit to analyze the fanout.

  • sort_by

    (Literal['number', 'path']) –

    Whether the fanout counts or the wire paths should be the keys of the returned fanout dictionary.

Returns:

  • Union[FANOUT_BY_NUMBER, FANOUT_BY_PATH]

    Union[FANOUT_BY_NUMBER, FANOUT_BY_PATH]: A dictionary containing all wires and their fanout counts (if sort_by is 'path'). Alternatively a dictionary of fanout numbers, where for each fanout number the value is a list of wire paths, where the wire has a fanout count equal to the key (if sort_by is 'number').

fanout_module

fanout_module(
    module: Module, *, sort_by: Literal["number"]
) -> FANOUT_BY_NUMBER
fanout_module(module: Module, *, sort_by: Literal['path']) -> FANOUT_BY_PATH
fanout_module(
    module: Module, *, sort_by: Literal["number", "path"]
) -> Union[FANOUT_BY_NUMBER, FANOUT_BY_PATH]

Analyzes the fanout of the given module and returns a dictionary containing all wires and their fanout.

If sort_by is 'path', the keys of the returned dictionary are the wire paths, and the value is the fanout count. If this value is 0, the wire does not have any loads. If sort_by is 'number', the keys of the returned dictionary are the fanout numbers, and the value is a list of wire paths, where the wire has a fanout count equal to the key. All entries in the list for key 0 are wires without any loads.

If a wire is more than 1 bit wide, and the segments have different fanout numbers, the wire segment paths are used (instead of the wire path) with the corresponding fanout numbers.

Parameters:

  • module

    (Module) –

    The module to analyze the fanout.

  • sort_by

    (Literal['number', 'path']) –

    Whether the fanout counts or the wire paths should be the keys of the returned fanout dictionary.

Returns:

  • Union[FANOUT_BY_NUMBER, FANOUT_BY_PATH]

    Union[FANOUT_BY_NUMBER, FANOUT_BY_PATH]: A dictionary containing all wires and their fanout counts (if sort_by is 'path'). Alternatively a dictionary of fanout numbers, where for each fanout number the value is a list of wire paths, where the wire has a fanout count equal to the key (if sort_by is 'number').

fanout_by_path

fanout_by_path(module: Module) -> FANOUT_BY_PATH

Analyzes the fanout of the given module and returns a dictionary containing all wires and their fanout.

The keys of the returned dictionary are the wire paths, and the value is the fanout count. If this value is 0, the wire does not have any loads.

If a wire is more than 1 bit wide, and the segments have different fanout numbers, the wire segment paths are used (instead of the wire path) with the corresponding fanout numbers.

Parameters:

  • module

    (Module) –

    The module to analyze the fanout.

Returns:

  • FANOUT_BY_PATH ( FANOUT_BY_PATH ) –

    A dictionary containing all wires and their fanout counts.

fanout_by_number

fanout_by_number(module: Module) -> FANOUT_BY_NUMBER

Analyzes the fanout of the given module and returns a dictionary containing all wires and their fanout.

The keys of the returned dictionary are the fanout numbers, and the value is a list of wire paths, where the wire has a fanout count equal to the key. All entries in the list for key 0 are wires without any loads.

If a wire is more than 1 bit wide, and the segments have different fanout numbers, the wire segment paths are used (instead of the wire path) with the corresponding fanout numbers.

Parameters:

  • module

    (Module) –

    The module to analyze the fanout.

Returns:

  • FANOUT_BY_NUMBER ( FANOUT_BY_NUMBER ) –

    A dictionary of fanout numbers, where for each fanout number the value is a list

  • FANOUT_BY_NUMBER

    of wire paths, where the wire has a fanout count equal to the key (if sort_by is 'number').