Netlist Preprocessor

In this Topic Hide

Overview

The netlist preprocessor is actually part of SIMetrix not SIMPLIS. However, although it can be used with SIMetrix (SPICE) netlists, it was originally developed for use with SIMPLIS and so is documented here. The netlist preprocessor provides some additional functionality not provided by the simulator itself. These functions are:

  1. Searches the model library for unresolved subcircuits and adds them to the netlist.
  2. Evaluates parameterised expressions.
  3. Builds static subcircuits from parameterised definitions
  4. Localizes globally defined subcircuits for SIMPLIS compatibility.
The parameterization system includes conditional and looping features using the controls .IF and .WHILE.

Launching Preprocessor

The preprocessor is launched using the script command PreProcessNetlist. The syntax is:

PreProcessNetlist [/inAppend extraInputLines] [/simulator SIMPLIS|SIMetrix] [/mc]
+ [/importglobals] [/params paramlist] [/mcseed seed] [/rawdeck] [/mclogfile mclogfile]
+ inFile outFile

where

inFile Input file name to be processed
outFile File to receive result
extraInputLines Additional lines appended to input file. Each line separated by a semi-colon ';'.
/mc If present, enables Monte Carlo distribution functions. When absent these functions will return unity
/importglobals If present, any values defined in the global group in the front end will be imported. This allows values in scripts to be passed to the pre-processor. E.g.


paramlist
semi-colon delimited list of name=value pairs to define local parameters. For example:

Let global:param1 = 100.0

The value of param1 will be available in the preprocessed netlist


seed
Assign Monte Carlo seed value. Requires /mc
/rawdeck This produces an intermediate file with the extension .rawdeck which includes the output after the models and subcircuits have been gathered from the library but before resolution of parameter expressions. This is intended for building encrypted parameterised models
mclogfile If specified, enables generation of a Monte Carlo log file which lists the values of components affected by Monte Carlo distribution functions. Requires /mc

The /simulator switch allows the specification of the simulator that the netlist is intended for and affects library searching and the effect of the .SIMULATOR control. The default value is "SIMPLIS".

The PreProcessNetlist command called automatically when a SIMPLIS simulation is initiated and the user does not usually need to be aware of this.

Library Search

The SIMetrix library will be searched for any device referenced in a subcircuit call that is not present in the input netlist. Only devices that are explicitly designated as SIMPLIS models will be recognized in this search. (Unless "/simulator SIMetrix" is specified at the PreProcessNetlist command line). SIMPLIS models are identified in the model files using the .SIMULATOR control. The syntax of this control is:

.SIMULATOR SIMPLIS | SIMetrix
The .SIMULATOR control applies to all models that appear after it until the next .SIMULATOR control.

If the device is found in the library, its text will be entered as if it had appeared in the input netlist. Currently only subcircuit devices are resolved in this library search. All primitive devices defined using .MODEL must be defined in the input netlist.

Note also that currently, only the SIMetrix global library will be searched. The .LIB control is not supported.

Parameters

Parameters may be defined using the .VAR control which has the following syntax:

.VAR parameterName={ parameterExpression }
parameterName may be any alphanumeric sequence and must start with a letter or underscore. paramterExpression may be any valid SIMetrix expression as detailed in the script reference manual. String expressions are acceptable. parameterExpression may reference parameters defined in earlier .VAR controls.

Any part of the netlist following a .VAR control may contain parameter expression enclosed with curly braces. E.g.

.VAR resval = { 1K }

R1 1 2 {resval * 2}
.VAR may be used inside subcircuit definitions in which case the have local scope. This means that the parameter definition is only valid within that subcircuit definition. Note that this scope is not inherited by nested subcircuit definitions. However, parameters defined at the top level have global scope.

Passing Parameters to Subcircuits

Parameters may be passed to subcircuits via the subcircuit call. The syntax is:

Xxxx nodes subname vars: param1=value1 param2=value2 ...
value1, 2 may be constants or an expression enclosed in curly braces. The expression may use values defined in previous .VAR controls and, if the X line is itself inside a subcircuit definition, values passed to that definition. The expression may not however, reference other passed parameters on the same X line. E.g. value2 may not reference param1.

Conditional Lines

The .IF control may be used to define lines that are passed to the output only if specified conditions are met. The syntax is as follows:

.IF {expression}
netlist lines
...
[.ELSE
netlist lines
...]
.ENDIF
If expression resolves to a non-zero value then the lines up to .ELSE will be output otherwise the lines between .ELSE and .ENDIF will be output. The .ELSE is optional. .IF/.ELSE/.ENDIF may be nested to any level.

expression may be any valid arithmetic expression and may refer to previously defined parameters including those passed through a subcircuit call.

Looping

The preprocessor may be instructed to output a repeated sequence of lines using the .WHILE control. The syntax is:

.WHILE {expression} [max_loop_count]
netlist lines
...
.ENDWHILE

The block between .WHILE and .ENDWHILE will be repeated as long as expression is non-zero up to a maximum of max_loop_count times. If max_loop_count is omitted it takes a default value of 100. max_loop_count is intended as a safety measure to prevent an endless loop from filling the user's fixed disk to its capacity.