next up previous contents index
Next: .mosmap Line Up: Title, Comments, Job Separation, Previous: .include or .inc Line   Contents   Index


.lib Line

General Form:
.lib [h] path_to_file name
Example:
.lib /usr/local/parts/mylib mos25
.lib h /usr/cad/hspice_models mymod

This will look in path_to_file for lines enclosed as follows.

.lib name
... lines of SPICE text
.endl
The lines inside the block will be read into the input deck being parsed, similar to the .include line.

If the h option (case insensitive) is given, the dollarcmt variable is effectively set while the file, and any recursive sub-files, are being read. Thus, the HSPICE `$' comment syntax will be recognized in the text. The dollarcmt variable is reset to its prior value after the read.

This avoids having to explicitly set the dollarcmt variable when reading files intended for HSPICE. It allows the normal WRspice shell substitution to work with the file containing the .lib line, which would not be the case if the dollarcmt variable was set explicitly.

While the file is being read, the current directory is pushed to the directory containing the file. Thus, .include and .lib lines in the file will have paths resolveed relative to that directory, and not the original current directory.

These lines are shell expanded when encountered, before the indicated file is accessed. This allows the paths or block names to include shell variables, which can be set interactively. Normal shell expansion, which applies to all other lines, occurs after all includes are read, parameter expansion, etc., much later in the sourcing process. Note that shell variables can't be used in files included with the `h' option, or when the dollarcmt variable is set, as the `$' will be taken as the start of a comment.

The library file can contain any number of .lib blocks. The .lib block can itself contain .lib references. The text can be any valid WRspice input. The name is an arbitrary text token, which should be unique among the .lib blocks in a library file.

Example:
title line
.lib /usr/stevew/spice/stuff/mylibrary mosblock
... more lines

In /usr/stevew/spice/stuff/mylibrary:

.lib mosblock
m0 4 9 12 PSUB p1pvt l=0.25u w=2.4u
.endl

is equivalent to:

title line
m0 4 9 12 PSUB p1pvt l=0.25u w=2.4u
... more lines

In WRspice, the keyword .splib is accepted as a synonym for .lib. This is for compatibility with Xic, which will replace .lib lines with the block of text from the library, but will pass .splib lines to SPICE, after converting ``.splib'' to ``.lib''.


next up previous contents index
Next: .mosmap Line Up: Title, Comments, Job Separation, Previous: .include or .inc Line   Contents   Index
Stephen R. Whiteley 2024-10-26