Using Parameters in Simulation

Parameter Definition

Parameters in Star-Hspice are names that have associated numeric values. You can use any of the following methods to define parameters:

Simple assignment

.PARAM <SimpleParam> = 1e-12

Algebraic definition

.PARAM <AlgebraicParam> = `SimpleParam*8.2'

User-defined function

.PARAM <MyFunc( x, y )> = `Sqrt((x*x)+(y*y))'

Subcircuit default

.SUBCKT <SubName> <ParamDefName> =
+ <Value>

Predefined analysis function

.PARAM <mcVar> = Agauss(1.0,0.1) (see Statistical Analysis and Optimization)

.MEASURE statement

.MEASURE <DC | AC | TRAN> result TRIG ...
+ TARG ... <GOAL = val> <MINVAL = val>
+ <WEIGHT = val> <MeasType> <MeasParam>
(see Specifying User-Defined Analysis (.MEASURE))

A parameter definition in Star-Hspice always takes the last value found in the Star-Hspice input (subject to local versus global parameter rules). Thus, the definitions below assign the value 3 to the parameter DupParam.

.PARAM DupParam = 1

...

.PARAM DupParam = 3

The value 3 will be substituted for all instances of DupParam, including instances that occur earlier in the input than the .PARAM DupParam = 3 statement.

All parameter values in Star-Hspice are IEEE double floating point numbers.

Parameter resolution order is as follows:

1. Resolve all literal assignments

2. Resolve all expressions

3. Resolve all function calls

Parameter passing order is shown in Parameter Passing Order.

Table 7-1: Parameter Passing Order

.OPTION PARHIER = GLOBAL

.OPTION PARHIER = LOCAL

Analysis sweep parameters

Analysis sweep parameters

.PARAM statement (library)

.SUBCKT call (instance)

.SUBCKT call (instance)

.SUBCKT definition (symbol)

.SUBCKT definition (symbol)

.PARAM statement (library)

Parameter Assignment

A constant real number or an algebraic expression of real values, predefined function, user-defined function, or circuit or model values can be assigned to parameters. A complex expression must be enclosed in single quotes in order to invoke the Star-Hspice algebraic processor. A simple expression consists of a single parameter name. The parameter keeps the assigned value unless there is a later definition that changes its value, or it is assigned a new value by an algebraic expression during simulation. There is no warning if a parameter is reassigned.

Syntax

.PARAM <ParamName> = <RealNumber>

.PARAM <ParamName> = '<Expression>' $ Quotes are mandatory

.PARAM <ParamName1> = <ParamName2> $ Cannot be recursive!

Numerical Example

.PARAM TermValue = 1g

rTerm Bit0 0 TermValue

rTerm Bit1 0 TermValue

	...
Expression Example

.PARAM Pi = '355/113'

.PARAM Pi2 = '2*Pi'

 

.PARAM npRatio = 2.1

.PARAM nWidth = 3u

.PARAM pWidth = 'nWidth * npRatio'

Mp1 ... <pModelName> W = pWidth

Mn1 ... <nModelName> W = nWidth

...

Inline Assignments

To define circuit values by a direct algebraic evaluation:

r1 n1 0 R = '1k/sqrt(HERTZ)' $ Resistance related to frequency.

Parameters in Output

To use an algebraic expression as an output variable in a .PRINT, .PLOT, or .PROBE statement, use the PAR keyword (see Specifying Simulation Output for more information on simulation output). For example:

.PRINT DC v(3) gain = PAR(`v(3)/v(2)') PAR(`v(4)/v(2)')

User-Defined Function Parameters

A user-defined function can be defined similar to the parameter assignment except for the fact that it cannot be nested more than three deep.

Syntax

.PARAM <ParamName>(<pv1>[, <pv2>]) = '<Expression>'

Example
.PARAM CentToFar (c) 					 = '(((c*9)/5)+32)'
.PARAM F(p1,p2)					 = 'Log(Cos(p1)*Sin(p2))'
.PARAM SqrdProd (a,b)					 = '(a*a)*(b*b)'

Subcircuit Default Definitions

The specification of hierarchical subcircuits allows you to pick default values for circuit elements. This is typically used in cell definitions so the circuit can be simulated with typical values (see Using Subcircuits for more information on subcircuits).

Syntax

.SUBCKT <SubName> <PinList> [<SubDefaultsList>]

where <SubDefaultsList> is

<SubParam1> = <Expression> [<SubParam2> = <Expression> ...]

Subcircuit Parameter Example

The following example implements an inverter with a Strength parameter. By default, the inverter can drive three devices. By entering a new value for the parameter Strength in the element line, you can select larger or smaller inverters to suit the application.

.SUBCKT Inv a y Strength = 3
	Mp1 <MosPinList> pMosMod L = 1.2u W = 'Strength * 2u'
	Mn1 <MosPinList> nMosMod L = 1.2u W = 'Strength * 1u'
.ENDS
...
xInv0 a y0 Inv			 $ Default devices: p device = 6u,n device = 3u
xInv1 a y1 Inv Strength = 5					$ p device = 10u, n device = 5u
xInv2 a y2 Inv Strength = 1					$ p device =  2u, n device = 1u
...
Parameter Scoping Example

The following example shows explicitly the difference between local and global scoping for parameter usage in subcircuits.

Given the input netlist fragment:

.PARAM DefPwid = 1u

 

.SUBCKT Inv a y DefPwid = 2u DefNwid = 1u
	Mp1 <MosPinList> pMosMod L = 1.2u W = DefPwid
	Mn1 <MosPinList> nMosMod L = 1.2u W = DefNwid
.ENDS

with the global parameter scoping option .OPTION PARHIER = GLOBAL set, and the following input statements

...
xInv0 a y0 Inv							$ Xinv0.Mp1 width = 1u
xInv1 a y1 Inv DefPwid = 5u							$ Xinv1.Mp1 width = 5u
.MEASURE TRAN Wid0 PARAM = 'lv2(xInv0.Mp1)'			 $ lv2 is the
.MEASURE TRAN Wid1 PARAM = 'lv2(xInv1.Mp1)'	 $ template for the
							$ channel width
							$`lv2(xInv1.Mp1)'
...

the following results are produced in the listing file:

wid0 	 = 	1.0000E-06
wid1 	 = 	1.0000E-06

With the local parameter scoping option .OPTION PARHIER = LOCAL set, and the following statements

...
xInv0 a y0 Inv						$ Xinv0.Mp1 width = 1u
xInv1 a y1 Inv DefPwid = 5u						$ Xinv1.Mp1 width = 1u:
.MEASURE TRAN Wid0 PARAM = 'lv2(xInv0.Mp1)'								
$ override the global .PARAM
.MEASURE TRAN Wid1 PARAM = 'lv2(xInv1.Mp1)'
...

the following results are produced in the listing file:

wid0	  = 	2.0000E-06
wid1 	 = 	5.0000E-06

Predefined Analysis Function

Star-Hspice has specialized analysis types, primarily Optimization and Monte Carlo, that require a method of controlling the analysis. The parameter definitions related with these analysis types are described in Statistical Analysis and Optimization.

Measurement Parameters

.MEASURE statements in Star-Hspice produce a type of parameter called a measurement parameter. In general, the rules for measurement parameters are the same as the rules for standard parameters, with one exception: measurement parameters are not defined in a .PARAM statement, but are defined directly in a .MEASURE statement. The detailed syntax and usage of the .MEASURE statement is described in Specifying User-Defined Analysis (.MEASURE).

Multiply Parameter

The multiply parameter M is a special keyword common to all elements (except for voltage sources) and subcircuits. It multiplies the internal component values to give the effect of making parallel copies of the element or subcircuit. To simulate the effect of 32 output buffers switching simultaneously, only one subcircuit call needs to be placed, such as:

X1 in out buffer M = 32

Multiply works hierarchically. A subcircuit within a subcircuit is multiplied by the product of the multiply parameters at both levels.

Figure 7-1: Multiply Parameters Simplify Flip-Flop Initialization
Star-Hspice Manual - Release 2001.2 - June 2001