Use this dialog set up your own SPICE netlist entry for a Part using a template containing plug in values that are satisfied when the netlist is generated prior to simulation.

Normally a single line is created in the netlist for each schematic component according to its Spice type. If, however, a Spice template is specified this system is bypassed and the netlist entry is defined by the value of the multi-line template string.

The Spice template can contain a number of special keywords that will be substituted during the netlist creation. Values that can be substituted include node names, pin names and the value of any attribute.

Shortcuts

Default Keys: None

Default Menu: Simulation

Command: Edit Spice Value/Model

How To Edit A Spice Template

There are two ways of changing a Part’s SPICE template, either locally on a Schematic Component, or directly on a Part in a Library.

In a Schematic Design, select the Component that you wish to change. Use the Edit Spice Type option from the Simulation menu.

From a Parts Library, edit the required Part. Press the Edit Spice button on the Details tab.

In both cases the Define Spice Type dialog will be displayed. Check the Define Netlist Entry using a Template box and press the Edit Template button.

The following dialog will be displayed:

Use Spice Template

Check this box to enable use of the template netlist entry.

Template Entry

Type the multi-line netlist entry. Any text typed here will be output as the device entry in the SPICE netlist prior to Simulation. Text enclosed by ’<’ and ’>’ are keywords and have special meanings, described below. Text enclosed by two ’%’ characters each side is the name of an attribute that will be replaced by the attribute value at run time.

Plug in Keywords

Plug in Attributes and some special keywords can be inserted into the template entry. These have their calculated values substituted into the netlist entry at the time of its generation.

First click the cursor in the template entry at the place you want the keyword to be inserted, or select the text in the template entry you wish to replace with the keyword.

Select the required keyword from the keyword dropdown list and press the Paste into Template button to insert the keyword into the template.

Selecting the Attribute keyword will display an edit box for you to supply the attribute name. Selecting Net name of specified pin keyword will display an edit box for you to specify the required pin name or schematics symbol pin number to specify which pin.

Here is a list of the keywords provided along with a description of what is plugged in when the netlist is generated:

AttributeThe value of the specified attribute.
Component nameThe component’s name e.g. U4. If this is being used as the device name at the beginning of a device line in the netlist, see the Component Name Prefix section below.
First pin’s nameThe name of the first pin on the component.
Name of pin connected to first pinThe name of the pin on the other end of the connection attached to the specified pin.
Net nameThe specified net name. This is better than using a net name directly in the template text because as the system knows it is a net name, it can remove invalid Spice characters.
Net name of specified pinThe name of the net that the specified pin is on.
Node list: Each pin’s net nameThe names of the nets that each pin is on, listed in schematic symbol pin order.
Parameter ValueThe value of the specified parameter extracted from either of the special component attributes or .
Part nameThe name of the component’s part.
Pin list for a sub-circuit callThe text “pinnames:” followed by each of the component’s pin names in schematic symbol pin order. Use at end of a SPICE sub-circuit call.
Pin list: Each pin’s nameEach of the component’s pin names in schematic symbol pin order.
Spice parametersThe value of the attribute.
Spice tolerancesThe value of the attribute.
Spice value/modelThe value of the attribute.

Notes:

If a pin name is plugged in, the schematics symbol pin number will be used if the specified pin has no name.

The schematic symbol pin order can be changed for Spice output by using the Pin Properties option when editing a part.

Operator Keywords

The following operator keywords can be inserted into the template to perform simple calculations on values prior to putting the result out into the netlist.

Select the required operator from the keyword dropdown list and press the Paste into Template button to insert it into the template.

Each of the operator arguments can either be an absolute numerical value (e.g. 3 or 4.5), an attribute (e.g. ), the loop counter (e.g. ) or a device parameter name (e.g. ESR). Note, if the operator is an attribute, at runtime the attribute value must supply a numerical value or a parameter name.

The following operators are currently provided:

AddAdds the two supplied operator arguments and writes result to the netlist. The template format is <add[arg1][arg2]>.
DivideDivides the first supplied operator argument by the second and writes result to the netlist. The template format is <div[arg1][arg2]>.
MultiplyMultiplies the two supplied operator arguments and writes result to the netlist. The template format is <mul[arg1][arg2]>.
SubtractSubtracts the second supplied operator argument from the first and writes result to the netlist. The template format is <sub[arg1][arg2]>.

Control Keywords

Some control keywords can be inserted into the template entry to control which parts of the template are output based on runtime conditions, and how many times sections are repeated.

Select the required operator from the keyword dropdown list and press the Paste into Template button to insert it into the template.

The following control keywords are currently provided:

If (Parameter Value)Use this to conditionally output one set of netlist commands or another based on the value of a device parameter. If the runtime value of the supplied device parameter is resolved to be a non-zero value, the text in the template following this command up to the next End If or Else commands will be output to the netlist. If the parameter resolves to zero, this text will not be output, but any text between an Else command and the End If command will be output. The template format is <if[parameter_name]>.
ElseUse this after an If command to start an alternative set of netlist commands to be output if the If command was not satisfied. The template format is
End IfUse this after If or Else commands to terminate their set of netlist commands. The template format is
RepeatUse this to output a section of text commands to the netlist file a set number of times. The number of repeats is supplied as either an exact integer value or using a device parameter whose value is extracted at runtime. Use an End Repeat command to terminate the text section to be repeated. A count variable is incremented on each repeat using the using the Count (Repeat Loop) command, and this may be used in the repeated text section to define changing device or node names. The template format is <repeat[parameter_name]> or <repeat[10]> The following example creates a subcircuit that define an RC ladder circuit with a variable number of sections defined by the device parameter NUM. The resistance of each section is defined by the parameter RES and the capacitance by CAP. .subckt ladder 1 <add[NUM][1]> gnd <repeat[NUM]>X <add[][1]> gnd section .subckt section in out gnd R1 in out <param[RES]> C1 out gnd <param[CAP]> .ends .ends If NUM were set to four, the line: X <add[][1]> gnd section would be repeated four times with incrementing by one each time. The end result of the above with NUM=4, RES=1k and CAP=1n is: .subckt ladder 1 5 gnd X1 1 2 gnd section X2 2 3 gnd section X3 3 4 gnd section X4 4 5 gnd section .subckt section in out gnd R1 in out 1k C1 out gnd 1n .ends .ends
Count (Repeat Loop)Use this to output the value of the count variable that is incremented in a Repeat loop. This is initialised to 1. See example above. The template format is
End RepeatUse this after the Repeat command to terminate the set of netlist commands to be repeated. The template format is

Reset

Sets the template entry back to the original text when the dialog was first displayed.

Delete All

Clears the template.

Component Name Prefix

In a Spice netlist the first letter of the component name indicates what type of device it is, for example R is a resistor, A ia an XSPICE device etc. In Pulsonix-Spice we remove the need for you to name your components in the design with the right letter by inserting a prefix of the form $ to the component name to give it its Spice type. The simulator understands this prefix and removes it when reporting the component name for any reason.

So for example you can name a bus register which is a XSPICE type BUSREG1 in the design and when Spice is output the netlist contains A$BUSREG1, so the standard Spice format rule is satisfied (it starts with an A) but at the same time the simulator knows the component is called BUSREG1.

If you are using a template and you know the device is a capacitor (for example) the include C$ before to enable you to call the capacitors anything in the design.

Define Spice Type | Pin Properties