KLayout 0.29.8 (2024-11-26 926dac96c) [master]

API reference - Class LayoutToNetlist

Notation used in Ruby API documentation

Module: db

Description: A framework for extracting netlists from layouts

Sub-classes: BuildNetHierarchyMode

This class provides a framework for extracting a netlist from a layout.

A LayoutToNetlist object extracts a netlist from an external Layout. To do so, it keeps an internal copy with an optimized representation of the original layout. When a netlist is extracted the net geometries can be recovered from that internal layout. In addition to that layout, it keeps the extracted netlist. Netlist and internal layout form a pair and there are references between them. For example, the Circuit objects from the netlist have an attribute cell_index, which tells what cell from the internal layout the circuit was derived from. In the same way, subcircuit references refer to cell instances and nets keep a reference to the shapes they were derived from.

LayoutToNetlist can also operate in detached mode, when there is no external layout. In this mode, layers are created inside the internal layout only. As there is no input hierarchy, operation is necessarily flat in that case. Single Region and Texts shape collections can be introduced into the LayoutToNetlist objects from external sources to populate the layers from the internal layout. For detached mode, use the 'LayoutToNetlist(topcell, dbu)' constructor.

Usually, the internal layout is stored inside an internal DeepShapeStore object, which supplies additional services such as layer lifetime management and maintains the connection to and from the external layout. However, you can also use the extractor with an existing DeepShapeStore object. In that case, this external DeepShapeStore object is used instead of the internal one.

The LayoutToNetlist object can be persisted into a 'Layout to netlist database' file. This database is a storage for both the netlist and the net or circuit geometries. When reading such file into a new LayoutToNetlist object, there will be no connection to any external layout, but all the essential netlist and geometry information will be available.

The LayoutToNetlist object is also the entry point for netlist-driven algorithms such as antenna checks.

The use model of the LayoutToNetlist object consists of five steps which need to be executed in this order.

Once the extraction is done, you can persist the LayoutToNetlist object using write and restore it using read. You can use the query API (see below) to analyze the LayoutToNetlist database.

The query API of the LayoutToNetlist object consists of the following parts:

The LayoutToNetlist object is also the entry point for connectivity-aware DRC checks, such as antenna checks.

This class has been introduced in version 0.26.

Public constructors

new LayoutToNetlist ptrnew(const RecursiveShapeIterator iter)Creates a new extractor connected to an original layout
new LayoutToNetlist ptrnewCreates a new and empty extractor object
new LayoutToNetlist ptrnew(DeepShapeStore ptr dss,
unsigned int layout_index = 0)
Creates a new extractor object reusing an existing DeepShapeStore object
new LayoutToNetlist ptrnew(string topcell_name,
double dbu)
Creates a new, detached extractor object with a flat DSS

Public methods

[const]LayoutToNetlist ptr_const_castReturns a non-const reference to self.
void_createEnsures the C++ object is created
void_destroyExplicitly destroys the object
[const]bool_destroyed?Returns a value indicating whether the object was already destroyed
[const]bool_is_const_object?Returns a value indicating whether the reference is a const reference
void_manageMarks the object as managed by the script side.
void_unmanageMarks the object as no longer owned by the script side.
Regionantenna_check(const Region gate,
const Region metal,
double ratio,
variant[] diodes = [],
Texts ptr texts = nil)
Runs an antenna check on the extracted clusters
Regionantenna_check(const Region gate,
double gate_perimeter_factor,
const Region metal,
double metal_perimeter_factor,
double ratio,
variant[] diodes = [],
Texts ptr texts = nil)
Runs an antenna check on the extracted clusters taking the perimeter into account
Regionantenna_check(const Region gate,
double gate_area_factor,
double gate_perimeter_factor,
const Region metal,
double metal_area_factor,
double metal_perimeter_factor,
double ratio,
variant[] diodes = [],
Texts ptr texts = nil)
Runs an antenna check on the extracted clusters taking the perimeter into account and providing an area factor
[const]doublearea_ratioGets the area_ratio parameter for the hierarchical network processor
voidarea_ratio=(double r)Sets the area_ratio parameter for the hierarchical network processor
[const]voidbuild_all_nets(const CellMapping cmap,
Layout target,
map<unsigned int,const Region ptr> lmap,
variant net_cell_name_prefix = nil,
variant netname_prop = nil,
LayoutToNetlist::BuildNetHierarchyMode hier_mode = BNH_Flatten,
variant circuit_cell_name_prefix = nil,
variant device_cell_name_prefix = nil)
Builds a full hierarchical representation of the nets
[const]voidbuild_net(const Net net,
Layout target,
Cell target_cell,
map<unsigned int,const Region ptr> lmap,
variant netname_prop = nil,
LayoutToNetlist::BuildNetHierarchyMode hier_mode = BNH_Flatten,
variant circuit_cell_name_prefix = nil,
variant device_cell_name_prefix = nil)
Builds a net representation in the given layout and cell
[const]voidbuild_nets(const Net ptr[] nets,
const CellMapping cmap,
Layout target,
map<unsigned int,const Region ptr> lmap,
variant net_cell_name_prefix = nil,
variant netname_prop = nil,
LayoutToNetlist::BuildNetHierarchyMode hier_mode = BNH_Flatten,
variant circuit_cell_name_prefix = nil,
variant device_cell_name_prefix = nil)
Like build_all_nets, but with the ability to select some nets.
CellMappingcell_mapping_into(Layout layout,
Cell cell,
bool with_device_cells = false)
Creates a cell mapping for copying shapes from the internal layout to the given target layout.
CellMappingcell_mapping_into(Layout layout,
Cell cell,
const Net ptr[] nets,
bool with_device_cells = false)
Creates a cell mapping for copying shapes from the internal layout to the given target layout.
voidcheck_extraction_errorsRaises an exception if extraction errors are present
voidclear_join_net_namesClears all implicit net joining expressions.
voidclear_join_netsClears all explicit net joining expressions.
voidconnect(const Region l)Defines an intra-layer connection for the given layer.
voidconnect(const Region a,
const Region b)
Defines an inter-layer connection for the given layers.
voidconnect(const Region a,
const Texts b)
Defines an inter-layer connection for the given layers.
voidconnect(const Texts a,
const Region b)
Defines an inter-layer connection for the given layers.
unsigned longconnect_global(const Region l,
string global_net_name)
Defines a connection of the given layer with a global net.
unsigned longconnect_global(const Texts l,
string global_net_name)
Defines a connection of the given text layer with a global net.
CellMappingconst_cell_mapping_into(const Layout layout,
const Cell cell)
Creates a cell mapping for copying shapes from the internal layout to the given target layout.
[const]stringdescriptionGets the description of the database
voiddescription=(string description)Sets the description of the database
[const]doubledevice_scalingGets the device scaling factor
voiddevice_scaling=(double f)Sets the device scaling factor
DeepShapeStoredssGets a reference to the internal DSS object.
[const,iter]LogEntryDataeach_log_entryIterates over all log entries collected during device and netlist extraction.
voidextract_devices(DeviceExtractorBase extractor,
map<string,ShapeCollection ptr> layers)
Extracts devices
voidextract_netlistRuns the netlist extraction
[const]stringfilenameGets the file name of the database
[const]stringgeneratorGets the generator string.
voidgenerator=(string generator)Sets the generator string.
[const]stringglobal_net_name(unsigned long global_net_id)Gets the global net name for the given global net ID.
[const]boolinclude_floating_subcircuitsGets a flag indicating whether to include floating subcircuits in the netlist.
voidinclude_floating_subcircuits=(bool flag)Sets a flag indicating whether to include floating subcircuits in the netlist.
Layout ptrinternal_layoutGets the internal layout
Cell ptrinternal_top_cellGets the internal top cell
[const]boolis_extracted?Gets a value indicating whether the netlist has been extracted
[const]boolis_persisted?(const Region layer)Returns true, if the given layer is a persisted region.
[const]boolis_persisted?(const Texts layer)Returns true, if the given layer is a persisted texts collection.
voidjoin_net_names(string pattern)Specifies another pattern for implicit joining of nets for the top level cell.
voidjoin_net_names(string cell_pattern,
string pattern)
Specifies another pattern for implicit joining of nets for the cells from the given cell pattern.
voidjoin_nets(string[] net_names)Specifies another name list for explicit joining of nets for the top level cell.
voidjoin_nets(string cell_pattern,
string[] net_names)
Specifies another name list for explicit joining of nets for the cells from the given cell pattern.
voidkeep_dssTakes ownership of the DSS object if the LayoutToNetlist object was created with an external one.
new Region ptrlayer_by_index(unsigned int index)Gets a layer object for the given index.
new Region ptrlayer_by_name(string name)Gets a layer object for the given name.
[const]unsigned intlayer_index(const ShapeCollection l)Gets the layer index for the given data object
[const]unsigned int[]layer_indexesReturns a list of indexes of the layers kept inside the LayoutToNetlist object.
[const]LayerInfolayer_info(unsigned int index)Returns the LayerInfo object attached to a layer (by index).
[const]stringlayer_name(const ShapeCollection l)Gets the name of the given layer
[const]stringlayer_name(unsigned int l)Gets the name of the given layer (by index)
[const]string[]layer_namesReturns a list of names of the layers kept inside the LayoutToNetlist object.
[const]unsigned intlayer_of(const Region l)Gets the internal layer for a given extraction layer
[const]unsigned intlayer_of(const Texts l)Gets the internal layer for a given text collection
new Region ptrmake_layer(string name = )Creates a new, empty hierarchical region
new Region ptrmake_layer(unsigned int layer_index,
string name = )
Creates a new hierarchical region representing an original layer
new Region ptrmake_polygon_layer(unsigned int layer_index,
string name = )
Creates a new region representing an original layer taking polygons only
new Texts ptrmake_text_layer(unsigned int layer_index,
string name = )
Creates a new region representing an original layer taking texts only
[const]unsigned longmax_vertex_count
voidmax_vertex_count=(unsigned long n)Sets the max_vertex_count parameter for the hierarchical network processor
[const]stringnameGets the name of the database
voidname=(string name)Sets the name of the database
[const]Netlist ptrnetlistgets the netlist extracted (0 if no extraction happened yet)
[const]stringoriginal_fileGets the original file name of the database
voidoriginal_file=(string path)Sets the original file name of the database
Net ptrprobe_net(const Region of_layer,
const DPoint point,
SubCircuit ptr[] ptr sc_path_out = nil,
Circuit ptr initial_circuit = nil)
Finds the net by probing a specific location on the given layer
Net ptrprobe_net(const Region of_layer,
const Point point,
SubCircuit ptr[] ptr sc_path_out = nil,
Circuit ptr initial_circuit = nil)
Finds the net by probing a specific location on the given layer
voidread(string path)Reads the extracted netlist from the file.
voidread_l2n(string path)Reads the extracted netlist from the file.
unsigned intregister(const ShapeCollection l,
string n = )
Names the given layer
voidreset_extractedResets the extracted netlist and enables re-extraction
[const]new Region ptrshapes_of_net(const Net net,
const Region of_layer,
bool recursive = true,
const ICplxTrans trans = unity)
Returns all shapes of a specific net and layer.
[const]voidshapes_of_net(const Net net,
const Region of_layer,
bool recursive,
Shapes to,
unsigned long propid = 0,
const ICplxTrans trans = unity)
Sends all shapes of a specific net and layer to the given Shapes container.
[const]map<unsigned int,Region>shapes_of_pin(const NetSubcircuitPinRef pin,
const ICplxTrans trans = unity)
Returns all shapes of the given subcircuit pin that make a connection to the net the pin lives in.
[const]map<unsigned int,Region>shapes_of_terminal(const NetTerminalRef terminal,
const ICplxTrans trans = unity)
Returns all shapes of the given device terminal that make a connection to the net the terminal lives in.
voidsoft_connect(const Region a,
const Region b)
Defines an inter-layer connection for the given layers in soft mode.
voidsoft_connect(const Region a,
const Texts b)
Defines an inter-layer connection for the given layers in soft mode.
voidsoft_connect(const Texts a,
const Region b)
Defines an inter-layer connection for the given layers in soft mode.
unsigned longsoft_connect_global(const Region l,
string global_net_name)
Defines a connection of the given layer with a global net in soft mode.
unsigned longsoft_connect_global(const Texts l,
string global_net_name)
Defines a connection of the given text layer with a global net in soft mode.
[const]intthreadsGets the number of threads to use for operations which support multiple threads
voidthreads=(int n)Sets the number of threads to use for operations which support multiple threads
[const]booltop_level_modeGets a flag indicating whether top level mode is enabled.
voidtop_level_mode=(bool flag)Sets a flag indicating whether top level mode is enabled.
voidwrite(string path,
bool short_format = false)
Writes the extracted netlist to a file.
voidwrite_l2n(string path,
bool short_format = false)
Writes the extracted netlist to a file.

Public static methods and constants

[static,const]LayoutToNetlist::BuildNetHierarchyModeBNH_DisconnectedThis constant tells build_net and build_all_nets to produce local nets without connections to subcircuits (used for the "hier_mode" parameter).
[static,const]LayoutToNetlist::BuildNetHierarchyModeBNH_FlattenThis constant tells build_net and build_all_nets to flatten the nets (used for the "hier_mode" parameter).
[static,const]LayoutToNetlist::BuildNetHierarchyModeBNH_SubcircuitCellsThis constant tells build_net and build_all_nets to produce a hierarchy of subcircuit cells per net (used for the "hier_mode" parameter).

Deprecated methods (protected, public, static, non-static and constructors)

voidcreateUse of this method is deprecated. Use _create instead
voiddestroyUse of this method is deprecated. Use _destroy instead
[const]booldestroyed?Use of this method is deprecated. Use _destroyed? instead
[const,iter]LogEntryDataeach_errorUse of this method is deprecated. Use each_log_entry instead
[const]boolis_const_object?Use of this method is deprecated. Use _is_const_object? instead

Detailed description

BNH_Disconnected

Signature: [static,const] LayoutToNetlist::BuildNetHierarchyMode BNH_Disconnected

Description: This constant tells build_net and build_all_nets to produce local nets without connections to subcircuits (used for the "hier_mode" parameter).

Python specific notes:
The object exposes a readable attribute 'BNH_Disconnected'. This is the getter.

BNH_Flatten

Signature: [static,const] LayoutToNetlist::BuildNetHierarchyMode BNH_Flatten

Description: This constant tells build_net and build_all_nets to flatten the nets (used for the "hier_mode" parameter).

Python specific notes:
The object exposes a readable attribute 'BNH_Flatten'. This is the getter.

BNH_SubcircuitCells

Signature: [static,const] LayoutToNetlist::BuildNetHierarchyMode BNH_SubcircuitCells

Description: This constant tells build_net and build_all_nets to produce a hierarchy of subcircuit cells per net (used for the "hier_mode" parameter).

Python specific notes:
The object exposes a readable attribute 'BNH_SubcircuitCells'. This is the getter.

_const_cast

Signature: [const] LayoutToNetlist ptr _const_cast

Description: Returns a non-const reference to self.

Basically, this method allows turning a const object reference to a non-const one. This method is provided as last resort to remove the constness from an object. Usually there is a good reason for a const object reference, so using this method may have undesired side effects.

This method has been introduced in version 0.29.6.

_create

Signature: void _create

Description: Ensures the C++ object is created

Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created.

_destroy

Signature: void _destroy

Description: Explicitly destroys the object

Explicitly destroys the object on C++ side if it was owned by the script interpreter. Subsequent access to this object will throw an exception. If the object is not owned by the script, this method will do nothing.

_destroyed?

Signature: [const] bool _destroyed?

Description: Returns a value indicating whether the object was already destroyed

This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself.

_is_const_object?

Signature: [const] bool _is_const_object?

Description: Returns a value indicating whether the reference is a const reference

This method returns true, if self is a const reference. In that case, only const methods may be called on self.

_manage

Signature: void _manage

Description: Marks the object as managed by the script side.

After calling this method on an object, the script side will be responsible for the management of the object. This method may be called if an object is returned from a C++ function and the object is known not to be owned by any C++ instance. If necessary, the script side may delete the object if the script's reference is no longer required.

Usually it's not required to call this method. It has been introduced in version 0.24.

_unmanage

Signature: void _unmanage

Description: Marks the object as no longer owned by the script side.

Calling this method will make this object no longer owned by the script's memory management. Instead, the object must be managed in some other way. Usually this method may be called if it is known that some C++ object holds and manages this object. Technically speaking, this method will turn the script's reference into a weak reference. After the script engine decides to delete the reference, the object itself will still exist. If the object is not managed otherwise, memory leaks will occur.

Usually it's not required to call this method. It has been introduced in version 0.24.

antenna_check

(1) Signature: Region antenna_check (const Region gate, const Region metal, double ratio, variant[] diodes = [], Texts ptr texts = nil)

Description: Runs an antenna check on the extracted clusters

The antenna check will traverse all clusters and run an antenna check for all root clusters. The antenna ratio is defined by the total area of all "metal" shapes divided by the total area of all "gate" shapes on the cluster. Of all clusters where the antenna ratio is larger than the limit ratio all metal shapes are copied to the output region as error markers.

The simple call is:

l2n = ... # a LayoutToNetlist object
l2n.extract_netlist
# check for antenna ratio 10.0 of metal vs. poly:
errors = l2n.antenna(poly, metal, 10.0)

You can include diodes which rectify the antenna effect. Provide recognition layers for theses diodes and include them in the connections. Then specify the diode layers in the antenna call:

...
# include diode_layer1:
errors = l2n.antenna(poly, metal, 10.0, [ diode_layer1 ])
# include diode_layer1 and diode_layer2:errors = l2n.antenna(poly, metal, 10.0, [ diode_layer1, diode_layer2 ])

Diodes can be configured to partially reduce the antenna effect depending on their area. This will make the diode_layer1 increase the ratio by 50.0 per square micrometer area of the diode:

...
# diode_layer1 increases the ratio by 50 per square micrometer area:
errors = l2n.antenna(poly, metal, 10.0 [ [ diode_layer, 50.0 ] ])

If 'texts' is non-nil, this text collection will receive labels explaining the error in terms of area values and relevant ratio.

The 'texts' parameter has been added in version 0.27.11.

(2) Signature: Region antenna_check (const Region gate, double gate_perimeter_factor, const Region metal, double metal_perimeter_factor, double ratio, variant[] diodes = [], Texts ptr texts = nil)

Description: Runs an antenna check on the extracted clusters taking the perimeter into account

This version of the antenna_check method allows taking the perimeter of gate or metal into account. The effective area is computed using:

Aeff = A + P * t

Here Aeff is the area used in the check, A is the polygon area, P the perimeter and t the perimeter factor. This formula applies to gate polygon area/perimeter with 'gate_perimeter_factor' for t and metal polygon area/perimeter with 'metal_perimeter_factor'. The perimeter_factor has the dimension of micrometers and can be thought of as the width of the material. Essentially the side walls of the material are taking into account for the surface area as well.

This variant has been introduced in version 0.26.6.

(3) Signature: Region antenna_check (const Region gate, double gate_area_factor, double gate_perimeter_factor, const Region metal, double metal_area_factor, double metal_perimeter_factor, double ratio, variant[] diodes = [], Texts ptr texts = nil)

Description: Runs an antenna check on the extracted clusters taking the perimeter into account and providing an area factor

This (most generic) version of the antenna_check method allows taking the perimeter of gate or metal into account and also provides a scaling factor for the area part. The effective area is computed using:

Aeff = A * f + P * t

Here f is the area factor and t the perimeter factor. A is the polygon area and P the polygon perimeter. A use case for this variant is to set the area factor to zero. This way, only perimeter contributions are considered.

This variant has been introduced in version 0.26.6.

area_ratio

Signature: [const] double area_ratio

Description: Gets the area_ratio parameter for the hierarchical network processor

See area_ratio= for details about this attribute.

Python specific notes:
The object exposes a readable attribute 'area_ratio'. This is the getter.

area_ratio=

Signature: void area_ratio= (double r)

Description: Sets the area_ratio parameter for the hierarchical network processor

This parameter controls splitting of large polygons in order to reduce the error made by the bounding box approximation.

Python specific notes:
The object exposes a writable attribute 'area_ratio'. This is the setter.

build_all_nets

Signature: [const] void build_all_nets (const CellMapping cmap, Layout target, map<unsigned int,const Region ptr> lmap, variant net_cell_name_prefix = nil, variant netname_prop = nil, LayoutToNetlist::BuildNetHierarchyMode hier_mode = BNH_Flatten, variant circuit_cell_name_prefix = nil, variant device_cell_name_prefix = nil)

Description: Builds a full hierarchical representation of the nets

cmap:The mapping of internal layout to target layout for the circuit mapping
target:The target layout
lmap:Target layer indexes (keys) and net regions (values)
hier_mode:See description of this method
netname_prop:An (optional) property name to which to attach the net name
circuit_cell_name_prefix:See method description
net_cell_name_prefix:See method description
device_cell_name_prefix:See above

This method copies all nets into cells corresponding to the circuits. It uses the 'cmap' object to determine the target cell (create it with "cell_mapping_into" or "const_cell_mapping_into"). If no mapping is provided for a specific circuit cell, the nets are copied into the next mapped parent as many times as the circuit cell appears there (circuit flattening).

If 'netname_prop' is not nil, a property with the given name is created and attached to shapes. The value of the property is the net name.

'lmap' defines which layers are to be produced. It is map, where the keys are layer indexes in the target layout and the values are Region objects indicating the layer where shapes are to be taken from. Use layer_by_name or layer_by_index to get the Region object corresponding to a layer stored inside the LayoutToNetlist database.

The method has three net annotation modes:

  • No annotation (net_cell_name_prefix == nil and netname_prop == nil): the shapes will be put into the target cell simply.
  • Net name property (net_cell_name_prefix == nil and netname_prop != nil): the shapes will be annotated with a property named with netname_prop and containing the net name string.
  • Individual subcells per net (net_cell_name_prefix != 0): for each net, a subcell is created and the net shapes will be put there (name of the subcell = net_cell_name_prefix + net name). (this mode can be combined with netname_prop too).

In addition, net hierarchy is covered in three ways:

  • No connection indicated (hier_mode == BNH_Disconnected: the net shapes are simply put into their respective circuits. The connections are not indicated.
  • Subnet hierarchy (hier_mode == BNH_SubcircuitCells): for each root net, a full hierarchy is built to accommodate the subnets (see build_net in recursive mode).
  • Flat (hier_mode == BNH_Flatten): each net is flattened and put into the circuit it belongs to.

If a device cell name prefix is given, cells will be produced for each device abstract using a name like device_cell_name_prefix + device name. Otherwise the device shapes are treated as part of the net.

build_net

Signature: [const] void build_net (const Net net, Layout target, Cell target_cell, map<unsigned int,const Region ptr> lmap, variant netname_prop = nil, LayoutToNetlist::BuildNetHierarchyMode hier_mode = BNH_Flatten, variant circuit_cell_name_prefix = nil, variant device_cell_name_prefix = nil)

Description: Builds a net representation in the given layout and cell

target:The target layout
target_cell:The target cell
lmap:Target layer indexes (keys) and net regions (values)
hier_mode:See description of this method
netname_prop:An (optional) property name to which to attach the net name
cell_name_prefix:Chooses recursive mode if non-null
device_cell_name_prefix:See above

This method puts the shapes of a net into the given target cell using a variety of options to represent the net name and the hierarchy of the net.

If 'netname_prop' is not nil, a property with the given name is created and attached to shapes. The value of the property is the net name.

'lmap' defines which layers are to be produced. It is map, where the keys are layer indexes in the target layout and the values are Region objects indicating the layer where shapes are to be taken from. Use layer_by_name or layer_by_index to get the Region object corresponding to a layer stored inside the LayoutToNetlist database.

Net hierarchy is covered in three ways:

  • No connection indicated (hier_mode == BNH_Disconnected: the net shapes are simply put into their respective circuits. The connections are not indicated.
  • Subnet hierarchy (hier_mode == BNH_SubcircuitCells): for each root net, a full hierarchy is built to accommodate the subnets (see build_net in recursive mode).
  • Flat (hier_mode == BNH_Flatten): each net is flattened and put into the circuit it belongs to.
If a device cell name prefix is given, cells will be produced for each device abstract using a name like device_cell_name_prefix + device name. Otherwise the device shapes are treated as part of the net.

build_nets

Signature: [const] void build_nets (const Net ptr[] nets, const CellMapping cmap, Layout target, map<unsigned int,const Region ptr> lmap, variant net_cell_name_prefix = nil, variant netname_prop = nil, LayoutToNetlist::BuildNetHierarchyMode hier_mode = BNH_Flatten, variant circuit_cell_name_prefix = nil, variant device_cell_name_prefix = nil)

Description: Like build_all_nets, but with the ability to select some nets.

cell_mapping_into

(1) Signature: CellMapping cell_mapping_into (Layout layout, Cell cell, bool with_device_cells = false)

Description: Creates a cell mapping for copying shapes from the internal layout to the given target layout.

If 'with_device_cells' is true, cells will be produced for devices. These are cells not corresponding to circuits, so they are disabled normally. Use this option, if you want to access device terminal shapes per device.

CAUTION: this function may create new cells in 'layout'. Use const_cell_mapping_into if you want to use the target layout's hierarchy and not modify it.

(2) Signature: CellMapping cell_mapping_into (Layout layout, Cell cell, const Net ptr[] nets, bool with_device_cells = false)

Description: Creates a cell mapping for copying shapes from the internal layout to the given target layout.

This version will only create cells which are required to represent the nets from the 'nets' argument.

If 'with_device_cells' is true, cells will be produced for devices. These are cells not corresponding to circuits, so they are disabled normally. Use this option, if you want to access device terminal shapes per device.

CAUTION: this function may create new cells in 'layout'. Use const_cell_mapping_into if you want to use the target layout's hierarchy and not modify it.

check_extraction_errors

Signature: void check_extraction_errors

Description: Raises an exception if extraction errors are present

This method has been introduced in version 0.28.13.

clear_join_net_names

Signature: void clear_join_net_names

Description: Clears all implicit net joining expressions.

See extract_netlist for more details about this feature.

This method has been introduced in version 0.27 and replaces the arguments of extract_netlist.

clear_join_nets

Signature: void clear_join_nets

Description: Clears all explicit net joining expressions.

See extract_netlist for more details about this feature.

Explicit net joining has been introduced in version 0.27.

connect

(1) Signature: void connect (const Region l)

Description: Defines an intra-layer connection for the given layer.

The layer as a Region object, representing either an original layer created with make_layer and its variants or a derived layer which was registered using register. Certain limitations apply. It's safe to use boolean operations for deriving layers. Other operations are applicable as long as they are capable of delivering hierarchical layers. Operations that introduce flat layers will create additonal pins as connections need to be made from a subcell to the top cell. Hence, flat layers - or rather some with a bad hierarchy - should be avoided in connect.

(2) Signature: void connect (const Region a, const Region b)

Description: Defines an inter-layer connection for the given layers.

The conditions mentioned with intra-layer connect apply for this method too.

(3) Signature: void connect (const Region a, const Texts b)

Description: Defines an inter-layer connection for the given layers.

The conditions mentioned with intra-layer connect apply for this method too. As one argument is a (hierarchical) text collection, this method is used to attach net labels to polygons.

This variant has been introduced in version 0.27.

(4) Signature: void connect (const Texts a, const Region b)

Description: Defines an inter-layer connection for the given layers.

The conditions mentioned with intra-layer connect apply for this method too. As one argument is a (hierarchical) text collection, this method is used to attach net labels to polygons.

This variant has been introduced in version 0.27.

connect_global

(1) Signature: unsigned long connect_global (const Region l, string global_net_name)

Description: Defines a connection of the given layer with a global net.

This method returns the ID of the global net. Use global_net_name to get the name back from the ID.

(2) Signature: unsigned long connect_global (const Texts l, string global_net_name)

Description: Defines a connection of the given text layer with a global net.

This method returns the ID of the global net. Use global_net_name to get the name back from the ID.

This variant has been introduced in version 0.27.

const_cell_mapping_into

Signature: CellMapping const_cell_mapping_into (const Layout layout, const Cell cell)

Description: Creates a cell mapping for copying shapes from the internal layout to the given target layout.

This version will not create new cells in the target layout. If the required cells do not exist there yet, flatting will happen.

create

Signature: void create

Description: Ensures the C++ object is created

Use of this method is deprecated. Use _create instead

Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created.

description

Signature: [const] string description

Description: Gets the description of the database

Python specific notes:
The object exposes a readable attribute 'description'. This is the getter.

description=

Signature: void description= (string description)

Description: Sets the description of the database

Python specific notes:
The object exposes a writable attribute 'description'. This is the setter.

destroy

Signature: void destroy

Description: Explicitly destroys the object

Use of this method is deprecated. Use _destroy instead

Explicitly destroys the object on C++ side if it was owned by the script interpreter. Subsequent access to this object will throw an exception. If the object is not owned by the script, this method will do nothing.

destroyed?

Signature: [const] bool destroyed?

Description: Returns a value indicating whether the object was already destroyed

Use of this method is deprecated. Use _destroyed? instead

This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself.

device_scaling

Signature: [const] double device_scaling

Description: Gets the device scaling factor

See device_scaling= for details about this attribute.

Python specific notes:
The object exposes a readable attribute 'device_scaling'. This is the getter.

device_scaling=

Signature: void device_scaling= (double f)

Description: Sets the device scaling factor

This factor will scale the physical properties of the extracted devices accordingly. The scale factor applies an isotropic shrink (<1) or expansion (>1).

Python specific notes:
The object exposes a writable attribute 'device_scaling'. This is the setter.

dss

Signature: DeepShapeStore dss

Description: Gets a reference to the internal DSS object.

See the class description for details about the DSS object used inside the LayoutToNetlist object.

each_error

Signature: [const,iter] LogEntryData each_error

Description: Iterates over all log entries collected during device and netlist extraction.

Use of this method is deprecated. Use each_log_entry instead

This method has been introduced in version 0.28.13.

each_log_entry

Signature: [const,iter] LogEntryData each_log_entry

Description: Iterates over all log entries collected during device and netlist extraction.

This method has been introduced in version 0.28.13.

extract_devices

Signature: void extract_devices (DeviceExtractorBase extractor, map<string,ShapeCollection ptr> layers)

Description: Extracts devices

See the class description for more details. This method will run device extraction for the given extractor. The layer map is specific for the extractor and uses the Region objects derived with make_layer and its variants or Region objects registered through register. The layer map keys are the inputs layers defined for the specific extractor, but also the output layers where the extractor places markers for the device terminals.

In addition, derived regions can also be passed to the device extractor inside the layer map. Certain limitations apply. It is usually safe to use boolean operations for deriving layers. Other operations are applicable as long as they are capable of delivering hierarchical layers.

Example:

ly = ... # original Layout

l2n = RBA::LayoutToNetlist::new(RBA::RecursiveShapeIterator::new(ly, ly.top_cell, []))
rnwell   = l2n.make_layer(ly.layer(1, 0), "nwell" )
ractive  = l2n.make_layer(ly.layer(2, 0), "active" )
rpoly    = l2n.make_layer(ly.layer(3, 0), "poly" )

rpactive = ractive & rnwell
rpgate   = rpactive & rpoly
rpsd     = rpactive - rpgate

rnactive = ractive - rnwell
rngate   = rnactive & rpoly
rnsd     = rnactive - rngate

# PMOS transistor device extraction
pmos_ex = RBA::DeviceExtractorMOS3Transistor::new("PMOS")
l2n.extract_devices(pmos_ex, { "SD" => rpsd, "G" => rpgate, "P" => rpoly })

# NMOS transistor device extraction
nmos_ex = RBA::DeviceExtractorMOS3Transistor::new("NMOS")
l2n.extract_devices(nmos_ex, { "SD" => rnsd, "G" => rngate, "P" => rpoly })

If errors occur, they will be logged inside the device extractor object and copied to the log of this LayoutToNetlist object (self).

extract_netlist

Signature: void extract_netlist

Description: Runs the netlist extraction

See the class description for more details.

This method has been made parameter-less in version 0.27. Use include_floating_subcircuits= and join_net_names as substitutes for the arguments of previous versions.

filename

Signature: [const] string filename

Description: Gets the file name of the database

The filename is the name under which the database is stored or empty if it is not associated with a file.

generator

Signature: [const] string generator

Description: Gets the generator string.

The generator is the script that created this database.

Python specific notes:
The object exposes a readable attribute 'generator'. This is the getter.

generator=

Signature: void generator= (string generator)

Description: Sets the generator string.

Python specific notes:
The object exposes a writable attribute 'generator'. This is the setter.

global_net_name

Signature: [const] string global_net_name (unsigned long global_net_id)

Description: Gets the global net name for the given global net ID.

include_floating_subcircuits

Signature: [const] bool include_floating_subcircuits

Description: Gets a flag indicating whether to include floating subcircuits in the netlist.

See include_floating_subcircuits= for details.

This attribute has been introduced in version 0.27.

Python specific notes:
The object exposes a readable attribute 'include_floating_subcircuits'. This is the getter.

include_floating_subcircuits=

Signature: void include_floating_subcircuits= (bool flag)

Description: Sets a flag indicating whether to include floating subcircuits in the netlist.

With 'include_floating_subcircuits' set to true, subcircuits with no connection to their parent circuit are still included in the circuit as floating subcircuits. Specifically on flattening this means that these subcircuits are properly propagated to their parent instead of appearing as additional top circuits.

This attribute has been introduced in version 0.27 and replaces the arguments of extract_netlist.

Python specific notes:
The object exposes a writable attribute 'include_floating_subcircuits'. This is the setter.

internal_layout

Signature: Layout ptr internal_layout

Description: Gets the internal layout

The internal layout is where the LayoutToNetlist database stores the shapes for the nets. Usually you do not need to access this object - you must use build_net or shapes_of_net to retrieve the per-net shape information. If you access the internal layout, make sure you do not modify it.

See the class description for details about the internal layout object.

internal_top_cell

Signature: Cell ptr internal_top_cell

Description: Gets the internal top cell

Usually it should not be required to obtain the internal cell. If you need to do so, make sure not to modify the cell as the functionality of the netlist extractor depends on it.

See the class description for details about the internal layout object.

is_const_object?

Signature: [const] bool is_const_object?

Description: Returns a value indicating whether the reference is a const reference

Use of this method is deprecated. Use _is_const_object? instead

This method returns true, if self is a const reference. In that case, only const methods may be called on self.

is_extracted?

Signature: [const] bool is_extracted?

Description: Gets a value indicating whether the netlist has been extracted

This method has been introduced in version 0.27.1.

is_persisted?

(1) Signature: [const] bool is_persisted? (const Region layer)

Description: Returns true, if the given layer is a persisted region.

Persisted layers are kept inside the LayoutToNetlist object and are not released if their object is destroyed. Layers created with make_... or registered through register are persisted. This basically applies to all layers, except intermediate layers that are potentially created as results of operations between layers and which are not registered.

(2) Signature: [const] bool is_persisted? (const Texts layer)

Description: Returns true, if the given layer is a persisted texts collection.

Persisted layers are kept inside the LayoutToNetlist object and are not released if their object is destroyed. Layers created with make_... or registered through register are persisted. This basically applies to all layers, except intermediate layers that are potentially created as results of operations between layers and which are not registered.

The variant for Texts collections has been added in version 0.27.

join_net_names

(1) Signature: void join_net_names (string pattern)

Description: Specifies another pattern for implicit joining of nets for the top level cell.

Use this method to register a pattern for net labels considered in implicit net joining. Implicit net joining allows connecting multiple parts of the same nets (e.g. supply rails) without need for a physical connection. The pattern specifies labels to look for. When parts are labelled with a name matching the expression, the parts carrying the same name are joined.

This method adds a new pattern. Use clear_join_net_names to clear the registered pattern.

Each pattern is a glob expression. Valid glob expressions are:

  • "" no implicit connections.
  • "*" to make all labels candidates for implicit connections.
  • "VDD" to make all 'VDD'' nets candidates for implicit connections.
  • "VDD" to make all 'VDD'+suffix nets candidates for implicit connections.
  • "{VDD,VSS}" to all VDD and VSS nets candidates for implicit connections.

Label matching is case sensitive.

This method has been introduced in version 0.27 and replaces the arguments of extract_netlist.

(2) Signature: void join_net_names (string cell_pattern, string pattern)

Description: Specifies another pattern for implicit joining of nets for the cells from the given cell pattern.

This method allows applying implicit net joining for specific cells, not only for the top cell.

This method adds a new pattern. Use clear_join_net_names to clear the registered pattern.

This method has been introduced in version 0.27 and replaces the arguments of extract_netlist.

join_nets

(1) Signature: void join_nets (string[] net_names)

Description: Specifies another name list for explicit joining of nets for the top level cell.

Use this method to join nets from the set of net names. All these nets will be connected together forming a single net. Explicit joining will imply implicit joining for the involved nets - partial nets involved will be connected too (intra-net joining).

This method adds a new name list. Use clear_join_nets to clear the registered pattern.

Explicit net joining has been introduced in version 0.27.

(2) Signature: void join_nets (string cell_pattern, string[] net_names)

Description: Specifies another name list for explicit joining of nets for the cells from the given cell pattern.

This method allows applying explicit net joining for specific cells, not only for the top cell.

This method adds a new name list. Use clear_join_nets to clear the registered pattern.

Explicit net joining has been introduced in version 0.27.

keep_dss

Signature: void keep_dss

Description: Takes ownership of the DSS object if the LayoutToNetlist object was created with an external one.

See the class description for details about the DSS object used inside the LayoutToNetlist object.

layer_by_index

Signature: new Region ptr layer_by_index (unsigned int index)

Description: Gets a layer object for the given index.

The returned object is a new Region object representing the layer with the given index. It will refer to a layer inside the internal layout, or more specifically inside the DeepShapeStorage object (see dss and internal_layout). The method returns 'nil' if the index is not a valid layer index.

layer_by_name

Signature: new Region ptr layer_by_name (string name)

Description: Gets a layer object for the given name.

The returned object is a new Region object representing the named layer. It will refer to a layer inside the internal layout, or more specifically inside the DeepShapeStorage object (see dss and internal_layout). The method returns 'nil' if the name is not a valid layer name. See register and the make_... methods for a description of layer naming.

layer_index

Signature: [const] unsigned int layer_index (const ShapeCollection l)

Description: Gets the layer index for the given data object

This method is essentially identical to layer_of, but uses ShapeCollection, which is a polymorphic base class for a variety of shape containers.

The layer index returned is index of the corresponding layer inside the internal layout (see internal_layout). The layer index is more handy to use for identifying a layer than a Region of Texts object, for example when using it as a key in hashes.

You can use layer_by_index to retrieve the Region object of a layer from the layer index.

This method has been introduced in version 0.29.3.

layer_indexes

Signature: [const] unsigned int[] layer_indexes

Description: Returns a list of indexes of the layers kept inside the LayoutToNetlist object.

You can use layer_name to get the name from a layer index. You can use layer_info to get the LayerInfo object attached to a layer - if the layer is an original layer. You can use layer_by_index to get the Region object for the layer by index.

This method has been introduced in version 0.29.2.

layer_info

Signature: [const] LayerInfo layer_info (unsigned int index)

Description: Returns the LayerInfo object attached to a layer (by index).

If the layer is an original layer and not a derived one, this method will return the stream layer information where the original layer was taken from. Otherwise an empty LayerInfo object is returned.

The LayerInfo object is usually empty for derived layers - i.e. those which are computed through boolean operations for example. It is recommended to assign names to such layers for easy identification later.

This method has been introduced in version 0.29.2.

layer_name

(1) Signature: [const] string layer_name (const ShapeCollection l)

Description: Gets the name of the given layer

The layer is given by a ShapeCollection object which is either a Region or Texts object. This Region or Texts object needs to be either one that was created by make_... or one that was registered through register. This function will return the name that was given to that Region or Texts during those operations. You can use layer_by_name to retrieve the Region object of a layer from the layer index.

(2) Signature: [const] string layer_name (unsigned int l)

Description: Gets the name of the given layer (by index)

See layer_index for a description of the layer index.

layer_names

Signature: [const] string[] layer_names

Description: Returns a list of names of the layers kept inside the LayoutToNetlist object.

layer_of

(1) Signature: [const] unsigned int layer_of (const Region l)

Description: Gets the internal layer for a given extraction layer

This method is required to derive the internal layer index - for example for investigating the cluster tree.

(2) Signature: [const] unsigned int layer_of (const Texts l)

Description: Gets the internal layer for a given text collection

This method is required to derive the internal layer index - for example for investigating the cluster tree.

The variant for Texts collections has been added in version 0.27.

make_layer

(1) Signature: new Region ptr make_layer (string name = )

Description: Creates a new, empty hierarchical region

This method will create a new, empty layer inside the internal layout and register it. It returns a new Region object that represents the new layer. See the class description for more details. The name is optional. If given, the layer will already be named accordingly (see register).

(2) Signature: new Region ptr make_layer (unsigned int layer_index, string name = )

Description: Creates a new hierarchical region representing an original layer

'layer_index' is the layer index of the desired layer in the original layout. This variant produces polygons and takes texts for net name annotation as special, property-annotated polygons. A variant not taking texts is make_polygon_layer. A Variant only taking texts is make_text_layer.

This method will basically create a copy of the original layer inside the internal layout - more specifically inside the DSS (see dss and internal_layout). It returns a new Region object that represents this layer copy. The new layer is already registered with the given name and can be used for connect for example.

make_polygon_layer

Signature: new Region ptr make_polygon_layer (unsigned int layer_index, string name = )

Description: Creates a new region representing an original layer taking polygons only

See make_layer for details.

make_text_layer

Signature: new Texts ptr make_text_layer (unsigned int layer_index, string name = )

Description: Creates a new region representing an original layer taking texts only

See make_layer for details.

Starting with version 0.27, this method returns a Texts object.

max_vertex_count

Signature: [const] unsigned long max_vertex_count

Description:

See max_vertex_count= for details about this attribute.

Python specific notes:
The object exposes a readable attribute 'max_vertex_count'. This is the getter.

max_vertex_count=

Signature: void max_vertex_count= (unsigned long n)

Description: Sets the max_vertex_count parameter for the hierarchical network processor

This parameter controls splitting of large polygons in order to enhance performance for very big polygons.

Python specific notes:
The object exposes a writable attribute 'max_vertex_count'. This is the setter.

name

Signature: [const] string name

Description: Gets the name of the database

Python specific notes:
The object exposes a readable attribute 'name'. This is the getter.

name=

Signature: void name= (string name)

Description: Sets the name of the database

Python specific notes:
The object exposes a writable attribute 'name'. This is the setter.

netlist

Signature: [const] Netlist ptr netlist

Description: gets the netlist extracted (0 if no extraction happened yet)

new

(1) Signature: [static] new LayoutToNetlist ptr new (const RecursiveShapeIterator iter)

Description: Creates a new extractor connected to an original layout

This constructor will attach the extractor to an original layout through the shape iterator.

The shape iterator does not need to be an actual shape iterator. It is merely used to identify the original layout and provides additional parameters such as the top cell to use and advanced options such as subtree pruning.

You can construct a dummy iteraor usable for this purpose without layers using an empty layer set:

ly = ...  # external layout
l2n = RBA::LayoutToNetlist::new(RBA::RecursiveShapeIterator::new(ly, ly.top_cell, []))...

Python specific notes:
This method is the default initializer of the object.

(2) Signature: [static] new LayoutToNetlist ptr new

Description: Creates a new and empty extractor object

The main objective for this constructor is to create an object suitable for reading an annotated netlist.

Python specific notes:
This method is the default initializer of the object.

(3) Signature: [static] new LayoutToNetlist ptr new (DeepShapeStore ptr dss, unsigned int layout_index = 0)

Description: Creates a new extractor object reusing an existing DeepShapeStore object

This constructor can be used if there is a DSS object already from which the shapes can be taken. This version can only be used with register to add layers (regions) inside the 'dss' object.

The make_... methods will not create new layers as there is no particular place defined where to create the layers.

The extractor will not take ownership of the dss object unless you call keep_dss.

Python specific notes:
This method is the default initializer of the object.

(4) Signature: [static] new LayoutToNetlist ptr new (string topcell_name, double dbu)

Description: Creates a new, detached extractor object with a flat DSS

topcell_name:The name of the top cell of the internal flat layout
dbu:The database unit to use for the internal flat layout

This constructor will create an extractor for flat extraction. Layers registered with register will be flattened. New layers created with make_... will be flat layers.

The database unit is mandatory because the physical parameter extraction for devices requires this unit for translation of layout to physical dimensions.

Example:

rmetal1 = ...  # an external Region object representing 'metal1' layer
rvia11  = ...  # an external Region object representing 'via1' layer
rmetal2 = ...  # an external Region object representing 'metal2' layer

l2n = RBA::LayoutToNetlist::new("TOP_CELL", 0.001)
# imports the external Regions as flat ones and assigns proper names
l2n.register(rmetal1, "metal1")
l2n.register(rvia1, "via1")
l2n.register(rmetal2, "metal2")

# intra- and inter-layer connects:
l2n.connect(metal1)
l2n.connect(metal1, via1)
l2n.connect(metal2)

Python specific notes:
This method is the default initializer of the object.

original_file

Signature: [const] string original_file

Description: Gets the original file name of the database

The original filename is the layout file from which the netlist DB was created.

Python specific notes:
The object exposes a readable attribute 'original_file'. This is the getter.

original_file=

Signature: void original_file= (string path)

Description: Sets the original file name of the database

Python specific notes:
The object exposes a writable attribute 'original_file'. This is the setter.

probe_net

(1) Signature: Net ptr probe_net (const Region of_layer, const DPoint point, SubCircuit ptr[] ptr sc_path_out = nil, Circuit ptr initial_circuit = nil)

Description: Finds the net by probing a specific location on the given layer

This method will find a net looking at the given layer at the specific position. It will traverse the hierarchy below if no shape in the requested layer is found in the specified location. The function will report the topmost net from far above the hierarchy of circuits as possible.

If initial_circuit is given, the probing will start from this circuit and from the cell this circuit represents. By default, the probing will start from the top circuit.

If no net is found at all, 0 is returned.

It is recommended to use probe_net on the netlist right after extraction. Optimization functions such as Netlist#purge will remove parts of the net which means shape to net probing may no longer work for these nets.

If non-null and an array, 'sc_path_out' will receive a list of SubCircuits objects which lead to the net from the top circuit of the database.

This variant accepts a micrometer-unit location. The location is given in the coordinate space of the initial cell.

The sc_path_out and initial_circuit parameters have been added in version 0.27.

(2) Signature: Net ptr probe_net (const Region of_layer, const Point point, SubCircuit ptr[] ptr sc_path_out = nil, Circuit ptr initial_circuit = nil)

Description: Finds the net by probing a specific location on the given layer

See the description of the other probe_net variant. This variant accepts a database-unit location. The location is given in the coordinate space of the initial cell.

The sc_path_out and initial_circuit parameters have been added in version 0.27.

read

Signature: void read (string path)

Description: Reads the extracted netlist from the file.

This method employs the native format of KLayout.

read_l2n

Signature: void read_l2n (string path)

Description: Reads the extracted netlist from the file.

This method employs the native format of KLayout.

register

Signature: unsigned int register (const ShapeCollection l, string n = )

Description: Names the given layer

Returns:The index of the layer registered

'l' must be a Region or Texts object. Flat regions or text collections must be registered with this function, before they can be used in connect. Registering will copy the shapes into the LayoutToNetlist object in this step to enable netlist extraction.

External Region or Texts objects that are registered are persisted. This means the LayoutToNetlist object becomes owner of them and they are not discarded when the Region or Text object is destroyed.

Naming a layer allows allows retrieving the layer later, for example after the LayoutToNetlist object has been written to a file and restored from that file (during this process, the layer indexes will change).

If no name is given, the system will assign a name automatically. It is recommended to specify a name if it is required to identify the layer later - for example for retrieving shapes from it.

This method has been generalized in version 0.27. Starting with version 0.29.3, the index of the layer is returned.

reset_extracted

Signature: void reset_extracted

Description: Resets the extracted netlist and enables re-extraction

This method is implicitly called when using connect or connect_global after a netlist has been extracted. This enables incremental connect with re-extraction.

This method has been introduced in version 0.27.1.

shapes_of_net

(1) Signature: [const] new Region ptr shapes_of_net (const Net net, const Region of_layer, bool recursive = true, const ICplxTrans trans = unity)

Description: Returns all shapes of a specific net and layer.

If 'recursive'' is true, the returned region will contain the shapes of all subcircuits too.

The optional 'trans' parameter allows applying a transformation to all shapes. It has been introduced in version 0.28.4.

(2) Signature: [const] void shapes_of_net (const Net net, const Region of_layer, bool recursive, Shapes to, unsigned long propid = 0, const ICplxTrans trans = unity)

Description: Sends all shapes of a specific net and layer to the given Shapes container.

If 'recursive'' is true, the returned region will contain the shapes of all subcircuits too. "prop_id" is an optional properties ID. If given, this property set will be attached to the shapes. The optional 'trans' parameter allows applying a transformation to all shapes. It has been introduced in version 0.28.4.

shapes_of_pin

Signature: [const] map<unsigned int,Region> shapes_of_pin (const NetSubcircuitPinRef pin, const ICplxTrans trans = unity)

Description: Returns all shapes of the given subcircuit pin that make a connection to the net the pin lives in.

This will return all shapes from the subcircuit attached by the given pin that interact with the net the pin lives in. This method returns a Region object with the shapes per layer where interactions are found. The layers are given as layer indexes.

The returned shapes are already transformed into the coordinate system of the net (see shapes_of_net for example). An additional transformation can be applied using the optional trans argument.

Note, that this method only considers interations between net shapes and subcircuits on every level below, but not between subcircuits. It can be used for example for digital nets connecting gate cells. In the general case however, nets may be formed also by touching subcircuits. In that case, the nets do not have shapes of their own and this function cannot detect the pin shapes.

The call of this method may not be cheap, specificially if large nets are involved.

This method has been introduced in version 0.29.2.

shapes_of_terminal

Signature: [const] map<unsigned int,Region> shapes_of_terminal (const NetTerminalRef terminal, const ICplxTrans trans = unity)

Description: Returns all shapes of the given device terminal that make a connection to the net the terminal lives in.

This will return all shapes from the device attached by the given terminal that interact with the net the terminal lives in. This method returns a Region object with the shapes per layer where interactions are found. The layers are given as layer indexes.

The returned shapes are already transformed into the coordinate system of the net (see shapes_of_net for example). An additional transformation can be applied using the optional trans argument.

Note, that this method only considers interations between net shapes and the device connected by the terminal, but not between subcircuits on the net and the device. It can be used for example for flat-extracted, transistor-level netlists. In the general case however, nets may be formed also by subcircuits touching devices. In that case, the nets do not have shapes of their own and this function cannot detect the terminal shapes.

The call of this method may not be cheap, specificially if large nets are involved.

This method has been introduced in version 0.29.2.

soft_connect

(1) Signature: void soft_connect (const Region a, const Region b)

Description: Defines an inter-layer connection for the given layers in soft mode.

Connects two layers through a soft connection. Soft connections cannot make connections between two different nets. These are directional connections where 'b' is the 'lower' layer (typically high-ohmic substrate or diffusion).

Soft connections have been introduced in version 0.29.

(2) Signature: void soft_connect (const Region a, const Texts b)

Description: Defines an inter-layer connection for the given layers in soft mode.

Connects two layers through a soft connection. Soft connections cannot make connections between two different nets. These are directional connections where 'b' is the 'lower' layer (typically high-ohmic substrate or diffusion). As one argument is a (hierarchical) text collection, this method is used to attach net labels to polygons.

Soft connections have been introduced in version 0.29.

(3) Signature: void soft_connect (const Texts a, const Region b)

Description: Defines an inter-layer connection for the given layers in soft mode.

Connects two layers through a soft connection. Soft connections cannot make connections between two different nets. These are directional connections where 'b' is the 'lower' layer (typically high-ohmic substrate or diffusion). As one argument is a (hierarchical) text collection, this method is used to attach net labels to polygons.

Soft connections have been introduced in version 0.29.

soft_connect_global

(1) Signature: unsigned long soft_connect_global (const Region l, string global_net_name)

Description: Defines a connection of the given layer with a global net in soft mode.

This method returns the ID of the global net. Use global_net_name to get the name back from the ID. Soft connections are directional, where the global net is the 'lower' layer (typically high-ohmic substrate or diffusion).

Soft connections have been introduced in version 0.29.

(2) Signature: unsigned long soft_connect_global (const Texts l, string global_net_name)

Description: Defines a connection of the given text layer with a global net in soft mode.

This method returns the ID of the global net. Use global_net_name to get the name back from the ID. Soft connections are directional, where the global net is the 'lower' layer (typically high-ohmic substrate or diffusion).

Soft connections have been introduced in version 0.29.

threads

Signature: [const] int threads

Description: Gets the number of threads to use for operations which support multiple threads

Python specific notes:
The object exposes a readable attribute 'threads'. This is the getter.

threads=

Signature: void threads= (int n)

Description: Sets the number of threads to use for operations which support multiple threads

Python specific notes:
The object exposes a writable attribute 'threads'. This is the setter.

top_level_mode

Signature: [const] bool top_level_mode

Description: Gets a flag indicating whether top level mode is enabled.

See top_level_mode= for details.

This attribute has been introduced in version 0.28.13.

Python specific notes:
The object exposes a readable attribute 'top_level_mode'. This is the getter.

top_level_mode=

Signature: void top_level_mode= (bool flag)

Description: Sets a flag indicating whether top level mode is enabled.

In top level mode, must-connect warnings are turned into errors for example. To enable top level mode, set this attribute to true. By default, top-level mode is turned off.

This attribute has been introduced in version 0.28.13.

Python specific notes:
The object exposes a writable attribute 'top_level_mode'. This is the setter.

write

Signature: void write (string path, bool short_format = false)

Description: Writes the extracted netlist to a file.

This method employs the native format of KLayout.

write_l2n

Signature: void write_l2n (string path, bool short_format = false)

Description: Writes the extracted netlist to a file.

This method employs the native format of KLayout.