Devices such as transistors require model specification for generation of SPICE simulation input. Xic has a mechanism for handling large numbers of device models, while at the same time providing interactive editing capability. Models for devices (.model lines) and subcircuits (.subckt lines) are read from model library file found along the library search, and from files found in particular subdirectories of the directories in the path.
The first model library file found in the search path is searched for models and subcircuits, as are any files found in subdirectories with a specified name. The default name for model library files is ``model.lib'', however another name can be specified in the technology file with the ModelLibrary keyword. The default name for subdirectories to search for device models is ``models'', and this name can be changed in the technology file with the ModelSubdirs keyword.
In the search, the current directory is always searched first, whether or not this is actually specified in the search path. Only the first model library file is read, which allows the user to override a system model library file with a custom version. All files found in models subdirectories will be searched. The names of the files found in models subdirectories are unimportant, but files existing in these directories should contain SPICE models, though it is not an error if no models or subcircuits are found in a file.
As with the device library file, the model library file can be edited using the Open command in Xic. One simply enters the name (e.g., ``model.lib'') when prompted for the cell name to edit. A text editing window appears. If the file was not found in the current directory, it is copied to the current directory. Otherwise, the file in the current directory is copied to a file with the same name but with a ``.bak'' extension. When editing is complete and changes saved, the model database is rebuilt, using the model library file in the current directory.
The ``models'' subdirectories might be used with large collections of files provided by semiconductor manufacturers. Typically, the package supplied from the manufacturer contains a number of files, each describing a device sold by the manufacturer. In most cases, all that is required to make these models available to Xic is to move the files into a models subdirectory of a directory in the library path. All of these files found will be added to the database.
The format is that of SPICE, where the first line of each model starts with .model (case insensitive), and the text for that model is assumed to extend to the next .model or .subckt line or end of file.
Subcircuits as well as models are are tabulated. A subcircuit begins with .subckt, and ends on a line starting with .ends. Models and subcircuits defined within a subcircuit are not accessible as separate library references.
Any line which begins with `#' or `*' is treated as a comment and ignored.
The text of any of the files in the models subdirectories must not change while Xic is active. If the text changes after the time that Xic caches the file offsets to the models, the model text that Xic will extract from the file will very likely be bogus. If the model library file is edited with the Open command and saved, all offset tables are updated.