These functions provide an interface to the derived layer capability (see 15.2). Derived layers are invisible internal layers that imply geometry resulting from evaluation of a layer expression, which may involve normal layers and other derived layers. Derived layers are recognized by name in layer expressions.
There are actually two implementations of derived layer functionality. The interface functions allow explicit choice of which evaluation method to use. Within Xic, this detail is generally invisible to the user.
In the original implementation, developed for the DRC system, the geometry of derived layers must be created or updated before the derived layer is referenced. In use, reference to a derived layer in a layer expression retrieves this geometry, very similar to what happens when a normal layer is referenced. Ordinarily, the derived layer geometry will be cleared after final use. This method may be fast when the same layer expressions must be evaluated many times, so it seems a good match for DRC, where it is used.
To use this method, the interface function EvalDerivedLayers is called to create the geometry for each derived layer that will be evaluated. Then, GetDerivedLayerLexpr is called with a boolean true second argument to get the evaluation objects as needed, which are evaluated to create new geometry. When done, ClearDerivedLayers is called to destroy the precomputed geometry.
In the second mode of operation, when the parse tree for the derived layer is created, references to derived layers will be recursively parsed and stitched into the tree. The final parse tree will contain normal layers only, and can therefor be evaluated in any context, without the need for precomputed geometry caches.
With this method, there is no need to call EvalDerivedLayers and ClearDerivedLayers, as there is no use of cached geometry. The evaluation object is returned from GetDerivedLayerLexpr with a boolean false second argument.
The third argument is a string starting with an optional keyword followed by a layer expression, separated by space. The keyword is one of join, split, or splitv. These are the same keywords, and have the same effects, as is explained for the DerivedLayer keyword in the technology file. The expression can reference by name ordinary layers and derived layers. The expression is not parsed until evaluation time.
The function fails if either the lname or lexpr are null or empty strings.
The name can be in the form ``layer:purpose'' as for normal Xic layers, however the entire token is taken verbatim. This is a subtle difference from normal layers, where for example ``m1:drawing'' and ``m1'' are equivalent (the drawing purpose being the default). As derived layer names, the two would differ, and the notion of a purpose does not apply to derived layers.
The boolean second argument will suppress derived layer expansion if set.
There are two ways to handle derived layers. Generally, layer expression parse trees are expanded (second argument is false), meaning that when a derived layer is encountered, the parser recursively descends into the layer's expression. The resulting tree references only normal layers, and evaluation is straightforward.
A second approach might be faster. The parse trees are not expanded (second argument is true), and a parse node to a derived layer contains a layer descriptor, just as for normal layers. Before any computation, EvalDerivedLayers must be called, which actually creates database objects in a database for the derived layer. Evaluation involves only finding the geometry in the search area, as for a normal layer.
Evaluation creates the geometry described by the layer expression. Derived layers are never visible, so this geometry is internal, but can be accessed, e.g., by design rule evaluation functions, or used to create normal layers with the !layer command or the Evaluate Layer Expression panel from the Edit Menu.
The first argument is a string containing a list of derived layer names, separated by commas or white space. The function will evaluate these derived layers, and any derived layers referenced in their layer expressions, in an order such that the derived layers will be evaluated before being referenced during another evaluation.
All geometry created will exist in the current cell, and the layer expressions will source all levels of the hierarchy. Any geometry left in the current cell from a previous evaluation will be cleared first. Derived layer geometry in subcells is ignored.
The second argument can set the area where the layers will be evaluated, which can be any rectangular region of the current cell. This can be an array of size four or larger, specifying left, bottom, right, and top coordinates in microns in the 0, 1, 2, 3 indices. The argument can also be a scalar 0 which indicates to use the entire current cell.
The return is a string listing all of the derived layers evaluated, which will include derived layers referenced by the original list but not included in the list. This should be passed to ClearDerivedLayers when finished using the layers.