Upload
jechu-j-leon
View
43
Download
6
Embed Size (px)
DESCRIPTION
comparación entre simuladores.
Citation preview
Tarea 1: Comparación entre los simuladores HSPICE, APLAC
y ANALOG INSYDES Maestría en Ciencias Especialidad en Electrónica
Instituto Nacional de Astrofísica Óptica y Electrónica Jesús Jiménez León
Element Definition (name, nodes, delimiter)
HSPICE
Element and Source Statements
Element statements describe the netlists of devices and sources. Use nodes to connect
elements to one another. Nodes can be either numbers or names. Element statements
specify:
Type of device.
Nodes to which the device is connected.
Operating electrical characteristics of the device.
Element statements can also reference model statements that define the electrical
parameters of the element.
Elements: Element name that cannot exceed 1023 characters, and must begin with a specific
letter for each element type.
Nodes: Node names identify the nodes that connect to the element. The node name begins
with a letter and can contain a maximum of 1023 characters. For a listing of legal and illegal
special characters that can be used in node names, see the Special Characters section, Table 3
on page 42.
Models: HSPICE or HSPICE RF requires a model reference name for all elements, except passive
devices.
Parameters: An element parameter name identifies the parameter value that follows this
name.
Expressions: Any mathematical expression containing values or parameters, such as param1 *
val2
Values: Value of the pname1 parameter, or of the corresponding model node. The value can
be a number or an algebraic expression.
Element multiplier: Element multiplier. Replicates val element times, in parallel. Do not assign
a negative value or zero as the M value.
Example 1: Q1234567 4000 5000 6000 SUBSTRATE BJTMODEL AREA=1.0
The preceding example specifies a bipolar junction transistor, with its collector connected to
node 4000, its base connected to node 5000, its emitter connected to node 6000, and its
substrate connected to the SUBSTRATE node. The BJTMODEL name references the model
statement,
* Delimiters
An input token is any item in the input file that HSPICE recognizes. Input token
delimiters are: tab, blank (whitespace), comma (,), equal sign (=), and parentheses ( ).
Single (‘) or double quotes (“) delimit expressions and filenames.
Colons (:) delimit element attributes (for example, M1:VGS).
Periods (.) indicate hierarchy. For example, X1.X2.n1 is the n1 node on the X2
subcircuit of the X1 circuit.
APLAC
The Element Statement has the general form (in this example, some details from the reference
page for Resistor are used, but instead user can replace for “cap”, “ind”, etc.):
Res ”name” n1 n2 value C=c L=l
The statement is shown as it is generally used, along with the obligatory arguments in their
correct order, followed by parameter settings.
Name Name of the element
n1 Positive node
n2 Negative node
value If a value is specified without a label, it is the functional value of resistance [Ω ]
Example: Res ”R1” 1 2 10k
Delimiters
Blank space, equal sign, and comma are delimiters.
Examples:
Res R1 n1 n2 4.7k
Res=R2=n3=n4=4.7k
Res,R3,n5,n6,4.7k
ANALOG INSYDES
Analog Insydes provides functions which can automatically set up several types of circuit equations from the netlist description of a circuit. Netlists are sequences of Mathematica lists encapsulated by the Analog Insydes command Netlist (Section 3.1.1). There must be one such list, or netlist entry, for each element in a circuit. Netlist entries are not required to be listed in any particular order. netlistname =
Netlist[
netlist entry 1,
netlist entry 2,
…
]
In Analog Insydes, netlist entries must be lists of three fields which are called the reference designator, the connectivity list, and the value field:
reference designator, connectivity list, value field
The reference designator is a unique name by which a particular circuit element can be distinguished from all other elements in the same netlist. Typically, the leading one, two, or three characters of a reference designator implicitly determine the type of the corresponding element. The connectivity list specifies the nodes of the circuit to which the terminals of an element are connected. For that purpose, every node in a circuit must be given a unique name, a node identifier, by which it can be referenced. While some circuit simulators require the nodes to be enumerated by consecutive nonnegative integers, Analog Insydes lets you choose node identifiers quite freely. You do not have to number your nodes consecutively, nor do you need to use numbers as node identifiers at all. In addition to nonnegative integers, you may also use symbols or strings as node labels. The only requirement is that the circuit’s ground node must be identified by the label 0 (zero). Internally all node identifiers are converted to strings. Thus, the node identifiers OUT and "OUT" refer to the same node. Moreover, node identifiers are case sensitive. Thus, OUT and Out refer to different nodes. For a two-terminal element, such as a resistor (Section 4.2.1), the connectivity list must contain exactly two node identifiers whereas a controlled source, i.e. a four-terminal element, requires four node identifiers: two for the controlling branch and two for the controlled branch. Netlist entries for the resistor and the voltage-controlled current source to be written as follows:
R1, 1, 2, R
VC2, 4, 6, out1, out2, gm
As opposed to SPICE, the values of circuit elements need not be purely numerical quantities. Since Mathematica is capable of performing mathematical calculations symbolically, the element values may also be any symbolic or mixed symbolic/numeric expressions.
In[4]:= voltageDivider2 =
Netlist[
V0, 1, 0, 10,
R1, 1, out, R,
R2, out, 0, 2 R
]
Sweep Definition
HSPICE
Parameter Sweep
When the values of a parameter can be expressed using decade, octave, linear, or point-of-
interest variation, you can use the sweep keyword to control the parameter. This method does not allow for multiple parameters to be swept. Similar to the data-driven sweep, only one output file is created, with the signals having multiple
traces. Be sure to sequence the var (param) before the type (DEC, LIN).
Examples In this example, param will be varied 10 times for each decade from 1u to 10u and a transient analysis will be run for each value. .tran 1n 100n sweep param DEC 10 1u 10u
In this example, param will be varied 5 equal times from 1u to 10u with atransient analysis for each value.
.tran 1n 100n sweep param LIN 5 1u 10u
Similar to the data-driven sweep, only one output file will be created. The signals will also be multi-membered.
Sweeping Multiple Parameters Although HSPICE does not directly provide the facility to sweep multiple parameters, it does offer
the .DATA table structure. A linked perl script is available to allow you to specify lists of
parameters and values at https://solvnet.synopsys.com/retrieve/021478.html This script will create a .DATA table with all permutations of the listed values. It also allows you
to create .ALTERs instead of a .DATA table, if preferred. For usage details, run
hspice_param_sweeper -h.
APLAC
Sweep – Variable Sweeps Defines variable, frequency, time and temperature sweeps. Usage Sweep title
+ [ Optional parameters ]
+ [ Analyzer parameters ]
Other APLAC commands
EndSweep
General form: Sweep ”title” LOOP n FREQ LOG ...
Other APLAC commands
EndSweep
Using SWEEP command user can change the value of a defined Variable VAR X.
VAR x Variable to be swept. During the Sweep, the value of x is changed.
ANALOG INSYDES
Parameter Sweeps Analog Insydes supports the following parameter sweep formats:
Valid parameter sweep formats.
The following example shows valid parameter sweeps: R1, 100, 1000, 10000,
V1, 1, 5, 1,
P1 -> 10, P2 -> 20, P1 -> 20, P2 -> 10
Multiple sweeps If several sweep formats are combined in a list (as shown in the example above) the outer product of all sweep specifications is computed.
Parameter Definition
HSPICE
Parameters and Expressions
Parameter names in HSPICE or HSPICE RF use HSPICE name syntax rules, except that
names must begin with an alphabetic character. To define parameter hierarchy overrides
and defaults, use the .OPTION PARHIER=global | local statement.
If you create multiple definitions for the same parameter or option, HSPICE or HSPICE RF
uses the last parameter definition or .OPTION statement, even if that definition occurs later in the input than a reference to the parameter or option. HSPICE or HSPICE RF does not warn you when you redefine a parameter.
You must define a parameter before you use that parameter to define another parameter.
When you select design parameter names, be careful to avoid conflicts with parameterized libraries.
To delimit expressions, use single or double quotes.
Expressions cannot exceed 1024 characters.
For improved readability, use a double backslash preceded by a whitespace
( \\) at end of a line, to continue the line.
You can nest functions up to three levels.
Any function that you define can contain up to two arguments.
Use the PAR (expression or parameter) function to evaluate expressions in
output statements.
Limitation 1: If a parameter is defined as an expression containing output
signals such as v(node) or i(element), this parameter only can be used in an
element value expression directly, and can not be evaluated to another
parameter.
For example, the following is correct:
.param a='2*sqrt(V(p,n))'
r1 p n '1k+a'
The following definition is correct, but this definition points up the limitation and is not permitted because HSPICE generates an incorrect result.
.param a='2*sqrt(v(p,n))'
.param b='a+1'
r1 p n '1k+b'
It is best to use a user-defined function to replace the previous example, so that all of r1 and r2 are correct.
.param a(x)='2*sqrt(x)'
.param b(x)='a(x)+1'
r1 p n '1k+a(V(p,n))'
r2 p n '1k+b(V(p,n))'
Limitation 2: If an expression containing output signals such as v(node) or i(element) is used in an element value directly, the element only can be R,C, L, E, or G.
Correct G1 1 0 cur='((1-(a0*v(gate)))/b0)'
Incorrect I1 1 0 cur='((1-(a0*v(gate)))/b0)'
APLAC
Strictly speaking, a parameter is an identifier associated with one or more arguments. The expression is also commonly used to refer to the identifier itself, such as CYCLES or RANGE. Optional parameters associated with analysis statements or component models may contain/require one or more arguments, which may be character strings, real numbers, vectors, variables, etc. The type of each argument following a parameter is symbolized by one or two letters according to Table 1.1 shown un page 9 of the APLAC Reference Manual Volume 1. Example:
In the example, parameter STRING must be followed by three arguments, the first two being real numbers (x and y coordinates in this case) and the third being a string of characters such as ”Voltage 1”. NOTE: Digits 1 and 2 have been attached to the letter r to distinguish between the two arguments of the same type in the parameter description. This parameter should be used as follows:
... STRING 1.2 3.56 ”Voltage 1” ...
Optional parameters are shown in square brackets but these square brackets are not used in the input file.
ANALOG INSYDES
With Analog Insydes you can describe electrical circuits and control systems hierarchically in terms of netlists, subcircuit or device model definitions, and model parameter sets. Circuits are defined with the commands Circuit or Netlist. The general syntax for a Circuit object is as follows: Circuit[
Netlist[top-level netlist with subcircuit references],
Model[subcircuit/model definition],
Parameter Argument Description
STRING r1 r2 s Displays string s at position (r1,r2).
…
ModelParameters[model parameters specification],
…
GlobalParameters[global parameters specification],
]
ModelParameters
Command Structure for ModelParameters In addition to subcircuit and device models, you can also define parameter sets (model cards) that can be used in conjunction with model references in a circuit description. The following statement defines a model parameter set for the device type DEFNPN.
ModelParameters[Name -> DEFNPN, IS -> 1.0*^-16, BF -> 100,
BR -> 1, VAF -> 150]
These model parameter sets can be used in model references by means of the Parameters keyword. GlobalParameters
Command Structures for GlobalParameters With GlobalParameters you can specify settings for global parameters used in a Circuit object, as for instance TEMP or GMIN. The following examples are valid declarations for global parameters:
GlobalParameters[TEMP -> 300.15, GMIN -> 1.0*^-12]
GlobalParameters[TEMP -> TNOM, TNOM -> 300.15,
GMIN -> 1.0*^-12]
Call to a particular integration method
HSPICE
Numerical Integration Algorithm Controls In HSPICE transient analysis, you can select one of several options solve the circuit differential algebraic equations:
Backward-Euler
Gear
Trapezoidal
BDF
Integration Algorithm
Option Settings Comments
Backward- Euler (BE)
METHOD=GEAR MAXORD=1 or METHOD=GEAR MU=0
Backward-Euler only
GEAR METHOD=GEAR METHOD=GEAR MAXORD=2|3
Combines GEAR and BE 2nd/3rd order increases accuracy
TRAP METHOD=TRAP METHOD=TRAP PURETP
Combines Trapezoidal and BE Trapezoidal only
BDF METHOD=BDF Higher order integration (Backward Differentiation Formulae)
Each algorithm has advantages and disadvantages. The trapezoidal is often the preferred algorithm because of its high accuracy level and low simulation time. The pure trapezoidal (PURETP) is recommended for oscillators. The Gear method is an appropriate algorithm for convergence. 2nd-order GEAR is more accurate than Backward-Euler and 3rd-order GEAR is more accurate than 2nd-order GEAR. The GEAR is recommended for those circuit simulations that require high accuracy on current such as leakage current measurement.
If the circuit fails to converge using the Trapezoidal integration method, HSPICE uses the GEAR method to run the transient analysis again from time=0. This process is called autoconvergence. The BDF method is an high order integration method based on the backward differentiation formulae. The key features include: variable order, variable step size, and high order polynomial
interpolation. Two tolerance options are available to the user for the BDF method: .OPTIONS BDFRTOL (relative) and BDFATOL (absolute); each has a default of 1e-3.
APLAC
In APLAC the integration method is a common parameter in all APLAC models. The general form is:
Any Model
+ [ Common Model Parameters ]
The parameters for the different integration methods are:
Parameter Description EULER Use of a backward Euler in the numerical integration. Note that
a backward Euler is always used twice in starting the integration and whenever abrupt changes occur in the signal sources. Meaningful only to a dynamic component. Default: the global method defined by Analyze, Prepare, SetParam, or Sweep.
TRAPEZ Use of a trapezoidal rule in the numerical integration. Meaningful only to a dynamic component. Default: the global method defined by Analyze, Prepare, SetParam, or Sweep.
GEAR Use of the Gear-Shichman rule in the numerical integration. Meaningful only to a dynamic component. Default: the global method defined by Analyze, Prepare, SetParam, or Sweep.
ANALOG INSYDES
The strategy NDAESolve employs to integrate a system of differential and algebraic equations. The main idea behind the algorithm is to transform the problem of solving a nonlinear system of differential and algebraic equations into a sequence of linear and purely algebraic problems which can be solved rather easily. The transformation is carried out in two stages. In the first step, the differential equations are discretized by replacing all time derivatives with a finite difference approximation. The differential equations are thus evaluated and solved at discrete time steps only. The finite difference approximation scheme used by NDAESolve is an implicit integration method known as the trapezoidal rule. In a second step the resulting nonlinear algebraic system of equations is then solved for the voltages and currents using the multi-dimensional Newton-Raphson method.
Analog Insydes’ manuals do not any information about selecting the integration method.
Node Errors
HSPICE
Shorted Element Nodes HSPICE disregards any capacitor, resistor, inductor, diode, BJT, or MOSFET if all of its leads connect together. The simulation ignores it in its component tally, and issues a warning:
**warning**
all nodes of element x:<name> are connected together
APLAC
APLAC’s Manuals do no content any information about node errors.
ANALOG INSYDES
When an element is not connected from one side, a warning message is shown:
Netlist::lttc: Less than two connections at node(s).
ANALOG INSYDES’ Manuals do no content any more information about node errors.
Initial Conditions for Capacitor and Inductor
HSPICE
Capacitors General form: Cxxx n1 n2 <mname> <C=>capacitance <<TC1=>val>
+ <<TC2=>val> <SCALE=val> <IC=val> <M=val>
+ <W=val> <L=val> <DTEMP=val>
Cxxx n1 n2 <C=>’equation’ <CTYPE=0|1>
+ <above_options...>
IC Initial voltage across the capacitor, in volts. If you specify UIC in the .TRAN statement, HSPICE or HSPICE RF uses this value as the DC operating point voltage. The .IC statement overrides it.
Inductors General form:
Lxxx n1 n2 <L=>inductance <<TC1=>val>
+ <<TC2=>val> <SCALE=val> <IC=val> <M=val>
+ <DTEMP=val> <R=val>
Lxxx n1 n2 L=‘equation’ <LTYPE=val> <above_options...>
IC Initial current through the inductor, in amperes. HSPICE or HSPICE RF uses this value as the DC operating point current.
Also command .IC can be used; it sets transient initial conditions in HSPICE. Syntax .IC V(node1)=val1 V(node2)=val2 ...
Argument Description val1 ... Specifies voltages. The significance of these voltages depends on whether you
specify the UIC parameter in the .TRAN command.
node1 ... Node numbers or names can include full paths or circuit numbers. Description
Use the .IC command or the .DCVOLT command to set transient initial conditions in
HSPICE. How it initializes depends on whether the .TRAN analysis command includes the UIC
parameter. This command is less preferred compared to using the.NODESET command in many cases.
When using the .IC command, forcing circuits are connected to the .IC nodes for the duration of DC convergence. After DC convergence is obtained, the forcing circuits are removed for all further analysis. The DC operating point for each .IC'd node should be very close to the
voltage specified in the .IC command. If a node is not, then that node has a DC conductance to ground comparable to GMAX.
APLAC
Capacitors
Usage
Cap "name" n1 n2 value
+ [ Optional parameters ]
+ [ Common model parameters ]
+ [ Electrothermal parameters ]
General form: Cap ”name” n1 n2 value C=c G=g IO=io L=l ...
Among the parameters, user can set the initial conditions (voltage) with:
UO x Initial voltage [V] of C. Default: DC voltage of C)
Inductors
Usage
Ind "name" n1 n2 value
+ [ Optional parameters ]
+ [ Common model parameters ]
+ [ Electrothermal parameters ]
General form: Ind ”name” n1 n2 value C=c G=g L=l ...
Among the parameters, user can set the initial conditions (current) with:
IO x Initial current [A] of L. Default: DC current of L
ANALOG INSYDES
With the InitialCondition option, you can specify initial currents and voltages for the dynamic elements Inductor and Capacitor respectively. If no initial condition is given explicitly, it will be assumed to be zero (AC analysis) or will be calculated automatically from the operating-point data (transient analysis). InitialConditions
Format of the InitialConditions argument
With the InitialConditions argument, you can specify initial conditions for dynamic variables in behavioral model equations. Initial conditions can be assigned to any quantity x whose derivative x' appears in the equations. This applies to internal model variables as well as to branch voltages and currents. The following example shows how to specify an initial condition for the branch quantity Voltage["P", "N"]. Note that it is not important whether this quantity appears directly in the equations or not. However, its derivative Voltage["P", "N"]' must be present as a prerequisite for the assignment of an initial condition.
Model[
Name -> "Capacitor", Selector -> "Behavioral",
Ports -> "P", "N", Parameters -> C,
Variables -> Current["P", "N"], Voltage["P", "N"],
Definition -> Equations[
Current["P", "N"] == C*Voltage["P", "N"]'
],
InitialConditions -> Voltage["P", "N"] -> 1.52 ]
Starting point in DC
HSPICE
The .DC command performs several types of sweeps during DC analysis. The general syntax is: Sweep or Parameterized Sweep: .DC var1 START=start1 STOP=stop1 STEP=incr1
.DC var1 START=[param_expr1]
+ STOP=[param_expr2] STEP=[param_expr3]
.DC var1 start1 stop1 incr1
+ [SWEEP var2 type np start2 stop2]
.DC var1 start1 stop1 incr1 [var2 start2 stop2 incr2
In this, the arguments “start” and “stop” gives the starting point and stopping point for the analysis. start1 ... Starting voltage, current, element, or model parameters; or temperature values. If
you use the POI (list of points) variation type, specify a list of parameter values, instead of start stop.
stop1 ... Final voltage, current, any element, model parameter, or temperature values.
APLAC
APLAC’s Manuals say nothing about starting points in DC analysis. Instead, user can define the maximum number of the step cycles in source stepping and the initial step with the parameters:
Parameter Argument Description
SOURCE STEP CYCLES
i Maximum number of source step cycles in source stepping. The source stepping is a convergence-aiding strategy in which the values of selected sources are damped, if required, and then gradually increased to their final values. The strategy is used internally only if convergence is not achieved on the first attempt with the specified source values. On the other hand, if INIT SOURCE STEP is defined, source stepping is used immediately starting from the specified initial step. Setting SOURCE STEP CYCLES to zero prevents the use of source stepping. Default: 50
DCSOURCE STEP CYCLES
i Same as SOURCE STEP CYCLES but applies to the DC ources of DC analysis only. Default: 50
This is normally used to solve convergence problems.
ANALOG INSYDES
In ANALOG INSYDES seems to be no way to set a starting point in voltage or current for the DC analysis, instead the user can give a set of options to initialize and find the operating point. These options are focused in specifying the size of the integration steps and the initial step of integration. The function NDAESolve allows for carrying out several numerical analyses, such as an operatingpoint (DC) analysis, a detailed description of all NDAESolve options is given below in alphabetical order:
MaxSteps The option MaxSteps limits the number of integration steps. The computation will be stopped immediately if the limiting value is exceeded. MaxStepSize The option MaxStepSize specifies the upper limit of the integration step size. MinStepSize
The option MinStepSize specifies the lower limit of the integration step size. The computation will be stopped immediately if the integration step size falls below this limit.
StartingStepSize The option StartingStepSize specifies the initial integration step size. The default setting is StartingStepSize -> Automatic.