# any comments
# optional keywords to implement conditional flow
Define [eval] name [value]
Property number string
Alias alias refname
Reference name path [cellname]
The first line must begin with ``(Library '', which designates a library file to Xic. The libname on this line following Library is ignored, but by convention is the library file name. Within the file are three kinds of data fields: properties, references, and cells. Any line starting with a pound sign (`#') is taken as a comment and ignored. Blank lines are ignored.
It is recommended that library files be given a ``.lib'' extension. This is not a strict requirement, except that the listing of libraries from the search path provided in the Libraries List button in the File Menu will contain only files with this extension.
All library files (including the device library) support a limited macro capability. The macro capability makes use of the generic macro preprocessor provided in Xic, which is described in 18.1. The reader should refer to this section for a full description of the preprocessor capabilities. The preprocessor provides a few predefined macros used for testing (and customizing for) release number, operating system, etc. The keyword names, which correspond to the generic names as described for the macro preprocessor, are case-insensitive and listed in the following table.
|Define||Define a macro.|
|If||Conditional evaluated test.|
|IfDef||Conditional definition test.|
|IfnDef||Conditional non-definition test.|
|Else||Conditional else clause.|
|Endif||Conditional end clause.|
These can be used to conditionally determine which parts of the file are actually loaded when the library is read. Presently, there is no macro expansion or text substitution in lines of text in the library, the macros simply implement flow control. Otherwise, they work the same as similar keywords in the technology file (see A.2) and in scripts (see 18.8), and are reminiscent of the preprocessor directives in the C/C++ programming language.
Properties are used in the device library file (which is a special library file which must exist in order to use electrical mode), and are described in the description of the device library file format.
Aliases provide alternative names by which data records can be obtained from the library. In particular, for the device library, this facilitates accessing library devices under alternative names. For example, in older device libraries, the terminal device was named ``vcc'', while the present name of a similar terminal is ``tbar''. The addition of
Alias vcc tbar
will satisfy references to the vcc terminal device in older designs.
References associate a name with a cell, or another library. For a cell, name (above) is the name by which the cell will be added to the database when opened, and the name that will appear in selection listings. The path is a path to the file containing the cell, which can be native (Xic), or a path to an archive file containing the cell. If the path contains white space characters, it should be single or double quoted.
Aliases may be used to provide alternative names.
If the path points to an archive file, the cellname argument can be set to the name of the cell in the file. Note that this does not have to be the same as name. Opening name will open the cell referenced and add it to the database as name. Any subcells that have references in the same library file will be opened under the library reference name. All other cell name aliasing is suppressed, except for AutoRename.
If cellname is not given, opening a reference to an archive file with multiple cells will cause a pop-up to appear, allowing the user to choose which cell to open. In this case, the cell will be opened under its own name.
If path points to another library file, then cellname, if given, indicates which reference in the library to open, i.e., it should be one of the names in the referenced library. In this case, the cell will be opened as name in the original library. If cellname is not given, a pop-up will appear allowing the user to choose which library element in the referenced library to open. A cell selected in this way will be opened as name in the referenced library. Thus the Reference keyword provides a means for multiple-level indirection through the library files.
The Directory keyword is followed by a full path to a directory. Every layout or library file found in the directory is logically added as a Reference, but with no cellname given. This keyword provides an easy way to reference a collection of cell files, for example.
Cells can be defined within libraries by including the native-format body in the library file. The first line of the cell must start with ``(Symbol ''. The symbol text should contain both the electrical and physical blocks. The cells in the device library file are special in that they contain only an electrical block, so are not representative. Cells can be added to a library with a text editor, by copying from native cell files. The name of the cell is actually given by the lines with format like ``9 symbolname;'' and the symbolname in the ``(Symbol symbolname);'' is actually ignored. The user need not concern themselves with details of the format, it is sufficient to simply copy the entire Xic cell file into the library, however any trailing SPICE listing should be excluded, including the ``*Generated by Xic...'' line.