Introduction
Caltech Intermediate Form (CIF) is a text language for the mask geometry of integrated
circuits: boxes, polygons, wires and round flashes on named layers, grouped into symbols that
can be placed many times. Files are usually written by programs, but can be read and typed by
hand. Version 2.0, described here, is set out by Robert Sproull and Richard Lyon, revised by
Stephen Trimberger, in Caltech Silicon Structures Project report 2686 of February 1980, in
material almost identical to section 4.5 of Mead and Conway’s Introduction to VLSI
Systems. The first CIF was designed by Ivan Sutherland and Ron Ayres in 1976. The
extension .cif is also used by crystallography’s Crystallographic Information
File, which is a different format. Chip layouts are also exchanged as binary
GDSII files.
Syntax
A file is a sequence of commands, each ended by a semicolon, followed by the end command
E. In this grammar, in Wirth’s notation, braces mean any number of repetitions,
square brackets an optional part and | a choice.
cifFile = {{blank} [command] semi} endCommand {blank}.
command = primCommand | defDeleteCommand
| defStartCommand semi {{blank} [primCommand] semi} defFinishCommand.
primCommand = polygonCommand | boxCommand | roundFlashCommand | wireCommand
| layerCommand | callCommand | userExtensionCommand | commentCommand.
polygonCommand = "P" path.
boxCommand = "B" integer sep integer sep point [sep point].
roundFlashCommand = "R" integer sep point.
wireCommand = "W" integer sep path.
layerCommand = "L" {blank} shortname.
defStartCommand = "D" {blank} "S" integer [sep integer sep integer].
defFinishCommand = "D" {blank} "F".
defDeleteCommand = "D" {blank} "D" integer.
callCommand = "C" integer transformation.
userExtensionCommand = digit userText.
commentCommand = "(" commentText ")".
endCommand = "E".
transformation = {{blank} ("T" point | "M" {blank} "X" | "M" {blank} "Y" | "R" point)}.
path = point {sep point}.
point = sInteger sep sInteger.
sInteger = {sep} ["-"] integerD.
integer = {sep} integerD.
integerD = digit {digit}.
shortname = c [c] [c] [c].
c = digit | upperChar.
userText = {userChar}.
commentText = {commentChar} | commentText "(" commentText ")" commentText.
semi = {blank} ";" {blank}.
sep = upperChar | blank.
blank = any ASCII character except a digit, an upper-case letter,
"-", "(", ")" and ";".
userChar = any ASCII character except ";".
commentChar = any ASCII character except "(" and ")".
The definition of blank is unusually wide: lower-case letters, commas, line ends
and other punctuation all count as space, and upper-case letters can separate numbers. So
Box Length 25 Width 60 Center 80,40 Direction -20,20; and
B25 60 80 40 -20 20; are the same command. Definitions cannot be nested.
Programs need not carry out every feature, but they must parse the whole syntax correctly. There are no floating-point numbers and no loops. The language sets no limit on the size of numbers, so a reader has to check for overflow.
Coordinates and units
Coordinates are right-handed, x to the right and y upwards, looking at
the front surface of the finished chip. The unit is a hundredth of a micrometre. A direction
is a vector of two integers whose length does not matter: 1 0 and
17 0 both point along +x, and 1 1 is 45° anticlockwise
from it. A reader may treat 0 0 as +x and warn.
Shapes
| Command | Parameters | Shape |
|---|---|---|
B | length, width, centre, optional direction | A rectangle. The length is measured along the direction, which defaults to (1, 0), and the width at right angles to it. |
P | points | A polygon through the points; the edge from the
last back to the first is implied, as in P 0 0 10 20 -30 40;. There are no
generally accepted restrictions on the path. |
R | diameter, centre | A round flash, as in
R 200 500 800;. Some programs draw octagons. |
W | width, points | A wire, as in
W 50 0 0 10 20 -30 40;. The ideal shape is every point within half the width
of the path, which rounds the ends and joints. Devices may approximate it with squared ends
or with boxes. |
Wires as boxes
The report gives a way to turn a wire of width w through points p1 to pn into one box per segment without trigonometry. A single point becomes a round flash of diameter w. Otherwise each segment S = pi+1 − pi gets an extension at both ends. At the two ends of the wire it is w/2. At an inner point, the next segment is rotated by the matrix that turns S onto +x, giving the bend vector b, and
extension = w/2 × |b.y| / (length(b) + |b.x|)
box length = length(S) + extension + previous extension
box width = w
box centre = (p[i] + p[i+1]) / 2 + (S / length(S)) × (extension − previous extension) / 2
box direction = S
A bend vector of (0, 0) means a repeated point, which is deleted before starting again, and a zero segment must not be used as a direction. The boxes cover more than the ideal wire at gentle bends and less at sharp ones; a path that reverses on itself gets no extension at the turn.
Layers
L sets the layer for all the shapes that follow, as in L ND;. A name
is one to four digits or upper-case letters, and its first character stands for the
technology. The report defines these names for the nMOS process:
| Name | Layer |
|---|---|
ND | Diffusion |
NP | Polysilicon |
NC | Contact cut |
NM | Metal |
NI | Depletion-mode implant |
NB | Buried contact |
NG | Openings in the overglass |
Rubin’s textbook lists names used for CMOS: CMF first metal, CMS
second metal, CPG polysilicon, CAA active area, CSG
select, CWG well, CC contact, CVA via and
COG overglass. A reader should check names, and may list the ones it ignores.
The layer setting is preserved across symbol calls and definitions. The report suggests that
readers act as if L ZZZZ; stood at the start of the file and at the start of every
definition, and report any shape drawn on ZZZZ as an error, so that each symbol
names its own layers.
Symbols
A symbol is a numbered group of commands between DS and DF. The
number has nothing to do with the order of symbols in the file. DS may add a scale,
two integers a and b (both 1 if absent): every distance in the
definition, whether a position or a size, in shapes and calls alike, becomes
a × distance / b. DS 57 100 1; lets symbol 57 be written in
micrometres. The scale does not reach into the contents of the symbols it calls, and a call
cannot scale. Version 2.0 has no symbol parameters and no arrays.
DF ends the definition. A definition may contain calls but not other
definitions. Defining a number again discards the earlier symbol, with a warning. The file is
meant to be read in one pass: a symbol must be defined by the time it is instantiated, and a
call outside any definition is instantiated before more of the file is read. A typical file is
a set of definitions followed by a single call.
DD n forgets every symbol numbered n or higher, which
helps when files are joined: for example library symbols numbered below 100, projects from 100,
and DD 100; between projects. The effect should be as if the text of those
definitions had never been included, so a call always refers to the most recent definition of a
number.
Calls and transformations
C n places symbol n, followed by any number of
transformations, applied in the order written:
| Item | Effect on a point (x, y) |
|---|---|
T a b | (x + a, y + b) |
MX | (−x, y) |
MY | (x, −y) |
R a b | ((ax − by) / c, (bx + ay) / c) with c = √(a² + b²): the symbol’s x axis is turned to the direction (a, b) |
So C 1 T 500 0 MX; moves and then mirrors, while C 1 MX T 500 0;
mirrors and then moves. As 3 × 3 matrices acting on the row vector [x y
1], the whole call is the product of its items in order. A box direction is transformed as
[x y 0], so that translation does not affect it. Distances never change.
In nested calls the inner call’s matrix is applied first, then that of the enclosing call.
The report’s method for expanding a call is to push the current matrix and layer, set the
layer to ZZZZ, multiply the call’s items in front of the current matrix, process
the symbol and restore both. A symbol that calls itself, directly or through others, is not
sensible and should be detected.
Comments, extensions and the end
A comment is a command in parentheses. Parentheses inside it must balance, so a comment can switch off commands.
Commands starting with a digit are reserved for users and will never be given a meaning by
the standard; the report’s examples are 3 SYMBOL.LIBRARY; and
5:NONSTANDARD DESIGN RULES:LAMBDA = 4.0;, and it mentions file inclusion,
instructions to preprocessors and extra data as uses.
E ends the file. A reader should report a missing E as an error and
warn about anything but space after it. For moving files between systems the report asks for
ASCII with no limit on line length where possible; otherwise readers should accept lines of at
least 132 characters and writers should write shorter ones. An end of line counts as a
blank.
Conventional extensions
These are not part of the standard. They are listed by Rubin, or handled by the readers of KLayout and Magic.
| Command | Meaning |
|---|---|
0 x y layer N name; | Named node |
0V x1 y1 … xn yn; | Vectors |
2A "msg" T x y; | Message above a point; 2B below,
2C centred, 2L left, 2R right |
4A lowx lowy highx highy; | Cell boundary |
4B name; | Instance name |
4N name x y; | Signal label |
9 name; | Name of the symbol being defined |
91 name; | Instance name for the next call |
93 nx dx ny dy; | KLayout: makes the following call an array of nx by ny copies with spacings dx and dy |
94 name x y; | Label at a point. Magic allows a layer name after it; KLayout instead reads an optional text height, a decimal number |
95 name length width x y; | Label over a rectangle, given by its size and centre. Magic allows a layer name after it |
98 n; | KLayout: wire end style, 0 flush, 1 round, 2 square |
Example
(A cell written in micrometres, placed twice);
DS 1 100 1;
9 pad;
L NM; B 10 4 5 2;
L NP; W 2 0 0 0 20;
DF;
C 1 T 0 0;
C 1 MX T 3000 0;
E
9 line is the cell name extension.Recognising a file
There is no signature. A CIF file is ASCII text of commands ended by semicolons, commonly
starting with a comment in parentheses or with DS, and its last command is
E. Outside comments and user commands, each command starts with P,
B, R, W, L, D, C,
a digit, ( or E, after any blanks.
Divergence from spec and in software
- KLayout accepts lower-case letters and underscores in layer names, which the grammar treats as blanks.
- KLayout draws a wire with squared ends that reach half the width past the end points,
unless its options or a
98command ask for flush or round ends. The report’s ideal wire is round. - KLayout ignores
DDwith a warning, so joined files that rely on it may resolve calls differently. - KLayout ignores shapes that come before a layer has been chosen, and starts every definition without a layer. A zero scale divisor is an error to it.
- KLayout names a symbol
Cn unless a9command names it, and collects top-level shapes and calls in a cell of its own. - Magic handles the user commands
9,91,94and95, and reports any other as unimplemented before ignoring it. It refuses a call that would place a cell inside itself.
In the explorer
The viewer reads every command of the report, the user extensions listed above and any other
user command as text. It lists commands, symbol definitions, calls, layers and points, and the
wire boxes the report derives from a wire. It expands calls, scales, arrays and
DD deletions, draws the whole chip, single symbols and single layers, and lists
every placed shape with its coordinates. Syntax and structure errors are listed as problems.
Every label in a picture is written; labels that share a spot are written over each other,
and the table of user commands lists each text.
A picture of a very large layout is drawn in passes of 20 million shapes, calls and copies. A picture that is not finished says so; further passes draw on over it, 1, 10 or 100 at a time, until it is complete, also where more lies on one spot than a pass holds. Each picture also opens into quarters, again and again, and the list of placed shapes has all of them. Files up to 256 MB are read.
Links
Software
Developers
- KLayout source – includes the CIF reader and writer (C++)
- Magic cell reader – calls and user commands (C)
Reference
- The Caltech Intermediate Form for LSI Layout Description – Silicon Structures Project report 2686, Caltech library record (PDF)
- Computer Aids for VLSI Design, Appendix B – Steven Rubin’s description of CIF and its conventional extensions