KLayout Advanced Features

This manual briefly describes a couple of advanced features of KLayout.

The XOR tool

The XOR tool performs a geometrical XOR (also ANOTB and BNOTA for asymmetric differences) on two layouts by performing the respective boolean operations layer by layer. The XOR tool is started using "XOR Tool" from the "Tools/Verification" menu). Currently, the tool compares all or just the visible layers. Currently, it compares layers from one layout vs. the identical layers from the other layout.

The current implementation employs a flat XOR processor. This limits the application somewhat to small and medium sized layouts and does not make use of hierarchy, which basically excludes applications for very hierarchical layouts (i.e. memory arrays). The memory footprint associated with the flat approach can be mitigated by using the tiling feature which performs the operation on a tile with limited size. This does not reduce the run times but the memory requirements.

The XOR tool allows to specify tolerances. Basically a tolerance is an undersizing step following the boolean operation. This way, small markers can be suppressed. This is particular useful to remove markers resulting from tiny differences between the layouts being compared. Multiple tolerances can be specified. In that case, multiple undersize steps are performed to create sets of layers with different tolerances each. For example, a tolerance specification of "0,0.001,0.005,0.010" will create four sets (marker categories) containing all difference markers and others for markers indicating differences larger than 1nm, 5nm and 10nm.

Tiling can be enabled by entering a tile size into the entry box. For semi-flat layouts such as standard cell blocks, a tile size of 1000 micron is a good starting point. The choice of the tile size mainly determines memory requirements.

The XOR tool allows to send the output either to a marker database or to another or one of the input layouts. The mode can be selected with the "Output" drop-down box. If output is sent to one of the original inputs, it is mandatory to specify a layer offset which maps the original layer to a new layer. An offset of "1000/0" for example means, that differences between shapes on layer "16/0" will be sent to "1016/0" for the first tolerance category and "2016/0" for the second.

The Diff tool

As the XOR tool, the Diff tool performs a comparison of two layouts. In contrast to the XOR tool, it does a cell-by-cell and object-by-object comparison and reports differing cells, instances and geometrical objects. In effect, the comparison is more strict and not purely geometry-related. It does not verify the identity of the layouts on mask level but rather the exact identity of the objects that comprise the layout file. On the other hand, the Diff tool usually detects the actual changes rather than their effect on geometry.

Usually, that kind of comparison is very sensitive to "cosmetic" changes, i.e. cell renaming. KLayout's Diff tool tries to mitigate this effect with these features:

  • Before it does the cell-by-cell comparison it tries to detect cells which have been renamed by comparing their instantiation. That way, it can compare the right cells even though their names may be different.
  • It allows some level of control over the strictness of the compare. For example, cell arrays can be expanded before the individual instances are compared. By default, some second-order information like users properties or certain text properties is not compared.
  • The diff tool can also work in "XOR" more. In that mode, the differences found are used to provide input for a subsequent, polygon-only XOR step. The result is a fair approximation of a true, as-if-flat XOR which delivers a superset of the true XOR's results. It may report some locations as being different which if fact are not, but it will not fail to report differences where there are some. Compared with the XOR tool's functionality, some options are missing (i.e. tolerance), but the performance is much better.

The Diff tool is found in the "Verification" sub-menu of the "Tools" menu. In this dialog

  • Select layout A and B in the "Input" section.
  • Check "Run XOR on differences" to select the "XOR mode".
  • Check "Summarize missing layers" to have missing layers reported as one difference instead of one per shape.
  • Check "Detailed information" to receive detailed information about every difference. Without that option, only the number of differing shapes or instances is reported.
  • Check "Expand cell arrays" to compare individual instances of array instances.
  • Check "Exact compare" to include second-order information (i.e. user properties, text orientation) in the compare.

The Diff tool will create a marker database and show the results in the marker database browser.

The fill (tiling) utility

The fill utility creates a regular pattern of fill unit cell instances in certain areas of a layout. This feature is usually refered to as "tiling" or "fill". It is based on a rectangular unit cell which is repeated in x- and y-direction to fill the available space. In most cases, the intention is to fill empty areas in the layout to enhance the layout uniformity for a better process performance.

Before the fill utility can be used, a fill cell must be prepared in the layout that is filled. The dimension of the cell are defined by a box drawn on an arbitrary layer. This box must represent the "footprint" of the cell. This is the space that one instance will cover in the region to be filled.

The fill utility is found in the "Utilities" sub-menu of the "edit" menu and is available in edit mode only. To use this utility, open the dialog and

  • Select the outer boundary of the fill region ("what to fill"). Available choices are: Full cell, the interior or the polygons on a given layer, the interior of all selected polygons, a single box or an area defined by a ruler.
  • Specify if the fill area should keep a certain minimum distance to the border of the fill region.
  • Specify the regions within the fill region which must not be filled. Available choices are: All layers (don't create fill over any polygon drawn), all visible layers (don't create fill over any polygon visible), all selected layers or don't exclude anything.
  • If the fill tiles must keep a certain minimum distance from the exclude regions, specify that distance in the "Spacing around exclude areas" entry field.
  • Specify the fill cell and the boundary layer which defines the cell's footprint in the "Fill Cell" group.

By default, the fill utility operates on a fixed raster. This can lead to a poor fill efficiency in some cases. The fill utility offers a "Enhanced fill" option, where it tries to find a cell arrangement which is not necessarily on a common raster but provides a better fill performance. In addition, second-order fill is supported. In that case, a second - usually smaller - fill cell can be specified which is used to fill the remaining areas of the layout.

The following screenshots show the effect of the different fill modes for some artificial fill problem.

Default:

Enhanced:

Enhanced plus
second order:

Importing Gerber PCB files

Gerber PCB import allows to create GDS layout data from Gerber PCB files or to add Gerber files to GDS files as new layers. The import function supports a majority of the RS274X features for artwork files and a couple of different formats for the drill files. The importer will take a set of files and convert them to layout geometry. The importer offers some functionality to adjust the data appropriately, i.e. to define output layers and apply geometrical transformations. Another basic capability is to merge the geometry of a layer to remove overlaps and join paths into larger polygons.

Because of the manifold options, the import specification can become pretty complex. Therefore, it can be saved into a file (suggested suffix is ".pcb") in XML format which contains the importer specifications. Once such a file is created, KLayout can read this file like usual stream files (i.e. it can be specified on the command line) and use it as a recipe to import the associated Gerber files.

The PCB import function is available in the "File" menu ("Import/Gerber PCB"). Different entry points are provided that start a new project, open an existing project or to continue with the last project.

The basic workflow to import PCB data is:

  • Specify the directory where the PCB data files are located (the "base" directory).
  • Specify the import mode (the destination of the layout data).
  • Decide about the layer mapping mode: free layer mapping or metal stack mapping. Free layer mapping allows an arbitrary mapping between PCB layers and GDS layers. This specification is the most flexible one but is tedious to enter. Metal stack mapping is easier to specify but confined to mapping a set of PCB files to a metal/via/metal stack scheme.
  • Specify the files, GDS layers and PCB to GDS layer mapping.
  • Specify a transformation if desired, either by specifying mapping points or a transformation directly.
  • Decide about further options (i.e. merging, database unit, top cell name etc.).

The basic decision is how to specify the layer mapping. In free mode, the specification requires these steps:

  • Specify the files to load (in the dialog on the "Files" page).
  • Specify a list of output layers.
  • Fill the input to output mapping matrix which assigns one or many output layers to each input file.

In layer stack mode, the specification workflow consists of these steps:

  • Specify the GDS layer stack (the complete stack available for mapping PCB data into). The idea is basically to put another set of series of metal/via/metal layers on top of the GDS layer stack. The PCB layer closest to the die surface is placed into the first metal layer which is supposed to be the first above the on-chip layers.
  • When the GDS layers are set, specify how many metal and drill hole files the PCB file set contains and whether the chip will be mounted on the top or bottom of the PCB. The latter decides in which order the PCB layers are assigned to GDS layers (remember, the first GDS layer will be the PCB layer closest to the die surface).
  • Enter file names for the artwork files corresponding to metal layers.
  • Specify file names for the drill files and what metal layers are connected by the (plated) drill holes. Since a drill hole can connect multiple layers in the stack, a connection information is always of the type "from metal, to metal" with the drill holes connecting all metal layers between "from" and "to".

The import dialog

The import dialog is organized in multiple pages that reflect the workflow for the import specification. On every page, the "File" menu button allows to save the current settings as a PCB import project, to open an existing project or to create a new project and to restart from scratch.

The first page offers some basic options:

  • Base directory: this is the directory where all the PCB files are found. Not necessarily all files must be located there but are looked for relative to this directory. If all files are moved, just the base directory must change. The base directory is not stored in a project file. Instead, the base directory is the directory where the project file is stored. Basically this implies, that all data files will be referred to relative to the project file.
  • Import mode: PCB data can be imported into the current layout (into the current cell). Usually, it this case, layers will be added to the current layout. Alternatively, a layout can be created which will be either placed into a new panel or added to the current panel.
  • Layer mapping mode: Specify here whether to use free or layer stack mode. Check the box to use free layer mapping mode.

The layer stack flow

In the layer stack flow, on the first page, a sequence of metal and via layers must be specified. The assignment of metal and via layers is done automatically. The sequence is always a metal layer followed by a via layer. The number of layers must be odd so the last layer is a metal layer again. Via layers will connect the adjacent metal layers only.

Use the "+" button to add new layers. Move layers by selecting them and moving them up or down with the arrow buttons. Use the "X" button to remove all selected layers.

On the next page, the number of artwork and drill files needs to be specified. Later, the actual files need to be entered and assigned to metal or via layers. In addition the chip mounting position needs to be specified. In "top mounting" mode, it is assumed that the chip is placed surface down on the top (first) PCB layer. Thus the first metal above the chip stack will be the top PCB layer. In "bottom mounting" mode, the last PCB metal layer will be the first metal layer above the chip stack.

On the "Artwork Files" page, the artfile file names must be entered. They are automatically assigned to the respective metal layers. The assignment order depends on the mounting mode.

On the "Drill Files" page, the drill file names must be entered. Each drill file describes a certain drill step, which can connect multiple metal layers. On this page, this specification must be made. The first and last metal layer connected by the plated hole must be specified. The corresponding via layers will then be used to create via shapes.

The free layer mapping flow

On the "Files" page, all PCB data files must be specified. This includes artwork and drill files. The order is not important but it is recommended to follow the physical stacking. This simplifies the assignment to GDS layers later. Use the arrow buttons to move the selected entries up or down. Use the "X" button to delete files from the list and use the "+" button to add new files.

On the "Layout Layers" page all target layers must be specified. Provide a list with all layers that are used as target layers for the import. Again, the order is not important but maintaining a technological order will simplify the assignment in the next step. As on the previous page use the arrow buttons to move selected entries and the "+" and "X" button to add new entries and deleted the selected ones.

On the "Layer Mapping" page, each file can be assigned to one or may GDS layers. The assignment is described in form of a matrix where an "x" means that the file or layer given by the row is imported into the layer given by the column. A file can be imported into multiple layers which basically will duplicate the shapes. Click at the boxes to set or reset the mark. Use the "X" button on the left to reset all marks for the rows selected.

General options

The "Coordinate Mapping" page allows to specify the transformation of the PCB data into the GDS space. Since PCB and GDS rarely share the origin, a transformation can be specified which is applied to the shapes when importing them.

A specification can be made in two ways:

Hint: Both specifications can be combined, i.e. one coordinate pair can be given to define the displacement and the rotation can be specified explicitly.

Finally, on the "Options" page, various options can be set:

  • Layer properties file: If specified, this layer properties file will be loaded after the layers have been imported. The file is specified relative to the base directory.
  • Number of points per circle: KLayout resolves the circular apertures commonly used in PCB layout into polygons to perform geometrical operations. This options allows to choose how many points will be used for the approximation of a full circle. Less points will mean less accurate representation but smaller polygons hence better performance on boolean operations used to compute clear areas for example.
  • Merge polygons: If this option is set, all polygons will be joined if they overlap or touch. Note, that merging also happens implicitly if clear layers are used because the boolean operations used to cut out clear regions will implicitly merge the previous layout. This implicit merging cannot be disabled.
  • Database unit and top cell name: This option allows to choose the database unit and top cell name for new layouts. This applies only, if the import mode implies a new layout.

Importing other layout files

This function can merge other layouts into the layout loaded. Merging means that the hierarchy of the specified layout is inserted into the given layout. Different modes are available that control the way how the hierarchy is merged. This function is available in the "File" menu as "Import/Other File Into Current".

The workflow for importing a different layout is this:

  • Specify the file to input. At least the file name is required. Additionally, a cell can be specified. In that case, only the cells referred to by the given cell (directly or indirectly) are imported. Reader options can be specified separately for the import. Reader options are applied the same way than the reader options are used for the standard load function.
  • Specify the import mode. The modes are described below.
  • Specify the layer mapping. Either the shapes are imported on their original layer or an offset can be used that will be added to the layer to form the target layer of the import. An offset of "1000/0" for example specifies to add 1000 to the layer and use the original datatype.
  • Specify an optional transformation. The imported layout will be transformed accordingly. The transformation can be specified explicitly or with up to three points which are mapped onto each other.

Four import modes are available that control how the hierarchy of the imported layout is inserted into the existing layout:

  • Merge: in this mode, the contents of the imported cell will be put into the current cell and the child hierarchy is added below the current cell.
  • Extra: in this mode, new top level cells containing the hierarchy tree of the imported cell or cells will be created. In this mode, multiple cells can be imported if the imported layout contains multiple top cells. Leave the cell specification empty for this.
  • Instantiate: the imported cell will be instantiated into the current cell as a separate hierarchy.
  • Merge hierarchy: The fourth mode is a little bit more complex. Basically it works like "Merge", but identifies corresponding cells and merges the contents for the corresponding imported cells into the original cells. The algorithm identifies corresponding cells by requiring that the flat instances of the imported child cell exactly equal the flat instances of the corresponding original cell (where flat refers to the instances of a cell in the context of the current cell). This is done by selectively thinning out the candidate list and finally employing a name similarity measure to resolve ambiguities.

The import function will create new cell names using the "$x" suffix to avoid name ambiguities.

The net tracing feature

The net tracing function allows to trace a net by detecting touching shapes that together form a conductive region. It allows to specify a metal stack of metal (or in general "conductive") layers optionally connected through via shapes. The net tracing algorithm will follow connections over the via shapes to form connections to other metal layers.

The algorithm is intended for extracting single nets and employs an incremental extraction approach. Therefore extraction of a single small net is comparatively fast while extraction of large nets such as power nets is considerably slower compared to hierarchical LVS tools currently.

The net tracing function can be found in the "Tools" menu. The user interface allows to trace multiple nets which are stored in a list of nets extracted. If labels are found on the nets, these are used to derive a net name. Beside that, the cells which are traversed in the net extraction are listed, so the cells being connected by this net can be identified.

Before nets can be extracted, a layer stack must be specified. Press "Layer Stack" on the user interface to open the layer stack dialog. Layers must be specified in the "layer/datatype" notation. The via specification is optional. If no via layer is specified, both metal layer shapes are required to touch in order to form a connection. If a via layer is specified, a via shape must be present to form the connection.

If a layer stack has been defined, a net can be traced by pressing the "Trace Net" button and clicking on a point in the layout. Starting from shapes found under this point, the net is extracted and listed in the net list on the left side of the net tracing dialog. If "Lock" is checked, another net can be traced by clicking at another point without having to press the "Trace Net" button again.

The "Trace Path" function works similar but allows to specify two points and let the algorithm find the shortest connection (in terms of shape count, not geometrical length) between those points. If the points are not connected, a message is given which indicates that no path leads from one point to the other.

The display of the nets can be configured in many ways. The configuration dialog is opened when "Configure" is pressed in the trace net dialog. Beside the color and style of the markers used to display the net it can be specified if and how the window is changed to fit the net.