MacSpice_Templates (ongoing personal cheatsheet)
*======== ====== ====== ======
====== ====== ====== ====== ======
*V_DC_NUM NODE_P
NODE_N
DC VALUE AC
ACMAG ACPHASE
*I_DC_NUM NODE_P
NODE_N
DC VALUE
*======== ====== ====== ======
====== ====== ====== ====== ====== ====== ====== ====== ====== ======
*V_PULSE# NODE_P
NODE_N PULSE( VINIT
VPULSE TDELAY TRISE TFALL PWIDTH PERIOD )
*V_SIN# NODE_P
NODE_N SIN(
V_DC AC_MAG FREQ DELAY FDamp)
*V_PWL# NODE_P
NODE_N PWL(
T1 V1
T2 V2
T3 V3 ...>)
*======== ====== ====== ======
====== ====== ====== ====== ======
*E_GAIN# NODE_P NODE_N
CNTL_P CNTL_N GAIN
*G_GM#B NODE_P NODE_N
CNTL_P CNTL_N GM ON/OFF
*======== ====== ====== ======
====== ====== ====== ====== ======
*D_NUMB NODE_P
NODE_N
MODEL AREA IC=? TEMP=?
*Q_NUMB
NCOL NBASE NEMIT NSUB MODEL
AREA IC=? TEMP=?
*MOS_NUMB NDRAIN NGATE
NSOUR NBULK MODEL L=VAL W=VAL
AD=? AS=? PD=?
PS=?
*M1
2 9
3 0
MOD1 L=10U W=5U AD=100P AS=100P
PD=40U PS=40U
*JFET_NUM NDRAIN NGATE
NSOUR MODEL
AREA IC=? TEMP=?
*R_Rsemi#
N1 N2
VALU MNAME
L=? W=? TEMP=?
*======== ====== ====== ======
====== ====== ====== ====== ======
*R_NUMB NODE1
NODE2 RVALUE
MODEL L=VAL W=VAL
*C_NUMB NODE1
NODE2 CVALUE
MODEL IC=V0
*L_NUMB NODE1
NODE2 LVALUE
MODEL IC=I0
*K_L_NUM LNUM1
LNUM2 KVALUE
*Switch# NODE1
NODE2 CNTL_P CNTL_N MODEL ON/OFF
*======== ====== ====== ======
====== ====== ====== ====== ======
*DC
SOURC1 VSTART VSTOP VSTEP SOURC2 START2 STOP2 STEP2
*AC
DECLin NUMDEC FSTART FSTOP TRAN TSTEP
TSTOP TSTART TMAX ?UIC?
*TRAN
TSTEP TSTOP TSTART TMAX ?UIC?
*======== ====== ====== ======
====== ====== ====== ====== ======
*SET
SPECWINDOW= "BLACKMAN"
*SPEC
FSTART FSTOP FSTEP VECTOR
*PLOT
MAG( VECTOR )
*======== ====== ====== ======
====== ====== ====== ====== ====== ====== ====== ====== ====== ======
* plot
xlog ylog loglog linear samep vs~~~~~xname
* plot
ylimit~ylo~~~~yhi xlimit~xlo~~~~xhi xdelta~xdel
ydelta~ydel xindices~xilo~xihi
* plot
xlabel~word ylabel~word title~~word
xcompress~comp
*
*======== ====== ====== ======
====== ====== ====== ====== ====== ====== ====== ====== ====== ======
*PLOT
MAG() PH() DB() REAL() IMAG() LOG()
LN() EXP() ABS() MEAN() SQRT() DERIV()
*PLOT
SIN() COS() TAN() ATAN() VECTOR RND()
J() NORM() POS() LENGTH
*======== ====== ====== ======
====== ====== ====== ====== ====== ====== ====== ====== ====== ======
set pensize = N
nodesets
"filename" //Create
a file of .nodeset statements
.NODESET:
Specify Initial Node Voltage Guesses
.NODESET V(NODNUM)=VAL
V(NODNUM)=VAL ...
.NODESET V(12)=4.5 V(4)=2.23
.IC: Set Initial
Conditions
MacSpice 44 -> print
length(v(1))
length(v(1)) =
3.220000e+02
Possible values for specwindow are: none, hanning, cosine, rectangular,
hamming, triangle,
bartlet, blackman, gaussian.
dc Source-Name Vstart Vstop Vincr [ Source2 Vstart2 Vstop2 Vincr2 ]
ac ( DEC | OCT | LIN ) N Fstart Fstop tran Tstep Tstop [ Tstart [ Tmax
] ] [ UIC ]
alter device value
alter device parameter value [ parameter value ]
PULSE(V_initialVal V_pulsedVal T_delay T_rise T_fall PeriodWidth Period)
VIN 3 0 PULSE(-1 1 2NS 2NS 2NS 50NS 100NS)
The following functions are available:
gt > lt < ge >=
le <= ne <> eq =
and & or | not !
MODELS
R Semiconductor resistor
model
C Semiconductor capacitor
model
SW
Voltage controlled
switch
CSW
Current controlled
switch
URC
Uniform distributed
RC model
LTRA Lossy transmission line model
D
Diode model
NPN
NPN BJT model
PNP
PNP BJT model
NJF
N-channel JFET
model
PJF
P-channel JFET
model
NMOS
N-channel MOSFET
model
PMOS
P-channel MOSFET
model
NMF
N-channel MESFET
model
PMF
P-channel MESFET
model
Semiconductor Resistors
name
parameter
units default example
TC1 first order temperature
coeff. Z/ C
0.0 -
TC2 second order temperature
coeff. Z/ C^2
0.0 -
RSH sheet
resistance
Z/[]
- 50
DEFW default
width
meters 1e-6 2e-6
NARROW
narrowing due to side etching
meters 0.0 1e-7
TNOM parameter measurement
temperature C
27 50
R(T) = R(T_0 ) [1 + TC1 (T - T_0 ) + TC2 (T-T_0
)^2 ]
.model RMODEL R(RSH=1000)
.model d1n4148 D (IS=0.1PA, RS=16 CJO=2PF TT=12N BV=100 IBV=0.1PA)
* MacSpice 14 -> display
* Here are the vectors currently active:
*
boltz
: notype, real, 1 long 1.380620e-23
*
c
: notype, real, 1 long 2.997925e+08
*
e
: notype, real, 1 long 2.718282e+00
*
echarge
: notype, real, 1 long 1.602190e-19
*
false
: notype, real, 1 long
*
foo
: notype, real, 4 long, dims = [2,2]
*
foobar
: notype, real, 6 long, dims = [3,2]
*
fowee
: notype, real, 5 long
*
foweex
: notype, real, 5 long
*
i
: notype, complex, 1 long
*
kelvin
: notype, real, 1 long -2.73150e+02
*
no
: notype, real, 1 long
*
pi
: notype, real, 1 long 3.141593e+00
*
planck
: notype, real, 1 long 6.626200e-34
*
true
: notype, real, 1 long
*
yes
: notype, real, 1 long [default scale]
*
* MacSpice 129 -> show
qn1
* BJT: Bipolar Junction Transistor
*
device
qn1
*
model
npn1
*
ic
4.9777e-07
*
ib
2.23097e-09
*
ie -5.00001e-07
*
vbe
0.575934
*
vbc
-9.99502
*
gm
1.92426e-05
*
gpi
8.6257e-08
*
gmu
1e-18
*
gx
0
*
go
2.92815e-09
*
cpi
0
*
cmu
0
*
cbx
0
*
ccs
0
MacSpice 40 -> showmod
BJT models (Bipolar Junction Transistor)
model
npnv
type
npn
is
1.551e-17
bf
50
nf
1.005
vaf
30.2
ikf
0.0057
ise
9.15e-17
ne
2
br
0.4822
nr
1.006
var
4.286
ikr
0.0002472
isc
1e-21
nc
2
rb
732
irb
0.00075
rbm
441.2
re
15.33
rc
109.1
cje
1.727e-14
vje
0.6408
mje
0.2563
tf
1.65e-11
xtf
1.25
vtf
1
itf
0.003532
ptf
205
cjc
1.826e-14
vjc
0.6399
mjc
0.3531
xcjc
0.4201
tr
6e-09
cjs
2.939e-14
ccs
2.939e-14
vjs
0.3488
mjs
0.1813
xtb
2
eg
1.11
xti
5
fc
0.88
tnom
25
kf
1e-16
af
1
MacSpice 36 -> dump
Current Value Node Name
------------- ---------
0 1
3.95186889372539e-09 2
3.69342266124883e-09 3
0 4
-3.95186889372539e-10 6
7.38684532249766e-12 7
0 8
196.96040782371 11
7.38684532249766e-08 vsense2#branch
-7.38684532249766e-08 h_torq#branch
-7.90373778745077e-09 vsense1#branch
-7.90373778745077e-09 h_emf#branch
7.38684532249766e-08 lj#branch
-7.90373778745077e-09 la#branch
7.90373778745077e-09 v_amp#branch
MacSpice 34 -> listing
DC_MOTOR_MODEL.CIR *
1 :
DC_MOTOR_MODEL.CIR *
2 :
v_amp 1
0
ac 1
pwl(0ms 0v 1ms 10v 1000ms 10v 1010ms
0v 2000ms 0v)
5 :
ra 1
2 0.5
6 :
la 2
3 0.0015
7 :
h_emf 3
4 vsense2 0.05
8 :
vsense1 4
0
dc 0v
11 :
h_torq 6
0 vsense1 0.05
12 :
lj 6
7 0.00025
13 :
rb 7
8 0.0001
14 :
vsense2 8 0
dc 0v
17 :
fpos 0
11 vsense2 1
18 :
cpos 11
0 1
19 :
rpos 11
0 1meg
22 :
.TRAN 10MS 2000MS
25 : .control
26 : run
27 : set
pensize = 2
28 : plot v(1)
i(vsense1)
30 : dump
31 : .endc
------ : .end
=====================================Pulse=====================================
PULSE(V1
V2 TD TR TF PW PER )
VIN 3 0 PULSE( -1
1 2NS 2NS 2NS 50NS
100NS)
V1
Initial
value
V2
Pulsed
value
TD Delay time
TR
Rise
time
TF
Fall
time
PW
Pulse
width
PER
Period
Time
Value
0 V1
TD
V1
TD+TR
V2
TD+TR+PW
V2
TD+TR+PW+TF
V1
TSTOP V1
Intermediate points are determined by linear interpolation.
=====================================Piece-Wise Linear=====================================
PWL(T1 V1
<T2 V2 T3 V3 T4 V4
...> )
VCLOCK 7 5 PWL( 0 -7
10NS -7 11NS -3 17NS -3
18NS -7 50NS -7)
The value at
intermediate values of time is inear interpolation
on the input values.
=====================================Sinusoidal=====================================
SIN(VO
VA FREQ TD THETA)
VIN 3 0 SIN( 0 1 100MEG
1NS 1E10)
VO Offset
VA Amplitude
FREQ Frequency
TD Delay
THETA) Damping
factor
Time, t
Value
0 to TD
VO
TD
to TSTOP VO +VA*sin(2π*FREQ*[t−TD])*exp(−[t−TD]×THETA))
=====================================Single-Frequency FM=====================================
SFFM(VO VA
FC MDI FS)
V1 12 0 SFFM( 0 1M
20K 5 1K)
VO
DC Offset
VA
Amplitude
FC
Carrier frequency
MDI
Modulation index
FS
Signal frequency
V(t)= VO +VA*sin(2π*FC*t +MDI*sin[2π*FS*t])
===============================================================================================================
Linear
Voltage-Controlled Current Sources
GXXXXXXX
N+ N- NC+ NC- VALUE
G1
2 0 5
0 0.1MMHO
N+ and N- are the positive and negative nodes
Current
flow positive nodeto the negative
node.
NC+ and NC- are the positive and negative controlling nodes.
VALUE is the transconductance
(in mhos).
Linear
Voltage-Controlled Voltage Sources
EXXXXXXX
N+ N- NC+ NC- VALUE
E1
2 3 14
1 2.0
N+ is positive node, N- negative node.
NC+ and NC- are
the positive and negative controlling nodes
VALUE is the
voltage
gain.
Linear
Current-Controlled Current Sources
FXXXXXXX
N+ N- VNAM VALUE
F1 13 5
VSENS
5
N+ and N- are the positive and negative nodes
Current
flow from positive node, through source, to
negative
node.
VNAM
a voltage source through which current is monitored.
Positive controlling
current flow is from positive node, through source,
to
negative node of VNAM.
VALUE
is the current gain.
Linear
Current-Controlled Voltage Sources
H
XXXXXXX N+ N- VNAM
VALUE
HX
5 17 VZ
0.5K
N+ and N- are the positive and negative nodes, respectively.
VNAM
a voltage source through which current is monitored.
Positive controlling
current flow is from positive node, through source,
to
negative node of VNAM.
VALUE
is the transresistance
(in ohms).
===============================================================================================================
Voltage-Controlled Current Sources
GXXXXXXX N+ N-
<POLY(ND)> NC1+ NC1-.
P0 <P1 ...>
<IC=...>
G1 1 0
5
3 0 0.1M
GR 17
3 17 3
0 1M
1.5M IC=2V
GMLT 23 17 POLY(2)
3 5 1 2 0
1M
17M 3.5U
IC=2.5, 1.3
N+ and N- are the positive and negative nodes, respectively.
Current
flow is from the positive node, through the source, to the negative
node.
POLY(ND) specified if
multi-dimensional (one-dimensional is the default). ND is number
of dimensions
NC1+, NC1-, ... Are
the positive and negative controlling nodes, respectively.
One
pair of
nodes must be specified for each dimension.
P0, P1, P2, ..., Pn
are the
polynomial coefficients.
function
is one-dimensional fa
(the function argument):
fv = p0
+ (p1*fa)
+ (p2*fa**2) + (p3*fa**3) +
(p4*fa**4) +
(p5*fa**5) + ...
function
is two-dimensional, with arguments fa and fb.
fv = p0 +p1*fa +p2*fb
+p3*fa**2 +p4*fa*fb +p5*fb**2 +p6*fa**3 +p7*fa**2*fb +p8*fa*fb**2 + p9*fb**3 + ...
===============================================================================================================
Non-linear
Dependent Sources
BXXXXXXX N+ N- <I=EXPR> <V=EXPR>
B1 0 1 I =
cos(v(1))+sin(v(2))
B1 0 1
V = ln(cos(log(v(1,2)^2)))-v(3)^4+v(2)^v(1)
B1 3 4 I = 17
B1 3 4 V =
exp(pi^i(vdd))
abs
asinh cosh sin
acos atan exp sinh
acosh atanh ln
sqrt
asin cos log tan
u()
unit step function, zero
= ( arguments <=0)
one ( arguments > 0)
uramp(x)
integral of the unit
step:
The following standard operators are defined:
+
- *
/ ^
unary -
If the argument of log(), ln(), or sqrt() becomes less than zero, the
absolute value of the argument is used.
If a divisor becomes zero or
the argument of log() or ln() becomes zero, an error will result.
Other
problems may occur when the argument for a function in a partial
derivative enters a region where that function is undefined.
To get time into the expression
you can integrate the current from a
constant current source with a capacitor
and use the resulting voltage
(don't forget to set the initial voltage across the capacitor).
Nonlinear resistors, capacitors, and inductors may be synthesized with
the nonlinear dependent source.
Nonlinear resistors are obvious.
Nonlinear capacitors and inductors are implemented with their linear
counterparts
by a change of variables implemented with the nonlinear
dependent source.
The following subcircuit will implement a nonlinear
capacitor:
.Subckt nlcap
pos neg
Bx 1
0 v = f(v(pos,neg)) * Bx: calculate f(input voltage)
Cx 2
0
1
* Cx: linear capacitance
Vx 2
1 DC
0Volts * Vx: Ammeter to measure current into
the
capacitor
Fx pos
neg Vx
1
* Drive the current
through Cx back into the
circuit
.ends
Non-linear inductors are similar.
Inductors
LYYYYYYY N+ N- VALUE <IC=INCOND>
LLINK 42 69 1UH
LSHUNT 23 51 10U
IC=15.7MA
N+ and N- are the positive and negative element nodes, respectively.
VALUE is the inductance in henries.
The (optional) initial condition apply only if
UIC specified on .TRAN analysis line.
Coupled (Mutual)
Inductors
KXXXXXXX LYYYYYYY LZZZZZZZ VALUE
K43
LAA
LBB
0.999
KXFRMR L1
L2 0.87
LYYYYYYY and LZZZZZZZ
names of coupled
inductors,
VALUE K
coupling coefficient 0 -> 1.'dot'convention,
place 'dot'
on first node of each inductor.
Switches
SXXXXXXX
N+ N- NC+ NC- MODEL
<ON><OFF>
s1 1 2
3 4 switch1 ON
s2 5 6
3 0
sm2 off
Switch1 1 2 10 0 smodel1
WYYYYYYY N+ N-
VNAM MODEL
<ON><OFF>
w1
1 2 vclock switchmod1
W2 3 0
vramp
sm1 ON
wreset 5 6 vclck
lossyswitch OFF
N+ and N- are the nodes between which the switch terminals are
connected.
The model name is mandatory while the initial conditions are
optional.
For the voltage controlled switch, NC+ and NC- are the
positive and negative controlling nodes respectively.
For the current
controlled switch, the controlling current is that through the
specified voltage source VNAM.
The direction of positive controlling
current flow is from the positive node, through the source, to the
negative node.
Switch Model
(SW/CSW)
Name Parameter
Units Default Switch
VT Threshold voltage
V 0.0 S
VH Hysteresis voltage
V 0.0 S
IT Threshold current
A 0.0 W
IH Hysteresis current
A 0.0 W
RON On resistance
Ω 1.0 both
ROFF Off resistance
Ω 1/GMIN* both
================BipolarTerms.cir=====================================
**
**
___
**
|(C)| NPN
** SPICE
MODEL
|___|
**
<actual_behavior>
|
** <varies from spice model !> / RC
110ohms VAF=215
**
\
**
/
4fF
**
________________________|_____________________
**
| |
| |
| |
_|_ _|_Cjs
**
| |12fF
| | |Ir/BR |Irn / _
\ ___
**
| |
| / _|_
_|_ \/ \/ |gnd!
** _|_Cjcx _|_Cjc _|_Cdc
\ ^ ^
/\_/\ _|_
** ___
___ ___ /
/_\ /_\ \___/ \sub/
** ___ |
Rbb'| | gmin \
| | Ic | \ /
** |(B)|_|_/\
__|______|______|____|______| |
| V
** |___| \/
| |
| _|_ _|_ | V
(hidden)
** 600ohms _|_Cje _|_Cde
\ \ / \ / |
** BF=116
___ ___ /
_v_ _v_ |
**
|20fF | gmin \ |If/Bf |Ifn |
**
|______|______|____|______|______|
**
|
**
TF=8ps / RE 15ohms
**
\
**
/
**
_|_
**
|(E)|
**
|___|
**
.MODEL
NPNV NPN(
* ===========================================================
+ IS=15.51E-18 NF=1.005
BF=110 VAF=130.2
IKF=0.0001
+
NR=1.006 BR=0.4822
VAR=4.286 IKR=0.0002472
*
===========================================================
+ ISE=9.15E-17
NE=2
+ ISC=1E-21 NC=2
*
===========================================================
+ RB=732
RBM=441.2
IRB=7.5E-04
+ RE=15.33 RC=109.1
*
===========================================================
+ CJE=1.727E-14 VJE=0.6408
MJE=0.2563
+ CJC=1.826E-14 VJC=0.6399
MJC=0.3531
+ CJS=2.939E-14 VJS=0.3488 MJS=0.1813 XCJC=0.4201
*
===========================================================
+ TF=4.65E-12 XTF=1.25
VTF=1
ITF=0.009532
+ TR=6E-09
FC=0.88 PTF=205
*
===========================================================
+ KF=1.000E-16 AF=1
*
===========================================================
+ XTB=2
EG=1.11
XTI=5
TNOM=25 )
.END
IS = transport saturation current
NF = forward
current emission coefficient
NR = reverse
current emission coefficient
BF = ideal maximum
forward beta
BR = ideal
maximum reverse beta
VAF = forward Early voltage
VAR = reverse Early voltage
IKF = corner for forward beta high current roll-off
IKR = corner for
reverse beta high current roll-off
ISE = B-E leakage saturation current
ISC = B-C leakage
saturation current
NE = B-E leakage emission coefficient
NC = B-C leakage emission coefficient
RB = zero bias base resistance
RBM = minimum base
resistance at high currents
IRB = current where base
resistance falls halfway to its min value
RE = emitter resistance
RC = collector resistance
CJE = B-E zero-bias depletion capacitance
CJC = B-C zero-bias
depletion capacitance
CJS = zero-bias
collector-substrate capacitance
VJE = B-E built-in
potential
VJC = B-C built-in
potential
VJS = substrate
junction built-in potential
MJE = B-E junction
exponential factor
MJC = B-C junction
exponential factor
MJS = substrate
junction exponential factor
XCJC = fraction of B-C
depletion capacitance connected to internal base node
TF = ideal forward transit time
TR = ideal
reverse transit time
XTF = coefficient for bias
dependence of TF
VTF = voltage describing VBC dependence of TF
ITF = high-current parameter for effect on TF
FC =
coefficient for forward-bias depletion capacitance formula
PTF = excess phase at
freq=1.0/(TF*2PI)Hz
KF = AF = flicker-noise
exponent
XTB = forward and reverse beta temperature exponent
EG = energy gap for temperature effect on IS
XTI = temperature exponent for effect on IS
TNOM = 300.15
================Read_PWL.cir=====================================
*
OUT Rload
* _____/\ __
* _|_ \/ |
test for read in files
* / \
|
* /VpwlT\ |
* \ / _|_
* \___/ ///
*
| Gnd
* _|_
* ///
* Gnd
*
* VpwlT OUT 0 PWL( 5E-07 0.33 1E-06
-0.15 1.5E-06 0.521 ...
*
.........etc............
* ...
-1.81124
0.00025 1.5831 )
*
* The total
measurement time is 250us corresponds to 4KHz resolution
* The sample period is
0.5e-6 corresponds to 1MHz Bandwidth
*
* This text file is located at the
following
* Users/donsauer/Documents/MacSpice/PWL_File3c.txt
*======== ====== ====== ====== ====== ====== ====== ====== ======
====== ======
Rload
OUT 0 1k
.include PWL_File3c.txt
.tran
0.1u 250u 0
250u
*.tran
TSTEP TSTOP TSTART TMAX sample 0->250u(4kHz) @0.1u(10MHz)
rate
.control
run
plot
out
linearize
set
specwindow = "rectangular"
*hanning,cosine,bartlet,blackman,rectangular,hamming,triangle,gaussian
spec
4k
5000k 4k v(out)
*spec
start_f stop_f step_f vector
[vector ...]
plot
db(v(out)) xlimit 4k 5000k ylimit -10 -60 xlog
.endc
.end
================RC_3dB.cir=====================================
RC_3dB
*
*
*
R1
*
VIN
___
* _____/\ /\
/\________|OUT|
* |
\/ \/ | |___|
*
_|__
|
* /_
\
_|_
* // \
\ ___
C1 Find 3dB freq
* \
\_//
|
*
\____/
_|_
*
_|_
///
* ///
*
*
VIN IN 0 DC
0V AC 1V
R1 IN OUT 1k
C1 OUT 0 1u
.OPTIONS GMIN=1e-15 METHOD=gear ABSTOL=1e-15 temp=27
.control
run
ac
dec
10
1 10khz
plot db(v(out)) ylimit
-3 0
title
Find_R_C_3dB
let n = 0
let m = 0
let f = 0
repeat 39
let m = n+1
let n = m
if
( db( out[$m]) >-3)
let f =
mag(frequency[$m])
endif
endrepeat
echo "3dB point = $&f Hz"
.endc
.end
* 3dB point = 158.489 Hz
================NPN_Ftau.cir=====================================
*
*
*
*
________
*
| |
*
| _|_
*
|C /VCC\
*
R1
_| \___/
* ____/\ /\
/\____|'QN1 |
* _|_ \/ \/
B |`-> _|_
*
///
|E ///
*
|
*
_|_
*
/ _ \
*
1I \/ \/
*
/\_/\
*
\___/
*
_|_
*
///
.OPTIONS GMIN=1e-15 METHOD=gear
ABSTOL=1e-15 TEMP=27 srcsteps = 1 gminsteps =
1
VCC C 0
DC 2V
QN1 C B
E NPNV
R1 0
B 1
I1 E 0
DC 100u AC 1n
.control
set outfile
=
"f_tau_test.txt"
echo
"Ibias
Ftau
VCC " > $outfile
echo
"Ibias
Ftau
VCC "
foreach vc
2V 5V
alter
vcc dc
= $vc
foreach
ibias .000001 .000003
.000010 .000030 .000100 .000300 .001000 .003000 .005000
alter
I1 dc =
$ibias
run
ac
dec 30 .01Ghz
10Ghz
set n
set m
set g
set f = 0
let n = 0
let m = 0
let f = 0
let g = 0
repeat 89
let m =n+1
let n = m
let g = db(b[m])
if ( g < -186)
let
f = mag(frequency[m])
endif
endrepeat
echo "$ibias
$&f $vc"
echo
"$ibias
$&f $vc"
>> $outfile
end
echo
"=============================="
echo
"=============================="
>> $outfile
end
.endc
.MODEL
NPNV NPN(
+ IS=15.51E-18 NF=1.005
BF=110 VAF=130.2 IKF=0.0001
+
NR=1.006 BR=0.4822
VAR=4.286 IKR=0.0002472
+ ISE=9.15E-17
NE=2
+ ISC=1E-21
NC=2
+ RB=732
RBM=441.2
IRB=7.5E-04
+ RE=15.33
RC=109.1
+ CJE=1.727E-14
VJE=0.6408
MJE=0.2563
+ CJC=1.826E-14 VJC=0.6399
MJC=0.3531
+ CJS=2.939E-14 VJS=0.3488 MJS=0.1813
XCJC=0.4201
+ TF=4.65E-12
XTF=1.25
VTF=1
ITF=0.009532
+ TR=6E-09
FC=0.88
PTF=205
+ KF=1.000E-16 AF=1
+ XTB=2
EG=1.11
XTI=5
TNOM=25 )
.END
**
**
___
**
|(C)| NPN
** SPICE
MODEL
|___|
**
<actual_behavior>
|
** <varies from spice model !> / RC
110ohms VAF=215
**
\
**
/
4fF
**
________________________|_____________________
**
| |
| |
| |
_|_ _|_Cjs
**
| |12fF
| | |Ir/BR |Irn / _
\ ___
**
| |
| / _|_
_|_ \/ \/ |gnd!
** _|_Cjcx _|_Cjc _|_Cdc
\ ^ ^
/\_/\ _|_
** ___
___ ___ /
/_\ /_\ \___/ \sub/
** ___ |
Rbb'| | gmin \
| | Ic | \ /
** |(B)|_|_/\
__|______|______|____|______| |
| V
** |___| \/
| |
| _|_ _|_ | V
(hidden)
** 600ohms _|_Cje _|_Cde
\ \ / \ / |
** BF=116
___ ___ /
_v_ _v_ |
**
|20fF | gmin \ |If/Bf |Ifn |
**
|______|______|____|______|______|
**
|
**
TF=8ps / RE 15ohms
**
\
**
/
**
_|_
**
|(E)|
**
|___|
**
Circuit:
NPN_Ftau
Ibias
Ftau
VCC
.000001
9.26119E+07 2V
.000003
2.32631E+08 2V
.000010
6.30957E+08 2V
.000030
1.4678E+09 2V
.000100
2.92864E+09 2V
.000300
5.01187E+09 2V
.001000
6.81292E+09 2V
.003000
5.84341E+09 2V
.005000
2.15443E+09 2V
==============================
.000001
9.26119E+07 5V
.000003
2.32631E+08 5V
.000010
6.30957E+08 5V
.000030
1.4678E+09 5V
.000100
2.92864E+09 5V
.000300
5.01187E+09 5V
.001000
7.35642E+09 5V
.003000
6.81292E+09 5V
.005000
3.16228E+09 5V
==============================
================LC_transLine1.cir=====================================
*
*
RIN
1 2 3
4 5
6 7 8
9 10
*
VIN
___ ___ ___ ___
___ ___ ___ ___
___ ___ ___
* ___/\ /\
/\____|LC1|_|LC1|_|LC1|_|LC1|_|LC1|_|LC1|_|LC1|_|LC1|_|LC1|_|LC1|__|OUT|
* _|__ \/ \/ _|_ |___|
|___| |___| |___| |___| |___| |___| |___| |___| |___| |___|
* /_
\ ___
_|_ _|_ _|_ _|_
_|_ _|_ _|_ _|_
_|_ _|_ |__
* // \ \ CIN
| /// /// ///
/// /// /// ///
/// /// /// | _|_
* \
\_//
_|_
| ___ COUT
*
\____/
///
__/\ /\ /\____| |
*
_|_
_|_ \/ \/ ROUT _|_
*
///
///
///
*
*
.OPTIONS GMIN=1e-18 METHOD=gear
ABSTOL=1e-18 TEMP=27 srcsteps = 1 gminsteps =
1
VIN VIN
0 PWL( 0 0 2n 0 3.0n 1 18n 1 19.0n
0)
RIN VIN
1 50m
C1 VIN
0 -1.6
XLC1 1
2 LC1
XLC2 2
3 LC1
XLC3 3
4 LC1
XLC4 4
5 LC1
XLC5 5
6 LC1
XLC6 6
7 LC1
XLC7 7
8 LC1
XLC8 8
9 LC1
XLC9 9
10 LC1
XLC10 10
OUT LC1
R1 OUT
0 50
C2 OUT
0 -1.6p
C3 OUT
0 10f
.tran 0.01n 30n 0 30n
.control
run
plot
v(1) v(6) out title
RC_160ps_1GHz_50out
.endc
.SUBCKT LC1
IN OUT
L1 IN OUT 8n
C1 OUT 0
3.2p
.ENDS LC1
*
.SUBCKT LC1
IN OUT
* _ _
_ L1
* ___ / \/ \/ \
___ ___
_______ ___
* |IN |_| () () |___|OUT| |IN
|__| |___|OUT|
*
|___| |
|___| |___| | LC1
| |___|
*
_|_
|_______|
*
___
C1
_|_
*
|
///
*
_|_
*
/// 8nH_3.2pF =>50Ohms @ 1Ghz 50*3.2p =160ps
*
.end
================MakeArrays.cir=====================================
.CONTROL
run
unlet fowee
unlet foweex
unlet foo
unlet foobar
let fowee = (11;12;11;15;17)
let foweex = ((1;2;3;5;7))
plot fowee vs foweex
let foo = ((11;12);(21;22))
let foobar = (foo;(31;32))
print foo
print fowee[1]
print foobar
print foobar[1][0]
plot foobar
.ENDC
* Circuit: ==================
* ---------------------------
* Index foo
* ---------------------------
* 0 1.100000e+01
* 1 1.200000e+01
* 2 2.100000e+01
* 3 2.200000e+01
* fowee[1] = 1.200000e+01
* ---------------------------
* Index foobar
* ---------------------------
* 0 1.100000e+01
* 1 1.200000e+01
* 2 2.100000e+01
* 3 2.200000e+01
* 4 3.100000e+01
* 5 3.200000e+01
* ---------------------------
* Index foobar[1,2]
* ---------------------------
* 0 2.100000e+01
* 1 2.200000e+01
* 2 3.100000e+01
* 3 3.200000e+01
* foobar[1][0] = 2.100000e+01
* MacSpice 14 -> display
*
foo
: notype, real, 4 long, dims = [2,2]
*
foobar
: notype, real, 6 long, dims = [3,2]
*
fowee
: notype, real, 5 long
*
foweex
: notype, real, 5 long
================THD-Diff.cir=====================================
*
^ VC
*
/_\
*
|
*
__/\ /\ /\_|__/\ /\ /\__
*
| \/
\/ \/
\/ |<