Simulation Library Manager: SPICE Import Support

Import/ Parser Log

The sections below discuss the errors and warnings that may occur during the SPICE Import.

Find details on nested sub-circuits and limitations below.

SPICE Parser Errors and Warnings

All parser errors for a selected model are shown. It may be the case that fixing the first error causes some or all of the later errors to be removed too. This is often the case if the .SUBCKT statement is incorrect.

Each parser error has a highlighted link that, when selected, opens the SPICE file in the user's preferred text editor.

If an error or warning can be associated with a line this line number is given.

The table below does not contain a full list of possible error messages, instead those that can be described in further detail are included.

Error Messages Description
Incomplete sub-circuit found in the SPICE file. Expected .ends There is a .SUBCKT line without a corresponding .ENDS line or parsing of the sub-circuit is not completed correctly due to other syntax errors in the file.
.ENDS without corresponding .SUBCKT statement.
Note: keywords are considered case insensitive.
A correct .SUBCKT statement is expected before a .ENDS statement.
Illegal keyword. Expected either .SUBCKT or .ENDS
Note: keywords are considered case insensitive.
Keywords are preceded by a "." the only allowed keywords are .SUBCKT and .ENDS. See the SPICE File content section for more details.
Too few arguments for the .SUBCKT statement. A sub-circuit name and at least two nodes are required. A top-level sub-circuit must have at least two specified external nodes. A nested sub-circuit must have two nodes one of which may be an implicit ground node (where the corresponding X element only has one node).
More than one ground external node found. External nodes must be unique. Only one ground node may be specified in the .SUBCKT statement.
Element is not supported.
Only R, L, C, X, or K elements are supported.
The only supported elements are: R - resistors, L - inductors, C - capacitors, X - nested sub-circuits, and K - coupled (mutual) inductors.
Illegal element statement within sub-circuit.
Input line does not start with a letter.
All element statements should begin with R, L, C, X or K in upper or lower case.
Element is defined outside a sub-circuit. All element statements should be placed between the .SUBCKT and .ENDS keywords.
Element name is not unique. All element names must be unique. Note that the case of the letter identifying the element is not distinguished between. I.e. an element r1 will not be considered to be different to an element R1.
Illegal inductance name. An inductance name must begin with an L The element statements beginning with K must be of the form: <induct1> <induct2> <k>. Where the inductance name begins with an "L".
Element is shortened (hot-wired). The element statements beginning with R, L and C must be of the form: <node1> <node2> <value>.
Where node1 and node2 are not the same node.
External node is not used in sub-circuit. All external nodes defined in the .SUBCKT statement must be referenced in the element statements.
Internal node is left open in sub-circuit. It has to be referenced at least twice. Nodes referenced in the element statements that are not external nodes must be referenced at least twice unless they are ground nodes.
Inductance named in mutual inductor does not exist. All inductance names in Coupled (mutual) inductor statements beginning with K must have their own element statement within the same sub-circuit.
The coupling between the inductors in the element has already been described. Repeated description of the same coupled pair. For example:
K1   L1   L2   0.5
K2   L2   L1   0.6
Coupled inductors in the element must be unique. Use of the same inductor in a K element. For example:
K1   L1   L1   0.6
Inductors cannot be connected to the same nodes. Both inductors connected to the same nodes. For example:
L1   n1   n2   0.6
L2   n2   n1   0.7
The nested sub-circuit does not exist. The sub-circuit referenced by an X element does not exist in the SPICE file. See the section on Nested Sub-Circuits for more details.
The nested sub-circuit cannot be used as it is defined in-line within a different sub-circuit. The sub-circuit referenced by an X element is defined in-line within a different sub-circuit.
More than one definition of the nested sub-circuit exists. The sub-circuit referenced by an X element has been defined more than once in the SPICE file.
Recursive nested sub-circuits are not supported. A sub-circuit references itself or references another sub-circuit that references itself.
Incorrect number of external nodes in the nested sub-circuit. The number of external nodes of the nested sub-circuit does not match the number of nodes of the X element that references it.
No sub-circuit found in the SPICE file. There are no .SUBCKT and .ENDS pairs in the SPICE file.
Invalid V-element statement. A V-element must have the form:
V<name> <n+> <n-> [DC [=]] <value>
Invalid element description found.
Invalid [EG]-element statement. A[n] [EG]-element must have the form:
[EG]<name> <n+><n->
[VCVS|VCCS] ><nc+> <nc-><value>
Invalid element description found.
Invalid [FH]-element statement. An [FH]-element must have the form:
[FH]<name> <n+> <n->
[CCCS|CCVS] V<cname> <value>
Invalid element description found.
Invalid [FH]-element statement [FH]<name>.
The control source V<cname> does not exist in sub-circuit.
For FH-elements it is required that the control voltage sources are part of the actual sub-circuit. If this is not the case the error message is issued.

 

Warning Message Description
Implicit node detected in sub-circuit.
The implicit node will be added to the model's external node list.
The nodes "0" and "GND" are implicit. On import any implicit nodes will be added to the model's external node list.
All implicit nodes in the sub-circuit will be renamed in the imported model. There is a mix of "0" and "GND" nodes in the subcircuit, or "GND" has been specified in lower-case. All implicit nodes in the sub-circuit will be renamed to be consistent.
The sub-circuit is not included in any top-level sub-circuits. A nested sub-circuit is described in-line but it is not included in any sub-circuit X elements.
Capacitance elements with values smaller than 1fF have been removed from the circuit. Capacitance elements with values smaller than 1fF are not supported. They have been automatically removed from the circuit description when the SPICE file was opened.
[EFGHRLCVX]-element including extra strings found.
The extra strings are removed from [EFGHRLCVX]<name>.
Elements have been imported successfully, but extra strings are ignored.

 

Import Errors and Warnings

The tables below list the Error and warning messages that can be given when importing models into the Simulation Library. The following terms are used:

  • <ModelName> This refers to the name given in the Model Name column for the sub-circuit.

  • <SimBranch> This refers to the Simulation Library Branch that the model will be imported into, either User or Site.

  • <DeviceName> This is the name of the device that will be automatically created for the imported model.

 

Error Messages Description
The model <ModelName> has not been imported into the Simulation Library branch <SimBranch> as the SPICE Status is set to Duplicate. This model cannot be imported into the Simulation Library as the SPICE Status is set to Duplicate.
The model <ModelName> has not been imported into the Simulation Library branch <SimBranch> as the SPICE Status is set to Error. This model cannot be imported into the Simulation Library as the SPICE Status is set to Error.
The model <ModelName> and associated device have not been imported into the Simulation Library branch <SimBranch> as the SPICE Status is set to Duplicate. This model cannot be imported into the Simulation Library as the SPICE Status is set to Duplicate. No associated device is created.
The model <ModelName> and associated device have not been imported into the Simulation Library branch <SimBranch> as the SPICE Status is set to Error. This model cannot be imported into the Simulation Library as the SPICE Status is set to Error. No associated device is created.
Error: The model <ModelName> has not been imported into the Simulation Library branch <SimBranch> as the model already exists with either a different number of external nodes or with external nodes with different names.

This model cannot be overwritten as the model with this name that already exists in the Simulation Library either has a different number of external nodes or the external nodes have different names.

Note
A model cannot be overwritten by another with a different number of external nodes as the existing model may be associated with the connective element of a device. This association is based on the number of external nodes and the names of the external nodes. If the existing model were to be overwritten, the association would be invalid.
Error: The Model name <ModelName> and associated device <deviceName> have not been imported into the Simulation Library branch <SimLibBranch> as the associated device is duplicated in the Model List. This is given for every model that will create a duplicate device after an attempted import where the user has selected to create devices. For example where device names have been truncated to 40 characters.

 

Warning Messages Description

The model <ModelName> has not been imported into the Simulation Library branch <SimBranch> as the model already exists and the option to overwrite existing data was not selected.

This model was previously imported successfully

The model has not been modified or reloaded since it was loaded into this dialog and imported.
The option to overwrite the existing data was not selected, so this model was not imported again.
The model <ModelName> has not been imported into the Simulation Library branch <SimBranch> as the model already exists and the option to overwrite existing data was not selected. A model of this name already exists in the Simulation Library branch.
The option to overwrite the existing data was not selected, so the model was not imported again.

The model <ModelName> and associated device have not been imported into the Simulation Library branch <SimBranch> as the model already exists and the option to overwrite existing data was not selected.

This model was previously imported successfully

The model has not been  modified or reloaded since it was loaded into this dialog and imported.
The option to overwrite the existing data was not selected, so this model was not imported again. No associated device is created.
The model <ModelName> and associated device have not been imported into the Simulation Library branch <SimBranch> as the model already exists and the option to overwrite existing data was not selected. A model of this name already exists in the Simulation Library branch.
The option to overwrite the existing data was not selected, so the model was not imported again. No associated device is created.
The model <ModelName> and associated device have not been imported into the Simulation Library branch <SimBranch> as the associated device already exists and the option to overwrite existing data was not selected. The Create devices for selected models option has been selected, and the Overwrite existing data option has not been selected. The associated device already exists in the library so the model is not imported and the device is not created.
The comment for the imported device associated with the model <ModelName> has been truncated to 256 characters. The Reuse model comment for device option has been selected, and the comment for the model is longer than 256 characters. The comment for the device is truncated to 256 characters.
The device name for the imported device associated with the model <ModelName> has been truncated to <DeviceName>. The maximum device name length is 40. The name of the model is longer than 40 characters, which is longer than the maximum valid length for a device name. Therefore the name of the device is created from a truncated version of the model name.

 

SPICE File Content

For each SPICE-file, multiple sub-circuit descriptions are allowed. The general syntax follows the SPICE .SUBCKT  definition. Find more details here: http://bwrc.eecs.berkeley.edu/Classes/IcBook/SPICE

An example of a correct SPICE File is given below:

* Example 8a
.SUBCKT example8a 2a 3b 4e
C1 2a  4e  1.5p
L1 2a  1   2.0n

R1 1   3b  0.8m
C2 3b  4e  1.5p

.ENDS

The sub-circuit to be imported is described by a set of element lines, which define the circuit topology and element values. A line may be continued by entering a "+" (plus) in the first column of the following row. The statement is continued beginning with column 2.

The order of the remaining lines is arbitrary (except that continuation lines must immediately follow the line being continued).

Comment lines (* <any comment>) must be placed just before the .SUBCKT statement in the input file, so that the comment can be associated with the sub-circuit. Any comments lines between .SUBCKT and .ENDS will be ignored.

The .SUBCKT and .ENDS statements are treated as case insensitive in arbitrary notation, e.g. .Subckt, .SubCkt, .subckt are all valid.

Note
You may use both lower and uppercase letters for the element and node identifiers. However, case differences such as "R1" and "r1" will not be distinguished between. The name length must not exceed 64 characters in total.

Implicit reference nodes are supported. They may be called either "0" or "GND".  
Implicit ground nodes are nodes which connect directly to an ideal ground voltage source (0.0 V). In SPICE these are all nodes named "0" (zero). However, nodes named "GND "are supported as well.

Values may be described in a floating point notation, e.g. 12e3 for 12000, or 100e-6 for 0.0001, etc. or by specifying scaling factors e.g. 1.5p for 1.5e-12

Two alternative scaling factor conventions are supported: "SPICE standard" and "SI units". The default scaling factor is the SPICE standard. Scale factors can be specified in either upper case or lower case and are as follows:

Scale Factor
(case sensitive)
Prefix Multiplying Factor
T tera 1e12
G giga 1e9
MEG or X mega 1e6
K kilo 1e3
M milli 1e-3
U micro 1e-6
N nano 1e-9
P pico 1e-12
F femto 1e-15
MIL mil 25.4e-6

 

SI units are also supported if required.

Note
SI scale factors must be specified in the correct case. Specifying SI scale factors can be selected by setting the environment variable SLM_SPICE_IMPORT_SCALE = SI
Scale Factor
(case sensitive)
Prefix Multiplying Factor
T tera 1e12
G giga 1e9
M mega 1e6
k kilo 1e3
m milli 1e-3
u micro 1e-6
n nano 1e-9
p pico 1e-12
f femto 1e-15
mil mil 25.4e-6

If the environment variable has been set to SI, and scale factors are present in the file then a warning message will be written to the Import/Parser Log.

Nested Sub-Circuits

Nested sub-circuits are sub-circuits that are referenced from another sub-circuit using an X element.

Nested sub-circuits may be defined either in parallel (sub-circuits defined sequentially) or in-line (sub-circuits defined within the referencing sub-circuit) as shown below:

* Nested sub-circuit define in parallel

.SUBCKT INNER  a  b
R1   a     b     1k
.ENDS

.SUBCKT OUTER IN  OUT  GND
L1  IN     1     2.5n
XRS  1   OUT     INNER
C1   1   GND     1.5p
.ENDS

* Nested sub-circuit define in-line

.SUBCKT OUTER IN  OUT  GND
.SUBCKT INNER  a  b
R1   a     b     1k
.ENDS
L1  IN     1     2.5n
XRS  1   OUT     INNER
C1   1   GND     1.5p
.ENDS

Nested sub-circuits must be defined within the same SPICE file as the sub-circuit that references them. They may either precede or follow the referencing sub-circuit.

A maximum hierarchical depth of 6 referenced sub-circuits is supported.

When a nested sub-circuit is read in from the SPICE file it will be automatically flattened before it is imported into the Simulation Library. The flattening process is attempted before the model is added to the Simulation Library.

When flattening takes place the internal nodes from the top level sub-circuit element replace the external nodes from the nested sub-circuit. To ensure that element and node names remain unique within the flattened sub-circuit, the element and internal node names in the nested sub-circuit have the element name from the referencing element appended to their name. Note: Ground nodes are a special case and these will not be changed.

The character ‘:’ is used as a separator between the element and node name and the appended element name.

Opening either of the sub-circuits defined above will generate the sub-circuit shown below. The X element “RS” in the top level sub-circuit “OUTER” has been replaced with the contents of the nested sub-circuit “INNER”. The element name “R1” has had “:RS” appended to the element name.

.SUBCKT OUTER IN  OUT  GND
R1:RS 1   OUT   1k
C1    1   GND   1.5p
L1    IN  1     2.5n
.ENDS

Note
As a result of this flattening process, if the model is subsequently exported from the Simulation Library Manager (for example HSPICE Export) it will be in this flattened form. It will not be possible to regenerate the original nested definition.

For reference, an additional comment is added to the model to indicate that it has been flattened:
"The sub-circuit contained nested sub-circuits and has been flattened."

Limitations

The SPICE import facility is subject to a few limitations regarding the content of the SPICE sub-circuit description.

In general, only passive R, L, C networks are supported, whereby the individual elements have ideal behaviour, i.e. no parasitics or thermal dependencies are supported.
Controlled sources (so called E, F, G and H elements) are supported as well. In addition, a constant voltage source (V element) is also supported.

A reverted coupling direction of mutual inductances, indicated by a negative coupling factor, is not allowed. In order to avoid this, swap the pin order of the coupled inductance.

Only the general mutual inductor form is supported. The mutual core form is not supported.

In addition, this import facility does not support the following components:

  • passive semiconductor models (e.g. for resistors)
  • transmission lines

The allowed value ranges of the individual elements are:

  • L: >= 1 pH
  • C: >= 1 fF
  • R: >= 1 µOhm
  • 0 < K <= 1

Any capacitance elements with values smaller than 1 fF will be removed from the circuit description when the SPICE file is opened.
They will not be shown in the SPICE Text area or be part of the imported circuit description.
If the removal of these elements causes the sub-circuit to be invalid then the model will not be imported.

The number of external nodes is limited to 14 due to the model usage as a circuit model within the Analysis environment of CR-8000.

The node names may only consist of alphanumeric characters and must not exceed 64 characters.

See the section on Circuit Models.