Specifies the entire SPICE declaration relating to a component of the circuit. In particular, it allows you to specify the category (capacitor, resistor, diode, etc.) to which the component belongs, its value and its points of connection with the other components of the circuit.
If you need to specify multiple SPICE statements for a component, insert them in separate lines.
Syntax: |
---|
<SPICE netlist line 1> ... <SPICE netlist line N> |
- SPICE netlist line
-
The text string describing the netlist consists of zero or more conversion specifications and ordinary characters. All ordinary characters are copied unchanged into the netlist.
Multi-part components
If the PINS attribute defines multiple parts then the string specified in the CARD attribute is repeated as many times as the parts defined in the PINS attribute are.
To insert in the netlist a SPICE declaration that is unique for the component, i.e. that it is not repeated for each of its parts, must be use the *SINGLEINSTANCE directive. Everything that follows the directive is added to the netlist only once.
Example
The following is the value of the CARD attribute for a voltage controlled switch:
Copy code | |
---|---|
%?#<%RS %# %C_MODEL>
*SINGLEINSTANCE
.MODEL %C_MODEL SW(%=VT %=VH %=RON %=ROFF %&ONOFF)
|
The PINS attribute value for a component containing four switches can be as follows:
Copy code | |
---|---|
1,2,13,7;3,4,5,7;8,9,6,7;10,11,12,7
|
If all switches are used, the following SPICE statements are generated:
SW1_1 1 2 13 7 SW1_MODEL
SW1_2 3 4 5 7 SW1_MODEL
SW1_3 8 9 6 7 SW1_MODEL
SW1_4 10 11 12 7 SW1_MODEL
.MODEL SW1_MODEL SW(VT=5 VH=1 RON=1 ROFF=1G)
The conversion specifications
A conversion specification has the following form:
%<type>[argument] |
The conversion specifications describe how to format a argument in the netlist and always start with a percentage sign '%'. The mandatory field type specifies the type of conversion to be applied to a argument. A simple conversion specification contains only the percentage sign and a character describing the conversion type. For example, %V specifies a conversion of the component value. To insert a percentage sign character into the netlist, use %%. If a percentage sign is followed by a character that has no meaning as a format field, an error message is generated.
In the following tables, the conversion specifications are shown in bold while the arguments are shown in green. Conversion specifications must be entered exactly as shown.
To enter component properties
The following conversion specifications allow you to add some properties of the component to the netlist.
%Rprefix |
This is replaced by the name of the component in the netlist. The component name in the netlist is built as follows: [prefix]<schref>[_<partindex>][_<cardindex>]
|
||||||||
%C |
It is replaced by the component reference. |
||||||||
%V |
It is replaced by the value of the component. Corresponds to the value field of the component symbol. |
To enter the model
The following conversion specifications allow you to insert in the netlist the name of the SPICE model to be used for the simulation of the component.
%M |
It is replaced with the value of the MODEL attribute or, if empty, with the value of the component. The model is loaded from the libraries and added to the netlist. If the model does not exist, an error message is displayed. |
|||
%M<default_model> |
It is replaced with the value of the MODEL attribute or, if empty, with the default model specified in default_model. The model is loaded from the libraries and added to the netlist. If the model does not exist, an error message is displayed. default_model can be empty.
|
|||
%M(model_name) |
It is replaced by the model name. If the model does not exist, an error message is displayed.
|
|||
%M[model_parameters] |
It is replaced with the model name and the model defined by model_parameters is added to the netlist.
|
|||
%Mattr_name |
It is replaced with the model name specified in the attr_name attribute. The model is loaded from libraries and added to the netlist. If the model does not exist, an error message is displayed. |
|||
%Mattr_name<default_model> |
It is replaced with the model name specified in the attr_name attribute or, if empty, with the default model specified in the default_model. The model is loaded from the libraries and added to the netlist. If the model does not exist, an error message is displayed. |
To enter the subcircuit
The following conversion specifications allow you to insert in the netlist the name of the subcircuit to be used for the component simulation.
%S |
It is replaced with the value of the MODEL attribute or, if empty, with the value of the component. The subcircuit is loaded from the libraries and added to the netlist. If the subcircuit does not exist, an error message is displayed. |
||
%S<default_subckt> |
It is replaced with the value of the MODEL attribute or, if empty, with the default subcircuit name specified in default_subckt. The subcircuit is loaded from the libraries and added to the netlist. If the subcircuit does not exist, an error message is displayed. default_subckt may be empty.
|
||
%S(subckt_name) |
It is replaced by the name of the subcircuit. If the subcircuit does not exist, an error message is displayed.
|
To enter the attributes
The following conversion specifications allow you to insert the value of the component's attributes into the netlist. The attr_name parameter represents the attribute name and has the following form:
<name>[/category] |
For SPICE category attributes, the category may be omitted.
Enter only the value of the attributes
The following conversion specifications allow you to insert the value of the attributes into the netlist. Add the character '!' after the character '&' to generate an error if the conversion result is an empty string.
%&attr_name |
It is replaced with the value of the attribute specified in attr_name. |
%&attr_name<default> |
It is replaced with the value of the attribute specified in attr_name or, if the value of the attribute is empty, with the default value specified in default. Example: For a potentiometer, two resistors can be declared whose value is adjusted by the POSITION attribute that specifies the percentage position of the cursor. If the POSITION attribute does not have a value, the value 50 is used to position the cursor in half. %RR_A %#(1 2) {(%V*(%&POSITION<50>/100))+0.001} |
%&#attr_name |
It is replaced with an integer value that indicates the number of fields contained in the value of the attribute specified in attr_name. Individual fields must be separated by a space character. |
%&(index)attr_name |
This is replaced by the contents of the field indicated by index of the attribute specified in attr_name. In the attribute value, the individual fields must be separated by a space character. The first field has index 1. If index is zero, the entire string is used. |
%&(index)attr_name<default> |
It is replaced by the content of the field indicated by index of the attribute specified in attr_name or, if the value is empty, with the default value specified in default. In the attribute value, the individual fields must be separated by a space character. The first field has index 1. If index is zero is used the whole string. |
To enter the name and value of the attributes
The following conversion specifications allow you to insert in the netlist the value of the attributes of the component preceded by the name of the attribute and the character '='. The result of the conversion is an empty string if the attribute does not exist or does not have a value. Add the character '!' after the character '=' to generate an error if the conversion result is an empty string.
%=attr_name |
It is replaced with the name and value of the attribute specified in attr_name. The name and value are separated by the character '='. |
%=attr_name<default> |
It is replaced with the name and value of the attribute specified in attr_name or, if the value of the attribute is empty, with the default value specified in default. The name and value are separated by the character '='. |
%=(index)attr_name |
This is replaced by the name of the attribute followed after the character '=' by the content of the field indicated by index of the attribute specified in attr_name. In the attribute value, the individual fields must be separated by a space character. The first field has index 1. If index is zero, the entire string is used. |
%=(index)attr_name<default> |
This is replaced by the name of the attribute followed after the character '=' by the content of the field indicated by index of the attribute specified in attr_name or, if the value is empty, with the default value specified in default. In the attribute value, the individual fields must be separated by a space character. The first field has index 1. If index is zero is used the whole string. |
The following conversion specifications allow you to insert into the netlist the value of the component attributes preceded by the attribute name. The result of the conversion is an empty string if the attribute does not exist or does not have a value. Add the character '!' after the character '@' to generate an error if the conversion result is an empty string.
%@attr_name |
It is replaced with the name and value of the attribute specified in attr_name. The name and value are separated by a space. |
%@attr_name<default> |
It is replaced with the name and value of the attribute specified in attr_name or, if the value of the attribute is empty, with the value specified in default. The name and value are separated by a space. |
%@(index)attr_name |
This is replaced by the name of the attribute followed by the content of the field indicated by index of the attribute specified in attr_name. In the attribute value, the individual fields must be separated by a space character. The first field has index 1. If index is zero, the following is used the whole string. |
%@(index)attr_name<default> |
This is replaced by the name of the attribute followed by the content of the field indicated by index of the attribute specified in attr_name or, if the value is empty, with the default value specified in default. In the attribute value, the individual fields must be separated by a space character. The first field has index 1. If index is zero, the following is used the whole string. |
To enter the name of a file or block of data
If the value of an attribute is composed of several lines of text, it can be copied in a temporary file and in the netlist only the file name is inserted, enclosed in quotation marks.
%Fattr_name |
It is replaced by the name of the temporary file, enclosed in quotes, where the value of the attribute specified in attr_name is copied. If the attribute does not exist or is empty you have an error message. |
%Fattr_name<default> |
It is replaced by the name of the temporary file, enclosed in quotes, where the value of the attribute specified in attr_name is copied. If the attribute does not exist or is empty it is replaced with the value specified in default. |
%F(attr_name) |
attr_name is the name of an attribute that contains the name of a file or the name of a block of data defined in a SPICE document by the .DATA instruction. It is replaced by the full path, enclosed in quotation marks, of the file or block of data. If the attribute does not exist or is empty, an error occurs. If the file or data block is not found, an error message is displayed. If the file name does not contain the full path, it is searched in the following order:
|
%F[file_name] |
It is replaced by the full path, enclosed in quotes, of file_name. The file specified by the file_name is searched in the folders and library files. If the file is not found, an error message is displayed. If the file name does not contain the full path it is searched in the following order:
file_name can also be the name of a block of data defined in a SPICE document via the .DATA instruction. |
To insert the circuit nodes
The following conversion specifications allow you to include in the netlist the nodes to which the component pins are connected. Pins are searched by pin number.
%# |
It is replaced by the list of nodes to which the pins specified in the PINS attribute are attached. If the PINS attribute is empty then the nodes are inserted in the fixed order of the pins. See Order of nodes for SPICE elements. |
%#pin_number |
This is replaced by the node to which the pin indicated by pin_number is attached. If the attribute PINS is specified, pin_number is an integer numeric value representing the pin index in the list, otherwise it represents the pin number. If the pin is not connected, an error message is displayed. |
%#?pin_number |
It is replaced with the node to which the pin indicated by pin_number is connected or, if the pin is not connected, with "null". If the attribute PINS is specified, pin_number is an integer numeric value representing the pin index in the list, otherwise it represents the pin number. If the pin is not connected, "null" is inserted in the netlist. |
%#(pin1, pin2, ... ) |
This is replaced by the nodes to which the specified pins are connected. If the attribute PINS is specified, pin is an integer numeric value representing the pin index in the list, otherwise it represents the pin number. Pins should be separated by a space character or commas. You can specify a pin interval by entering the start and end indexes separated by two suspension points. If one of the specified pins is not connected, an error message is displayed. Examples:
%#(1 2 3 4 5 9 10) |
%#[pin1, pin2, ...] |
This is replaced by the node to which one of the specified pins is connected. If the attribute PINS is specified, pin is an integer numeric value representing the pin index in the list, otherwise it represents the pin number. Pins should be separated by a space character or commas. You can specify a pin interval by entering the start and end indexes separated by two suspension points. If none of the specified pins are connected, an error message is displayed. Examples:
%#(1 2 3 4 5 9 10) |
Conditional Directives
The following conversion specifications allow you to build the netlist according to the attributes of the component.
%?attr_name<netlist1><netlist2> |
It is replaced with netlist1 if the attribute specified by attr_name has a value otherwise it is replaced with netlist2. |
%?attr_name~value<netlist1><netlist2> |
It is replaced with netlist1 if the attribute specified by attr_name has a value starting with value otherwise it is replaced with netlist2. |
%?attr_name=value<netlist1><netlist2> |
It is replaced with netlist1 if the attribute specified by attr_name has a value that coincides with value otherwise it is replaced with netlist2. |
%??attr_name<netlist1><netlist2> ... |
It is replaced with netlist1 if the first option has been selected in the listbox type attribute specified by attr_name, with netlist2 if the second option has been selected and so on. |
%?[attr1 attr2 ...]<netlist1><netlist2> |
It is replaced by netlist1 if at least one of the specified attributes has a value otherwise it is replaced by netlist2. |
%?(attr1 attr2 ...)<netlist1><netlist2> |
It is replaced with netlist1 if all specified attributes have a value otherwise it is replaced by netlist2. |
The following conversion specifications allow you to compose the netlist according to the pins of the component. Pins are searched by pin number.
%?#<netlist1><netlist2> |
It is replaced with netlist1 if all pins exist otherwise it is replaced with netlist2. The list of pin numbers is specified in the PINS attribute. If the PINS attribute is empty then the nodes are searched in the fixed order of the pins. See Order of nodes for SPICE elements. |
%?#pin<netlist1><netlist2> |
It is replaced with netlist1 if the specified pin exists otherwise it is replaced with netlist2. If the attribute PINS is specified, pin is an integer numeric value representing the pin index in the list, otherwise it represents the pin number. |
%?#(pin1, pin2, ...)<netlist1><netlist2> |
It is replaced with netlist1 if all specified pins exist otherwise it is replaced with netlist2. If the attribute PINS is specified, pin is an integer numeric value representing the pin index in the list, otherwise it represents the pin number. |
Other directives
%[[netlist]name1<str1>name2<str2> ... ] |
It is replaced with netlist after replacing every occurrence of name1 with str1, every occurrence of name2 with str2 etc. Example: The non-linear generator BVCVS2 is defined as follows: %RB %#(1 2) V=%[[%&EXPR<%V>]V1<V(%#3,%#4)>V2<V(%#5,%#6)>] The value of the voltage generated at pins 1 and 2, is given by the expression specified in the EXPR parameter or in its absence from the expression specified in the value field of the component. All occurrences in the expression, of V1 are replaced by V(%#3,%#4) and all occurrences of V2 are replaced by V(%#5,%#6). The replacements allow you to use, in the expression, simply V1 to refer to the control voltage present at pins 3 and 4, and V2 to refer to to the control voltage at pins 5 and 6. For example, for a voltage summer, the expression contained in EXPR can be: V1+V2. |
Simplified form
For many components it is sufficient to specify only the component type and the SPICE declaration is assembled as shown in the following table. The list of pin numbers must be specified in the PINS attribute. If the PINS attribute is empty then the nodes are searched in the fixed order of the pins. See Order of nodes for SPICE elements.
SPICE prefix | Device | Format string | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
R |
Resistor |
%RR %# %V %M<> %=TEMP %=TC Parameters:
|
||||||||||||
RSEMI |
Semiconductor resistor |
%RR %# %M<%M[R(%=RSH %=DEFW %=NARROW %=TC1 %=TC2 %=TCE %=TNOM %=TABS %=TREL)]> L=%&L %=W %=TEMP Parameters:
|
||||||||||||
C |
Capacitor |
%RC %# %V %M<> %=IC Parameters:
|
||||||||||||
CSEMI |
Semiconductor capacitor |
%RC %# %M<%M[C(%=CJ %=CJSW %=DEFW %=NARROW %=TC1 %=TC2 %=TNOM %=TABS %=TREL)]> L=%&L %=W %=IC Parameters:
|
||||||||||||
L |
Inductor |
%RL %# %V %=IC Parameters:
|
||||||||||||
D |
Diode |
The SPICE declaration is assembled according to the model type specified in the MODEL attribute as shown in the following table:
|
||||||||||||
Q |
BJT |
The SPICE declaration is assembled according to the model type specified in the MODEL attribute as shown in the following table:
|
||||||||||||
J |
JFET |
The SPICE declaration is assembled according to the model type specified in the MODEL attribute as shown in the following table:
|
||||||||||||
M |
MOSFET |
The SPICE declaration is assembled according to the model type specified in the MODEL attribute as shown in the following table:
|
||||||||||||
Z |
MESFET |
The SPICE declaration is assembled according to the model type specified in the MODEL attribute as shown in the following table:
|
||||||||||||
V |
Voltage source |
%RV %# DC %&DC<%V> %&TRAN %@AC %@DISTOF1 %@DISTOF2 Parameters:
|
||||||||||||
I |
Current source |
%RI %# DC %&DC<%V> %&TRAN %@AC %@DISTOF1 %@DISTOF2 Parameters:
|
||||||||||||
T |
Lossless Transmission Lines |
%RT %# %=Z0 %=TD %=F %=NL %=IC Parameters:
|
||||||||||||
O |
Lossy Transmission Lines |
%RO %# %M<%M[LTRA(%=R %=L %=G %=C %=LEN)]> %=IC Parameters:
|
||||||||||||
U |
Uniform Distributed RC Lines (Lossy) |
%RU %# %M<%M[URC(%=K %=FMAX %=RPERL %=CPERL %=ISPERL %=RSPERL)]> %=L %=N Parameters:
|