Next: Derived Layers
Up: The DRC Menu: Design
Previous: The DRC Menu: Design
Contents
Index
Layer Expressions
Many of the design rules, extraction specifications, and commands make
use of ``layer expressions''. These expressions are used to signify
regions of the layout where certain combinations of layers (or absence
of layers) exist. A layer expression consists of a logical
expression, in the format recognized by the script parser used to
evaluate script files.
The expression may contain physical layer and derived layer (see
15.2) names, functions from the list below, operators from the
table below, numeric constants, and parentheses to enforce precedence.
In its simplest form, a layer expression is a layer name, which can be
thought of as a list of regions corresponding to the dark areas
(boxes, polygons, and wires) of that layer. A numeric value of zero
represents emptiness, and a nonzero value represents full coverage.
When a layer expression is evaluated in the !layer command or
the Evaluate Layer Expression panel, the result is always a
normal layer, thus derived layers can be made visible by this means.
If the layer expression represents a simple copy, the created physical
layer will take any attributes of the derived layer (color, fill,
etc.) that were given to the derived layer.
If the names of any defined layers are numeric values, one must be a
little careful when specifying the equivalent numeric value, since a
layer name interpretation will supersede a numeric interpretation.
For example, in the presence of a layer named ``1'', one could use
``1.0'' to specify the number 1. A four-digit hex number is always
assumed to be a layer name, even if a layer of that name does not
presently exist. This is necessary so that when reading the
technology file, layer expressions can reference layers with numerical
names (likely from GDSII conversion) that have not yet been defined.
Layer names in the ``decimal'' format must be double quoted, e.g.,
"22,0".
The layer name token can actually take an extended syntax which
enables extraction of geometry from cells other than the current cell.
lname[.stname][.cellname]
See the description of the !layer command in 19.13.2 for
a description of this syntax and examples.
The following operators are accepted in layer expressions:
&
or *
|
intersection |
|
or +
|
union |
!
|
inversion |
^
|
exclusive-or |
-
|
and-not, i.e.,
A - B = A&!B
|
and |
synonym for &
|
or |
synonym for |
|
not |
synonym for !
or -
|
xor |
synonym for
^
|
The operator-equivalent keywords (and, or, not, xor) are recognized without case sensitivity. The not keyword
can represent a unary negation or a binary ``andnot'', depending on
the context. Thus, for layers A and B, each of the
following are equivalent: A not B, A -
B, A &!
B, A and not B.
Parentheses can be used to enforce precedence.
The expression returns an internal data structure representing those
regions of the current cell where the expression is true, i.e., where
the layers exist with the given logic.
There is a special layer named ``$$'' which logically consists of
boxes covering each of the subcells in the current cell.
The !layer command can create a new layer from a layer
expression, and is therefor a good vehicle for experimenting with
layer expressions.
The tokens are interpreted as they would be in an ordinary expression
involving numbers, thus their precedence might not be quite as
expected in layer expressions. For example
!layer CAA = !CAA & $$
and
!layer CAA = !CAA * $$
are not equivalent. The latter expression is equivalent to
!layer CAA = !(CAA & $$)
since `*' has higher precedence than `&'. The equivalent expression
is
!layer CAA = (!CAA) * $$
(recall that `$$' is the name for an internal layer consisting of
subcell bounding boxes).
The following function calls are supported in layer expressions. Only
the functions listed below are available, and all return a layer
expression object.
-
- sqz(layer_exp expr)
This is a special function that evaluates the layer expression passed
as an argument, but the geometry for the given layers is obtained from
the selection queue (the currently selected objects), and not the
entire cell as in the normal case. It can be freely used within a
larger layer expression.
Below are some examples, using the !layer command.
- !layer new = sqz(CPG-CAA)
Create a layer ``new'' that will contain the selected objects on CPG
clipped around selected objects on CAA.
- !layer new = VIA & sqz(M2)
Create a layer ``new'' that will contain the areas of VIA that overlap
selected objects on M2.
- !layer CPG = CPG - sqz(temp)
Clip out the selected objects on layer temp from CPG.
- bloat(real incr, layer_exp layer,
int mode)
This expands the features on the layer by incr (in microns),
which may be negative. The effect is similar to the !bloat
command and the BloatZ script function. The mode integer
is described with the !bloat command.
- extent(layer_exp layer)
This evaluates to a trapezoid list containing at most one entry, a
rectangle giving the bounding box of the expression result. The
return is null if the expression is nowhere dark. This is similar to
the ExtentZ script function.
- edges(real incr, layer_exp layer,
int mode)
This creates an edge list, similar to the EdgesZ script
function. See the description of that function for the edge modes
available. The modes 0-3 are equivalent to returns from the bloat function when returning the edge template, for the four corner
fill-in modes.
- manhattanize(real dimen, layer_exp layer,
int mode)
This converts the representation to a Manhattan approximation. The
first argument is the minimum width or height in microns of rectangles
that are created to approximate the non-Manhattan parts. The third
argument is an integer taken as zero or nonzero to specify which of
two algorithms to use. This is similar to the !manh command
(where the algorithms are described), and to the ManhattanizeZ
script function.
- box(real l, real b, real r,
real t)
This defines a rectangular region from the four real arguments, which
can be used for clipping or construction in layer expressions. The
coordinates are given in microns. This is similar to the BoxZ
script function.
- zoid(real xll, real xlr, real yl,
real xul, real xur, real yu)
This defines a horizontal trapezoid region from the six real
arguments, which can be used for clipping or construction in layer
expressions. The coordinates are given in microns. This is similar
to the ZoidZ script function.
- filt(layer_exp zoids, layer_exp lyr2)
This function is rather specialized. First, the trapezoids passed in
the first argument are separated into groups of mutually-connected
trapezoids. Each group is like a wire net. We throw out the groups
that do not intersect with nonzero area the dark area implied by the
second argument. The return value is a list of the trapezoids that
remain.
- geomAnd(layer_exp lyr1 [, layer_exp lyr2])
If one argument is given, the result is the overlapping parts of
regions in the internal list corresponding to the argument. This is
only useful if the argument was explicitly constructed with geomCat (see below). With two arguments, this is equivalent to the
intersection operator. The function is similar to the GeomAnd
script function.
- geomAndNot(layer_exp lyr1, layer_exp lyr2)
This is equivalent to the and-not operator, and is similar to the GeomAndNot script function.
- geomCat(layer_exp lyr1, ... )
This takes one or more layer expression arguments and simply
concatenates the regions, without any merging or clipping, similar to
the GeomCat script function.
- geomNot(layer_exp lyr)
This is equivalent to the inversion operator, similar to the GeomNot script function.
- geomOr(layer_exp lyr1, ...)
This takes one or more layer expression arguments and returns the
union, constructed internally so that no two regions overlap. This is
similar to the GeomOr script function.
- geomXor(layer_exp lyr1 [, layer_exp lyr2])
If one argument is given, the return is the set of regions
representing the exclusive-or of regions represented by the argument.
This is only useful if the user has explicitly constructed the
argument using geomCat. If two arguments are given, the result
is the exclusive-or of the areas, equivalent to the exclusive-or
operator. This function is similar to the GeomXor script
function.
- drcZlist(string layername, string rulename,
integer index, layer_exp lyr1)
This will return the test areas based on an existing design rule
definition, very similar to the DRCzList script function. This
function exists only when design rule checking is included in the
feature set.
- drcZlistEx(layer_exp lyr1, tring target,
string inside, string outside, integer incode,
integer outcode, real dimen)
This will return the test areas based on the DRC test area generation
specified by the arguments, very similar to the DRCzListEx
script function. This function exists only when design rule checking
is included in the feature set.
Examples:
!layer M2 = M2 & box(100, 100, 200, 200)
This clips M2 to the given box.
!layer M2 = bloat(5, M2, 0)
This bloats the M2 geometry by 5 microns.
Next: Derived Layers
Up: The DRC Menu: Design
Previous: The DRC Menu: Design
Contents
Index
Stephen R. Whiteley
2024-09-29