Published by Jessica Masters – Latest update on 15/09/2021
ID: TN018
Relevant product(s): L-Edit
Operating systems: Linux RHEL 6 and above / Windows 7 and above
Versions affected: All
Relevant area(s): Usage / Automation
Summary
This note will explain how to use Boolean operations in L-Edit. This is beneficial when changing the size of an object or making an object that is the product of Boolean relationship between objects on different layers.
In this technote, we will show how to perform:
- Basic Boolean Operations using the GUI
- Boolean Operations on Derived Layers and Their Hierarchy
- Boolean Operations using a Script
Details
Boolean Operations
This section contains details on running basic Boolean operations in the GUI. This section is example-driven, hence, please download the “BooleanOperationCell.tdb” file in the attachment section at the bottom of the page.
- To run Boolean operations using toolbar icons, first, ensure that the Editing toolbar is enabled. If it is not enabled, go to the “View” menu, “Toolbars” option, and select Editing
- Open the cell “BooleanOp” in the library “BooleanOperationCell”. The following shape below is used as the initial layout, made from 2 different layers, to demonstrate how the various Boolean operations will affect a set of objects
- Boolean Operations run on all selected objects. Please use Ctrl+A to select all objects in the cell
- Run the Boolean operations from the Editing toolbar using the icon “Boolean/Grow Operations”, as shown below
- The settings can be configured as desired (please find the corresponding screenshot below):
a) To remove the initial layers, tick next to the box “Delete inputs after operation is done”, which will remove the input geometry
b) In the result box, choose the layer for the resulting object to be placed onto
c) In inputs, it will include all the objects being calculated in the operations, which will be all the selected objects from step 3
d) To select which operation to use on the inputs, select from the drop down box next to the Operation section
The different operations available are shown below, performed on the initial layout object in the cell “BooleanOp”.
Note: The resultant layer is shown in yellow for each operation, while Metal 1 and Metal 2 remain blue and green respectively.
Derived Layers and Hierarchy
Another way to perform Boolean operations on a design is using derived layers. For more information on using these layers to create rules, please look at the technote “Setting up complex rules with Standard DRC”, found by selecting here or in the References section at the bottom of the page.
When using Boolean operations for layers, multiple operations can be performed at once to create more complex operations. These operations have a hierarchy that decides which operations are calculated first. These are:
- Grow/Shrink on each object
- NOT on each layer
- AND between layers
- OR between layers
XOR does not have any hierarchy over AND or OR, this will just run in the order stated. If it is a XOR b AND c, it will complete a XOR b first, and then AND the result with c. If it is c AND b XOR a, it will complete c AND b first, and then XOR the result with a. These will provide different results.
This can be seen in the example file “BooleanLayerGenerationHierarchyCell.tdb”. Run this file in L-Edit and follow the steps below.
- Open the cell “BooleanHierarchy” in the library “BooleanLayerGenerationHierarchyCell”
- To find the Boolean Operation, got to the “Setup” menu, “Layers…” and select the result layer “layer_result”. Under the “Derivation” tab, the Boolean equation can be created
In this example, shown below, the operation can be expressed as: (a OR ((NOT (Grow(5) b))) AND (NOT (c)))
This will run the operations in the following order:
- Grow by 5 on layer b
- NOT the result from step 1
- NOT layer c
- AND Operation between the result from step 2 and the result from step 3
- OR Operation between a and the result from step 4
An example layer using XOR can be found under “layer_result_XOR”.
To generate the result of the derived layers, the menu bar or a script can be used. Using the menu bar, go to the “Tools” menu, and select “Generate New Layers”. Alternatively, when using a script in C/C++, use the following:
LCell_GenerateLayers_v11_10 (Cell, CommandFile, LayerName, No.ofLayers, Merge);
- Cell: (BooleanHierarchy) Name of the Cell
- CommandFile: (NULL) Name of the DRC file
- LayerName: (layer_result) Name of the layer to be generated
- No.ofLayers: (1) Number of layers to generate
- Merge: (LFALSE) Merge objects on the same layer
Boolean Operations Using a Script
Scripts can be used to run Boolean operations. The command is called LCell_BooleanOperation and can be used in C/C++, Python or Tcl. To follow an example script written in Tcl, please find the file “BooleanScriptDoc.tcl” in the attachments section at the bottom of the page.
- Open one of the other designs, such as “BooleanOperationCell.tdb”, from the Boolean Operations section. This is so that the layers already exist
On the command line, type “source {filepath_to_tcl_script}” to run the file, for example: “source {C:\scripts\BooleanScriptDoc.tcl}”. This will generate two overlapping boxes and then perform the AND operation on them
- The code file can be found by opening the tcl file in a code management app such as Notepad
The LCell_BooleanOperation commands’ arguments are listed below:
LCell_Boolean Operation (Cell, BooleanOperation, Amount, ResultLayer, DeleteInputs, ObjectA, ObjectB);
- Cell: This is the name of the cell to put the result. This means that it does not need to be the same as where the objects are
- BooleanOperation: These are already defined, for example, the OR operation is $LBoolOp_OR in Tcl. More values and other languages can be seen in the table below
- Amount: When using Grow or Shrink operations, this is the amount it changes size. When this is not used, use an empty string
- ResultLayer: the name of the layer where the result objects will be placed
- DeleteInputs: choose whether to delete the inputs after calculating or not. The options are $LTRUE or $LFALSE
- ObjectA: The first object that the Operation will use
- ObjectB: The second object that the Operation will use. This is not always necessary
Operation | Tcl Language Value | Python and C/C++ Language Value |
OR | $LBoolOp_OR | LBoolOp_OR |
AND | $LBoolOp_AND | LBoolOp_AND |
XOR | $LBoolOp_XOR | LBoolOp_XOR |
NOT | $LBoolOp_NOT | LBoolOp_NOT |
GROW | $LBoolOp_GROW | LBoolOp_GROW |
SHRINK | $LBoolOp_SHRINK | LBoolOp_SHRINK |
SUBTRACT | $LBoolOp_SUBTRACT | LBoolOp_SUBTRACT |
Useful references
Setting up complex rules with Standard DRC: https://www.eda-solutions.com/tn016/
Attachments
Example file here containing a TDB database: https://we.tl/t-xGH4e8bZk0
Example file here containing a script example: https://we.tl/t-u2Mb48iHio