hspice 教程
TA: Chien-Nan Liu
(Office:ED520 TEL:55551 Email:u8511566@cc.nctu.edu.tw)
HSPICE Tutorials
1. Introduction:
SPICE -- imulation rogram with ntegrated ircuit mphasis, SPICE,
developed by U.C. Berkeley.
SPICE simulate your electrical circuit designs, based on circuit level, in ,
the following domains:
-- Steady-state (DC Analysis)
-- Time (Transient Analysis)
-- Frequency (AC Analysis)
2. Flow Chart of Circuit Analysis with
SPICE:
Schematic CaptureCOMPOSER(CADENCE),for SPICE NetlistECS, WORKVIEW, etc.
Decide Types ofDC, Transient, AC, Noise,Analysis to be DoneDistortion, Fourier, etc.
Create SPICE input FilePE2, EDIT(DOS), VI, JOE,Including Control StatementsTEXTEDIT(UNIX), etc.
Run SPICE UsingHSPICE, IsSPICE, PSpice,SPICE Input FileSPICE2G.6, SPICE3E, etc.
Examine SPICE OutputGSI, HSPLOT, PROBE, etc.File and Results
AreNOModified DesignResult OK?
YES
Analysis Completed /Documentations
-- P.1 --
HSPICE Tutorials
3. Basic Netlist Structure:
Implicit first line; becomes output file Title
heading on each page.
Comments to describe the circuit. * or $
Set conditions for simulation. .OPTIONS
Analysis & temp.Set analysis type, temperature, or other
control commands.
Set initial conditions or input state. .IC
Set global variables. .GLOBAL
Parameterizes input element, source, and .PARAM
model data ... etc.
Source Voltage or current sources. Netlist Circuit netlist descriptions. Device modelsSpecify characteristics of each semi-
conductor device in circuit.
Set sub-circuit statement .SUBCKT
NetlistSub-circuit definition and description.
End statement of sub-circuit description. .ENDS
Output formatSet output varaibles and its format.
Rerun the circuit with changed netlist. .ALTER
NetlistThe changed portion in circuit
Terminate the simulation. This line always be .END
the last in the input netlist file.
4. An Example of Small Circuit:
Rs
50 ohmout12
Vgs =R1RLVsCL10V210 Kohm10 Kohm0.1V100pF
0
-- P.2 --
HSPICE Tutorials
The netlist file to simulate above circuit is
Small signal model of transitor
* Enable output of HSPLOT postprocessor files
.OPTION POST NOMOD
* Transient analysis over interval 0 to 50ms,
* with 100us printing increment.
.TRAN 100us 50ms
* Set initial condition
.IC V(out)=0
* Set parameters
.PARAM Load=10K
* Input sinusoidal wave with amplitude 0-0.1v, frequency 60Hz
Vs 1 0 SIN(0v 0.1v 60 0us 0 0)
Egs out 0 2 0 10
Rs 1 2 50
R1 2 0 10K
RL out 0 Load
CL out 0 100P
* Observe value: V(1) , V(out) and I(CL)
.PRINT tran V(1) V(out) I(CL)
* Measure peak value of output
.MEAS tran Omax MAX V(out)
* Change output load to 5K and run again
.ALTER
.PARAM Load=5K
.END $ End of file
5. Input Format and Conventions:
1) Fields on a line are seperated by one or more blanks( ), a comma(,), an
::equal sign(=), or a left or right parenthesis( or ); extra spaces are
ignored.
2) A line may be continued by entering a plus sign('+') in of the column 1
following line.
3) A name field must begin with a letter (A through Z) and cannot contain
any delimiters. The first letter of the element name specifies the element
type.
4) Nodes may be designed by either alphabets (up to 16 Char.) or by
numbers (0 ... 99999999).
5) The ground node be indicated by either the number , the name must0
, or . GND!GND
6) A number field may be an interger number(e.g. 12, -44), a floating point
number(e.g. 3.14159), an interger or floating point number followed by
-- P.3 --
HSPICE Tutorials
an interger exponent(e.g. 1e-14, 2.65e3) or an interger or floating point
number followed by one of the listed as following : scale factors
= 1e-15 = 1e-12 = 1e-9 = 1e-6 FPNU
= 1e-3 = 1e3 = 25.4e-6 = = 1e6 MKMIMEGX
= 1e9 = 1e12 = 20log10 =0.305 GTDBFT(Meters)
7) Any letters that are not and immediately follow an entry scale factors
number are ignored, with the exception of or . OI
8) 10=10amps=10V=10Hz, and 1Mamps=1Msec=1Mhenry.
9) Unit => Resistor (ohm), Capacitor (farad), Inductor (Henry), Voltage
(volt), Current (ampere), Length (meter), Time (second), Frequency
(Hertz), Temperature (degree Centigrade, unless specified as Kelvin). 10) The voltage or current output varaible, outvar, is denoted as V(node) or
I(element) respectively. Voltage difference between two nodes is de-
noted as V(node1, node2).
11) Current is assumed to flow in the direction of voltage drop for nodal
voltage and branch current.
12) Quotation marks must be used to specify an algebraic equation. Both
single(' ') and double(" ") quotation marks can be used.
J = A+B*C , K = 2*J . ''""
13) Upper and lower case is ignored except as filenames on UNIX. 14)The input file cannot contain lines with more than 80 columns (72 better). 15) Except first line, , and last line, , the order of the remaining Title.END
lines is arbitrary (except, of course, that continuous lines must immedi-
ately follow the line being continued).
6. Major Control Statements:
1) options .OPTION
options :
Cause accounting and run time statistics to be ACCT
printed at the end of the run.
Stops the transient analysis when all the , AUTOSTOPRISE
and specified in the measure FALLDELAYS
statements are calculated.
Causes an element summary listing of the input LIST
data to be printed.
Causes a nodal cross-refrence table to be printed. NODE
Supresses the printout of model parameters. NOMOD
-- P.4 --
HSPICE Tutorials
Supresses page ejects for title headings. NOPAGE
Enables output of HSPLOT postprocessor files. POST
Limits the postprocessor output to just the PROBE
// variables. PRINTPLOTMEAS
= Search a directory for subcircuits that are refer-SEARCH
'directory' enced in the input netlist file, but are not defiened
in the input netlist file. It searches the directory
specified for files suffixed with and inserts .inc
them into netlist file, if they match.
Stops printback of the data file until a BRIEF.OPTION
or the statement is encountered. BRIEF=0.END
It also resets the options and . LISTNODE
Prints table of single plate nodal capacitance for CAPTAB
diodes, BJTs, MOSFETs, JFETs and passive
capacitors at each operating point.
2) [Any comment] .END
Terminates input netlist file.
3) (node1)=val1 [ (node2)=val2 ... ] .ICVV
Sets initial values of the nodes.
4) (node1)=val1 [ (node2)=val2 ... ] .NODESETVV
Seting the nodes to values that are close to the actual DC operating
point solution enhances the convergent properties of simulation.
5) parname=val1 [ parname2=val2 ... ] .PARAM
Parameterize input element, source, and model data ... etc. The val
can be a algebraic expression.
6) node1 [ node2 ... ] .GLOBAL
Assign a common node name to subcircuit nodes.
7) [filepath] filename.ext .INCLUDE''
Includes the named file in the netlist file when the simulation is run.
8) temprature .TEMP
Set the enviroment temprature in simulation.
-- P.5 --
HSPICE Tutorials
7. Analysis Types:
1) .OP
-- Computes and prints operating point.
var1 start1 stop1 incr1 [ var2 start2 stop2 incr2 ] 2) .DC
-- DC sweep analysis.
Examples:
.DC Vin 0.25 5.0 0.25
$ Sweep Vin from 0.25v to 5v by 0.25v increments. .DC Vds 0 5 0.1 Vgs 0 5 1
$ Sweep Vds from 0v to 5v by 0.1 incr. at Vgs of 0, 1, 2, 3, 4, 5v.
.DC TEMP -55 125 25
$ Sweep TEMP from -55C to 125C in 25 degree C increments.
type npoint fstart fstop 3) .AC
-- AC small-signal analysis.
type :
measure frequency increase by decade DEC
measure frequency increase by octad OCT
measure frequency increase linearly LIN
Examples:
.AC DEC 10 1K 100MEG
$ Freq. sweep 10 points per decade for 1kHz to 100MEGHz. .AC LIN 100 1 100hz
$ Linear sweep 100 points from 1Hz to 100Hz.
tincr1 tstop1 [ tincr2 tstop2 ... ] [ = val ] 4) .TRANSTART
-- Transient analysis.
Examples:
.TRAN 1ns 100ns
$ Transient analysis is made from 0 to 100ns and printed per 1ns.
.TRAN 0.1ns 25ns 1ns 40ns START = 10ns $ Calculation is made every 0.1ns for the first 25ns, and then every 1ns until
40ns. The printing and plotting begin at 10ns.
-- P.6 --
HSPICE Tutorials
8. Source Statements:
1) string n+ n- [[=] dcval] [tranfun] [[=acmag] acphase] VDCAC
-- Independent voltage source. Where n+, n- are the positive and negative output nodes.
2) string n+ n- [[=] dcval] [tranfun] [[=acmag] acphase] IDCAC
-- Independent current source. Where n+, n- are the positive and negative output nodes.
tranfun:
( V1|I1 V2|I2 [ td [ t1 [ t2 [ pw [ period ] ] ] ] ] ) PULSE
-- Pulse periodic waveform.
Volt
V2
V1
Timetdt1pwt2
period
( t1 v1 [ t2 v2 [ t3 v3 [ ... ] ] ] [ ] ) PWLR
-- Piece-wise linear waveform. Where means that the waveform is repeated. 'R'
Volt
V3
V4
V5
V2
V1
Time
t1t2t3t4t5
[ ] ] ] ] ) ( Voffset Vamp [ freq [ td [ SIN,,
-- Sinusoidal waveform. Where the function is :
0Voffsetttd,,,,Vt(),,,,()ttd,,VoffsetVampefreqttdtdttstop,,,,,**sin{[*()/]},2360,,,
-- P.7 --
HSPICE Tutorials
3) string n+ n- nc+ nc- Vgain [ = val ] [ = val ] EMAXMIN
-- Voltage control voltage source (VCVS).
Where n+, n- are the positive and negative output nodes;
nc+, nc- are the positive and negative nodes of the controlling voltage.
4) string n+ n- Vname Igain [ = val ] [ = val ] FMAXMIN
-- Current control current source (CCCS).
Where n+, n- are the positive and negative output nodes;
Vname is the element whose current is the controlling one.
5) string n+ n- nc+ nc- Ggain [ = val ] [ = val ] GMAXMIN
-- Voltage control current source (VCCS).
Where n+, n- are the positive and negative output nodes;
nc+, nc- are the positive and negative nodes of the controlling voltage.
6) string n+ n- Vname Rgain [ = val ] [ = val ] HMAXMIN
-- Current control voltage source (CCVS).
Where n+, n- are the positive and negative output nodes;
Vname is the element whose current is the controlling one.
9. Element Statements:
SPICE allows the following key types of elements : 1) string n+ n- Rval R
-- Resistor.
2) string n+ n- Cval [ =Vval ] CIC
-- Capacitor.
3) string n+ n- Lval [ =Cval ] LIC
-- Inductor.
4) string n+ n- mname [ =val ] [] [ =vd ] [=val] DAREAOFFICM
-- Diode.
mname: the model name of the diode in library.
M=val: the number of device paralleled. 5) string nc nb ne [ns] mname [ =val ] [ =val ] QAREAAREAB
+[ =val ] [ =val ] [ =val ] [=val] [] AREACVBEVCEMOFF
-- Bipolar junction transistor (BJT). 6) string nd ng ns [nb] mname [ =val ] [ =val ] [ =val ] JLWVDS
+[ =val ] [=val] [] VGSMOFF
-- Junction field effect transistor (JFET). 7) string nd ng ns [nb] mname [ =val ] [ =val ] [ =val ] MLWAD
+[ =val ] [ =val ] [ =val ] [ =vds,vgs,vbs ] [=val] ASPDPSICM
-- MOSFET.
-- P.8 --
HSPICE Tutorials
10. MODEL Statement:
mname type [ parname1=val1 parname=val2 ... ] .MODEL
mname The model name reference. Elements must refer to the model
by this name.
Type Select the model type. Avaliable types are , , , , , RCLDAMP
, , , , , and . NPNPNPNMOSPMOSNJFPJF
Parnames The parameter names. They must be assigned from the list of
parameter names for the appropriate model type.
statement defines the semiconductor component's parameters .MODEL
needed in simulation. These parameters are often given by the foundry, so
that the circuit designers don't have to waste time on measuring these para-
meters.
Examples:
M1 D G S B NCH W=2u L=1u
.MODEL NCH NMOS WMIN=1.5u WMAX=3u LMIN=0.8u LMAX=2u
11. Library Statements:
1) Library Call :
[filepath] filename.ext entryname .LIB''
2) Library Definition :
entryname1 .LIB
Any valid set of HSPICE statements.
entryname1 .ENDL
entryname2 .LIB
Any valid set of HSPICE statements.
entryname2 .ENDL
(continued)
Libraries can be built using the statement in a library file. For each .LIB
library macro, the statement begins the library macro, and .LIB
the statement ends it. .ENDL
-- P.9 --
HSPICE Tutorials
12. Subcircuit/Macro Statements:
1) Subcircuit/Macro Call :
string n1 [ n2 ... nN ] subname [ parname=val ... ] X
2) Subcircuit Definition :
subname n1 [ n2 ... ] [ parname=val ... ] .SUBCKT
subcircuit netlist descriptions
[ subname ] .ENDS
parname=val --- Set the parameter "parname" to a value.
3) Macro Definition :
subname n1 [ n2 ... ] [ parname=val ... ] .MACRO
subcircuit netlist descriptions
[ subname ] .EOM
◎ In subcircuit, all nodes are except strictly localGROUND NODE (0)and nodes specified in statement. .GLOBAL
Examples :
.PARAM VCC=5V
.GLOBAL VCC
X1 1 2 invsub mult=3
.....
.SUBCKT invsub IN OUT MULT=1 M1 OUT IN VCC VCC P W=4u L=2u M=mult
$ M gets 3 from Call
M2 OUT IN 0 0 N W=4u L=2u M=mult C1 OUT 99 10p
$ Node 0 not mentioned in CALL, Node 99 is local.
R1 99 0 10
.ENDS
$ output variables
.PRINT I( X1.M1 )
.PRINT V( X1.99 )
.PRINT V( 1 )
$ Since IN and OUT have been replaced by nodes 1 and 2, respectively.
.END
-- P.10 --
HSPICE Tutorials
13. ALTER Statement:
.ALTER
Circuit/analysis/parameter redefinition
.ALTER
Circuit/analysis/parameter redefinition
.
.
.
.END
specifies that a simulation be rerun several times using different .ALTER
circuit topologies, models, library components, elements, parameter values, test vectors, source stimulus (must parameterize), analysis variables and print/plot commands (must parameterize).
14. Output Format:
◎ The valid output variable, outvar, format has described a little in Section
5. Nodes or element within an subcircuit are indicated with an associ-
ated full name such as stringnode. e.g., indicates the node X.X12.9999
in subcircuit . X12
1) outvar1 [ outvar2 ... outvar32 ] .PRINTDC|AC|TRAN
-- Prints output variable to output file or line printer.
Examples :
.PRINT tran V(4) I(vin) par( ' V(out)/V(in) ' )
$ Print results of transient analysis for nodal voltage named 4, current through
voltage source named vin, and the ratio of the nodal voltage at node 'out' and 'in'.
.PRINT AC VM(4,2) VR(7) VP(8,3) Ii(R1)
$ Print AC magnitude of the voltage difference between nodes 4 and 2, real part
of the AC voltage between nodes 7 and ground. VP is phase difference between
nodes 8 and 3. Ii is the imaginary part of the current through element R1.
2) outvar1 [ outvar2 ... outvar32 ] .PLOTDC|AC|TRAN
-- Plots output variable to output file or line printer.
-- P.11 --
HSPICE Tutorials
3) measure_name .MEASDC|AC|TRAN
+ outvar1 =trig_val [=td] [#crosses] TRIGVALTDCROSS=
+ [=#rises] [=#falls] RISEFALL
+ outvar2 =trig_val [=td] [=#crosses] TARGVALTDCROSS
+ [=#rises] [=#falls] RISEFALL
-- Measure rise, fall and delay time.
Examples :
.MEAS TRAN tphl TRIG V(in) VAL=2.5V RISE=1
+ TARG V(out) VAL=2.5V FALL=1
.MEAS TRAN tperiod TRIG V(in) VAL=2.5V CROSS=1
+ TARG V(in) VAL=2.5V CROSS=3
Volt
5VV(in)
0V
5VV(out)
0VTimetphl
tperiod
4) measure_name .MEASDC|TRAN|ACAVG|MAX|MIN|PP|RMS+ outvar [ =value ] [ =value ] FROMTO
-- Measure Average, MAX, MIN, Peak to Peak, and RMS value.
Examples :
.MEAS DC Imax MAX I(RL)
$ Measure the maximum current in RL.
5) measure_name .MEASDC|TRAN|AC
+ [ outvar1] outvar2=val (or outvar3) [=td] FINDWHENTD
+ [=#crosses] [=#rises] [=#falls] CROSSRISEFALL
-- Measure data at some point.
Examples :
.MEAS DC Iddq FIND I(M1) WHEN V(in)=5v CROSS=1
$ Measure the current in M1(PMOS) when it is off.
6) measure_name .MEASDC|TRAN|AC
+ =algebraic expression PARAM''
-- Calculate algebraic equation.
-- P.12 --
HSPICE Tutorials
15. HSPLOT Postprocessor:
1) After running , filename will be generated with HSPICE.tr0/sw0/ac0
respect to the analysis types . If multiple TRAN/DC/AC.ALTER
statement had invoked in netlist file, the additive corresponding files,
named filename ... filename., will be gen-.tr1/sw1/ac1trN/swN/acN
erated.
2) Before running , make sure that the HSPLOT"setenvDISPLAY
Local_ip_address has be executed. (You can type : 0.0""ypcat hosts |
hostname" in local station to get your Local_ip_address) grep
3) For transient analysis, type filename then an interactive "hsplot.tr0"
menu shows up.
4) After entering graphic mode, type to invoke print command then 'p'
select (laser) to generate a filename in PostScript format. '1'.gr0
5) In local station, get the filename file from remote shell by utility, .gr0ftp
then type filename(in ED415) to make a hardcopy. If "lpr -Pslw.gr0"
your account is in Computer Center, type filename, "lpr -Plaser.gr0"
then you can get your graph in the service counter.
6) By the way, a more convenient tool named is avaliable now. You GSI
can try to use it. Just type and enjoy it. "gsi"
16. Some Suggestions:
1) In general, the size of files is relatively very large so that the .trx
personal disk quotas may not enough to save your files. Conse-.trx
quently the limitation may cause HSPICE's work to be blocked. To solve
this situation, a solution is to involving the option in PROBE.OPTION
statement to efficiently reduce the size of . .trx
2) Use that associates with to speed up your analysis. .ALTER.PARAM
3) If circuit contains any Bi-stable, Mono-stable or Astable subcircuit,
use to help the operating point computation converges. .NODESET
4) For easily distinguishing individual curves, change the plot symbol
frequency () in the main menu of HSPLOT to get a suitable interval f
among symbols.
-- P.13 --
HSPICE Tutorials
5) For measuring branch current of appropriate device, insert a dummy
voltage source with into branch so that the branch current can be value 0
gotten, on HSPLOT, by measuring the corresponding current flowing
through the dummy voltage source.
17. Further Reading:
1) "HSPICE User's Manual H9001", Meta-Software, California, 1990.
2) "HSPICE Training Manual", CIC.
3) Paul W. Tuinenga. "SPICE - A Guide to Circuit Simulation & Analysis
Using PSPICE", 2nd Edition, Printice-Hall, New Jersey, 1992.
-- P.14 --
本文档为【hspice 教程】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。