Parameters in Star-Hspice are names that have associated numeric values. You can use any of the following methods to define parameters:
.PARAM <mcVar> = Agauss(1.0,0.1) (see Statistical Analysis and Optimization) |
|
.MEASURE <DC | AC | TRAN> result TRIG ... |
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.
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
Parameter passing order is shown in Parameter Passing Order.
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.
.PARAM <ParamName> = <RealNumber>
.PARAM <ParamName> = '<Expression>' $ Quotes are mandatory
.PARAM <ParamName1> = <ParamName2> $ Cannot be recursive!
...
.PARAM pWidth = 'nWidth * npRatio'
Mp1 ... <pModelName> W = pWidth
Mn1 ... <nModelName> W = nWidth
To define circuit values by a direct algebraic evaluation:
r1 n1 0 R = '1k/sqrt(HERTZ)' $ Resistance related to frequency.
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)')
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.
.PARAM <ParamName>(<pv1>[, <pv2>]) = '<Expression>'
.PARAM CentToFar (c) = '(((c*9)/5)+32)'
.PARAM F(p1,p2) = 'Log(Cos(p1)*Sin(p2))'
.PARAM SqrdProd (a,b) = '(a*a)*(b*b)'
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).
.SUBCKT <SubName> <PinList> [<SubDefaultsList>]
<SubParam1> = <Expression> [<SubParam2> = <Expression> ...]
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
...
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
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.
.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).
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.