Caltech Intermediate Form
Caltech Intermediate Form (CIF) is a file format for describing integrated circuits. CIF provides a limited set of graphics primitives that are useful for describing the two-dimensional shapes on the different layers of a chip. The format allows hierarchical description, which makes the representation concise. In addition, it is a terse but human-readable text format. Overview. Each statement in CIF consists of a keyword or letter followed by parameters and terminated with a semicolon. Spaces must separate the parameters but there are no restrictions on the number of statements per line or of the particular  columns of any field. Comments can be inserted anywhere by enclosing them in parentheses. There are only a few CIF statements and they fall into one of two categories: geometry or control. The geometry statements are: codice_1 to switch mask layers, codice_2 to draw a rectangle, codice_3 to draw a path, codice_4 to draw a circle, codice_5 to draw an arbitrary figure, and codice_6 to draw a subroutine of other geometry statements. The control statements are codice_7 to start the definition of a subroutine, codice_8 to finish the definition of a subroutine, codice_9 to delete the definition of subroutines, codice_10  through codice_11 to include additional user-specified information, and codice_12 to terminate a CIF file. All of these keywords are usually abbreviated to one or two letters that are unique. Geometry. The codice_1 statement (or the letter codice_14) sets the mask layer to be used for all subsequent geometry until the next such statement. Following the codice_1 keyword comes a single layer-name parameter. For example, the command: sets the layer to be the CMOS contact cut (see Fig. B.1 for some typical MOS layer names). The codice_2 statement (or the letter codice_17) is the most commonly used way of  specifying geometry. It describes a rectangle by giving its length, width, center position, and an optional rotation. The format is as follows: Without the rotation field, the four numbers specify a box the center of which is at ("xpos", "ypos") and is "length" across in x and "width" tall in y. All numbers in CIF are integers that refer to centimicrons of distance, unless subroutine scaling is specified (described later). The optional "rotation" field contains two numbers that define a vector endpoint starting at the origin. The default value of this field is (1, 0), which is a right-pointing  vector. Thus the rotation clause codice_18 defines a 26.6-degree counterclockwise rotation from the normal. Similarly, codice_19 will rotate clockwise by 45 degrees. Note that the magnitude of this rotation vector has no meaning. The codice_3 statement (or the letter codice_21) is used to construct a path that runs between a set of points. The path can have a nonzero width and has rounded corners. After the codice_3 keyword comes the width value and then an arbitrary number of coordinate pairs that describe the endpoints. Figure B.2 shows a sample wire. Note that the endpoint and corner rounding are implicitly  handled. The codice_4 statement (or the letter codice_24) draws a filled circle, given the diameter and the center coordinate. For example, the statement: will draw a circle that has a radius of 10 (diameter of 20), centered at (30, 40). The codice_5 statement (or the letter codice_26) takes a series of coordinate pairs and draws a filled polygon from them. Since filled polygons must be closed, the first and last coordinate points are implicitly connected and need not be the same. Polygons can be arbitrarily complex, including concavity and self-intersection. Figure B.3 illustrates a polygon statement. Hierarchy. The codice_6  statement (or the letter codice_28) invokes a collection of other statements that have been packaged with codice_7 and codice_8. All subroutines are given numbers when they are defined and these numbers are used in the codice_6 to identify them. If, for example, a codice_1 statement and a codice_2 statement are packaged into subroutine 4, then the statement: will cause the box to be drawn on that layer. In addition to simply invoking the subroutine, a codice_6 statement can include transformations to affect the geometry inside the subroutine. Three transformations can be applied to a subroutine in CIF: translation, rotation, and  mirroring. Translation is specified as the letter codice_35 followed by an x, y offset. These offsets will be added to all coordinates in the subroutine, to translate its graphics across the mask. Rotation is specified as the letter codice_24 followed by an x, y vector endpoint that, much like the rotation clause in the codice_2 statement, defines a line to the origin. The unrotated line has the endpoint (1, 0), which points to the right. Mirroring is available in two forms: codice_38 to mirror in x and codice_39 to mirror in y. Mirroring is a bit confusing, because codice_38 causes  a negation of the x coordinate, which effectively mirrors about the y axis. Any number of transformations can be applied to an object and their listed order is the sequence that will be used to apply them. Figure B.4 shows some examples, illustrating the importance of ordering the transformations (notice that Figs. B.4c and B.4d produce different results by rearranging the transformations). Defining subroutines for use in a codice_6 statement is quite simple. The statements to be packaged are enclosed between codice_7 (definition start) and codice_8 (definition finish) statements. Arguments to the codice_7 statement are the subroutine number and a  subroutine scaling factor. There are no arguments to the codice_8 statement. The scaling factor for a subroutine consists of a numerator followed by a denominator that will be applied to all values inside the subroutine. This scaling allows large numbers to be expressed with fewer digits and allows ease of rescaling a design. The scale factor cannot be changed for each invocation of the subroutine since it is applied to the definition. As an example, the subroutine of Fig. B.4 can be described formally as follows: Note that the scale factor is 20/2, which allows the trailing zero to  be dropped from all values inside the subroutine. Arbitrary depth of hierarchy is allowed in CIF subroutines. Forward references are allowed provided that a subroutine is defined before it is used. Thus the sequence: is legal, but the sequence: is not. This is because the actual invocation of subroutine 11 does not occur until after its definition in the first example. Control. CIF subroutines can be overwritten by deleting them and then redefining them. The codice_9 statement (delete definition) takes a single parameter and deletes every subroutine that has a number greater than or equal to this value. The statement  is useful when merging multiple CIF files because designs can be defined, invoked, and deleted without causing naming conflicts. However, it is not recommended for general use by CAD systems. Extensions to CIF can be done with the numeric statements codice_10 through codice_11. Although not officially part of CIF, certain conventions have evolved for the use of these extensions (see Fig. B.5). The final statement in a CIF file is the codice_12 statement (or the letter codice_50). It takes no parameters and typically does not include a semicolon. BNF grammar. The following is the grammar for the CIF format with  cifFile being the top level grammar node.