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.

AttenzioneSyntax:
<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 codeCopy 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 codeCopy 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>]

prefix

This is a character that represents the component's SPICE prefix. It is placed before the reference if different from the first character of the reference.

schref

It is the reference of the component in the schematic.

partindex

This is the index of the part. It is inserted only for multi-part components.

cardindex

This is the index of the CARD. It is not inserted if only one CARD attribute is defined.

%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.

default_model

Represents the default model name. The model is loaded from libraries and added to the netlist.

%M(model_name)

It is replaced by the model name. If the model does not exist, an error message is displayed.

model_name

Represents the model name. The model is loaded from libraries and added to the netlist.

%M[model_parameters]

It is replaced with the model name and the model defined by model_parameters is added to the netlist.

model_parameters

It represents the definition of the model and has the following form:

<model_type> [<param>=<value>]*

%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.

default_subckt

Represents the name of the default subcircuit. The subcircuit is loaded from the libraries and added to the netlist.

%S(subckt_name)

It is replaced by the name of the subcircuit. If the subcircuit does not exist, an error message is displayed.

subckt_name

Represents the name of the subcircuit. The subcircuit is loaded from the libraries and added to the netlist.

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}
%RR_B %#(2 3) {(%V*(1-(%&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:

  1. in the current Job;
  2. in the current Job folder;
  3. in library folders;
  4. in the component library files;

%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:

  1. in the current Job;
  2. in the current Job folder;
  3. in library folders;
  4. in the component library files;

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)
%#(1,2,3,4,5,9,10)
%#(1..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)
%#(1,2,3,4,5,9,10)
%#(1..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:

Value

Is the resistance (in ohms) and may be positive or negative but not zero.

MODEL

The model must be specified only when you want to assign a value to one or both of the temperature coefficients tc1 (coefficient of first order) and tc2 (coefficient of second order) measured in parts per degree centigrade.

TEMP

Is the temperature at which this device is to operate. This value, if specified, takes precedence over the analysis temperature.

TC

The term TC must be specified only when you want to assign a value to one or both of the temperature coefficients tc1 (coefficient of first order) and tc2 (coefficient of second order) measured in parts per degree centigrade. The use of the term TC is obsolete and is used for compatibility with the syntax of SPICE2. To specify a value for the temperature coefficient is preferable to use a model and assign a value to the parameters TC1 and TC2.

RSEMI

Semiconductor resistor

%RR %# %M<%M[R(%=RSH %=DEFW %=NARROW %=TC1 %=TC2 %=TCE %=TNOM %=TABS %=TREL)]> L=%&L %=W %=TEMP

Parameters:

MODEL

Specify the model name. If the model is not specified, the model parameters must be specified.

RSH,DEFW,NARROW,TC1
TC2,TCE,TNOM,TABS,TREL

Model parameters should only be specified if no model name is specified.

L

Diffusion length in meters. Must always be specified.

W

Diffusion width in meters. If width is not specified, then it is taken from the default width (DEFW) given in the model.

TEMP

Is the temperature at which this device is to operate. This value, if specified, takes precedence over the analysis temperature.

C

Capacitor

%RC %# %V %M<> %=IC

Parameters:

Value

Is the capacitance (in farads) and may be positive or negative but not zero.

MODEL

The model must be specified only when you want to assign a value to one or both of the temperature coefficients tc1 (coefficient of first order) and tc2 (coefficient of second order) measured in parts per degree centigrade.

IC

The (optional) initial condition is the initial (time-zero) value of capacitor voltage (in Volts).

CSEMI

Semiconductor capacitor

%RC %# %M<%M[C(%=CJ %=CJSW %=DEFW %=NARROW %=TC1 %=TC2 %=TNOM %=TABS %=TREL)]> L=%&L %=W %=IC

Parameters:

MODEL

Specify the model name. If the model is not specified, the model parameters must be specified.

CJ,CJSW,DEFW,NARROW
TC1,TC2,TNOM,TABS,TREL

Model parameters should only be specified if no model name is specified.

L

Diffusion length in meters. Must always be specified.

W

Diffusion width in meters. If width is not specified, then it is taken from the default width (DEFW) given in the model.

IC

The (optional) initial condition is the initial (time-zero) value of capacitor voltage (in Volts).

L

Inductor

%RL %# %V %=IC

Parameters:

Value

Is the inductance (in Henries). In general, inductors should have positive component values. In all cases, components must not be given a value of zero.

IC

The (optional) initial condition is the initial (time-zero) value of inductor current (in amps) that flows from node1, through the inductor, to node2.

D

Diode

The SPICE declaration is assembled according to the model type specified in the MODEL attribute as shown in the following table:

SPICE Model (D)

%RD %# %M %&AREA %&OFF %=IC %=TEMP

XSPICE Model (ZENER)

%RA %# %M

Subcircuit

%RX %# %S

Q

BJT

The SPICE declaration is assembled according to the model type specified in the MODEL attribute as shown in the following table:

SPICE Model (NPN,PNP)

%RQ %# %M %&AREA %&OFF %=IC %=TEMP

Subcircuit

%RX %# %S

J

JFET

The SPICE declaration is assembled according to the model type specified in the MODEL attribute as shown in the following table:

SPICE Model (NJF,PJF)

%RJ %# %M %&AREA %&OFF %=IC %=TEMP

Subcircuit

%RX %# %S

M

MOSFET

The SPICE declaration is assembled according to the model type specified in the MODEL attribute as shown in the following table:

SPICE Model (NMOS,PMOS)

%RM %# %M %=L %=W %=AD %=AS %=PD %=PS %=NRD %=NRS %&OFF %=IC %=TEMP

Subcircuit

%RX %# %S

Z

MESFET

The SPICE declaration is assembled according to the model type specified in the MODEL attribute as shown in the following table:

SPICE Model (NMF,PMF)

%RZ %# %M %&AREA %&OFF %=IC

Subcircuit

%RX %# %S

V

Voltage source

%RV %# DC %&DC<%V> %&TRAN %@AC %@DISTOF1 %@DISTOF2

Parameters:

Value

Is the DC and transient analysis value of the source. This value is used if the DC attribute is not specified.

DC

Is the DC and transient analysis value of the source.

TRAN

Time-dependent value for transient analysis.

AC

The AC magnitude and phase. The AC phase value is in degrees. The source is set to this value in the AC analysis.

DISTOF1

The magnitude and phase. The phase value is in degrees. Specify that the independent source has distortion inputs at the frequencies F1.

DISTOF2

The magnitude and phase. The phase value is in degrees. Specify that the independent source has distortion inputs at the frequencies F2.

I

Current source

%RI %# DC %&DC<%V> %&TRAN %@AC %@DISTOF1 %@DISTOF2

Parameters:

Value

Is the DC and transient analysis value of the source. This value is used if the DC attribute is not specified.

DC

Is the DC and transient analysis value of the source.

TRAN

Time-dependent value for transient analysis.

AC

The AC magnitude and phase. The AC phase value is in degrees. The source is set to this value in the AC analysis.

DISTOF1

The magnitude and phase. The phase value is in degrees. Specify that the independent source has distortion inputs at the frequencies F1.

DISTOF2

The magnitude and phase. The phase value is in degrees. Specify that the independent source has distortion inputs at the frequencies F2.

T

Lossless Transmission Lines

%RT %# %=Z0 %=TD %=F %=NL %=IC

Parameters:

Z0

Is the characteristic impedance.

TD

The transmission delay.

F

Is the frequency.

NL

Is the normalized electrical length of the transmission line with respect to the wavelength in the line at the frequency F.

IC

The (optional) initial condition specification consists of the voltage and current at each of the transmission line ports.

O

Lossy Transmission Lines

%RO %# %M<%M[LTRA(%=R %=L %=G %=C %=LEN)]> %=IC

Parameters:

MODEL

Specify the model name. If the model is not specified, the model parameters must be specified.

R,L,G,C,LEN

Model parameters should only be specified if no model name is specified.

IC

The (optional) initial condition specification consists of the voltage and current at each of the transmission line ports.

U

Uniform Distributed RC Lines (Lossy)

%RU %# %M<%M[URC(%=K %=FMAX %=RPERL %=CPERL %=ISPERL %=RSPERL)]> %=L %=N

Parameters:

MODEL

Specify the model name. If the model is not specified, the model parameters must be specified.

K,FMAX,RPERL,CPERL
ISPERL,RSPERL

Model parameters should only be specified if no model name is specified.

L

Is the length of the RC line in meters.

N

If specified, is the number of lumped segments to use in modelling the RC line (see the model description for the action taken if this parameter is omitted).

See also