Netlist Traversal Decorator

class hal_py.NetlistTraversalDecorator

A netlist decorator that provides functionality to traverse the associated netlist without making any modifications.

__init__(self: hal_py.NetlistTraversalDecorator, netlist: hal_py.Netlist) None

Construct new NetlistTraversalDecorator object.

Parameters

netlist (hal_py.Netlist) – The netlist to operate on.

get_combinational_cone(*args, **kwargs)

Overloaded function.

  1. get_combinational_cone(self: hal_py.NetlistTraversalDecorator, net: hal_py.Net, successors: bool, forbidden_pins: Set[hal_py.PinType] = set()) -> Optional[Set[hal_py.Gate]]

    Starting from the given net, collect the combinational cone in the given direction, i.e., the combinational fan-out (successors = True) or fan-in (successors = False) of the net. Continue traversal as long as further combinational gates are found and stop at gates that are not combinational, so that the cone extends up to (but not including) the sequential boundary. All combinational gates found during traversal are added to the result. Forbidden pins can be provided to, e.g., avoid the inclusion of logic in front of flip-flop control inputs.

    param hal_py.Net net

    Start net.

    param bool successors

    Set True to get the fan-out cone, set False to get the fan-in cone.

    param set[hal_py.PinType] forbidden_pins

    Traversal stops at pins of these types, i.e., gates reached through such a pin are not part of the result. Defaults to an empty set.

    returns

    The gates of the combinational cone on success, None otherwise.

    rtype

    set[hal_py.Gate] or None

  2. get_combinational_cone(self: hal_py.NetlistTraversalDecorator, gate: hal_py.Gate, successors: bool, forbidden_pins: Set[hal_py.PinType] = set()) -> Optional[Set[hal_py.Gate]]

    Starting from the given gate, collect the combinational cone in the given direction, i.e., the combinational fan-out (successors = True) or fan-in (successors = False) of the gate. Continue traversal as long as further combinational gates are found and stop at gates that are not combinational, so that the cone extends up to (but not including) the sequential boundary. All combinational gates found during traversal are added to the result. Forbidden pins can be provided to, e.g., avoid the inclusion of logic in front of flip-flop control inputs.

    param hal_py.Gate gate

    Start gate.

    param bool successors

    Set True to get the fan-out cone, set False to get the fan-in cone.

    param set[hal_py.PinType] forbidden_pins

    Traversal stops at pins of these types, i.e., gates reached through such a pin are not part of the result. Defaults to an empty set.

    returns

    The gates of the combinational cone on success, None otherwise.

    rtype

    set[hal_py.Gate] or None

get_common_inputs(self: hal_py.NetlistTraversalDecorator, gates: List[hal_py.Gate], threshold: int = 0) Optional[List[hal_py.Net]]

Get the nets that are inputs to at least threshold of the given gates.

Shared inputs across a group of gates typically indicate a shared control signal, so this is a cheap way to test whether a set of gates belongs together. Nets driven by GND or VCC gates do not count.

Parameters
  • gates (list[hal_py.Gate]) – The gates to inspect.

  • threshold (int) – The number of gates a net has to feed. 0 to require all of them. Defaults to 0.

Returns

The common input nets on success, None otherwise.

Return type

list[hal_py.Net] or None

get_complex_gate_chain(self: hal_py.NetlistTraversalDecorator, start_gate: hal_py.Gate, chain_types: List[hal_py.GateType], input_pins: Dict[hal_py.GateType, List[hal_py.GatePin]], output_pins: Dict[hal_py.GateType, List[hal_py.GatePin]], filter: Callable[[hal_py.Gate], bool] = None) List[hal_py.Gate]

Find a sequence of gates (of the specified sequence of gate types) that are connected via the specified input and output pins. The start gate may be any gate within a such a sequence, it is not required to be the first or the last gate. However, the start gate must be of the first gate type within the repeating sequence. If input and/or output pins are specified for a gate type, the gates must be connected through one of the input pins and/or one of the output pins. The optional filter is evaluated on every gate such that the result only contains gates matching the specified condition.

Parameters
  • start_gate (hal_py.Gate) – The gate at which to start the chain detection.

  • chain_types (list[hal_py.GateType]) – The sequence of gate types that is expected to make up the gate chain.

  • input_pins (dict[hal_py.GateType,set[str]]) – The input pins (of every gate type of the sequence) through which the gates must be connected.

  • output_pins (dict[hal_py.GateType,set[str]]) – The output pins (of every gate type of the sequence) through which the gates must be connected.

  • filter (lambda) – An optional filter function to be evaluated on each gate.

Returns

A list of gates that form a chain on success, an empty list on error.

Return type

list[hal_py.Gate]

get_gate_chain(self: hal_py.NetlistTraversalDecorator, start_gate: hal_py.Gate, input_pins: List[hal_py.GatePin] = [], output_pins: List[hal_py.GatePin] = [], filter: Callable[[hal_py.Gate], bool] = None) List[hal_py.Gate]

Find a sequence of identical gates that are connected via the specified input and output pins. The start gate may be any gate within a such a sequence, it is not required to be the first or the last gate. If input and/or output pins are specified, the gates must be connected through one of the input pins and/or one of the output pins. The optional filter is evaluated on every gate such that the result only contains gates matching the specified condition.

Parameters
  • start_gate (hal_py.Gate) – The gate at which to start the chain detection.

  • input_pins (list[hal_py.GatePin]) – The input pins through which the gates must be connected. Defaults to an empty list.

  • output_pins (set[hal_py.GatePin]) – The output pins through which the gates must be connected. Defaults to an empty list.

  • filter (lambda) – An optional filter function to be evaluated on each gate.

Returns

A list of gates that form a chain on success, an empty list on error.

Return type

list[hal_py.Gate]

get_gates(*args, **kwargs)

Overloaded function.

  1. get_gates(self: hal_py.NetlistTraversalDecorator, gate: hal_py.Gate, cache: hal_py.TraversalCache) -> Optional[Set[hal_py.Gate]]

    Traverse the netlist from the given gate, sharing results through the cache: what an earlier call worked out is not walked again.

    param hal_py.Gate gate

    The gate to start from.

    param hal_py.TraversalCache cache

    The cache holding the traversal and its results.

    returns

    The collected gates on success, None otherwise.

    rtype

    set[hal_py.Gate] or None

  2. get_gates(self: hal_py.NetlistTraversalDecorator, net: hal_py.Net, cache: hal_py.TraversalCache) -> Optional[Set[hal_py.Gate]]

    Traverse the netlist from the given net, sharing results through the cache: what an earlier call worked out is not walked again.

    param hal_py.Net net

    The net to start from.

    param hal_py.TraversalCache cache

    The cache holding the traversal and its results.

    returns

    The collected gates on success, None otherwise.

    rtype

    set[hal_py.Gate] or None

  3. get_gates(self: hal_py.NetlistTraversalDecorator, gate: hal_py.Gate, direction: hal_py.TraversalDirection, match: Callable[[hal_py.Gate], bool], stop: hal_py.TraversalStop, max_depth: int = 0, exit_endpoint_filter: Callable[[hal_py.Endpoint, int], bool] = None, entry_endpoint_filter: Callable[[hal_py.Endpoint, int], bool] = None) -> Optional[Set[hal_py.Gate]]

    Traverse the netlist from the given gate, collecting the gates that match accepts.

    param hal_py.Gate gate

    The gate to start from.

    param hal_py.TraversalDirection direction

    The direction to traverse in.

    param lambda match

    The condition a gate has to meet to be collected.

    param hal_py.TraversalStop stop

    Where to stop traversing, relative to the gates that match accepts.

    param int max_depth

    The maximum number of gates to traverse through. 0 for no limit.

    param lambda exit_endpoint_filter

    Condition that has to hold to leave a gate.

    param lambda entry_endpoint_filter

    Condition that has to hold to enter a gate.

    returns

    The collected gates on success, None otherwise.

    rtype

    set[hal_py.Gate] or None

get_next_matching_gates(*args, **kwargs)

Overloaded function.

  1. get_next_matching_gates(self: hal_py.NetlistTraversalDecorator, net: hal_py.Net, successors: bool, target_gate_filter: Callable[[hal_py.Gate], bool], continue_on_match: bool = False, exit_endpoint_filter: Callable[[hal_py.Endpoint, int], bool] = None, entry_endpoint_filter: Callable[[hal_py.Endpoint, int], bool] = None) -> Optional[Set[hal_py.Gate]]

    Starting from the given net, traverse the netlist and return only the successor/predecessor gates for which the target_gate_filter evaluates to True. Traverse over gates that do not meet the target_gate_filter condition. Stop traversal if (1) continue_on_match is False the target_gate_filter evaluates to True, (2) the exit_endpoint_filter evaluates to False on a fan-in/out endpoint (i.e., when exiting the current gate during traversal), or (3) the entry_endpoint_filter evaluates to False on a successor/predecessor endpoint (i.e., when entering the next gate during traversal). Both the entry_endpoint_filter and the exit_endpoint_filter may be omitted.

    param hal_py.Net net

    Start net.

    param bool successors

    Set True to get successors, set False to get predecessors.

    param lambda target_gate_filter

    Filter condition that must be met for the target gates.

    param bool continue_on_match

    Set True to continue even if target_gate_filter evaluated to True, False otherwise. Defaults to False.

    param lambda exit_endpoint_filter

    Filter condition that determines whether to stop traversal on a fan-in/out endpoint.

    param lambda entry_endpoint_filter

    Filter condition that determines whether to stop traversal on a successor/predecessor endpoint.

    returns

    The next gates fulfilling the target gate filter condition on success, None otherwise.

    rtype

    set[hal_py.Gate] or None

  2. get_next_matching_gates(self: hal_py.NetlistTraversalDecorator, gate: hal_py.Gate, successors: bool, target_gate_filter: Callable[[hal_py.Gate], bool], continue_on_match: bool = False, exit_endpoint_filter: Callable[[hal_py.Endpoint, int], bool] = None, entry_endpoint_filter: Callable[[hal_py.Endpoint, int], bool] = None) -> Optional[Set[hal_py.Gate]]

    Starting from the given gate, traverse the netlist and return only the successor/predecessor gates for which the target_gate_filter evaluates to True. Traverse over gates that do not meet the target_gate_filter condition. Stop traversal if (1) continue_on_match is False the target_gate_filter evaluates to True, (2) the exit_endpoint_filter evaluates to False on a fan-in/out endpoint (i.e., when exiting the current gate during traversal), or (3) the entry_endpoint_filter evaluates to False on a successor/predecessor endpoint (i.e., when entering the next gate during traversal). Both the entry_endpoint_filter and the exit_endpoint_filter may be omitted.

    param hal_py.Gate gate

    Start gate.

    param bool successors

    Set True to get successors, set False to get predecessors.

    param lambda target_gate_filter

    Filter condition that must be met for the target gates.

    param bool continue_on_match

    Set True to continue even if target_gate_filter evaluated to True, False otherwise. Defaults to False.

    param lambda exit_endpoint_filter

    Filter condition that determines whether to stop traversal on a fan-in/out endpoint.

    param lambda entry_endpoint_filter

    Filter condition that determines whether to stop traversal on a successor/predecessor endpoint.

    returns

    The next gates fulfilling the target gate filter condition on success, None otherwise.

    rtype

    set[hal_py.Gate] or None

get_next_matching_gates_until(*args, **kwargs)

Overloaded function.

  1. get_next_matching_gates_until(self: hal_py.NetlistTraversalDecorator, net: hal_py.Net, successors: bool, target_gate_filter: Callable[[hal_py.Gate], bool], continue_on_mismatch: bool = False, exit_endpoint_filter: Callable[[hal_py.Endpoint, int], bool] = None, entry_endpoint_filter: Callable[[hal_py.Endpoint, int], bool] = None) -> Optional[Set[hal_py.Gate]]

    Starting from the given net, traverse the netlist and return only the successor/predecessor gates for which the target_gate_filter evaluates to True. Continue traversal independent of whatever target_gate_filter evaluates to. Stop traversal if (1) continue_on_mismatch is False the target_gate_filter evaluates to False, (2) the exit_endpoint_filter evaluates to False on a fan-in/out endpoint (i.e., when exiting the current gate during traversal), or (3) the entry_endpoint_filter evaluates to False on a successor/predecessor endpoint (i.e., when entering the next gate during traversal). Both entry_endpoint_filter and the exit_endpoint_filter may be omitted.

    param hal_py.Net net

    Start net.

    param bool successors

    Set True to get successors, set False to get predecessors.

    param lambda target_gate_filter

    Filter condition that must be met for the target gates.

    param bool continue_on_mismatch

    Set True to continue even if target_gate_filter evaluated to False, False otherwise. Defaults to False.

    param lambda exit_endpoint_filter

    Filter condition that determines whether to stop traversal on a fan-in/out endpoint.

    param lambda entry_endpoint_filter

    Filter condition that determines whether to stop traversal on a successor/predecessor endpoint.

    returns

    The next gates fulfilling the target gate filter condition on success, None otherwise.

    rtype

    set[hal_py.Gate] or None

  2. get_next_matching_gates_until(self: hal_py.NetlistTraversalDecorator, gate: hal_py.Gate, successors: bool, target_gate_filter: Callable[[hal_py.Gate], bool], continue_on_mismatch: bool = False, exit_endpoint_filter: Callable[[hal_py.Endpoint, int], bool] = None, entry_endpoint_filter: Callable[[hal_py.Endpoint, int], bool] = None) -> Optional[Set[hal_py.Gate]]

    Starting from the given gate, traverse the netlist and return only the successor/predecessor gates for which the target_gate_filter evaluates to True. Continue traversal independent of whatever target_gate_filter evaluates to. Stop traversal if (1) continue_on_mismatch is False the target_gate_filter evaluates to False, (2) the exit_endpoint_filter evaluates to False on a fan-in/out endpoint (i.e., when exiting the current gate during traversal), or (3) the entry_endpoint_filter evaluates to False on a successor/predecessor endpoint (i.e., when entering the next gate during traversal). Both entry_endpoint_filter and the exit_endpoint_filter may be omitted.

    param hal_py.Gate gate

    Start gate.

    param bool successors

    Set True to get successors, set False to get predecessors.

    param lambda target_gate_filter

    Filter condition that must be met for the target gates.

    param bool continue_on_mismatch

    Set True to continue even if target_gate_filter evaluated to False, False otherwise. Defaults to False.

    param lambda exit_endpoint_filter

    Filter condition that determines whether to stop traversal on a fan-in/out endpoint.

    param lambda entry_endpoint_filter

    Filter condition that determines whether to stop traversal on a successor/predecessor endpoint.

    returns

    The next gates fulfilling the target gate filter condition on success, None otherwise.

    rtype

    set[hal_py.Gate] or None

get_next_matching_gates_until_depth(*args, **kwargs)

Overloaded function.

  1. get_next_matching_gates_until_depth(self: hal_py.NetlistTraversalDecorator, net: hal_py.Net, successors: bool, max_depth: int, target_gate_filter: Callable[[hal_py.Gate], bool] = None) -> Optional[Set[hal_py.Gate]]

    Starting from the given net, traverse the netlist and return only the successor/predecessor gates for which the target_gate_filter evaluates to True. Continue traversal independent of whatever target_gate_filter evaluates to. Stop traversal if the specified depth is reached. The current depth is counted starting at 1 for the destinations of the provided net. For a max_depth of 0, all gates between the start net and the global netlist outputs will be traversed. The target_gate_filter may be omitted in which case all traversed gates will be returned.

    param hal_py.Net net

    Start net.

    param bool successors

    Set True to get successors, set False to get predecessors.

    param int max_depth

    The maximum depth for netlist traversal starting from the start net.

    param lambda target_gate_filter

    Filter condition that must be met for the target gates.

    returns

    The next gates fulfilling the target gate filter condition on success, None otherwise.

    rtype

    set[hal_py.Gate] or None

  2. get_next_matching_gates_until_depth(self: hal_py.NetlistTraversalDecorator, gate: hal_py.Gate, successors: bool, max_depth: int, target_gate_filter: Callable[[hal_py.Gate], bool] = None) -> Optional[Set[hal_py.Gate]]

    Starting from the given gate, traverse the netlist and return only the successor/predecessor gates for which the target_gate_filter evaluates to True. Continue traversal independent of whatever target_gate_filter evaluates to. Stop traversal if the specified depth is reached. The current depth is counted starting at 1 for the direct successors/predecessors of the provided gate. For a max_depth of 0, all gates between the start gate and the global netlist outputs will be traversed. The target_gate_filter may be omitted in which case all traversed gates will be returned.

    param hal_py.Gate gate

    Start gate.

    param bool successors

    Set True to get successors, set False to get predecessors.

    param int max_depth

    The maximum depth for netlist traversal starting from the start gate.

    param lambda target_gate_filter

    Filter condition that must be met for the target gates.

    returns

    The next gates fulfilling the target gate filter condition on success, None otherwise.

    rtype

    set[hal_py.Gate] or None

get_next_sequential_gates(*args, **kwargs)

Overloaded function.

  1. get_next_sequential_gates(self: hal_py.NetlistTraversalDecorator, net: hal_py.Net, successors: bool, forbidden_pins: Set[hal_py.PinType] = set()) -> Optional[Set[hal_py.Gate]]

    Starting from the given net, traverse the netlist and return only the next layer of sequential successor/predecessor gates. Traverse over gates that are not sequential until a sequential gate is found. Stop traversal at all sequential gates, but only adds those to the result that have not been reached through a pin of one of the forbidden types.

    param hal_py.Net net

    Start net.

    param bool successors

    Set True to get successors, set False to get predecessors.

    param set[hal_py.PinType] forbidden_pins

    Sequential gates reached through these pins will not be part of the result. Defaults to an empty set.

    returns

    The next sequential gates on success, None otherwise.

    rtype

    set[hal_py.Gate] or None

  2. get_next_sequential_gates(self: hal_py.NetlistTraversalDecorator, gate: hal_py.Gate, successors: bool, forbidden_pins: Set[hal_py.PinType] = set()) -> Optional[Set[hal_py.Gate]]

    Starting from the given gate, traverse the netlist and return only the next layer of sequential successor/predecessor gates. Traverse over gates that are not sequential until a sequential gate is found. Stop traversal at all sequential gates, but only adds those to the result that have not been reached through a pin of one of the forbidden types.

    param hal_py.Gate gate

    Start gate.

    param bool successors

    Set True to get successors, set False to get predecessors.

    param set[hal_py.PinType] forbidden_pins

    Sequential gates reached through these pins will not be part of the result.

    returns

    The next sequential gates on success, None otherwise.

    rtype

    set[hal_py.Gate] or None

get_next_sequential_gates_map(self: hal_py.NetlistTraversalDecorator, successors: bool, forbidden_pins: Set[hal_py.PinType]) Optional[Dict[hal_py.Gate, Set[hal_py.Gate]]]

Get the next sequential gates for all sequential gates in the netlist by traversing through remaining logic (e.g., combinational logic). Compute a dict from a sequential gate to all its successors. Stop traversal at all sequential gates, but only adds those to the result that have not been reached through a pin of one of the forbidden types.

Parameters
  • successors (bool) – Set True to get successors, set False to get predecessors.

  • forbidden_pins (set[hal_py.PinType]) – Sequential gates reached through these pins will not be part of the result.

Returns

A dict from each sequential gate to all its sequential successors on success, None otherwise.

Return type

dict[hal_py.Gate,set[hal_py.Gate]] or None

get_shortest_path(*args, **kwargs)

Overloaded function.

  1. get_shortest_path(self: hal_py.NetlistTraversalDecorator, start_gate: hal_py.Gate, end_gate: hal_py.Gate, direction: hal_py.PinDirection, exit_endpoint_filter: Callable[[hal_py.Endpoint, int], bool] = None, entry_endpoint_filter: Callable[[hal_py.Endpoint, int], bool] = None) -> Optional[List[hal_py.Gate]]

    Find the shortest path (i.e., the smallest number of gates) that connects the start gate with the end gate. The gate where the search started from will be the first in the result list, the end gate will be the last. If there is no such path, None is returned. If there is more than one path with the same length, only the first one is returned.

    param hal_py.Gate start_gate

    The gate to start from.

    param hal_py.Gate end_gate

    The gate to connect to.

    param hal_py.PinDirection direction

    The direction to search in. Can be hal_py.PinDirection.input, hal_py.PinDirection.output or hal_py.PinDirection.inout to search both directions and return the shorter one.

    param lambda exit_endpoint_filter

    Filter condition that determines whether to stop traversal on a fan-in/out endpoint.

    param lambda entry_endpoint_filter

    Filter condition that determines whether to stop traversal on a successor/predecessor endpoint.

    returns

    A list of gates that connect the start with end gate on success, None otherwise.

    rtype

    list[hal_py.Gate] or None

  2. get_shortest_path(self: hal_py.NetlistTraversalDecorator, start_gate: hal_py.Gate, end_module: hal_py.Module, direction: hal_py.PinDirection, exit_endpoint_filter: Callable[[hal_py.Endpoint, int], bool] = None, entry_endpoint_filter: Callable[[hal_py.Endpoint, int], bool] = None) -> Optional[List[hal_py.Gate]]

    Find the shortest path that connects the start gate with any gate of the given module.

    param hal_py.Gate start_gate

    The gate to start from.

    param hal_py.Module end_module

    The module to connect to. Gates of its submodules count as belonging to it.

    param hal_py.PinDirection direction

    The direction to search in.

    param lambda exit_endpoint_filter

    Filter condition that determines whether to stop traversal on a fan-in/out endpoint.

    param lambda entry_endpoint_filter

    Filter condition that determines whether to stop traversal on a successor/predecessor endpoint.

    returns

    The path on success, None otherwise.

    rtype

    list[hal_py.Gate] or None

  3. get_shortest_path(self: hal_py.NetlistTraversalDecorator, start_module: hal_py.Module, end_module: hal_py.Module, direction: hal_py.PinDirection, exit_endpoint_filter: Callable[[hal_py.Endpoint, int], bool] = None, entry_endpoint_filter: Callable[[hal_py.Endpoint, int], bool] = None) -> Optional[List[List[hal_py.Gate]]]

    Find every shortest path that connects the start module with the end module.

    param hal_py.Module start_module

    The module to start from. Gates of its submodules count as belonging to it.

    param hal_py.Module end_module

    The module to connect to. Gates of its submodules count as belonging to it.

    param hal_py.PinDirection direction

    The direction to search in.

    param lambda exit_endpoint_filter

    Filter condition that determines whether to stop traversal on a fan-in/out endpoint.

    param lambda entry_endpoint_filter

    Filter condition that determines whether to stop traversal on a successor/predecessor endpoint.

    returns

    The shortest paths on success, None otherwise.

    rtype

    list[list[hal_py.Gate]] or None

get_shortest_path_distance(self: hal_py.NetlistTraversalDecorator, start_gate: hal_py.Gate, end_gate: hal_py.Gate, direction: hal_py.PinDirection, exit_endpoint_filter: Callable[[hal_py.Endpoint, int], bool] = None, entry_endpoint_filter: Callable[[hal_py.Endpoint, int], bool] = None) Optional[int]

Find the length of the shortest path (i.e., the smallest number of gates) that connects the start gate with the end gate. If there is no such path, None is returned. Computing only the shortest distance to a gate is faster than computing the shortest path, since it does not have to keep track of the path to reach each gate.

Parameters
  • start_gate (hal_py.Gate) – The gate to start from.

  • end_gate (hal_py.Gate) – The gate to connect to.

  • direction (hal_py.PinDirection) – The direction to search in. Can be hal_py.PinDirection.input, hal_py.PinDirection.output or hal_py.PinDirection.inout to search both directions and return the shorter one.

  • exit_endpoint_filter (lambda) – Filter condition that determines whether to stop traversal on a fan-in/out endpoint.

  • entry_endpoint_filter (lambda) – Filter condition that determines whether to stop traversal on a successor/predecessor endpoint.

Returns

The shortest distance between the start and end gate on success, None otherwise.

Return type

int or None

make_traversal_cache(self: hal_py.NetlistTraversalDecorator, direction: hal_py.TraversalDirection, match: Callable[[hal_py.Gate], bool], stop: hal_py.TraversalStop, exit_endpoint_filter: Callable[[hal_py.Endpoint], bool] = None, entry_endpoint_filter: Callable[[hal_py.Endpoint], bool] = None) hal_py.TraversalCache

Create a cache for one specific traversal, to be handed to get_gates in place of the traversal’s parameters.

The direction must be TraversalDirection.forward or backward. The endpoint filters receive no depth and there is no depth limit, as either would make the cached answers depend on how a net was reached.

Parameters
  • direction (hal_py.TraversalDirection) – The direction to traverse in.

  • match (lambda) – The condition a gate has to meet to be collected.

  • stop (hal_py.TraversalStop) – Where to stop traversing, relative to the gates that match accepts.

  • exit_endpoint_filter (lambda) – Condition that has to hold to leave a gate.

  • entry_endpoint_filter (lambda) – Condition that has to hold to enter a gate.

Returns

The cache.

Return type

hal_py.TraversalCache

class hal_py.TraversalDirection

The direction in which a netlist is traversed.

Members:

forward : Follow the fan-out, i.e., towards the successors of a gate.

backward : Follow the fan-in, i.e., towards the predecessors of a gate.

both : Follow both directions.

property name
class hal_py.TraversalStop

Where a traversal stops relative to the gates it is looking for.

Members:

at_match : Stop at a gate the filter accepts, so the collected gates bound the search.

at_mismatch : Stop at a gate the filter rejects, so the collected gates form a connected region.

never : Do not stop at a gate; bound the traversal with a depth or the endpoint filters.

property name
class hal_py.TraversalCache

A reusable store for the results of one specific traversal, handed to NetlistTraversalDecorator.get_gates.

The traversal a cache belongs to is sealed in when it is created and the cache can only ever be used for exactly that traversal, which is what makes reuse sound. Create one with NetlistTraversalDecorator.make_traversal_cache and drop it when the netlist is modified.