1MAGIC(5)                      File Formats Manual                     MAGIC(5)
2
3
4

NAME

6       magic - format of .mag files read/written by Magic
7
8

DESCRIPTION

10       Magic  uses  its  own  internal  ASCII format for storing cells in disk
11       files.  Each cell name is stored in its own file, named name.mag.
12
13       The first line in a .mag file is the string
14
15                 magic
16
17       to identify this as a Magic file.
18
19       The next line is optional and is used to  identify  the  technology  in
20       which a cell was designed.  If present, it should be of the form
21
22                 tech techname
23
24       If absent, the technology defaults to a system-wide standard, currently
25       nmos.
26
27       The next line is also optional and gives a timestamp for the cell.  The
28       line is of the format
29
30                 timestamp stamp
31
32       where  stamp  is  a  number  of seconds since 00:00 GMT January 1, 1970
33       (i.e, the Unix time returned  by  the  library  function  time()).   It
34       should  be the last time this cell or any of its children changed.  The
35       timestamp is used to detect when a child is edited outside the  context
36       of  its parent (the parent stores the last timestamp it saw for each of
37       its children; see below).  When this occurs,  the  design-rule  checker
38       must  recheck  the  entire  area  of  the child for subcell interaction
39       errors.  If this field is omitted in a cell, Magic supplies  a  default
40       value that forces the rechecks.
41
42       Next  come  lines describing the contents of the cell.  There are three
43       kinds of groups of lines, describing mask rectangles, subcell uses, and
44       labels.  Each group must appear contiguously in the file, but the order
45       between groups is arbitrary.
46
47       Each group of mask rectangles is headed with a line of the format
48
49                 << layer >>
50
51       where layer is a layername known in the  current  technology  (see  the
52       tech line above).  Each line after this header has the format
53
54                 rect xbot ybot xtop ytop
55
56       where  (xbot, ybot)  is the lower-left corner of the rectangle in Magic
57       (lambda) coordinates,  and  (xtop, ytop)  is  the  upper-right  corner.
58       Degenerate  rectangles are not allowed; xbot must be strictly less than
59       xtop, and ybot strictly less than ytop.  The smallest  legal  value  of
60       xbot or ybot is −67108858, and the largest legal value for xtop or ytop
61       is 67108858.  Values that approach these limits (within a factor of 100
62       or  1000)  may  cause numerical overflows in Magic even though they are
63       not strictly illegal.  We recommend using coordinates  around  zero  as
64       much as possible.
65
66       Rectangles  should  be non-overlapping, although this is not essential.
67       They should also already  have  been  merged  into  maximal  horizontal
68       strips  (the neighbor to the right or left of a rectangle should not be
69       of the same type), but this is also not essential.
70
71       The second kind of line group describes a single cell use.   Each  cell
72       use group is of the following form:
73
74                 use filename use-id
75                 array xlo xhi xsep ylo yhi ysep
76                 timestamp stamp
77                 transform a b c d e f
78                 box xbot ybot xtop ytop
79
80       A  group  specifies  a single instance of the cell named filename, with
81       instance-identifier use-id.  The  instance-identifier  use-id  must  be
82       unique among all cells used by this .mag file.  If use-id is not speci‐
83       fied, a unique one is generated automatically.
84
85       The array line need only be present if the cell is an  array.   If  so,
86       the  X indices run from xlo to xhi inclusive, with elements being sepa‐
87       rated from each other in the X dimension by xsep lambda.  The Y indices
88       run  from ylo to yhi inclusive, with elements being separated from each
89       other in the Y dimension by ysep lambda.  If xlo  and  xhi  are  equal,
90       xsep is ignored; similarly if ylo and yhi are equal, ysep is ignored.
91
92       The timestamp line is optional; if present, it gives the last time this
93       cell was aware that the child filename changed.  If there is  no  time‐
94       stamp  line, a timestamp of 0 is assumed.  When the subcell is read in,
95       this value is compared to the actual value  at  the  beginning  of  the
96       child  cell.  If there is a difference, the ``timestamp mismatch'' mes‐
97       sage is printed, and Magic rechecks design-rules around the child.
98
99       The transform line gives the geometric transform  from  coordinates  of
100       the  child  filename  into coordinates of the cell being read.  The six
101       integers a, b, c, d, e, and f are part of the following  transformation
102       matrix,  which  is  used  to  postmultiply all coordinates in the child
103       filename whenever their coordinates in the parent are required:
104
105                           a    d    0
106                           b    e    0
107                           c    f    1
108
109       Finally, box gives an estimate of the bounding  box  of  cell  filename
110       (covering  all the elements of the array if an array line was present),
111       in coordinates of the cell being read.
112
113       The third kind of line group in a .mag file is a list  of  labels.   It
114       begins with the line
115
116                 << labels >>
117
118       and is followed by zero or more lines of the following form:
119
120                 rlabel layer xbot ybot xtop ytop position text
121
122       Here layer is the name of one of the layers specified in the technology
123       file for this cell.  The label is attached to material  of  this  type.
124       Layer  may  be  space,  in which case the label is not considered to be
125       attached to any layer.
126
127       Labels are rectangular.  The lower-left corner of the label  (the  part
128       attached to any geometry if layer is non-space) is at (xbot, ybot), and
129       the upper-right corner at (xtop, ytop).  The width of the rectangle  or
130       its  height  may  be zero.  In fact, most labels in Magic have a lower-
131       left equal to their upper right.
132
133       The text of the label, text, may be  any  sequence  of  characters  not
134       including a newline.  This text is located at one of nine possible ori‐
135       entations relative to the center of the label's rectangle.  Position is
136       an  integer  between  0 and 8, each of which corresponds to a different
137       orientation:
138
139                 0    center
140                 1    north
141                 2    northeast
142                 3    east
143                 4    southeast
144                 5    south
145                 6    southwest
146                 7    west
147                 8    northwest
148
149
150       A .mag file is terminated by the line
151
152                 << end >>
153
154       Everything following this line is ignored.
155
156       Any line beginning with a pound sigh (``#'') is considered to be a com‐
157       ment  and  ignored.  Beware, however, that these comments are discarded
158       by Magic when it reads a cell, so if that  cell  is  written  again  by
159       Magic, the comments will be lost.
160
161

NOTE FOR PROGRAMS THAT GENERATE MAGIC FILES

163       Magic's  incremental  design  rule  checker  expects that every cell is
164       either completely checked, or contains information to tell the  checker
165       which  areas of the cell have yet to be examined for design-rule viola‐
166       tions.  To make sure that the  design-rule  checker  verifies  all  the
167       material  that  has  been  generated for a cell, programs that generate
168       .mag files should place the following rectangle in each file:
169
170                 << checkpaint >>
171                 rect xbot ybot xtop ytop
172
173       This rectangle may appear anywhere a list  of  rectangles  is  allowed;
174       immediately  following  the  timestamp  line at the beginning of a .mag
175       file is a good place.  The coordinates xbot etc. should be large enough
176       to  completely  cover  anything in the cell, and must surround all this
177       material by at least one lambda.  Be careful, however, not to make this
178       area  too  ridiculously large.  For example, if you use the maximum and
179       minimum legal tile coordinates, it will take the design-rule checker an
180       extremely long time to recheck the area.
181
182

SEE ALSO

184       magic(1)
185
186
187
1884th Berkeley Distribution                                             MAGIC(5)
Impressum