Professional Documents
Culture Documents
Tutorial PDF
Tutorial PDF
#Introduction
16
18
24
29
#Example 4: AC Analysis
34
#Example 5: Subcircuits
39
45
51
56
61
(continued)
Contents
Help
14
64
68
72
#Design Examples
76
Contents
Help
15
Introduction
Introduction
This tutorial provides a hands-on introduction to the integrated components of
the T-Spice Pro circuit analysis suite.
The tutorial examples follow a standard format, involving sample files (included
upon installation) of various types:
Simulation output files (.out) containing the numerical results of the circuit
analyses, for manipulation and display by W-Edit Waveform Viewer.
T-Spice Pros waveform probing feature integrates S-Edit, T-Spice, and W-Edit
to allow individual points in a circuit to be specified and analyzed (see
Waveform Probing on page 84).
Launch T-Spice.
Contents
Help
16
Introduction
Use File > Open to open the specified SPICE (.sp) file.
In the Run Simulation dialog, under Waveform options choose Show during.
Contents
Help
17
invert1.sdb
Input
invert1.sp
Output
invert1.out
Contents
Help
18
Schematic
Contents
Help
19
When the schematic is exported as a SPICE netlist (T-Spice input file), this
module becomes the .op command.
Similarly, module MOSFET_P has the property
[SPICE OUTPUT=M# %{D} %{G} %{S} %{B} ${model} L=${L} W=${W}
AD=${AD} PD=${PD} AS=${AS} PS=${PS}]
The variables prefixed by % are replaced by the appropriate node names, and the
variables prefixed by $ are replaced by the appropriate (numerical or string)
values (also specified as properties), in the exported netlist. Property values
specified when the module is instanced take precedence over default values: in
this case, the default values for the transistors width and length are 22u and 2u,
respectively, but these are overridden by the specifications W=12u and L=5u at
the level of this modules instancing in module invert1.
Input
c2 out Gnd 800ff
.include ml2_125.md
Contents
Help
20
A capacitor c2 (signified by the key letter c), connecting nodes out and GND, is
defined, with a capacitance of 800 femtofarads. (Strictly speaking, the capacitor
could be omitted from the circuit for this example, since it does not affect the DC
operation of the inverter.)
The .include command causes T-Spice to read in the contents of the model file
ml2_125.md for the evaluation of transistors m1n and m1p. This file (which
must be in the same directory as invert1.sp) consists of two .model commands,
describing two MOSFET models called nmos and pmos:
.model nmos nmos
+ Level=2
+ Nsub=1.066E+16
+ Gamma=.639243
+ Uexp=4.612355E-2
+ Vmax=177269
+ Nfs=4.55168E+12
+ Tpg=1.000
+ Cgdo=2.89E-10
+ Cjsw=1.74E-10
Contents
Ld=0.0u
Vto=0.622490
Phi=0.31
Ucrit=174667
Xj=.9u
Neff=4.68830
Rsh=60
Cj=3.27E-04
Mjsw=0.195
Help
Tox=225.00E-10
Kp=6.326640E-05
Uo=1215.74
Delta=0.0
Lambda=0.0
Nss=3.00E+10
Cgso=2.89E-10
Mj=1.067
21
Ld=.03000u
Vto=-0.63025
Phi=.541111
Ucrit=637449
Xj=0.112799u
Neff=0.64354
Rsh=150
Cj=4.75E-04
Mjsw=.307
Tox=225.000E-10
Kp=2.635440E-05
Uo=361.941
Delta=0.0
Lambda=0.0
Nss=3.00E+10
Cgso=3.35E-10
Mj=.341
Two transistors, m1n and m1p, are defined in invert1.sp. These are MOSFETs,
as indicated by the key letter m which begins their names. Following each
transistor name are the names of its terminals. The required order of terminal
names is: draingatesourcebulk. Then the model name ( nmos or pmos in this
example), and physical characteristics such as length and width, are specified.
The .op command performs a DC operating point calculation and writes the
results to the file specified in the Simulate > Start Simulation dialog.
Two voltage sources are defined: Vdd, which sets node Vdd to 3.0 volts relative
to system ground, and vin, which sets node in to 1.0 volt relative to ground.
Contents
Help
22
Output
The output file lists the DC operating point information for the circuit described
by the input file (in addition to comments of various kinds, not shown here).
DC ANALYSIS
v(out) =
v(in)
=
v(Vdd) =
i(Vdd) =
i(vin) =
2.9309e+00
1.0000e+00
3.0000e+000
-5.8215e-006
0.0000e+000
Contents
Help
23
invert2.sdb
Input
invert2.sp
Output
invert2.out
Contents
Help
24
Schematic
Contents
Help
25
Input
.include ml2_125.md
m1n out in GND GND nmos l=5u w=8u
m1p out in vdd vdd pmos l=5u w=12u
c2 out GND 800ff
vdd vdd GND 3.0
vin in GND 1.0
.dc vin 0 3 0.02 vdd 2 4 0.5
.print dc in out
Contents
Help
26
The .dc command ignores the values assigned to the voltage sources vdd and vin
in the voltage source statements, but they must still be declared in those
statements.
The results for nodes in and out are reported by the .print dc command to the
specified destination.
Contents
Help
27
Output
c:\tspro\tutorial\invert2.out
4.0
v(in),0
v(in),1
v(in),2
v(in),3
v(in),4
3.5
Volt (V)
3.0
2.5
2.0
1.5
1.0
0.5
0.0
00
05
10
15
20
25
30
4.0
v(out),0
v(out),1
v(out),2
v(out),3
v(out),4
3.5
Volt (V)
3.0
2.5
2.0
1.5
1.0
0.5
0.0
0.0
0.5
1.0
1.5
2.0
2.5
3.0
vin (V)
Contents
Help
28
invert3.sdb
Input
invert3.sp
Output
invert3.out
Contents
Help
29
Schematic
Contents
Help
30
Input
.include ml2_125.md
m1n out in GND GND nmos l=5u w=8u
m1p out in vdd vdd pmos l=5u w=12u
c2 out GND 800ff
vdd vdd GND 3.0
vin in GND PWL(0ns 0V 100ns 0V 105ns 3V 200ns 3V 205ns 0V
300ns
+ 0V 305ns 3V 400ns 3V 405ns 0V 500ns 0V 505ns 3V 600ns 3V)
.tran 2n 600n
.print tran in out
This circuit is identical to that of Example 1, except that voltage source vin,
instead of setting the voltage between nodes in and GND at a constant value, here
generates a piecewise linear waveform input (indicated by the keyword PWL) to
in.
The successive legs of the waveform are delimited by the corners, whose times
and voltages are specified in the arguments to PWL. Between 0 and 100
nanoseconds, the voltage at in is zero; between 100 and 105 nanoseconds, the
voltage is linearly interpolated (ramps up) between 0 and 3; between 105 and 200
nanoseconds, the voltage stays at 3; and so on.
The parameters of the device statement that defines vin are continued to the next
line with the + character in the first column.
Contents
Help
31
Contents
Help
32
Output
c:\tspro\tutorial\invert3.out
v(in)
3.0
Volt (V)
2.5
2.0
1.5
1.0
0.5
0.0
0
50
100
150
200
250
300
350
400
450
500
550
v(out)
3.0
Volt (V)
2.5
2.0
1.5
1.0
0.5
0.0
0
50
100
150
200
250
300
350
400
450
500
550
Time (ns)
Contents
Help
33
Example 4: AC Analysis
Example 4: AC Analysis
AC analysis characterizes the circuits behavior dependence on small-signal
input frequency. It involves three steps: (1) calculating the DC operating point;
(2) linearizing the circuit; and (3) solving the linearized circuit for each
frequency.
Example 4 involves a standard operational amplifier, consisting of seven
MOSFETs (four n-channel and three p-channel) and two capacitors.
Schematic
opamp.sdb
Input
opamp.sp
Output
opamp.out
Contents
Help
Example 4: AC Analysis
Schematic
Contents
Help
Example 4: AC Analysis
Input
.include ml2_125.md
mn1 vn1 vbias GND GND nmos l=10u w=6u
mn2 vm1 in1 vn1 GND nmos l=6u w=6u
mn3 vf1 in2 vn1 GND nmos l=6u w=6u
mp1 vm1 vm1 Vdd Vdd pmos l=6u w=6u
mp2 vf1 vm1 Vdd Vdd pmos l=6u w=6u
mn4 out vbias GND GND nmos l=10u w=6u
mp3 out vf1 Vdd Vdd pmos l=6u w=20u
cout out GND 2pf
ccomp vf1 out 2pf
vin1 in1 GND 2
Vdd Vdd GND 5.0
vbias vbias GND 0.8
vdiff in2 in1 -0.0007 AC 1 90
.ac DEC 5 1 100MEG
.print ac vdb(out)
.print ac vp(out)
.acmodel opamp1m.out {*}
vdiff sets the DC voltage difference between nodes in2 and in1 to 0.0007
Contents
Help
Example 4: AC Analysis
Output
The output file opamp1m.out lists small-signal data for all relevant devices.
Contents
Help
Example 4: AC Analysis
c:\tspro\tutorial\opamp.out
vdb(out)
150
100
(dB)
50
0
-50
-100
-150
10
100
1E3
1E4
1E5
1E6
1E7
vp(out)
150
100
(deg)
50
0
-50
-100
-150
10
100
1E3
1E4
1E5
1E6
1E7
Frequency (Hz)
Contents
Help
Example 5: Subcircuits
Example 5: Subcircuits
Subcircuit definitions allow arbitrarily complex arrangments of nodes and
devices to be easily reused multiple times in a circuit.
Example 5 uses a NAND gate to illustrate the use of subcircuit definitions and
subcircuit parameters.
Schematic
nandgate.sdb
Input
nandgate.sp
Output
nandgate.out
Contents
Help
39
Example 5: Subcircuits
Schematic
Contents
Help
40
Example 5: Subcircuits
Input
.include ml2_125.md
.subckt NAND in1 in2 out Vdd length=5u nwidth=10u pwidth=10u
mt1 out in1 n1 GND nmos l='length' w='nwidth'
mt2 n1 in2 GND GND nmos l='length' w='nwidth'
mt3 out in1 Vdd Vdd pmos l='length' w='pwidth'
mt4 out in2 Vdd Vdd pmos l='length' w='pwidth'
.ends
xnand1 a b outab Vdd NAND nwidth=8u pwidth=12u
vvdd Vdd GND 5.0
.ic nand1.n1=2V
va a GND PWL(0ns 0V 100ns 0V 105ns 5V 200ns 5V 205ns 0V
+ 300ns 0V 305ns 5V 400ns 5V 405ns 0V 500ns 0V 505ns 5V
+ 600ns 5V)
vb b GND 5
.print tran a outab nand1/n1
.op
.tran 1n 600n
Contents
Help
41
Example 5: Subcircuits
instances. Parameter values specified in the definition are used as defaults when
not specified in instances.
Within the subcircuit definition, four MOSFETs are defined in the usual manner
(and in these statements the order of terminals is important: draingatesource
bulk). Node n1 is the source of transistor mt1 and the drain of transistor mt2.
Subcircuit parameters, enclosed by single quotes, are used in place of numerical
values.
The subcircuit definition must be terminated by the .ends command. It is a
common mistake to omit this line accidentally.
After the subcircuit is defined, an instance of the subcircuit is created. The
instance statement begins with the key letter x, but the name of the instance (by
which it is to be identified in the rest of the input file) is nand1, not xnand1.
The list of terminals on the instance statement must have the same order as on the
first line of the subcircuit definition: a b outab Vdd (instance) corresponds to in1
in2 out Vdd (definition). The next argument of the instance statement is the
original subcircuit name (NAND).
Two of the default subcircuit parameter values, as originally specified by the
definition, are overriden by instance-specific assignments. These assignments
may appear in any order. The parameter omitted from the instance statement
(length) retains its default value.
Contents
Help
42
Example 5: Subcircuits
Initial conditions on node voltages and currents can be set for the purposes of
computing the DC operating point. The .ic command sets node nand1/n1 (that is,
node n1 of instance nand1) to 2 volts for the duration of the DC operating point
calculation. When the transient analysis begins, the node will return to a floating
voltage state.
Voltage source va supplies a PWL (piecewise linear) input waveform to node a.
Two analyses are carried out on this circuit: a DC operating point calculation
(.op) and a transient simulation (.tran) with a duration of 600 nanoseconds and a
maximum timestep of 1 nanosecond.
The .print command reports the results of the simulation for the voltages at nodes
a, outab, and nand1/n1.
Contents
Help
43
Example 5: Subcircuits
Output
c:\tspro\tutorial\nandgate.out
v(a)
Volt (V)
4
3
2
1
0
0
50
100
150
200
250
300
350
400
450
500
550
v(outab)
Volt (V)
4
3
2
1
0
0
50
100
150
200
250
300
350
400
450
500
550
v(nand1/nn1)
Volt (V)
4
3
2
1
0
0
50
100
150
200
250
300
350
400
450
500
550
Time (ns)
Contents
Help
44
dlatch.sdb
Input
dlatch.sp
Output
dlatch.out
Contents
Help
45
Schematic
Contents
Help
46
Input
.include ml2_125.md
*** Inverter Subcircuits
.subckt invmod1 in out vdd GND
mn out in GND GND nmos l=5u w=8u
mp out in vdd vdd pmos l=5u w=12u
.ends invmod1
.subckt invmod2 in out vdd GND
mp vdd in out vdd pmos l=5u w=12u
mn GND in out GND nmos l=5u w=8u
.ends invmod2
*** D Latch Circuit
mtg1p n1 phi1 data vdd pmos l=5u w=12u
mtg1n n1 phi2 data GND nmos l=5u w=8u
mtg2p n2 phi2 n1 vdd pmos l=5u w=12u
mtg2n n2 phi1 n1 GND nmos l=5u w=8u
xinv1 n1 n3 vdd GND invmod1
xinv2 n3 n2 vdd GND invmod2
mtg3p n5 phi2 n3 vdd pmos l=5u w=12u
mtg3n n5 phi1 n3 GND nmos l=5u w=8u
mtg4p n4 phi1 n5 vdd pmos l=5u w=12u
mtg4n n4 phi2 n5 GND nmos l=5u w=8u
xinv3 n5 Q vdd GND invmod1
xinv4 Q n4 vdd GND invmod2
cQ Q GND 64ff
cdata data GND 32ff
Contents
Help
47
n1 n3 n5 Q
The first three statements beginning with v define voltage sources for custom
input waveforms. Following each voltage source name are the names of the input
nodes and the type of waveform. Here, however, not piecewise linear but rather
bit waveforms are used. Following the keyword bit in parentheses are the
parameters specifying the waveform characteristics. The four-digit sequence in
curly brackets { } specifies the sequence of the waves states (either 1, on, or 0,
off). This sequence will be repeated until the simulation is complete. The pulse
width (pw) is 2 nanoseconds. The off voltage is zero, the on voltage is 3 volts,
and the rise (rt) and fall (ft) times are each one-quarter of a nanosecond.
Contents
Help
48
Voltage source vdd sets the voltage between power and ground to 3 volts.
The .print command writes the results of the simulation for the voltages at six
nodes to the specified file.
The .tran command instructs T-Spice to perform a 200-nanosecond simulation
while printing node voltages at least every 0.2 nanoseconds.
Contents
Help
49
Output
Volt (V)
c:\tspro\tutorial\dlatch.out
v(phi1)
3
2
1
0
Volt (V)
50
100
150
v(phi2)
3
2
1
0
Volt (V)
50
100
150
v(data)
3
2
1
0
Volt (V)
50
100
150
v(a1)
3
2
1
0
Volt (V)
50
100
150
v(a3)
3
2
1
0
Volt (V)
50
100
150
v(a5)
3
2
1
0
Volt (V)
50
100
150
v(Q)
3
1
0
50
100
150
Time (ns)
Contents
Help
50
ring.sdb
Input
ring.sp
Output
ring.out
Contents
Help
51
Schematic
Contents
Help
52
Input
.include ml2_125.md
.subckt inv in out Vdd
mt1 out in GND GND nmos l=5u w=8u
mt2 out in Vdd Vdd pmos l=5u w=12u
c2 out GND 800ff
.ends inv
xinv1 a1 a2 Vdd inv
xinv2 a2 a3 Vdd inv
xinv3 a3 a4 Vdd inv
xinv4 a4 a5 Vdd inv
xinv5 a5 a6 Vdd inv
xinv6 a6 a7 Vdd inv
xinv7 a7 a1 Vdd inv
cinv1 a7 GND 400ff
vdd Vdd GND 3.0
.print tran a1 a2 a7
.tran/powerup 1n 800n
Contents
Help
53
Contents
Help
54
Output
c:\tspro\tutorial\ring.out
v(a1)
3.0
Volt (V)
2.5
2.0
1.5
1.0
0.5
0.0
0
100
200
300
400
500
600
700
v(a2)
3.0
2.5
Volt (V)
2.0
1.5
1.0
0.5
0.0
0
100
200
300
400
500
600
700
v(a7)
3.0
Volt (V)
2.5
2.0
1.5
1.0
0.5
0.0
0
100
200
300
400
500
600
700
Time (ns)
Contents
Help
55
wave.sp
Output
wave.out
Schematic
In addition to illustrating the preview mode, this simple wave circuit
showcases the variety and flexibility of input patterns available to current and
voltage sources in T-Spice.
For a description of this circuit, see Input, below.
Input
r1 n1 GND 2k
r2 n2 GND 2k
r3 n3 GND 2k
Contents
Help
56
r4
r5
r6
r7
r8
r9
v1
+
v2
n4
n5
n6
n7
n8
n9
n1
GND
GND
GND
GND
GND
GND
GND
2k
2k
2k
2k
2k
2k
pwl (0n 0 100n 0 101n 5 300n 5 301n 0
500n 0 680n 5 700n 0 880n 5 900n 0)
n2 GND pwl (0n 0 100n 0 101n 1 200n 1 201n 2 300n 2 301n
3
+
400n 3 401n 4 500n 4 501n 5 600n 5 601n 4
+
700n 4 701n 3 800n 3 801n 2 900n 2 901n 1)
v3 n3 GND sin (2.5 2.5 30MEG 100n)
v4 n4 GND bit ({01010 11011} on=5.0 off=0.0 pw=50n rt=10n
ft=30n)
v5 n5 GND bit ({5(01010 5(1))} pw=10n on=5.0 off=0.0)
.vector bb {n6 n7 n8 n9}
vb bb GND bus ({50(Ah) 30(7d4) 20(1000)} pw=5n on=5.0
off=0.0)
.print tran n1 n2 n3 n4 n5 n6 n7 n8 n9
.tran/preview 1n 1u
Contents
Help
57
Two voltage sources, v1 and v2, generate pwl (piecewise linear) inputs. v1
produces a single pulse followed by a pair of sawtooth cycles, and v2 produces a
staircase waveform which takes 1-volt steps from zero up to 5 volts and back
down to 1 volt.
Voltage source v3 generates a sin (sinusoidal) input. It has an amplitude of 2.5
volts, a frequency of 30 MHz, an offset of 2.5 volts from system ground, and a
time delay of 100 nanoseconds after the start of the simulation before the wave
begins.
Voltage source v4 generates a bit input. Enclosed in curly brackets { } are two
binary-valued five-bit patterns specifying the waveform. The two patterns
alternate in time. The on voltage value is 5.0 volts; the off voltage value is zero.
The pulse width (pw), 50 nanoseconds, is the time the wave is either (ramping up
and) on, or (dropping down and) off. The rise time (rt), 10 nanoseconds, is the
time given for the wave to ramp from off to on; and the fall time (ft), 30
nanoseconds, the time given for the wave to drop from on to off.
Voltage source v5 generates a repeating bit input. Two distinct patterns are given
again, but now multiplier factors are included. The wave consists of two
alternating patterns: the first pattern contains five bits, the second is a single bit.
The five-bit pattern is followed by five successive repetitions of the single-bit
pattern, and this sequence is repeated five times. (The same pattern could be
described by {5(3(01) 4(1))}.) The pulse width and on and off voltages are again
specified, but the rise and fall times take default values.
Contents
Help
58
The .vector command defines the bus waveform generated by voltage source vb.
The command assigns the bus a name (bb) and specifies by name the number of
bits the bus waveform will have (four: n6 through n9). The voltage source
statement, which contains the bus keyword, specifies waveforms with one or
more patterns, along with pulse width and level information. The patterns can be
in binary, hexadecimal, octal, or decimal notation. (For decimal patterns the
number of lower-order bits to be collected is also given.)
The first pattern is Ah (hex) = 1010 (binary). Thus, using the names given on
the .vector command, n6=1, n7=0, n8=1, and n9=0. The pattern is repeated
50 times (that is, maintained for a time period equal to the pulse width
multiplied by 50).
The next pattern is 7d4 that is, 7 (decimal) = 111 (binary), or, to four
lower-order bits, 0111. So n6=0, n7=1, n8=1, and n9=1. The pattern is
repeated 30 times.
The last pattern is 1000 (binary), so n6=1, n7=0, n8=0, and n9=0. The
pattern is repeated 20 times.
The .print command writes the results at the output nodes of all nine voltage
sources.
The .tran preview command reports the input waveforms in place of running the
simulation.
Contents
Help
59
Volt (V
Volt (V)
Volt (V)
Volt (V)
Volt (V)
Volt (V)
Volt (V)
Volt (V)
Volt (V)
Output
c:\tspro\tutorial\wave.out
5.0
v(n1)
2.5
0.0
00
5.0
01
02
03
04
05
06
07
08
09
v(n2)
2.5
0.0
00
5.0
01
02
03
04
05
06
07
08
09
v(n3)
2.5
0.0
00
5.0
01
02
03
04
05
06
07
08
09
v(n4)
2.5
0.0
00
5.0
01
02
03
04
05
06
07
08
09
v(n5)
2.5
0.0
00
5.0
01
02
03
04
05
06
07
08
09
v(n6)
2.5
0.0
00
5.0
01
02
03
04
05
06
07
08
09
v(n7)
2.5
0.0
00
5.0
01
02
03
04
05
06
07
08
09
v(n8)
2.5
0.0
00
5.0
2.5
0.0
0.0
01
02
03
04
05
06
07
08
09
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
v(n9)
Time (us)
Contents
Help
60
opamp2.sdb
Input
opamp2.sp
Output
opamp2.out
Schematic
For a description of this circuit, see Example 4.
Input
.include ml2_125.md
mn1 vn1 vbias GND GND nmos l=10u w=6u
mn2 vm1 in1 vn1 GND nmos l=6u w=6u
mn3 vf1 in2 vn1 GND nmos l=6u w=6u
Contents
Help
61
Contents
Help
62
Volt (V/V)
Volt (uV/Rt(Hz))
Output
c:\tspro\tutorial\opamp2.out
inoise(mag)
onoise(mag)
30
20
10
0
1
10
100
1E3
1E4
1E5
1E6
1E7
1E8
v(out)/vbias
1.5
1.0
0.5
0.0
10
100
1E3
1E4
1E5
1E6
1E7
1E8
dn(mn1,RD)
dn(mn1,RS)
dn(mn1,FN)
Volt (nV/Rt(Hz)
Volt (nV/Rt(Hz)
1
80
80
Volt (kV/A)
Volt (mV/Rt(Hz)
1
400
200
0
-200
-400
300
10
100
1E3
1E4
1E5
1E6
1E7
1E8
dn(mn1,ID)
60
40
20
0
1
10
100
1E3
1E4
1E5
1E6
1E7
1E8
dn(mn1,TOT)
60
40
20
0
1
10
100
1E3
1E4
1E5
1E6
1E7
1E8
dn(mn1,RX)
200
100
0
Volt (mV)
10
100
1E3
1E4
1E5
1E6
1E7
1E8
inoise(total)
onoise(total)
1.0
0.5
0.0
1
10
100
1E3
1E4
1E5
1E6
1E7
1E8
Frequency (Hz)
Contents
Help
63
invert4.sdb
Input
invert4.sp
Output
invert4.out
Contents
Help
64
Schematic
Contents
Help
65
Input
.options deftables=0
.include ml2_125.md
m1n out in GND GND nmos l=5u w=8u
m1p out in vdd vdd pmos l=5u w=12u
c2 out GND 800ff
vdd vdd GND 3.0
vin in GND PWL(0ns 0V 100ns 0V 105ns 3V 200ns 3V 205ns 0V
300ns
+ 0V 305ns 3V 400ns 3V 405ns 0V 500ns 0V 505ns 3V 600ns 3V)
.tran 2n 600n
.print tran in out
This input file is identical to that of Example 1, with one addition: the command
.options deftables=0, which turns off default table generation and causes the
circuit to be simulated by direct evaluation of device models.
Output
Compare invert4.out, obtained using direct model evaluation, to invert1.out,
obtained using internal table-based evaluation. For the inverter or other digital
circuits there will be only slight differences in the results. For analog circuits,
however, there can be greater discrepancies between results from the two
evaluation techniques.
Contents
Help
66
c:\tspro\tutorial\invert4.out
v(in)
3.0
Volt (V)
2.5
2.0
1.5
1.0
0.5
0.0
0
50
100
150
200
250
300
350
400
450
500
550
v(out)
3.0
Volt (V)
2.5
2.0
1.5
1.0
0.5
0.0
0
50
100
150
200
250
300
350
400
450
500
550
Time (ns)
Contents
Help
67
Contents
Help
68
trangm.sp
Output
trangm.out
Input
.include ml5_20.md
mn5 drain gate GND GND nmos l=10u w=6u
vdrain drain GND 5
vgate gate GND 0.85
.dc vgate .5 1.5 0.01
.print dc id(mn5)
.options abstol=1E-14
Voltage source vgate is attached to the gate terminal of the MOSFET mn5 and is
swept from 0.5 to 1.5 volts with the .dc command. Voltage source vdrain is
attached to the drain terminal with a fixed value of 5 volts, which keeps the
transistor well in saturation. The source and bulk terminals are grounded.
Contents
Help
69
The .print dc command reports the current through the drain terminal of mn5.
The .options abstol command changes the absolute value of the current
tolerance that T-Spice uses, so that low-current and subthreshold behavior can be
simulated accurately. The results are quite accurate when T-Spice uses internal
tables (its default simulation technique) to represent the model. More accuracy
can be achieved by defining a larger gridsize (finer resolution for example,
.gridsize mos 500 500 500), or by using direct model evaluation (with the
.options deftables=0 command), but this is not necessary in most cases.
Output
The output is a logarithmic plot of the drain current against the gate voltage. The
logarithm of the current is a straight line for low gate voltages and shows a
smooth transition between low-current exponential behavior and high-current
quadratic behavior.
Contents
Help
70
c:\tspro\tutorial\trangm.out
id(mn5),0
1.0E-6
Current (A)
1.0E-7
1.0E-8
1.0E-9
1.0E-10
0.5
0.6
0.7
0.8
0.9
1.0
1.1
1.2
1.3
1.4
1.5
vgate (V)
Contents
Help
71
transamp.sdb
Input
transamp.sp
Output
transamp.out
Contents
Help
72
Schematic
Contents
Help
73
Input
.include ml5_20.md
mn1 vn1 vbias GND GND nmos l=10u w=6u
mn2 vm1 in1 vn1 GND nmos l=6u w=6u
mn3 out in2 vn1 GND nmos l=6u w=6u
mp1 vm1 vm1 Vdd Vdd pmos l=6u w=6u
mp2 out vm1 Vdd Vdd pmos l=6u w=6u
vin1 in1 GND 2
Vdd Vdd GND 5.0
vbias vbias GND 0.7
vdiff in2 in1 0.0
vout out GND 2.5
.options abstol=1E-14
.dc vdiff -1 1 0.01
.print dc i1(vout)
This circuit is identical to the one described in Example 4, except that the output
stage (inverter) has been removed, and a voltage source has been connected to
the output so that the transconductance characteristics of the amplifier can be
measured.
The .options abstol command changes the absolute value of the current
tolerance that T-Spice uses, so that low-current and subthreshold behavior can be
simulated accurately.
Contents
Help
74
Output
c:\tspro\tutorial\transamp.out
i1(vout),0
Current (nA)
2
1
0
-1
-2
-1 0
-0 5
00
05
10
id(mn3),0
Current (nA)
2
1
0
-1
-2
-1 0
-0 5
00
05
10
id(mn2),0
Current (nA)
2
1
0
-1
-2
-1.0
-0.5
0.0
0.5
1.0
vdiff (V)
Contents
Help
75
Design Examples
Design Examples
Following are design examples created and simulated by T-Spice Pro. Use S-Edit
to run all of the examples.
amp_ac.sdb
amp_dc.sdb
Contents
Help
76
Design Examples
amp_spar.sdb
amp_tran.sdb
AC Analysis Example
;
Use Module > Open to open module amp_ac (the top module) if it is not already
open.
To probe into a subcircuit, select the subcircuit and use the Probe toolbar buttons
to move through different levels. Click the Probe Push button to get into the
next lower level of the circuit, the Probe Pop button to go back to the next higher
level, and the Probe Top Level button to go to the top level.
Use the analysis buttons on the Probe toolbar to view the results of different
types of analyses.
Select the AC/Noise button and click on nodes to view AC analysis results. Click
on devices to view noise analysis results.
Contents
Help
77
Design Examples
Select the Operating Point/Small Signal button and click on nodes to view DC
operating point values. Click on devices for small signal parameters.
The measurement results are listed in the output file amp_ac.out.
DC Analysis Example
;
Use Module > Open to open module amp_dc (the top module) if it is not already
open.
Select the DC Transfer button in the Probe toolbar. Click on nodes to view DC
transfer analysis results.
Select the Operating Point/Small Signal button and click on nodes to view DC
operating point values. Click on devices for small signal parameters.
Contents
Help
78
Design Examples
Use Module > Open to open module amp_tran (the top module) if it is not
already open.
Select the Transient button and click on nodes to view transient analysis results.
Click on devices to view noise analysis results.
Use Module > Open to open module amp_spar (the top module) if it is not
already open.
Contents
Help
79
Design Examples
The circuit is wired in the same way that s-parameters are measured. The module
amp in the circuit is the amplifier that was studied in the previous three
examples.
;
Click on ports S11, S21, S12, and S22 to find the s-parameters S11, S21, S12, and
S22 of the amplifier.
Contents
Help
80
Design Examples
ringvco.sdb
tech.sdb
vco.c
vco.dll
vcomacro.sp
Use Module > Open to open module ringvco (the top module) if it is not already
open.
Contents
Help
81
Design Examples
This example will be modeled using the user-defined external model feature in
T-Spice. The file vco.c is the ring VCO model written in the C programming
language. You can compile and build the file into a dynamically linked library,
vco.dll, before you simulate the circuit. You can then include vco.dll in the
SPICE file for simulation in T-Spice.
;
Use File > Open to open vcomacro.sp. This file includes the file vco.dll.
Note:
For more information on the external model feature in T-Spice, see User-Defined
External Models on page 634 of the T-Spice User Guide and Reference.
Contents
Help
82
Design Examples
Use Module > Open to open module adc_sp (the top module) if it is not already
open.
Contents
Help
83