Include File (include)
Description
File inclusion allows the circuit description to be spread over several files. The include statement itself is replaced by the contents of the file named. An included file may also contain include statements. If the name given is not an absolute path specification, the path is taken relative to the directory of the file currently being read.
To read existing SPICE library and model files, Spectre automatically switches to SPICE input mode when it opens an include file. Thus, all files that use the Spectre native language must begin with a simulator lang=spectre statement. The one exception is files that end with a ".scs" file extension, which are treated specially and are read in Spectre input mode. This language mode treatment applies to files included by both the Spectre include statement, and the CPP #include statement.
After reading the include file, Spectre restores the language processing mode to what it was before the file was included, and continues reading the original file starting at the line after the include statement. Lines cannot be continued across file boundaries.
The CPP #include statement differs from Spectre include statement in that the CPP macro processing is not performed on files included by Spectre, but is performed on files included by CPP. If your netlist contains a #include statement, you must run CPP to perform this inclusion; otherwise, an error occurs.
If the file to be included cannot be found in the same directory as the including file, both the Spectre include and CPP #include search for the file to be included along the search path specified by the -I command-line arguments.
The Spectre include statement allows you to include a library section. The following is the syntax for specifying a library reference:
include "file" section=sectionName
where, file is the name of the library file to be included, and sectionName matches the name of the section defined in the library. The library reference statement looks like an include statement, except for the specification of the library section. When the file is being inserted, only the named section is actually included.
The Spectre include statement allows you to embed special characters in the name of the file to be included. The Spectre include statement automatically expands the ~ character to the user’s home directory,will expand the environment variables and % codes, such as
include "~/models/${SIMULATOR}_pd/npn.scs"
which looks in the directory given by the environment variable SIMULATOR, followed by _pd, which is under the models directory in the user’s home directory.
For additional information, see Input Data from Multiple Files in the Spectre Classic Simulator, Spectre APS, Spectre X, and Spectre XPS User Guide.
Definition
include "filename"
Return to top