Example: air traffic controller

spice - Cal Poly Pomona

1 ECE 220introduction tospicesource filesECE 220 - Electronic Devices and CircuitsPhyllis R. 2 The Input (*.cir) FileInpspice, this file must be named<filename>.cir. The source file for any version ofspicehas the following STATEMENTSANALYSIS COMMANDSOUTPUT points: The first line of this file is used as a title on output files. It isnot included in the circuitdescription. A common and frustrating error is caused by omitting the title. The file must end with the by a newline. Comment entire lines by beginning them with * or the rest of aline by using a ; Continue a statement on a new line with + ECE 220 - Electronic Devices and CircuitsPhyllis R. 3 The Circuit DescriptionA circuit description inspice, which is frequently called anetlist, consists of a statementdefining each circuit are described by naming nodes.

220-spice-notes.tex Page 3 The Circuit Description A circuit description in spice, which is frequently called a netlist, consists of a statement defining each circuit element. Connections are described by naming nodes.

Tags:

  Spices

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of spice - Cal Poly Pomona

1 1 ECE 220introduction tospicesource filesECE 220 - Electronic Devices and CircuitsPhyllis R. 2 The Input (*.cir) FileInpspice, this file must be named<filename>.cir. The source file for any version ofspicehas the following STATEMENTSANALYSIS COMMANDSOUTPUT points: The first line of this file is used as a title on output files. It isnot included in the circuitdescription. A common and frustrating error is caused by omitting the title. The file must end with the by a newline. Comment entire lines by beginning them with * or the rest of aline by using a ; Continue a statement on a new line with + ECE 220 - Electronic Devices and CircuitsPhyllis R. 3 The Circuit DescriptionA circuit description inspice, which is frequently called anetlist, consists of a statementdefining each circuit are described by naming nodes.

2 (The usual namesare actually numbers.) Onenode name has a defined 0 is ground!The format of an element description is<letter> <name> <n1> <n2> ..[mname] [parvals]where<..>must be present and[..]is optional. <letter>is a single letter denoting the component type <name>is a unique alpha-num combination describing the particular instance of thiscomponent <ni>is the name of a node [mname]is the (optional) model name [parvals]are (sometimes optional) parameter valuesECE 220 - Electronic Devices and CircuitsPhyllis R. 4 Sign ConventionsTwo-terminal elements (including sources!) assume the load sign conventionI+-VThe powerP=IVassociated with an element is positive when the sources delivering negative 220 - Electronic Devices and CircuitsPhyllis R.

3 5 Passive ElementsThe<letter>that begins an element instance denotes the circuit element. The passiveelements areRorrfor resistors,Lorlfor inductors, andCorcfor <letter>is followed by a unique instance name and then (in order) the nodesassociated with + and - voltage and the value of the associated parameter (R,L, orC).Examples: R1 5 0 20k cload nIN GND 250pF L4 122 21 4mHECE 220 - Electronic Devices and CircuitsPhyllis R. 6 Powers of TenThe following abbreviations for powers of ten are recognized (10 3inch)10 1510 1210 910 610 310+310+610+910+ 10 6 Once a valid suffix is read,spiceignores following letters. Thus10pF,10pAmps, and10psecall simply represent the value10 used to convert distances in thousands of an inch, sincespiceuses metric 220 - Electronic Devices and CircuitsPhyllis R.

4 7 Independent SourcesV<name> <n+> <n-> [type] <val>defines an independent voltage source with its + terminal at noden+and its - node at <name> <n+> <n-> [type] <val>defines an independent current source whose current flows through the source from noden+ : Vdd 4 0 5defines a5V source with the + terminal connected at node 4 and the -terminal connected at node 0 (ground) ibias 18 4 DC 15m V2 3 0 25V(spicerecognizes the common abbreviations for units, which helpstomake source files more easily understood by humans.)The optionaltypeargument will be described in the analysis 220 - Electronic Devices and CircuitsPhyllis R. 8 Voltage-Controlled Dependent SourcesThe voltage-controlled dependent sources are defined usingstatements of the form<letter> <name> <nout+> <nout-> <nc+> <nc-> <gain>or<letter> <name> <nout+> <nout-> (<nc+>,<nc->) <gain>whereEis a voltage-controlled voltage source,Gis a voltage-controlled current source, theoutput voltage is connected between nodesnout+andnout-, and the control voltage ismeasured at nodenc+with respect to : Ex 5 1 4 3 10defines a voltage source that makes node 5 a voltage10(v4 v3)above the voltage at node 1 G1 2 1 (5,8) 50mdefines a current source connected between node 2 (the + node)and node 1 and supplying a current50mf(v5 v8)ECE 220 - Electronic Devices and CircuitsPhyllis R.

5 9 Current-Controlled Dependent SourcesThe current-controlled dependent sources are defined by statements of the form<letter> <name> <nout+> <nout-> <vcontrol> <gain>whereFis a current-controlled current source,His a current-controlled voltage source, and theoutput current source is connected between nodesnout+andnout-, with positive currentflowing through the source from nodenout+tonout-. The control current flows from thepositive node of the sourcevcontrolthrough the source and out the negative : Fds 11 9 Vsens a current source connected from node 11 to node 9that generates a the current flowing through the sourceVsens. H1 30 20 v5 100kdefines a voltage source connected from node 30 to node 20 andsupplying a voltage100k times the current through the is frequently necessary to add a voltage source with value0V to the circuit to sensethe control current for these sources!

6 ECE 220 - Electronic Devices and CircuitsPhyllis R. 10 DiodesDiodes are defined using two statements. The netlist definition is of the formD<name> <n+> <n-> <model-name>Example:D1 4 2 my-diodecorresponds toD142 The<model-name>must be defined using <model-name> D ( [parameter = value] ..)Continuing the above example,.MODEL my-diode D ( IS= N= )whereISis the saturation current andNis the ideality factor (sometimes called the emissioncoefficient). There are approximately 30 parameters which can be specified for diodes. Those notexplicitly specified have default 220 - Electronic Devices and CircuitsPhyllis R. 11 Useful Diode Model parametersParameterDescriptionUnitsDefau ltISReverse saturation currentAmp10 14 XTIT emperature exponent of IS3 NIdeality factor (emission coefficient)1 BVReverse breakdown knee voltageVolt RSParasitic series resistanceOhm0 CJOZero-bias junction capacitanceFarad0 ECE 220 - Electronic Devices and CircuitsPhyllis R.

7 12 Bipolar Junction TransistorsThe BJT also requires both a netlist statement and A BJT is included in the netlistwith a statement of the formQ<name> <nc> <nb> <ne> <model-name>where the collector is connected at nodenc, the base at nodenb, and the emitter at :Q3 6 3 0 my-npncorresponds to630Q3 Themodel-nameis defined <model-name> <npn | pnp> ( [parameter = value] ..)Continuing the example,.MODEL my-npn npn ( BF = 175 IS=1e-17 VA=75 BR=2 )whereBFis the forward ,ISis the saturation current,VAis the Early voltage, andBRis thereverse . There are approximately 60 parameters for 220 - Electronic Devices and CircuitsPhyllis R. 13 MOSFETsThe BJT again requires both a netlist statement and A MOSFET is included in thenetlist with a statement of the formM<name> <nd> <ng> <ns> <nb> <model-name> [L=value] [W=value]where the drain, gate, source, and body are connected at nodesnd,ng,ns, andnbrespectively.

8 The lengthLand widthWare :Md 4 3 2 10 my-pmos L= W=4ucorresponds toVdd10432 MdL= defined <model-name> <nmos | pmos> ( [parameter = value] ..)Continuing the example,.MODEL my-pmos pmos ( VTO= KP=5e-4 LAMBDA= )whereVTOis the threshold voltage,KPis the transconductance parameter, andLAMBDA isthe channel-length modulation 220 - Electronic Devices and CircuitsPhyllis R. 14 SubcircuitsA subcircuit simplifiesspicenetlists by allowing re-use of a set of circuit elements. Thesyntax isSUBCKT <SubName> <N1> <N2> ..ENDSTheSubNameis the name used to reference the subcircuit, and the nodes are the internalnode numbers used to connect to the subcircuit can contain anyspicenetlist statements, andother elements, nodes, models, subcircuits, or definitions inthe subcircuit are completely local tothe 220 - Electronic Devices and CircuitsPhyllis R.

9 15 Vdd123+ vinRload+ Xinv1 Xinv230102040* subcircuit inverter 1 2 3* input | |* output |* dc supplymp 2 1 3 3 mypmosmn 2 1 0 0 mypmos pmos( .. ).model mynmos nmos( .. ).endsVdd 30 0 dc 10 0 dc 0 VXinv1 10 20 30 inverterXinv2 20 40 30 inverterRload 40 0 vin 0 220 - Electronic Devices and CircuitsPhyllis R. the small-signal response as a function of frequency. The command <type> <npts> <f-start> <f-end>where<type>is one ofLIN(linear sweep) The analysis is repeated at<npts>linearly-spaced frequencies starting at<f-start>and ending at<f-end>.DEC(log sweep by decades) The analysis is repeated at frequencies starting with<f-start>and ending with<f-end>. The frequencies are equally-spaced on alog10scale with<npts>per (log sweep by octaves) The analysis frequencies start at<f-start>and end with<f-end>, with<npts>points per source whose frequency is swept has atypedesignationACincluded in its 220 - Electronic Devices and CircuitsPhyllis R.

10 Circuitr1 1 2 10kc1 2 0 1nvin 1 0 ac 1 dc dec 10 .01 220 - Electronic Devices and CircuitsPhyllis R. the DC voltages and currents in a circuit for a range of values of a chosenvariable or variables. has three [LIN] <var1> <s1> <e1> <d1> [<var2> <s2> <e2> <d2>]sweepsvar1froms1toe1with a linear incrementd1. If the second set of values is present,the entire first analysis will be done for each value <DEC | OCT>] <var1> <s1> <e1> <np1> [<var2> ..]does a log sweep, adjustingvar1froms1toe1in decades (DEC) or octaves (OCT) withnp1points per interval. If the second set of values is present, the entire first analysis will be done foreach value <var1> LIST <val1> <val2> [..] [<var2> ..]performs the analysis for a list of values.


Related search queries