gdsfactory.get_netlist.get_netlist

Contents

gdsfactory.get_netlist.get_netlist#

gdsfactory.get_netlist.get_netlist(component: ~gdsfactory.component.Component, tolerance: int = 5, exclude_port_types: list[str] | tuple[str] | None = ('placement',), get_instance_name: ~collections.abc.Callable[[...], str] = <function get_instance_name_from_alias>, allow_multiple: bool = False, merge_info: bool = False, extend_recursive_port_names: bool = False) dict[str, Any][source]#

Returns instances, connections and placements from Component as a dict.

Does two sweeps over the connections:

  1. first tries to connect everything assuming perfect connections at each port.

  2. Then gathers ports which did not perfectly connect to anything and tries to find imperfect connections, by grouping ports on a coarse grid.

warnings collected during netlisting are reported back into the netlist. These include warnings about mismatched port widths, orientations, shear angles, excessive offsets, etc. You can also configure warning types which should throw an error when encountered by modifying DEFAULT_CRITICAL_CONNECTION_ERROR_TYPES. Validators, which will produce warnings for each port type, can be overridden with DEFAULT_CONNECTION_VALIDATORS A key difference in this algorithm is that we group each port type independently. This allows us to use different logic to determine i.e. if an electrical port is properly connected vs an optical port. In this function, the core logic is the same, but we employ extra validation for optical ports. snap_to_grid() allows a value of 0, which will return the original value, is more efficient when the value is 1, and will throw a more descriptive error when the value is <0 the default value of tolerance is 5nm because it should allow better performance with the two-grid-sweep approach.

Parameters:
  • component – to extract netlist.

  • tolerance – tolerance in grid_factor to consider two ports connected.

  • exclude_port_types – optional list of port types to exclude from netlisting.

  • get_instance_name – function to get instance name.

  • allow_multiple – False to raise an error if more than two ports share the same connection. if True, will return key: [value] pairs with [value] a list of all connected instances.

  • merge_info – True to merge info and settings into the same dict.

  • extend_recursive_port_names – Compatibility with recursive get_netlist port name identifiers.

Returns:

instances: Dict of instance name and settings. connections: Dict of Instance1Name,portName: Instance2Name,portName. placements: Dict of instance names and placements (x, y, rotation). port: Dict portName: ComponentName,port. name: name of component. warnings: warning messages (disconnected pins).

Return type:

Dictionary containing the following