.rm CM
.nr PS 12
.ps 12
.nr VS 14
.vs 14
.\" rcsid "@(#)tutwrl1	1.0 (decwrl) 12/20/89"
.de (C
.nr PS -2
.nr VS -2
.nr LL 5.5i
.IP
..
.de )C
.sp .5c
.nr PS +2
.nr VS +2
.nr LL 6i
..
.DS C
.LG
.LG
.sp |2c
\fBMagic Tutorial #W-1: Design-Rule Extensions
.rm CH
.ds LH Magic Tutorial #W-1: Design-Rule Extensions
.ds RH \*(DY
.ds CF - % -
.sp 1c
.NL
\fIDon Stark\fR
.sp 1c
Western Research Laboratory 
Digital Equipment Corporation 
Palo Alto, CA 94301

.SM
This tutorial corresponds to Magic version 6.


.DE
.SM
.LP
\fBTutorials to read first:\fR
.IP
Magic Tutorial #6: Design-Rule Checking
.br
Magic Tutorial #9: Format Conversion for CIF and Calma
.br
Magic Maintainer's Manual #2: The Technology File
.DE
.LP
\fBCommands introduced in this tutorial:\fR
.IP
none
.LP
\fBMacros introduced in this tutorial:\fR
.IP
none
.br
.NL
.sp 1c
.NH 1
Introduction
.PP
Magic's original design rule checker has proved inadequate to implement all
the rules found in advanced technologies.  The rules described
in this section allow more complicated configurations to be analyzed.
Two new rules check a region's area and its maximum width.  In addition,
width, spacing, area, and maxwidth checks may now be performed on cif layers.
.NH 1
Area Rules
.PP
The \fBarea\fR rule is used to check the minimum area of a region.  Its
syntax is:
.DS C
\fB area \fI types minarea minedge why\fR
.DE
\fITypes\fR is a list of types that compose the region, all of which must
be on the same plane.  
\fIMinarea\fR is the minimum area that a region must have, while \fIminedge\fR
is the minimum length of an edge for the region.  This second dimension 
is basically
an optimization to make the design rule checker run faster; without it,
the checker has to assume that a region 1 lambda wide and \fIminarea\fR
long is legal, and it must examine a much larger area when checking the
interaction between cells. Specifying \fIminedge\fR reduces this
interaction distance. An example rule is:
.DS C
\fB area (emitter,em1c)/npoly 6 2 "emitter must be at least 2x3"
.DE
.KS
.GS C
width 5.0i
thick 9
file tutwrl1.2.g
.GE
.(C
\fBFigure 1.\fR  Example of the  area rule. 
.)C
.KE
.PP
.NH 1
Maxwidth Rules
.PP
Sometimes a technology requires that a region not be wider than a
certain value.  The \fBmaxwidth\fR rule can be used to check this.
.DS C
\fB maxwidth \fI layers mwidth bends why\fR
.DE
\fILayers\fR, the types that compose the region, must all be in the 
same plane.  The region must be less than \fImwidth\fR wide in either the
horizontal or vertical dimension. \fIBends\fR takes one of two values,
\fBbend_illegal\fR and \fBbend_ok\fR.  For \fBbend_illegal\fR rules, the
checker forms a bounding box around all contiguous tiles of the correct type, 
then checks this box's width.  For example:
.DS C
\fB maxwidth (emitter,em1c)/npoly 2 bend_illegal "emitter width cannot be over 2"\fR
.DE
\fBbend_ok\fR rules are used to check structures where the region
must be locally less than maxwidth, but may contain bends,
T's, and X's. 
.DS C
\fB maxwidth trench 2 bend_ok "trench must be exactly 2 wide"\fR
.DE
\fBWarning:\fR the bend_ok rule is basically a kludge, and may fail for
regions composed of more than one type, or for intersections more
complicated than T's or X's. 
Figure 2 shows some examples of both types of rules.

.KS
.GS C
width 5.0i
thick 9
file tutwrl1.1.g
.GE
.(C
\fBFigure 2.\fR  Examples of the maxwidth rule. 
The dogleg at the left would
be ok in a \fBbend_ok\fR rule, but fails in a \fB bend_illegal\fR one, 
where the region's bounding box is checked.
For \fBbend_ok\fR rules, each tile in the region is checked. The left
shape fails in two places: the top horizontal part is too thick and the
stub at the bottom intersects the region in a shape other than a T or X.
.)C
.KE
.PP
.NH 1
Rules on CIF layers
.PP
For technologies with complicated generated layers, it is often difficult
to check design rules on the abstract types that are drawn in Magic.  To
ameliorate this problem, the extended checker allows simple checks to be
performed on cif layers.  The rules that can be checked are width,
spacing, area, and maxarea.  Since checking rules on the cif layers
requires that these layers be generated, these checks are considerably
slower than the normal ones, and should only be used when absolutely
necessary.
.NH 2
Setting the CIF style
.PP
The \fBcifstyle\fR rule is used to select which \fBcifoutput\fR style is
used.
.DS C
\fB cifstyle \fIcif_style\fR
.DE
\fICif_style\fR must be one of the cif styles included in the cifoutput
section.  In the current implementation, the cif checker generates all the
layers in the style regardless of whether they are actually used in
design-rule checks;  for speed, defining a separate cif style for design
rule checking it may be worthwhile when only a few layers are checked.
Any layer in the cif style, defined by either a \fIlayer\fR or a
\fItemplayer\fR rule, may be checked.
.NH 2
Width Checks
.PP
The syntax for \fBcifwidth\fR is analogous to that of the regular width
rule:
.DS C
\fB cifwidth \fIlayer width why\fR
.DE
\fILayer\fR is a single cif layer. (To do width checks with more than one cif
layer, \fBor\fR all the layers into a new \fItemplayer\fR). \fIWidth\fR
is the minimum width of the region in centimicrons.
.NH 2
Spacing Checks
.PP
The \fBcifspacing\fR rule is also very similar to the regular rule:
.DS C
\fB cifspacing \fIlayer1 layer2 separation adjacency why\fR
.DE
\fILayer1\fR and \fIlayer2\fR are both cif layers.  If \fIadjacency\fR is
\fBtouching_ok\fR, then layer1 must equal layer2. For
\fBtouching_illegal\fR rules, \fIlayer1\fR and \fIlayer2\fR may be any 
two cif layers. \fISeparation\fR is given in centimicrons.
.NH 2
Area Checks
.PP
The area rule is:
.DS C
\fB cifarea \fIlayer minarea minedge why\fR
.DE
\fI Layer\fR is again a single cif layer.  \fIminedge\fR is expressed in
centimicrons, and \fIminarea\fR is given in square centimicrons.
.NH 2
Maxwidth Checks
.PP
The maxwidth rule is:
.DS C
\fB cifmaxwidth \fI layer mwidth bends why\fR
.DE
Again, \fIlayer\fR is a single cif layer, and \fImwidth\fR is given in
centimicrons.

