KLayout Quickstart ManualThis user manual is brief recipe-type description of how to use the KLayout layout viewer. The first section describes the main window. Further sections describe simple use cases of the viewer starting from scratch:
Main windowThe main window is divided into three parts: the left panel is the hierarchy browser which depicts the cell hierarchy. Cell nodes can be expanded showing the child nodes. The cell selected in the cell browser is shown in the center panel. The center panel is the actual canvas. There, the layout is drawn. Click there to zoom or to draw rulers for measuring distances. The right panel is showing the layer list with the layer drawing style. Below a set of control panels is located. The control panels are minimized per default. They can be expanded by clicking on the header bar. Several control panels are available allowing to control colors, fill and drawing styles etc. Select one or many layers in the layer list to apply the selections from the control panels to. Multiple layouts can be shown at once. Either they can be overlayed or they can be shown in separate views. In this case, a tab panel appears at top of the main window. Switch between the views by selecting the tab. Loading a fileIn the "File" menu, choose
Either way, a file selection dialog will appear where a file can be chosen for loading. After choosing the file and clicking "Ok", the file is loaded. The program will automatically determine the type of the file. Currently, OASIS and GDS2 are supported. Certain options can be specified for the file loader with the reader option pages. To open the reader options dialog, choose "Reader Options" from the "File" menu. This dialog allows to specify certain options for all "Open" actions, for example:
Managing the panels and loaded layoutsChoose "Close" in the "File" menu to remove a layout of a panel and close the panel unless there are still layouts loaded. If multiple layouts are into the current panel, a dialog appears. This allows to select one or many layouts for closing. Choose "Clone" from the "File" menu to duplicate a panel. A new panel will be created that is an exact copy of the current one. Both, the current and the new panel are views to the same layout. This way, only one copy of the layout is held in memory. Choose "Reload" from the "File" menu to reload a file if the contents have changed. This does not happen automatically. Choose "Pull In Other Layout" to combine other layouts already loaded into the current panel. Basically, KLayout allows to view a layout in multiple panels, either on it's own in different configurations or together with other layouts. "Pull In Other Layout" allows to configure a panel to show another layout which has been loaded into another panel. In that sense it's the reverse of closing one layout from a panel showing multiple layouts. Choosing a cellTo show a certain cell, select the cell in the cell hierarchy in hierarchy browser to the left. Then, right-click in the cell tree to bring up the context menu and choose "Show as top" or simply select the cell with the middle mouse button. To select a cell by name, choose "Select Cell" in the "Display" menu. A dialog will appear that allows to select a cell by name or choose from an alphabetically sorted list. Additionally, this dialog allows to navigate the cell tree by choosing one of the child or parent cells. Choosing a hierarchy depthBy default, only the bounding box of the cell selected is shown. This corresponds to zero hierarchy levels being shown. To select more hierarchy levels, choose
Hiding cellsIndependent of the hierarchy levels shown, cells can be hidden. In this case, the cell is now shown but rather the bounding box is shown. To do so, select the cell from the cell list and choose "Hide" from the context menu. To show a cell again, choose "Show". To make all cells visible again, choose "Show All". Zooming into the layoutSelect the zoom area with the right mouse button in the layout canvas. Press the button, drag the box to the desired position and release the button. To zoom in (enlarge) drag the box right and down. To zoom out (shrink) drag the box up and left. To choose a new center, single-click the new center point with the right mouse button. Additionally, these functions are available from the menu or by hotkeys:
Return to a previous view stateChoose "Last State" from the "Display" menu to return to the last window shown. Choose "Next state" to switch to a more recent state again. Bookmarking viewsViews (window, cell) can be bookmarked for later retrieval. Choose "Bookmark This View" from the "Bookmarks" menu. A name is required to be entered for the bookmark. The bookmark will then appear in the "Goto Bookmarks" list. The list of bookmarks defined can be loaded or saved by using the "Load Bookmarks" and "Save Bookmarks" functions from the "Bookmarks" menu. Descending into a cell with contextA cell can be shown either isolated (this is the default, if the cell is the current cell), embedded (as a subcell of the current cell) or as the current cell in the context of another direct or indirect parent cell. In the latter mode, the cell is highlighted while the context cell is shown in dimmed or another, user-defined color. To highlight a cell in a context, first choose the context cell. Then select a shape or a cell instance within the cell to show in the context and choose "Descend" from the "Display" menu or press "Ctrl+D". Now, the first child cell leading to the selected shape is highlighted, while the surrounding shapes of the parent cell (the previous current cell) is shown in dimmed colors. Choose "Descend" repeatedly to descend further into the hierarchy until the selected shape or instance is on the level of the current cell. The current cell is show underlined in the cell tree, while the context cell is shown in bold font in the cell tree as usual. The reverse of this operation is "Ascend" (or "Ctrl+A") available from the "Display" menu. The way how the context layout is shown can be adjusted in the setup dialog on the "Background" tab. Choosing a layer colorSelect the layer or the layers for which to change the color and open the color chooser panel in the layer panel to the right. If the color chooser is not visible, select the small check box in the "Color" header bar. Then the color chooser is expanded. To change the color, click on the desired color. To select a color not offered in the list, select the "More Colors" button. A color choose dialog will open. To choose the color of the frame to draw around the shapes, without changing the fill color, use the "Frame Color" chooser panel. Layers can be "dimmed" by making their color darker or brighter so they contrast less with the background. To do so, choose "Dark" or "Bright" from the color panel. Pressing the button multiple times makes the colors darker or brighter each time. The brightness or darkness can be reset with the "Reset" button. Bringing layers to the front or pushing them to the backLayers can be brought to the front so they to do get obscured. To do so, select the layers and push the "down to bottom" button below the layer list. This will bring the layers to the end thus making them the last to be drawn (the top of the stack). Analogous layers can be pushed one level front using the "down" button and can be brought to the back by using the "up to top" or "up" buttons. The stacking order is saved with the "Save layer properties" function. Telling used from unused layersIn some applications, the layer list will grow very large and keeping track of the important layers may be hard. KLayout provides support for that task in two ways: KLayout checks whether a layer carries any information and displays the layers in a different way in the layer list, if it is empty. Two ways of checking the information content of a layer are provided: either a layer is said to be empty if the current cell does not have any shapes on it. Alternatively, a layer can be identified to be empty by checking if any shape is shown in the current view (more precisely if any shape's bounding box overlaps with the current view rectangle). The latter mode can be selected in the layer list's context menu with the option "Test For Shapes in View". If a layer is determined to be empty, it is either grayed out or it is now shown at all. The latter option keeps the layer list short and is selected with "Hide Empty Layers" from the layer list's context menu. Choosing a fill patternTo choose a fill pattern, select the layer or the layers for which to change the fill pattern and choose the fill pattern from the "Stipple" panel. New pattern can be created with the "Edit" button. A pattern editor will come up that allows to create and edit new pattern. The predefined pattern cannot be changed. To select a new pattern, select "More" from the pattern selection panel and choose the new pattern from the list. The new pattern is saved with the layer display properties. Animating layersLayers can be animated, i.e. made blinking or the fill pattern scroll. Select the layer or the layers for which to change the animation style and choose the animation style from the "Animation" panel. For blinking mode, two phases can be selected: "Blink" and "/Blink". Choosing different phases for two layers makes the layers appear alternatively. Changing the display styleThe line width of the element's frame can be changed by using the width buttons on the "Style" panel after having selected the layers to apply the change on. "0px" removes the line, "1px" draws a single-pixel wide line (the default), "2px" a somewhat thicker line and so on. "Simple" is the normal draw mode while "Marked" draws a cross on each vertex of the element. The cross size is constant so the shapes stay visible even on large scale where the elements would otherwise become single pixels. Changing the layer visibilityThe selected layers can be made invisible by choosing the "Hide" option on the "Visibility" panel. Choosing "Show" makes the layers visible again. Also, double-clicking a visible layer in the layer list toggles the layer's visibility. To make a layer "transparent" (i.e. let the other layers show through), select "Transp." on the "Visibility" panel. To make it opaque again, select "Opaque" (the default). Organizing layers hierarchicallyLayers can be organized hierarchically. For example, certain layers can be grouped together. Choose "Group" in the context menu of the layer list (right-click the layer list). The selected layers will be replaced by a tree node that represents these layers. Click on the tree node to expand or collapse this group. Once layers are grouped, they can be hidden or made visible with a single double-click on the node representative. The node representative also controls the appearance of the layers in the group: if a color or style is assigned to the representative, it overrides the respective style of all layers contained in the group. This way for example, the color of the layers contained in the group can be changed at once. To remove a color override of a node representative, set the color to "None". To resolve a group, select the group representative and choose "Ungroup" from the context menu. A variety of automatic grouping methods is provided. For example, the "Regroup views by layout index" from the layer context menu will collect all layers and put them into one group per layout shown in the panel. Removing and adding layers to the layer setThe layers shown in the layer list are rather "pointers" to the actual layout layers and not representing the actual layers. Because of this, these layers are more precisely referred to as "views". Layers can be removed and created again without affecting the actual layout data. To create a layer, choose "Insert View" from the layer context menu (right mouse button click on the layer list). Then, an input dialog prompts for the source specification. The source specification tells, from which actual data layer to take the displayed data from. The most simple form of a source specification is "layer/datatype" (i.e. "5/0") or the layer name, if an OASIS layer name is present. This specification can be enhanced by a layout index. The first layout loaded in the panel is referred to which "@1" or by omitting this specification. The source specification "10/5@2" therefore refers to layer 10, datatype 5 of the second layout loaded in the panel. Source specifications can be wildcarded. That means, either layer, datatype or layout index can be specified by "*". In this case, such a layer must be contained in a group and the group parent must provide the missing specifications. For example, if a layer is specified "10/*" and the parent is specified "*/5", the effective layer looked for will be "10/5". Unlike the behaviour for the display styles, the children override (or specialize) the parent's definition in the case of the source specification. The layer list can be cleaned up to remove layer views that do not correspond to actual layout layers using the function "Clean up views" from the context menu. Similar, layers that are present in the layout but for which there is no view can be added using the "Add other views" method. Transforming views and property selectorsThe source specification described in the section before is much more powerful than just allowing to describe the data source. In addition to that, the layer can be geometrically transformed and the display can be confined to shapes that belong to a certain class described by a property selector. A geometrical transformation is specified by appending a transformation in round brackets to the layer/datatype source specification. The format of this transformation is (not necessarily in this order): ( [<dx>,<dy>] [r<angle> | m<angle>] [*<mag>] )For example, "(r90)" specifies a rotation by 90 degree counter-clockwise. "(0,100.0 m45 *0.5)" will shrink the layout to half the size, flip at the 45 degree-axis (swap x and y axes) and finally shift the layout by 100 micron upwards. Transformations accumulate over the layer hierarchy. This means, that if a layer is transformed and the layer is inside a group whose representative specifies a transformation as well, the resulting transformation is the combination of the layer's transformation (first applied) and the group representative's transformation. Multiple transformations can be present. In this case, the layout is shown in multiple instances. A particular application is to regroup layers by layout index and assign a transformation to the group representative belonging to a certain layout such that the layouts get aligned.
The property selector is specified in square brackets. A selector combines
several expressions of the form "property==value" or " In GDS2 files, the property is always named with a integer value which is written with a single hash characters (i.e. "#43". The value of a GDS property is always a string. A string is either written as a text atom or can be enclosed in single or double quotes. The following is an example for a valid property selector for GDS files: 10/5 [#43==X]With this source specification, the layer will show all shapes from layer 10, datatype 5 which have a user property with number 43 and value string "X". A more complex example is this: 10/5 [!(#43==X&&(#2==Y||#2==U))]With OASIS files, the properties can be named with a string. In this case, the property selector can be "[prop==X]" for example. In addition, the value can be a an integer or a double value. This is reflected by the choice of the value: "[prop==#200]" will check, if the property named "prop" has an integer value which is 200. In the same fashion, "[prop==##0.5]" checks, if the property "prop" has a double value and this is 0.5. Property selectors combine over a layer hierarchy. This means, that if a group representative specifies a property selector and a layer in this group specifies a selector as well, only those shapes will be shown that meet both criteria. Specifying explicit hierarchy levels for one layer or a layer groupBy default, only the hierarchy levels that are selected in the hierarchy level selection boxes are shown, i.e. if levels 0 to 1 are selected, just the top level shapes and instances are shown. This selection can be modified for certain layers or layer groups. To specify a different hierarchy selection for a certain layer, use an optional source specification element, the hierarchy level selector: #[<lower-level>][ .. <upper-level>]Upper and lower level can be omitted. In this case, the respective level is not overridden. The upper level can be '*' which means: every level that is available. If just one level and no ".." is given, it is taken as upper level and the lower level is set to zero. Some examples might illustrate this:
Modifications of this notation are provide in order to support more use cases. Instead of specifying a single number for the level, the following alternative notations are supported:
For example:
Loading and saving the layer setsThe visual layer properties can be saved to a file using the "Save Layer Properties" function from the "File" menu. This list can be loaded again using the "Load Layer Properties" function. Creating a screenshotTo save the canvas as a PNG file, choose "Screenshot" from the "File" menu or press the "Print" key. A file dialog box will appear in which the file can be specified where the screenshot is saved to. Doing measurementsA measurement can be performed by choosing "Ruler" mode in the toolbar and left-clicking a point in the layout and left-clicking another point. A ruler will be shown that indicates the distance measured. Various options can be specified for the rulers using the setup dialog. To show the setup dialog, choose "Setup" from the "File" menu. On the "Rulers" tab, different options can be selected. A ruler can be made to snap to edges of objects by selecting "Snap to edge/vertex". Ruler orientations can be constrained by using the "Angle Constraint" options. While drawing or moving one point of a ruler, the direction constraint can be overridden with the Shift and Ctrl keys: pressing Shift while moving the mouse will enforce orthogonal constraint, Ctrl will enforce diagonal constraint while pressing both will release any direction constraint. The number of rulers can be limited. If the number of rulers specified is two for example, only the last two rulers are shown. All rulers can be cleared using the "Clear all rulers" function from the "Edit" menu. Ruler dragging can be canceled with the "Esc" key or using the "Cancel" function from the "Edit" menu. Rulers can be moved by selecting "Move" mode with the speedbar buttons in the toolbar or "Move" from the "Mode" submenu in the "Edit" menu. Then left-click and drag the ruler or the ruler end point that should be changed. Rulers can be deleted selectively by selecting a ruler in "Select" mode and pressing "Delete". Rulers can be modified in a variety of ways. For example, rulers can be shown as arrows. To edit the properties of a ruler, double-click the ruler or select it and use "Properties" from the "Edit" menu. See Ruler properties for a description of the properties. Multiple templates can be configured to be available for rulers. If multiple templates are available, the "Ruler" mode toolbar button will show a drop-down menu which allows to select one template to be used. Templates can be edited in the ruler setup page ("Setup" from the "File" menu) or "Ruler Setup" from the "Edit" menu. Ruler propertiesThese are the properties that can be configured for rulers:
The label format is an arbitrary text with embedded field descriptors that may represent a measurement value. Each such field starts with a dollar sign, followed by a field descriptor and an optional format specification in curly braces following C's "printf" notation. Two dollar characters give a single dollar sign. For example: the format "$x{%.2f}" is the horizontal extension of the ruler in nanometers, formatted in fixed-point notation with two digits precision. This is a list of all field descriptors:
Adding imagesFor some applications it is necessary to show flat pixel data together with the layout. That can either be a SEM image taken or some output of a simulation tool. KLayout provides a way to add images to the display and show them below the drawn layout. Currently, images can be read from any commonly used image format available in Qt (i.e. PNG, JPG, TIF ...). Color and monochrome images are supported. Internally an image is stored as a matrix of float values and it is possible to write custom importers using RBA. To add an image, use the "Add Image" function from the "Edit" menu. An image property dialog will appear where the image can be specified. Choose an image using the "Browse" button next to the file name box. An image has a variety of properties which mainly affect the way it is displayed:
Once an image is placed, it can be moved and resized using the "Move" function. The images properties can be adjusted using the "Properties" function from the Edit menu or double-clicking at the image. An arbitrary number of images can be placed on the layout view. To store the setup, save the session using the "File/Save Session" function. Browsing shapesA simple shape browser allows to browse all shapes on a layer. To do so, select the layer to browse in the layer list and choose "Browse shapes" from the "Tools" menu. A browser dialog will appear that lists the cells, shapes and cell instances. Selecting a cell will display all shapes in the cell in the middle list and the cell's instances with respect to the top cell in the right list. If a shape is selected, the layout canvas highlights this shape by drawing a marker box around the shape and zooming to the shape. How the shape is shown can be configured on the "Configure" tab of the shape browser dialog or on the respective page in the "Setup" dialog. Browsing instancesAll instances of a cell can be browsed by selecting the cell in the cell list (not making it top), and choosing "Browse instances" from the "Tools" menu. A simple instance browse comes up that shows all cells that the given cell is instantiated in and how the cell is instantiated. The marker browserKLayout offers a generic concept of storing error markers or related information. This concept is called the "Report database" (RDB). An arbitrary number of report databases can be associated with a layout view. Usually, each database refers to a certain layout but that is not a strict requirement. A report database primarily is a generic collection of "values", which can be strings or other items. Usually, a value is a collection of geometrical objects which somehow flag some position or drawn geometry. Multiple of such values comprise a "marker item". The report database associates these marker items with additional informations:
Marker items are organized into categories. Each marker item must be associated with a category. Categories themselves can be organized hierarchically, i.e. categories can be split into sub-categories. This offers a way of improving the organisation of such categories. Marker items are usually associated with a cell, i.e. where a error was detected. By default, a marker item is simply associated with the top cell. The report database uses a proprietary format based on XML which is capable of storing the annotations provided by the database. It is possible however to import Calibre DRC ASCII format files. The marker browser is a tool to browse a report database associated with a view. The marker browser can be started using the "Marker Browser" function in the "Tools" menu. The marker browser tracks whether a marker has already been visited similar to the "read" flag in a mail client. This allows to track a review session. The "visited" state is reflected in the database file. In the marker browser, use the "Open" button to load a XML database file or import files from other formats. Choose "Reload" to reload a file and "Save As" to write a database in XML format. The marker browser offers three panels:
Similar to the shape and instance browsers, the marker browser offers navigation buttons to select the next marker, category or cell. Selecting rulers, shapes or instancesRulers, shapes or instances can be selected by either clicking on the shape in "Select" mode or by dragging a selection rectangle with the left mouse button pressed. In this case, all shapes inside the selection rectangle will be selected. Pressing the Shift key in addition to selecting shapes or instances will extend the current selection. Pressing Ctrl key will remove all selected shapes or instances from the selection. Only such cells will be selected as instances, of which the bounding box is shown. With the check boxes of the "Edit" menu's "Select" menu, the kind of shapes that participate in the selection can be changed. In addition, selection of instances or rulers can be enabled or disabled. The properties of the selected objects can be browsed with the "Properties" function in the "Edit" menu. A dialog appears that shows the properties of the first object selected. In case of a rectangle for example these are the coordinates of the corners. Additionally, the instantiation path of the object can be shown by pressing the "Instantiation" button. The dialog that shows up then will state the cell that contains the object (this is the lowest cell) and the cells in which these cell is instantiated up to the top cell. Similar "User properties" shows a list of properties attached to this object. More configuration optionsThe option dialog available with the "Setup" function from the "File" menu offers numerous configuration options from background to rulers configuration. In this dialog for example, the color palette can be edited, so that different colors are available or the stipple palette can be configured. In addition, it is possible to define the order how these colors or stipples are assigned to layers initially and which colors are not used for layer coloring. Undo and redoMost operations such as changing of layer colors can be undone using the "Undo" function from the "Edit" menu. Analogous, the operations can be redone again using the "Redo" function from the "Edit" menu. Saving a layout or parts of itA layout or a subcell of it can be saved to either GDS2 or OASIS. To save a layout, choose "Save As" from the "File" menu. To save just a cell, select the cell in the cell tree (it does not need to be the currently shown one) and select "Save Current Cell As" from the context menu (right mouse button) of the cell tree. A file dialog will pop up to select the file name to which to write the cell or layout. After a file has been selected, an option dialog will be shown to specify further options. In this dialog, it is possible to constrain saving to a subset of layers, i.e. just visible ones. Also, the database unit can be changed or the layout can be scaled by a given factor. For OASIS, a compression level can be specified. At a level of 0, no particular attempt is made to compress shapes. At higher levels, shapes are classified and array compression is tried. The higher the level, the more attempts are made to compress shapes into arrays. In particular for flat layouts, compression of shapes requires some memory and slows down OASIS writing considerably. Saving and restoring a sessionA session can be saved and restored later. A "session" involves the files loaded, bookmarks, annotations, layer settings, hierarchy settings and application setup. Sessions are stored as XML files with the suffix ".lys". To save a session, choose "Save Session" from the "File" menu. To restore a session, choose "Restore Session". KLayout can be started with a certain session using the "-u" option from the command line followed by the session file. On Windows installations, session files are registered as being opened automatically by KLayout. |