← dune home

Examples

Every circuit in the oracle corpus — 119 decks — plus 29 pic schematics: the netlist, and what Dune computes for it. Each result was produced by Dune's WebAssembly build (dune-sim 0.10.0) when this page was generated; the same decks are checked point by point against ngspice-47 in CI. Swept charts (tran, ac, dc) are re-run on a display grid of at least 600 points, so the curves draw smoothly — the deck shown, on its own grid, is what CI compares.

Charts show at most 6 vectors (the deck's own .plot/.print choice when it has one), decimated to min/max per pixel column; complex plots show magnitude. Known-marginal circuits (corpus/XFAIL) and failures are shown as they are.

Figures (pic) 29

Schematics in rpic's pic language (corpus/pic/): the source, the figure Dune renders from it, the netlist its extractor derives, and the simulation of that netlist. The prelude itself lives in crates/dune-pic/src/spice.pic.

basic/acdiode.cir drawn: a 1 mA bias (with a 1 mA AC part) into a diode shunted by 100k; .ac sees the diode's small-signal model at that bias, rd = n Vt / Id = 25.9 ohm plus RS, against CJ + Cd

corpus/pic/acdiode.pic.ac#
acdiode.pic
.PS
# basic/acdiode.cir drawn: a 1 mA bias (with a 1 mA AC part) into a
# diode shunted by 100k; .ac sees the diode's small-signal model at
# that bias, rd = n Vt / Id = 25.9 ohm plus RS, against CJ + Cd.
# Card order kept; deck node 1 Va.
spice = 1
Va: (1.3,1.6)

Ibias: isource((0.3,0), (0.3,1.6), dc 1m ac 1m)
D1: diode(Va, (1.3,0), dmod)
Rsh: resistor((2.3,1.6), (2.3,0), 100k)

line from Ibias.N to Rsh.P
line from Ibias.P to Rsh.N
dot at Va; dot at D1.N
ground((0.8,0))
.model dmod d(is=1e-14 rs=10 cjo=5p tt=10n vj=0.8 m=0.4)
.ac oct 8 1k 100meg
.PE
the figure — rendered by Dune's rpic
dc 1m ac 1m dmod 100k
dune pic acdiode.pic
* netlist extracted by dune-pic
Ibias 0 Va dc 1m ac 1m
D1 Va 0 dmod
Rsh Va 0 100k
.model dmod d(is=1e-14 rs=10 cjo=5p tt=10n vj=0.8 m=0.4)
.ac oct 8 1k 100meg
.end
AC Analysismagnitudelog f
10 mV15 mV20 mV25 mV30 mV35 mV40 mV1 kHz10 kHz100 kHz1 MHz10 MHzv(va)
v(va)

basic/acrlc.cir drawn: a 2 V / 45 degree drive into a pair of 10u coils coupled by k = 0.3; the secondary rings a series 5 ohm / 253.3p branch (f0 = 3.16 MHz) and a VCVS (x2) buffers the secondary into RE. Card order kept; deck nodes 1 In, 2 Pri, 3 Sec, 4 Vc, 5 Vout

corpus/pic/acrlc.pic.ac#
acrlc.pic
.PS
# basic/acrlc.cir drawn: a 2 V / 45 degree drive into a pair of 10u
# coils coupled by k = 0.3; the secondary rings a series 5 ohm /
# 253.3p branch (f0 = 3.16 MHz) and a VCVS (x2) buffers the secondary
# into RE. Card order kept; deck nodes 1 In, 2 Pri, 3 Sec, 4 Vc,
# 5 Vout.
spice = 1
In:   (0.3,2)
Pri:  (1.4,2)
Sec:  (2.4,2)
Vc:   (3.5,2)
Vout: (5.1,2)

Vin: acsource(In, (0.3,0), ac 2 45)
RS: resistor(In, Pri, 50)
L1: inductor(Pri, (1.4,0), 10u)
L2: inductor(Sec, (2.4,0), 10u)
K12: coupling(L1, L2, 0.3)
RL: resistor(Sec, Vc, 5)
C2: capacitor(Vc, (3.5,0), 253.3p)
E1: vcvs(Vout, (5.1,0), (4.6,1.2), (4.6,0.8), 2)
RE: resistor((6.3,2), (6.3,0), 1k)

line from Sec to (2.4,2.6) then to (4.3,2.6) then to (4.3,1.2) then to E1.Cp
line from E1.Cn to (4.3,0.8) then to (4.3,0)
line from E1.P to RE.P
line from Vin.N to RE.N
dot at Sec
dot at L1.N; dot at L2.N; dot at C2.N; dot at (4.3,0); dot at E1.N
ground((0.85,0))
.ac lin 50 1meg 5meg
.PE
the figure — rendered by Dune's rpic
ac 2 45 50 10u 10u k=0.3 5 253.3p 2 + − 1k
dune pic acrlc.pic
* netlist extracted by dune-pic
Vin In 0 ac 2 45
RS In Pri 50
L1 Pri 0 10u
L2 Sec 0 10u
K12 L1 L2 0.3
RL Sec Vc 5
C2 Vc 0 253.3p
E1 Vout 0 Sec 0 2
RE Vout 0 1k
.ac lin 50 1meg 5meg
.end
AC Analysismagnitude
0 V5 V10 V15 V20 V25 V1 MHz2 MHz3 MHz4 MHz5 MHzv(pri)v(sec)v(vc)v(vout)
v(pri)v(sec)v(vc)v(vout)(+5 more vectors)

Series RLC band-pass, output across R1

corpus/pic/bandpass.pic.ac#
bandpass.pic
.PS
# Series RLC band-pass, output across R1:
# H = R/(R + j w L + 1/(j w C)); f0 = 1/(2 pi sqrt(L1 C1)) = 15.9 kHz,
# |H(f0)| = 1, bandwidth R1/(2 pi L1) = 7.96 kHz (Q = 2).
spice = 1
Vin: (0,1.5); Vout: (3,1.5)
V1: vsource(Vin, (0,0), AC 1)
L1: inductor(Vin, (1.5,1.5), 1m)
C1: capacitor(L1.N, Vout, 100n)
R1: resistor(Vout, (3,0), 50)
line from V1.N to R1.N
ground((1.5,0))
dot at Vout
"out" above at Vout + (0,0.05)
.ac dec 20 1k 1meg
.PE
the figure — rendered by Dune's rpic
AC 1 1m 100n 50 out
dune pic bandpass.pic
* netlist extracted by dune-pic
V1 Vin 0 AC 1
L1 Vin n1 1m
C1 n1 Vout 100n
R1 Vout 0 50
.ac dec 20 1k 1meg
.end
AC Analysismagnitudelog f
0 V500 mV1 V1.5 V2 V2.5 V1 kHz10 kHz100 kHz1 MHzv(n1)v(vout)
v(n1)v(vout)(+3 more vectors)

Common-emitter amplifier: divider bias R1/R2, collector load R3, emitter degeneration R4 (gain ~ -R3/R4), input coupled through C1

corpus/pic/bjtamp.pic.op.tran#
bjtamp.pic
.PS
# Common-emitter amplifier: divider bias R1/R2, collector load R3,
# emitter degeneration R4 (gain ~ -R3/R4), input coupled through C1.
spice = 1
Q1: npn((3,1.5), QN, "T₁")
Vb:   (2,1.5)
Vcc:  (5,3.5)
Vin:  (1,1.5)
Vout: (3.16,2.4)

V2: acsource((0.3,1.5), (0.3,0), SIN(0 10m 1k), "G₁")
C1: capacitor(Vin, Vb, 10u)
R1: resistor((2,3.5), Vb, 47k)
R2: resistor(Vb, (2,0), 10k)
R3: resistor((3.16,3.5), Vout, 4.7k)
R4: resistor(Q1.E, (3.16,0), 1k)
V1: vsource(Vcc, (5,0), DC 12, "VCC")

line from V2.P to C1.P
line from C1.N to Q1.B
line from R3.N to Q1.C
line from R3.N to (4.1,2.4); circle rad 0.04 at (4.14,2.4)
"out" ljust at (4.2,2.4)
line from R1.P to V1.P
line from V2.N to V1.N
dot at R1.N; dot at R3.P; dot at R2.N; dot at R4.N; dot at R3.N
ground((3.9,0))
.model QN NPN(IS=1e-14 BF=100 VAF=100)
.op
.tran 10u 3m
.PE
the figure — rendered by Dune's rpic
T₁ G₁ 10u 47k 10k 4.7k 1k VCC out
dune pic bjtamp.pic
* netlist extracted by dune-pic
Q1 Vout Vb n1 QN
V2 Vin 0 SIN(0 10m 1k)
C1 Vin Vb 10u
R1 Vcc Vb 47k
R2 Vb 0 10k
R3 Vcc Vout 4.7k
R4 n1 0 1k
V1 Vcc 0 DC 12
.model QN NPN(IS=1e-14 BF=100 VAF=100)
.op
.tran 10u 3m
.end
Operating Point
vectorvalue
v(vout)5.7692 V
v(vb)1.9999 V
v(n1)1.3385 V
v(vin)0 V
i(v2)0 A
v(vcc)12 V
i(v1)-1.5385 mA
Transient Analysis
-1 V0 V1 V2 V3 V4 V5 V6 V0 s500 µs1 ms1.5 ms2 ms2.5 ms3 msv(vout)v(vb)v(n1)v(vin)
v(vout)v(vb)v(n1)v(vin)(+3 more vectors)

Current-controlled sources read the current through V0, a 0 V ammeter in series with R1: i(v0) = 2 V / 1k = 2 mA. The CCCS

corpus/pic/ccprobe.pic.op#
ccprobe.pic
.PS
# Current-controlled sources read the current through V0, a 0 V
# ammeter in series with R1: i(v0) = 2 V / 1k = 2 mA. The CCCS
# (gain 3) pulls 6 mA out of Va through itself, so v(va) = -6 V across
# R2; the CCVS (500 ohm transresistance) sets v(vb) = 1 V across R3.
spice = 1
In: (0.3,2)
Vs: (1.5,2)
Va: (3.6,2)
Vb: (5.6,2)

V1: vsource(In, (0.3,0), DC 2)
R1: resistor(In, Vs, 1k)
V0: vsource(Vs, (1.5,0), DC 0)
F1: cccs((2.8,2), (2.8,0), V0 3)
R2: resistor(Va, (3.6,0), 1k)
H1: ccvs((4.8,2), (4.8,0), V0 500)
R3: resistor(Vb, (5.6,0), 1k)

line from F1.P to R2.P
line from H1.P to R3.P
line from V1.N to R3.N
dot at V0.N; dot at F1.N; dot at R2.N; dot at H1.N
ground(V1.N)
.op
.PE
the figure — rendered by Dune's rpic
DC 2 1k DC 0 V0 3 1k V0 500 1k
dune pic ccprobe.pic
* netlist extracted by dune-pic
V1 In 0 DC 2
R1 In Vs 1k
V0 Vs 0 DC 0
F1 Va 0 V0 3
R2 Va 0 1k
H1 Vb 0 V0 500
R3 Vb 0 1k
.op
.end
Operating Point
vectorvalue
v(in)2 V
i(v1)-2 mA
v(vs)0 V
i(v0)2 mA
v(va)-6 V
v(vb)1 V
i(h1)-1 mA

CMOS inverter (MOS1) driving 1 pF: a 0 -> 5 V input pulse flips the output rail to rail; no static current in either state

corpus/pic/cmosinv.pic.tran#
cmosinv.pic
.PS
# CMOS inverter (MOS1) driving 1 pF: a 0 -> 5 V input pulse flips the
# output rail to rail; no static current in either state.
spice = 1
M2: pmos((2,2.1), PMOD W=8u L=1u, "T₂")
M1: nmos((2,0.9), NMOD W=4u L=1u, "T₁")
Vin:  (1.2,1.5)
Vout: (M1.D.x,1.5)
Vdd:  (M2.S.x,2.7)

V1: vsource((0.3,1.5), (0.3,0), PULSE(0 5 5n 1n 1n 20n 50n), "G₁")
V2: vsource((6.2,2.7), (6.2,0), DC 5, "VDD")
C1: capacitor((4.2,1.5), (4.2,0), 1p)
line from M2.D to M1.D
line from M1.G to (Vin.x,M1.G.y) then to (Vin.x,M2.G.y) then to M2.G
line from V1.P to Vin
line from Vout to C1.P
line from M2.S to Vdd then to V2.P
line from M1.S to (M1.S.x,0)
line from V1.N to V2.N
dot at Vin; dot at Vout; dot at C1.P; dot at (M1.S.x,0); dot at C1.N
"in" above at (0.75,1.55)
line from C1.P to (4.8,1.5); circle rad 0.04 at (4.84,1.5)
"out" above at (4.84,1.55)
ground((1.2,0))
.model NMOD NMOS(LEVEL=1 VTO=0.7 KP=110u LAMBDA=0.04)
.model PMOD PMOS(LEVEL=1 VTO=-0.7 KP=50u LAMBDA=0.05)
.tran 0.1n 60n
.PE
the figure — rendered by Dune's rpic
T₂ T₁ G₁ VDD 1p in out
dune pic cmosinv.pic
* netlist extracted by dune-pic
M2 Vout Vin Vdd Vdd PMOD W=8u L=1u
M1 Vout Vin 0 0 NMOD W=4u L=1u
V1 Vin 0 PULSE(0 5 5n 1n 1n 20n 50n)
V2 Vdd 0 DC 5
C1 Vout 0 1p
.model NMOD NMOS(LEVEL=1 VTO=0.7 KP=110u LAMBDA=0.04)
.model PMOD PMOS(LEVEL=1 VTO=-0.7 KP=50u LAMBDA=0.05)
.tran 0.1n 60n
.end
Transient Analysis
0 V1 V2 V3 V4 V5 V0 s10 ns20 ns30 ns40 ns50 ns60 nsv(vout)v(vin)
v(vout)v(vin)(+3 more vectors)

basic/dc2src.cir drawn: two sources summed into R3 through 1k and 2k

corpus/pic/dc2src.pic.dc#
dc2src.pic
.PS
# basic/dc2src.cir drawn: two sources summed into R3 through 1k and 2k
# (Millman: v(vx) = (2 v1 + v2)/5), then an inverting VCVS (x-1.5)
# into R4, swept over both sources. Card order kept; deck nodes 1 V1n,
# 2 V2n, 3 Vx, 4 Vout.
spice = 1
V1n:  (0.3,2)
V2n:  (2.9,2)
Vx:   (1.6,2)
Vout: (4.4,2)

V1: vsource(V1n, (0.3,0), dc 0)
V2: vsource(V2n, (2.9,0), dc 0)
R1: resistor(V1n, Vx, 1k)
R2: resistor(V2n, Vx, 2k)
R3: resistor(Vx, (1.6,0), 1k)
E1: vcvs(Vout, (4.4,0), (3.9,1.2), (3.9,0.8), -1.5)
R4: resistor((5.6,2), (5.6,0), 1k)

line from Vx to (1.6,2.6) then to (3.6,2.6) then to (3.6,1.2) then to E1.Cp
line from E1.Cn to (3.6,0.8) then to (3.6,0)
line from E1.P to R4.P
line from V1.N to R4.N
dot at Vx; dot at R3.N; dot at V2.N; dot at (3.6,0); dot at E1.N
ground((0.95,0))
.dc v1 0 1 0.25 v2 0 2 0.5
.PE
the figure — rendered by Dune's rpic
dc 0 dc 0 1k 2k 1k -1.5 + − 1k
dune pic dc2src.pic
* netlist extracted by dune-pic
V1 V1n 0 dc 0
V2 V2n 0 dc 0
R1 V1n Vx 1k
R2 V2n Vx 2k
R3 Vx 0 1k
E1 Vout 0 Vx 0 -1.5
R4 Vout 0 1k
.dc v1 0 1 0.25 v2 0 2 0.5
.end
DC transfer characteristicnested sweep
-1.5 V-1 V-500 mV0 V500 mV1 V0 V200 mV400 mV600 mV800 mVv(vx)v(vout)
v(vx)v(vout)(+5 more vectors)

basic/depsrc.cir drawn: the four dependent sources, each into its own load, all controlled by the 2 V source V1 — the VCVS (x2.5) and the VCCS (1 mS) by its voltage (top row, wired to it), the CCCS (x10) and the CCVS (-500 ohm) by its current i(v1) = -2 mA (bottom row, named in the card). Card order kept; deck nodes 1 Vc, 2 Ve, 3 Vg, 4 Vf, 5 Vh

corpus/pic/depsrc.pic.op#
depsrc.pic
.PS
# basic/depsrc.cir drawn: the four dependent sources, each into its own
# load, all controlled by the 2 V source V1 — the VCVS (x2.5) and the
# VCCS (1 mS) by its voltage (top row, wired to it), the CCCS (x10) and
# the CCVS (-500 ohm) by its current i(v1) = -2 mA (bottom row, named
# in the card). Card order kept; deck nodes 1 Vc, 2 Ve, 3 Vg, 4 Vf,
# 5 Vh.
spice = 1
Vc: (0.3,5.6)
Ve: (2.8,5)
Vg: (5.2,5)
Vf: (1.5,2)
Vh: (4.2,2)

V1: vsource(Vc, (0.3,3), dc 2)
R1: resistor((1.1,5.6), (1.1,3), 1k)
E1: vcvs(Ve, (2.8,3), (2.3,4.2), (2.3,3.8), 2.5)
RE: resistor((4,5), (4,3), 1k)
G1: vccs((5.2,3), Vg, (4.7,4.2), (4.7,3.8), 1m)
RG: resistor((6.4,5), (6.4,3), 2k)
F1: cccs((1.5,0), Vf, v1 10, "10 i(V1)")
RF: resistor((2.5,2), (2.5,0), 100)
H1: ccvs(Vh, (4.2,0), v1 -500, "−500 i(V1)")
RH: resistor((5.2,2), (5.2,0), 1k)

line from V1.P to R1.P then to (4.4,5.6)
line from (2,5.6) to (2,4.2) then to E1.Cp
line from E1.Cn to (2,3.8) then to (2,3)
line from (4.4,5.6) to (4.4,4.2) then to G1.Cp
line from G1.Cn to (4.4,3.8) then to (4.4,3)
line from E1.P to RE.P
line from G1.N to RG.P
line from V1.N to RG.N
line from F1.N to RF.P
line from H1.P to RH.P
line from F1.P to RH.N
dot at R1.P; dot at (2,5.6)
dot at R1.N; dot at (2,3); dot at E1.N; dot at RE.N; dot at (4.4,3); dot at G1.P
dot at RF.N; dot at H1.N
ground((0.7,3)); ground((3.3,0))
.op
.PE
the figure — rendered by Dune's rpic
dc 2 1k 2.5 + − 1k 1m + − 2k 10 i(V1) 100 −500 i(V1) 1k
dune pic depsrc.pic
* netlist extracted by dune-pic
V1 Vc 0 dc 2
R1 Vc 0 1k
E1 Ve 0 Vc 0 2.5
RE Ve 0 1k
G1 0 Vg Vc 0 1m
RG Vg 0 2k
F1 0 Vf v1 10
RF Vf 0 100
H1 Vh 0 v1 -500
RH Vh 0 1k
.op
.end
Operating Point
vectorvalue
v(vc)2 V
i(v1)-2 mA
v(ve)5 V
i(e1)-5 mA
v(vg)4 V
v(vf)-2 V
v(vh)1 V
i(h1)-1 mA

basic/dfwd.cir drawn: two diodes of one model forward at 0.9 V — D1 straight across the source with area 2 (twice IS, half RS), D2 in series with 50 ohm. Card order kept; deck nodes 1 Va, 2 Vk

corpus/pic/dfwd.pic.op#
dfwd.pic
.PS
# basic/dfwd.cir drawn: two diodes of one model forward at 0.9 V — D1
# straight across the source with area 2 (twice IS, half RS), D2 in
# series with 50 ohm. Card order kept; deck nodes 1 Va, 2 Vk.
spice = 1
Va: (1.7,1.6)
Vk: (3,1.6)

V1: vsource((0.3,1.6), (0.3,0), dc 0.9)
D1: diode(Va, (1.7,0), dmod 2.0)
D2: diode(Va, Vk, dmod)
R2: resistor(Vk, (3,0), 50)

line from V1.P to Va
line from V1.N to R2.N
dot at Va; dot at D1.N
ground((1,0))
.model dmod d(is=2.5e-15 rs=4 n=1.2)
.op
.PE
the figure — rendered by Dune's rpic
dc 0.9 dmod 2 dmod 50
dune pic dfwd.pic
* netlist extracted by dune-pic
V1 Va 0 dc 0.9
D1 Va 0 dmod 2.0
D2 Va Vk dmod
R2 Vk 0 50
.model dmod d(is=2.5e-15 rs=4 n=1.2)
.op
.end
Operating Point
vectorvalue
v(va)900 mV
i(v1)-11.383 mA
v(vk)60.248 mV

Berkeley's diffpair.cir drawn: an emitter-coupled pair Q1/Q2 with 10k collector loads, its tail current set by the Q3/Q4 mirror and Rbias (~0.56 mA). Elements are in the deck's card order, so the figure's netlist is the deck's with named nodes (1 In, 2 B1, 3 B2, 4 Vc1, 5 Vc2, 6 Tail, 7 Bias, 8 Vp, 9 Vn) and simulates identically

corpus/pic/diffpair.pic.tran#
diffpair.pic
.PS
# Berkeley's diffpair.cir drawn: an emitter-coupled pair Q1/Q2 with
# 10k collector loads, its tail current set by the Q3/Q4 mirror and
# Rbias (~0.56 mA). Elements are in the deck's card order, so the
# figure's netlist is the deck's with named nodes (1 In, 2 B1, 3 B2,
# 4 Vc1, 5 Vc2, 6 Tail, 7 Bias, 8 Vp, 9 Vn) and simulates identically.
spice = 1
In:   (0.3,2.5)
Bias: (1.95,1.42)
Vp:   (6.2,4)
Vn:   (6.2,0.3)

Vin: vsource(In, (0.3,1.7), sin(0 0.1 5meg) ac 1, "G₁")
Vcc: vsource(Vp, (6.2,3.2), 12, "VCC")
Vee: vsource(Vn, (6.2,1.1), -12, "VEE")
Q1: npn((2.9,2.5), qnl, "T₁")
Q2: npn((5.2,2.5), qnl, "T₂")
RS1: resistor((1.5,2.5), Q1.B, 1k)
RS2: resistor(Q2.B, (3.9,2.5), 1k)
RC1: resistor(Q1.C, (Q1.C.x,4), 10k)
RC2: resistor(Q2.C, (Q2.C.x,4), 10k)
Q3: npn((4.3,1), qnl, "T₃")
Q4: npn((2.6,1), qnl, "T₄")
Rbias: resistor((1.2,1.42), (1.2,2.3), 20k)

B1:   Q1.B
B2:   Q2.B
Vc1:  Q1.C
Vc2:  Q2.C
Tail: (Q3.C.x,1.7)

# input; the bias riser crosses it without a dot (no connection)
line from Vin.P to RS1.P
line from Rbias.N to (1.2,4) then to Vcc.P
# emitter-coupled tail and its current source
line from Q1.E to (Q1.E.x,1.7) then to (Q2.E.x,1.7) then to Q2.E
line from Q3.C to Tail
# mirror: Q4 diode-connected, its base/collector node drives Q3
line from Q3.B to (3.45,1) then to (3.45,1.42) then to Rbias.P
line from Q4.B to (1.95,1) then to Bias
line from Q4.E to (Q4.E.x,0.3) then to Vee.P
line from Q3.E to (Q3.E.x,0.3)
line from Vee.N to (6.6,1.1)
dot at Tail; dot at Q4.C; dot at Bias; dot at (Q3.E.x,0.3)
dot at RC1.N; dot at RC2.N
ground(Vin.N); ground(RS2.N); ground(Vcc.N); ground((6.6,1.1))
.model qnl npn(bf=80 rb=100 ccs=2pf tf=0.3ns tr=6ns cje=3pf cjc=2pf
+   va=50)
.tran 5ns 500ns
.PE
the figure — rendered by Dune's rpic
G₁ VCC VEE T₁ T₂ 1k 1k 10k 10k T₃ T₄ 20k
dune pic diffpair.pic
* netlist extracted by dune-pic
Vin In 0 sin(0 0.1 5meg) ac 1
Vcc Vp 0 12
Vee Vn 0 -12
Q1 Vc1 B1 Tail qnl
Q2 Vc2 B2 Tail qnl
RS1 In B1 1k
RS2 B2 0 1k
RC1 Vc1 Vp 10k
RC2 Vc2 Vp 10k
Q3 Tail Bias Vn qnl
Q4 Bias Bias Vn qnl
Rbias Bias Vp 20k
.model qnl npn(bf=80 rb=100 ccs=2pf tf=0.3ns tr=6ns cje=3pf cjc=2pf
+   va=50)
.tran 5ns 500ns
.end
Transient Analysis
-2 V0 V2 V4 V6 V8 V0 s100 ns200 ns300 ns400 ns500 nsv(in)v(vc1)v(b1)v(tail)v(vc2)v(b2)
v(in)v(vc1)v(b1)v(tail)v(vc2)v(b2)(+6 more vectors)

basic/divider.cir drawn: a 1k/2k divider on a 5 V source beside a 1 mA current source into 4.7k (two independent loops, one ground)

corpus/pic/divider.pic.op#
divider.pic
.PS
# basic/divider.cir drawn: a 1k/2k divider on a 5 V source beside a
# 1 mA current source into 4.7k (two independent loops, one ground).
# Card order kept; deck nodes 1 Vs, 2 Vdiv, 3 Vi.
spice = 1
Vs:   (0.3,2)
Vdiv: (1.5,2)
Vi:   (2.8,2)

V1: vsource(Vs, (0.3,0), dc 5)
R1: resistor(Vs, Vdiv, 1k)
R2: resistor(Vdiv, (1.5,0), 2k)
I1: isource((2.8,0), Vi, dc 1m)
R3: resistor((3.8,2), (3.8,0), 4.7k)

line from I1.N to R3.P
line from V1.N to R3.N
dot at R2.N; dot at I1.P
ground((0.9,0))
.op
.PE
the figure — rendered by Dune's rpic
dc 5 1k 2k dc 1m 4.7k
dune pic divider.pic
* netlist extracted by dune-pic
V1 Vs 0 dc 5
R1 Vs Vdiv 1k
R2 Vdiv 0 2k
I1 0 Vi dc 1m
R3 Vi 0 4.7k
.op
.end
Operating Point
vectorvalue
v(vs)5 V
i(v1)-1.6667 mA
v(vdiv)3.3333 V
v(vi)4.7 V

regress/jfet_amp.cir drawn: an n-JFET common-source stage (VTO -2, BETA 1.3m) with 4.7k drain load and 100 ohm source degeneration, driven through 10k; the 1.5 V sine pushes the gate into forward conduction on its crests. Card order kept; deck nodes 1 Vp, 5 In, 2 Vg, 3 Vd, 4 Vs

corpus/pic/jfet_amp.pic.ac.op.tran#
jfet_amp.pic
.PS
# regress/jfet_amp.cir drawn: an n-JFET common-source stage (VTO -2,
# BETA 1.3m) with 4.7k drain load and 100 ohm source degeneration,
# driven through 10k; the 1.5 V sine pushes the gate into forward
# conduction on its crests. Card order kept; deck nodes 1 Vp, 5 In,
# 2 Vg, 3 Vd, 4 Vs.
spice = 1
Vp: (4.4,3.2)
In: (0.3,1.5)
Vg: (2.3,1.5)
Vd: (2.86,2.3)
Vs: (2.86,1.14)

Vdd: vsource(Vp, (4.4,0), dc 15, "VDD")
Vin: vsource(In, (0.3,0), dc 0 ac 1 sin(0 1.5 1meg), "G₁")
Rsig: resistor(In, Vg, 10k)
J1: njfet((2.7,1.5), jn, "T₁")
RD: resistor((2.86,3.2), Vd, 4.7k)
RS: resistor(Vs, (2.86,0), 100)

line from RD.N to J1.D
line from RD.P to Vdd.P
line from Vin.N to Vdd.N
line from Vd to (3.6,2.3); circle rad 0.04 at (3.64,2.3)
"out" above at (3.64,2.35)
dot at Vd; dot at RS.N
ground((1.5,0))
.model jn njf vto=-2 beta=1.3e-3 lambda=0.01 rd=20 rs=15 cgs=3p cgd=1.5p
+ pb=0.8 is=2e-14 b=0.95
.ac dec 10 1k 1g
.op
.tran 10n 3u
.PE
the figure — rendered by Dune's rpic
VDD G₁ 10k T₁ 4.7k 100 out
dune pic jfet_amp.pic
* netlist extracted by dune-pic
Vdd Vp 0 dc 15
Vin In 0 dc 0 ac 1 sin(0 1.5 1meg)
Rsig In Vg 10k
J1 Vd Vg Vs jn
RD Vp Vd 4.7k
RS Vs 0 100
.model jn njf vto=-2 beta=1.3e-3 lambda=0.01 rd=20 rs=15 cgs=3p cgd=1.5p
+ pb=0.8 is=2e-14 b=0.95
.ac dec 10 1k 1g
.op
.tran 10n 3u
.end
AC Analysismagnitudelog f
0 V200 mV400 mV600 mV800 mV1 V1.2 V1 kHz100 kHz10 MHz1 GHzv(vg)v(vd)v(vs)
v(vg)v(vd)v(vs)(+4 more vectors)
Operating Point
vectorvalue
v(vp)15 V
i(vdd)-2.9073 mA
v(in)0 V
i(vin)1.6518 pA
v(vg)16.518 nV
v(vd)1.3356 V
v(vs)290.73 mV
Transient Analysis
-2 V0 V2 V4 V6 V8 V10 V12 V14 V0 s500 ns1 µs1.5 µs2 µs2.5 µs3 µsv(in)v(vg)v(vd)v(vs)
v(in)v(vg)v(vd)v(vs)(+3 more vectors)

basic/lck.cir drawn: at the operating point the coils are shorts and the capacitors open, so v(vl) = 3 V and the coupled secondary L2

corpus/pic/lck.pic.op#
lck.pic
.PS
# basic/lck.cir drawn: at the operating point the coils are shorts and
# the capacitors open, so v(vl) = 3 V and the coupled secondary L2
# (k = 0.95) carries nothing: v(sec) = 0. Card order kept; deck nodes
# 1 Vs, 2 Vl, 3 Sec.
spice = 1
Vs:  (2.25,2.4)
Vl:  (2.25,1.2)
Sec: (3.25,2.4)

V1: vsource((0.3,2.4), (0.3,0), dc 3)
L1: inductor(Vs, Vl, 10m)
R1: resistor(Vl, (2.25,0), 150)
L2: inductor(Sec, (3.25,1.2), 20m)
K12: coupling(L1, L2, 0.95)
C1: capacitor((1.25,1.2), (1.25,0), 10u)
C2: capacitor((4.05,2.4), (4.05,0), 22u)
R3: resistor((4.85,2.4), (4.85,0), 1k)

line from V1.P to Vs
line from Vl to C1.P
line from L2.N to (3.25,0)
line from L2.P to R3.P
line from V1.N to R3.N
dot at Vl; dot at C2.P
dot at C1.N; dot at R1.N; dot at (3.25,0); dot at C2.N
ground((0.75,0))
.op
.PE
the figure — rendered by Dune's rpic
dc 3 10m 150 20m k=0.95 10u 22u 1k
dune pic lck.pic
* netlist extracted by dune-pic
V1 Vs 0 dc 3
L1 Vs Vl 10m
R1 Vl 0 150
L2 Sec 0 20m
K12 L1 L2 0.95
C1 Vl 0 10u
C2 Sec 0 22u
R3 Sec 0 1k
.op
.end
Operating Point
vectorvalue
v(vs)3 V
i(v1)-20 mA
v(vl)3 V
i(l1)20 mA
v(sec)0 V
i(l2)0 A

regress/mes_amp.cir drawn: an n-MESFET (Statz, NMF) common-source stage with a 1k drain load and a 50 fF load capacitor, driven through 50 ohm by a 1 GHz sine biased at -0.5 V. Card order kept; deck nodes 1 Vp, 5 In, 2 Vg, 3 Vd

corpus/pic/mes_amp.pic.ac.tran#
mes_amp.pic
.PS
# regress/mes_amp.cir drawn: an n-MESFET (Statz, NMF) common-source
# stage with a 1k drain load and a 50 fF load capacitor, driven through
# 50 ohm by a 1 GHz sine biased at -0.5 V. Card order kept; deck nodes
# 1 Vp, 5 In, 2 Vg, 3 Vd.
spice = 1
Vp: (4.8,3.2)
In: (0.3,1.5)
Vg: (2.3,1.5)
Vd: (2.86,2.3)

Vdd: vsource(Vp, (4.8,0), dc 5, "VDD")
Vin: vsource(In, (0.3,0), dc -0.5 ac 1 sin(-0.5 1.5 1g), "G₁")
Rsig: resistor(In, Vg, 50)
Z1: nmes((2.7,1.5), zn, "T₁")
RL: resistor((2.86,3.2), Vd, 1k)
CL: capacitor((3.7,2.3), (3.7,0), 50f)

line from RL.N to Z1.D
line from RL.P to Vdd.P
line from Vd to CL.P then to (4.1,2.3); circle rad 0.04 at (4.14,2.3)
"out" above at (4.14,2.35)
line from Z1.S to (2.86,0)
line from Vin.N to Vdd.N
dot at Vd; dot at (2.86,0); dot at CL.N
ground((1.5,0))
.model zn nmf vto=-1.8 beta=3e-3 b=0.3 alpha=2.5 lambda=0.05 rd=5 rs=5
+ cgs=1p cgd=0.2p pb=0.8
.ac dec 10 1meg 100g
.tran 10p 4n
.PE
the figure — rendered by Dune's rpic
VDD G₁ 50 T₁ 1k 50f out
dune pic mes_amp.pic
* netlist extracted by dune-pic
Vdd Vp 0 dc 5
Vin In 0 dc -0.5 ac 1 sin(-0.5 1.5 1g)
Rsig In Vg 50
Z1 Vd Vg 0 zn
RL Vp Vd 1k
CL Vd 0 50f
.model zn nmf vto=-1.8 beta=3e-3 b=0.3 alpha=2.5 lambda=0.05 rd=5 rs=5
+ cgs=1p cgd=0.2p pb=0.8
.ac dec 10 1meg 100g
.tran 10p 4n
.end
AC Analysismagnitudelog f
0 V1 V2 V3 V4 V5 V1 MHz10 MHz100 MHz1 GHz10 GHz100 GHzv(vg)v(vd)
v(vg)v(vd)(+4 more vectors)
Transient Analysis
-2 V-1 V0 V1 V2 V3 V4 V0 s1 ns2 ns3 ns4 nsv(in)v(vg)v(vd)
v(in)v(vg)v(vd)(+3 more vectors)

regress/mos3_inv.cir drawn: two level-3 CMOS inverters in cascade

corpus/pic/mos3_inv.pic.ac.op.tran#
mos3_inv.pic
.PS
# regress/mos3_inv.cir drawn: two level-3 CMOS inverters in cascade
# (T₁/T₂ drive T₃/T₄, 50f and 100f loads) and, on the right, a
# self-biased level-3 amplifier T₅ — 200k drain-to-gate feedback,
# 500 ohm source degeneration with the bulk on ground (a four-terminal
# MOS), 10k load. Card order kept; deck nodes 1 Vp, 2 In, 3 Out1,
# 4 Out2, 5 Ain, 6 Vg, 7 Vd, 8 Vs.
spice = 1
maxpswid = 12
Vp:   (11.2,3.1)
In:   (1.2,1.5)
Out1: (2.16,1.5)
Out2: (4.56,1.5)
Ain:  (6.8,1.2)
Vg:   (7.8,1.2)
Vd:   (8.96,2)
Vs:   (8.96,0.84)

Vdd: vsource(Vp, (11.2,0), dc 3.3, "VDD")
Vin: vsource((0.3,1.5), (0.3,0), dc 0 pulse(0 3.3 2n 1n 1n 8n 20n), "G₁")
MN1: nmos((2,0.9), n3 l=1u w=4u ad=8p as=8p pd=12u ps=12u, "T₁")
MP1: pmos((2,2.1), p3 l=1u w=10u ad=20p as=20p pd=24u ps=24u, "T₂")
C3: capacitor((3.2,1.5), (3.2,0), 50f)
MN2: nmos((4.4,0.9), n3 l=1u w=4u ad=8p as=8p pd=12u ps=12u, "T₃")
MP2: pmos((4.4,2.1), p3 l=1u w=10u ad=20p as=20p pd=24u ps=24u, "T₄")
C4: capacitor((5.6,1.5), (5.6,0), 100f)
Vac: vsource(Ain, (6.8,0), dc 0 ac 1, "G₂")
Cin: capacitor(Ain, Vg, 10p)
RF: resistor(Vd, (7.8,2), 200k)
MN3: nmos4((8.8,1.2), n3 l=2u w=20u ad=40p as=40p pd=44u ps=44u, "T₅")
RS3: resistor(Vs, (8.96,0), 500)
RL: resistor((8.96,3.1), Vd, 10k)
C7: capacitor((10.3,2), (10.3,0), 0.2p)

# the two inverters
line from Vin.P to In
line from MN1.G to (1.2,0.9) then to (1.2,2.1) then to MP1.G
line from MP1.D to MN1.D
line from Out1 to C3.P then to (3.6,1.5)
line from MN2.G to (3.6,0.9) then to (3.6,2.1) then to MP2.G
line from MP2.D to MN2.D
line from Out2 to C4.P
line from MN1.S to (2.16,0)
line from MN2.S to (4.56,0)
# the amplifier
line from Cin.N to MN3.G
line from RF.N to Vg
line from MN3.D to Vd then to C7.P
line from MN3.B to (9.4,1.2) then to (9.4,0)
# rails
line from MP1.S to (2.16,3.1) then to Vp
line from MP2.S to (4.56,3.1)
line from Vin.N to Vdd.N
dot at In; dot at Out1; dot at C3.P; dot at (3.6,1.5); dot at Out2
dot at Vg; dot at Vd
dot at (4.56,3.1); dot at RL.P
dot at (2.16,0); dot at C3.N; dot at (4.56,0); dot at C4.N; dot at Vac.N
dot at RS3.N; dot at (9.4,0); dot at C7.N
ground((0.75,0))
.model n3 nmos level=3 vto=0.6 nsub=4e16 tox=1.5e-8 xj=0.15u ld=0.05u u0=450
+ theta=0.06 eta=0.2 delta=0.6 vmax=1.6e5 kappa=0.4 nfs=6e11 rsh=15
+ cj=4e-4 mj=0.45 cjsw=3e-10 mjsw=0.3 cgso=2e-10 cgdo=2e-10 cgbo=1e-10
.model p3 pmos level=3 vto=-0.7 nsub=3e16 tox=1.5e-8 xj=0.2u ld=0.06u u0=180
+ theta=0.05 eta=0.15 delta=0.5 kappa=0.6 nfs=4e11 rsh=25
+ cj=5e-4 mj=0.5 cjsw=3.5e-10 mjsw=0.33 cgso=2.5e-10 cgdo=2.5e-10 cgbo=1e-10
.ac dec 10 10k 10g
.op
.tran 0.1n 40n
.PE
the figure — rendered by Dune's rpic
VDD G₁ T₁ T₂ 50f T₃ T₄ 100f G₂ 10p 200k T₅ 500 10k 0.2p
dune pic mos3_inv.pic
* netlist extracted by dune-pic
Vdd Vp 0 dc 3.3
Vin In 0 dc 0 pulse(0 3.3 2n 1n 1n 8n 20n)
MN1 Out1 In 0 0 n3 l=1u w=4u ad=8p as=8p pd=12u ps=12u
MP1 Out1 In Vp Vp p3 l=1u w=10u ad=20p as=20p pd=24u ps=24u
C3 Out1 0 50f
MN2 Out2 Out1 0 0 n3 l=1u w=4u ad=8p as=8p pd=12u ps=12u
MP2 Out2 Out1 Vp Vp p3 l=1u w=10u ad=20p as=20p pd=24u ps=24u
C4 Out2 0 100f
Vac Ain 0 dc 0 ac 1
Cin Ain Vg 10p
RF Vd Vg 200k
MN3 Vd Vg Vs 0 n3 l=2u w=20u ad=40p as=40p pd=44u ps=44u
RS3 Vs 0 500
RL Vp Vd 10k
C7 Vd 0 0.2p
.model n3 nmos level=3 vto=0.6 nsub=4e16 tox=1.5e-8 xj=0.15u ld=0.05u u0=450
+ theta=0.06 eta=0.2 delta=0.6 vmax=1.6e5 kappa=0.4 nfs=6e11 rsh=15
+ cj=4e-4 mj=0.45 cjsw=3e-10 mjsw=0.3 cgso=2e-10 cgdo=2e-10 cgbo=1e-10
.model p3 pmos level=3 vto=-0.7 nsub=3e16 tox=1.5e-8 xj=0.2u ld=0.06u u0=180
+ theta=0.05 eta=0.15 delta=0.5 kappa=0.6 nfs=4e11 rsh=25
+ cj=5e-4 mj=0.5 cjsw=3.5e-10 mjsw=0.33 cgso=2.5e-10 cgdo=2.5e-10 cgbo=1e-10
.ac dec 10 10k 10g
.op
.tran 0.1n 40n
.end
AC Analysismagnitudelog f
0 V1 V2 V3 V4 V10 kHz1 MHz100 MHz10 GHzv(vg)v(vd)v(vs)
v(vg)v(vd)v(vs)(+8 more vectors)
Operating Point
vectorvalue
v(vp)3.3 V
i(vdd)-194.08 µA
v(in)0 V
i(vin)0 A
v(out1)3.3 V
v(out2)9.9129 nV
v(ain)0 V
i(vac)0 A
v(vg)1.3592 V
v(vd)1.3592 V
v(vs)97.042 mV
Transient Analysis
-500 mV0 V500 mV1 V1.5 V2 V2.5 V3 V3.5 V0 s10 ns20 ns30 ns40 nsv(in)v(out1)v(out2)v(ain)
v(in)v(out1)v(out2)v(ain)(+7 more vectors)

Body effect: M1 (MOS1, VTO 0.7, GAMMA 0.5, PHI 0.6) with its bulk on V3 instead of the source. With VBS = -2 V the threshold rises to 0.7 + 0.5 (sqrt(2.6) - sqrt(0.6)) = 1.119 V, and the saturated drain current at VGS = 2 V falls from 0.845 mA to 0.388 mA. The .dc sweep walks VBS from 0 to -3 V

corpus/pic/mos4bias.pic.op.dc#
mos4bias.pic
.PS
# Body effect: M1 (MOS1, VTO 0.7, GAMMA 0.5, PHI 0.6) with its bulk on
# V3 instead of the source. With VBS = -2 V the threshold rises to
# 0.7 + 0.5 (sqrt(2.6) - sqrt(0.6)) = 1.119 V, and the saturated drain
# current at VGS = 2 V falls from 0.845 mA to 0.388 mA. The .dc sweep
# walks VBS from 0 to -3 V.
spice = 1
M1: nmos4((2,1), NMOD W=10u L=1u)
Vg:  (0.6,1)
Vd:  M1.D
Vb:  (3.2,1)
Vdd: (4.6,2.4)

V1: vsource(Vdd, (4.6,0), DC 5)
V2: vsource(Vg, (0.6,0), DC 2)
V3: vsource(Vb, (3.2,0), DC -2)
RD: resistor((M1.D.x,2.4), M1.D, 1k)

line from V2.P to M1.G
line from M1.B to V3.P
line from RD.P to V1.P
line from M1.S to (M1.S.x,0)
line from V2.N to V1.N
dot at (M1.S.x,0); dot at V3.N
ground((1.3,0))
.model NMOD NMOS(LEVEL=1 VTO=0.7 KP=100u GAMMA=0.5 PHI=0.6)
.op
.dc V3 0 -3 -1
.PE
the figure — rendered by Dune's rpic
NMOD W=10u L=1u DC 5 DC 2 DC -2 1k
dune pic mos4bias.pic
* netlist extracted by dune-pic
M1 Vd Vg 0 Vb NMOD W=10u L=1u
V1 Vdd 0 DC 5
V2 Vg 0 DC 2
V3 Vb 0 DC -2
RD Vdd Vd 1k
.model NMOD NMOS(LEVEL=1 VTO=0.7 KP=100u GAMMA=0.5 PHI=0.6)
.op
.dc V3 0 -3 -1
.end
Operating Point
vectorvalue
v(vd)4.6119 V
v(vg)2 V
v(vb)-2 V
v(vdd)5 V
i(v1)-388.14 µA
i(v2)0 A
i(v3)8.6319 pA
DC transfer characteristicnested sweep
4.1 V4.2 V4.3 V4.4 V4.5 V4.6 V4.7 V4.8 V-3 V-2.5 V-2 V-1.5 V-1 V-500 mV0 Vv(vd)
v(vd)(+6 more vectors)

Berkeley's mos6inv.cir drawn: four NDINV cells in a chain, each an instance of the subcircuit in mos6inv_sub.sub (pulled in by `.include`, with the deck's six model cards) through the generic `subckt6` box. Pins in `.SUBCKT NDINV 10 11 21 31 41 100` order: 1 in

corpus/pic/mos6inv.pic.tran#
mos6inv.pic
.PS
# Berkeley's mos6inv.cir drawn: four NDINV cells in a chain, each an
# instance of the subcircuit in mos6inv_sub.sub (pulled in by
# `.include`, with the deck's six model cards) through the generic
# `subckt6` box. Pins in `.SUBCKT NDINV 10 11 21 31 41 100` order: 1 in
# (left), 2-4 the inner stage outputs (bottom, brought out to test
# points as the deck does, so each is a one-pin net), 5 out (right),
# 6 vdd (top). Card order kept (XNDINV1-4, VDD, VIN); deck nodes 1 In,
# 2-5 N2-N5, 11-43 N11-N43, 100 Vp.
spice = 1
maxpswid = 12
In: (0.9,1.5)
N2: (2.1,1.5)
N3: (3.9,1.5)
N4: (5.7,1.5)
N5: (7.5,1.5)
Vp: (1.5,2.3)
N11: (1.2,1.1)
N12: (1.5,1.1)
N13: (1.8,1.1)
N21: (3,1.1)
N22: (3.3,1.1)
N23: (3.6,1.1)
N31: (4.8,1.1)
N32: (5.1,1.1)
N33: (5.4,1.1)
N41: (6.6,1.1)
N42: (6.9,1.1)
N43: (7.2,1.1)

XNDINV1: subckt6(In, N11, N12, N13, N2, (1.5,1.9), NDINV)
XNDINV2: subckt6((2.7,1.5), N21, N22, N23, N3, (3.3,1.9), NDINV)
XNDINV3: subckt6((4.5,1.5), N31, N32, N33, N4, (5.1,1.9), NDINV)
XNDINV4: subckt6((6.3,1.5), N41, N42, N43, N5, (6.9,1.9), NDINV)
VDD: vsource((8.7,2.3), (8.7,0), 5, "VDD")
VIN: vsource((0.3,1.5), (0.3,0), DC 0 PWL(0 0 2N 5), "G₁")

line from VIN.P to XNDINV1.P1
line from XNDINV1.P5 to XNDINV2.P1
line from XNDINV2.P5 to XNDINV3.P1
line from XNDINV3.P5 to XNDINV4.P1
line from XNDINV4.P5 to (7.9,1.5); circle rad 0.04 at (7.94,1.5)
"out" above at (7.94,1.55)
line from Vp to VDD.P
line from XNDINV1.P6 to (XNDINV1.P6.x,2.3)
line from XNDINV2.P6 to (XNDINV2.P6.x,2.3)
line from XNDINV3.P6 to (XNDINV3.P6.x,2.3)
line from XNDINV4.P6 to (XNDINV4.P6.x,2.3)
dot at (3.3,2.3); dot at (5.1,2.3); dot at (6.9,2.3)
line from XNDINV1.P2 to (1.2,0.84); circle rad 0.04 at (1.2,0.8); "11" below at (1.2,0.76)
line from XNDINV1.P3 to (1.5,0.84); circle rad 0.04 at (1.5,0.8); "12" below at (1.5,0.76)
line from XNDINV1.P4 to (1.8,0.84); circle rad 0.04 at (1.8,0.8); "13" below at (1.8,0.76)
line from XNDINV2.P2 to (3,0.84); circle rad 0.04 at (3,0.8); "21" below at (3,0.76)
line from XNDINV2.P3 to (3.3,0.84); circle rad 0.04 at (3.3,0.8); "22" below at (3.3,0.76)
line from XNDINV2.P4 to (3.6,0.84); circle rad 0.04 at (3.6,0.8); "23" below at (3.6,0.76)
line from XNDINV3.P2 to (4.8,0.84); circle rad 0.04 at (4.8,0.8); "31" below at (4.8,0.76)
line from XNDINV3.P3 to (5.1,0.84); circle rad 0.04 at (5.1,0.8); "32" below at (5.1,0.76)
line from XNDINV3.P4 to (5.4,0.84); circle rad 0.04 at (5.4,0.8); "33" below at (5.4,0.76)
line from XNDINV4.P2 to (6.6,0.84); circle rad 0.04 at (6.6,0.8); "41" below at (6.6,0.76)
line from XNDINV4.P3 to (6.9,0.84); circle rad 0.04 at (6.9,0.8); "42" below at (6.9,0.76)
line from XNDINV4.P4 to (7.2,0.84); circle rad 0.04 at (7.2,0.8); "43" below at (7.2,0.76)
line from VIN.N to VDD.N
ground((4.2,0))
.include mos6inv_sub.sub
.TRAN 0.5N 150N
.PRINT TRAN V(In) V(N2) V(N3) V(N4) V(N5)
.PRINT TRAN V(N11) V(N12) V(N13) V(N41) V(N42) V(N43)
.OPTIONS ACCT
.PE
the figure — rendered by Dune's rpic
NDINV 1 2 3 4 5 6 NDINV 1 2 3 4 5 6 NDINV 1 2 3 4 5 6 NDINV 1 2 3 4 5 6 VDD G₁ out 11 12 13 21 22 23 31 32 33 41 42 43
dune pic mos6inv.pic
* netlist extracted by dune-pic
XNDINV1 In N11 N12 N13 N2 Vp NDINV
XNDINV2 N2 N21 N22 N23 N3 Vp NDINV
XNDINV3 N3 N31 N32 N33 N4 Vp NDINV
XNDINV4 N4 N41 N42 N43 N5 Vp NDINV
VDD Vp 0 5
VIN In 0 DC 0 PWL(0 0 2N 5)
.include mos6inv_sub.sub
.TRAN 0.5N 150N
.PRINT TRAN V(In) V(N2) V(N3) V(N4) V(N5)
.PRINT TRAN V(N11) V(N12) V(N13) V(N41) V(N42) V(N43)
.OPTIONS ACCT
.end
mos6inv_sub.sub — pulled in by .include
* mos6inv_sub.sub: the NDINV subcircuit and the model cards of
* Berkeley's mos6inv.cir (corpus/spice3f5/examples), verbatim, for
* corpus/pic/mos6inv.pic, which pulls them in with `.include` (a
* .subckt body is not `.` lines, so it cannot live in the figure).
* Pins: in, the three inner stage outputs, out, vdd.
.SUBCKT NDINV 10 11 21 31 41 100
MP11  11 100 100 100   P12L5   L=1.2U W=5U
MP12  11 100 100 100   P12L5   L=1.2U W=5U
MP13  11 100 100 100   P12L5   L=1.2U W=5U
MP14  11  10 100 100   P12L5   L=1.2U W=5U
MN11  11 100  12   0   N10L5   L=1.0U W=5U
MN12  12 100  13   0   N10L5   L=1.0U W=5U
MN13  13 100  14   0   N10L5   L=1.0U W=5U
MN14  14  10   0   0   N10L5   L=1.0U W=5U

MP21  23   0 100 100   P12L5   L=1.2U W=20U
MP22  22  11  23 100   P12L5   L=1.2U W=20U
MP23  21   0  22 100   P12L5   L=1.2U W=20U
MN21  21   0   0   0   N10L5   L=1.0U W=5U
MN22  21  11   0   0   N10L5   L=1.0U W=5U
MN23  21   0   0   0   N10L5   L=1.0U W=5U

MP31  31  21 100 100   P12L5   L=1.2U W=10U
MP32  31 100 100 100   P12L5   L=1.2U W=10U
MN31  31  21  32   0   N10L5   L=1.0U W=5U
MN32  32 100   0   0   N10L5   L=1.0U W=5U

MP41  41  31 100 100   P12L5   L=1.2U W=10U
MN41  41  31   0   0   N10L5   L=1.0U W=5U

C11   11   0  1P
C21   21   0  1P
C31   31   0  1P
C41   41   0  1P
.ENDS

**** LEVEL 1 NMOS ****
.MODEL N10L1 NMOS
+ LEVEL=1 TPG=1
+ KP=2.33082E-05
+ LAMBDA=0.013333 VT0=0.69486 GAMMA=0.60309 PHI=1
+ TOX=1.9800000E-08  LD=0.1U           NSUB=4.9999999E+16
+ NSS=0.0000000E+00
+ CJ=4.091E-4        MJ=0.307           PB=1.0
+ CJSW=3.078E-10     MJSW=1.0E-2        
+ CGSO=3.93E-10      CGDO=3.93E-10
**** LEVEL 1 PMOS ****
.MODEL P12L1 PMOS
+ LEVEL=1 TPG=-1
+ KP=7.69968E-06
+ LAMBDA=0.018966 VT0=-0.60865 GAMMA=0.89213 PHI=1
+ TOX=1.9800000E-08  LD=0.28U           NSUB=4.9999999E+17
+ NSS=0.0000000E+00
+ CJ=6.852E-4        MJ=0.429           PB=1.0
+ CJSW=5.217E-10     MJSW=0.351
+ CGSO=7.29E-10      CGDO=7.29E-10
**** LEVEL 3 NMOS ****
.MODEL  N10L3  NMOS
+ LEVEL=3            TPG=+1
+ GAMMA=1.140501     THETA=0.8109787    KAPPA=0.1579183    ETA=5.0622310E-02
+ DELTA=0.000000E+00 UO=812.5126        VMAX=1186662.      VTO=0.8
+ TOX=1.9800000E-08  XJ=0.2U            LD=0.1U            NSUB=4.9999999E+16
+ NSS=0.0000000E+00
+ CJ=4.091E-4        MJ=0.307           PB=1.0
+ CJSW=3.078E-10     MJSW=1.0E-2        
+ CGSO=3.93E-10      CGDO=3.93E-10
**** LEVEL 3 PMOS ****
.MODEL  P12L3  PMOS
+ LEVEL=3            TPG=-1
+ GAMMA=1.211640     THETA=0.1184638    KAPPA=0.2162577    ETA=2.7580135E-02
+ DELTA=0.000000E+00 UO=89.16160        VMAX=5.9000000E+07 VTO=-0.8
+ TOX=1.9800000E-08  XJ=0.4U            LD=0.28U           NSUB=4.9999999E+17
+ NSS=0.0000000E+00
+ CJ=6.852E-4        MJ=0.429           PB=1.0
+ CJSW=5.217E-10     MJSW=0.351
+ CGSO=7.29E-10      CGDO=7.29E-10
**** LEVEL 6 NMOS ****
.MODEL N10L5 NMOS
+ LEVEL=6 TPG=1
+ KC=3.8921e-05 NC=1.1739 KV=0.91602 NV=0.87225
+ LAMBDA0=0.013333 LAMBDA1=0.0046901 VT0=0.69486 GAMMA=0.60309 PHI=1
+ TOX=1.9800000E-08  LD=0.1U           NSUB=4.9999999E+16
+ NSS=0.0000000E+00
+ CJ=4.091E-4        MJ=0.307           PB=1.0
+ CJSW=3.078E-10     MJSW=1.0E-2        
+ CGSO=3.93E-10      CGDO=3.93E-10
**** LEVEL 6 PMOS ****
.MODEL P12L5 PMOS
+ LEVEL=6 TPG=-1
+ KC=6.42696E-06 NC=1.6536 KV=0.92145 NV=0.88345
+ LAMBDA0=0.018966 LAMBDA1=0.0084012 VT0=-0.60865 GAMMA=0.89213 PHI=1
+ TOX=1.9800000E-08  LD=0.28U           NSUB=4.9999999E+17
+ NSS=0.0000000E+00
+ CJ=6.852E-4        MJ=0.429           PB=1.0
+ CJSW=5.217E-10     MJSW=0.351
+ CGSO=7.29E-10      CGDO=7.29E-10
Transient Analysisvectors from the deck’s .plot/.print
-1 V0 V1 V2 V3 V4 V5 V6 V0 s50 ns100 ns150 nsv(in)v(n2)v(n3)v(n4)v(n5)v(n11)
v(in)v(n2)v(n3)v(n4)v(n5)v(n11)(+38 more vectors)

Inverting amplifier: gain -R2/R1 = -10 around an ideal op-amp

corpus/pic/opamp.pic.dc#
opamp.pic
.PS
# Inverting amplifier: gain -R2/R1 = -10 around an ideal op-amp
# (corpus/pic/opamp_ideal.sub, pulled in by `.include` next to this file).
spice = 1
X1: opamp((3,1), opamp_ideal)
Vin:  (0.3,1.175)
Vm:   (1.8,1.175)
Vout: (3.8,1)

V1: vsource(Vin, (0.3,0), DC 0.5)
R1: resistor(Vin, Vm, 1k)
R2: resistor((1.8,2), (3.8,2), 10k)
line from Vm to X1.Inm
line from Vm to R2.P
line from R2.N to Vout
line from X1.Out to Vout then to (4.3,1); circle rad 0.04 at (4.34,1)
"out" ljust at (4.4,1)
line from X1.Inp to (X1.Inp.x,0)
line from V1.N to (X1.Inp.x,0)
dot at Vm; dot at Vout
ground((1.4,0))
.include opamp_ideal.sub
.dc V1 -1 1 0.25
.PE
the figure — rendered by Dune's rpic
opamp_ideal DC 0.5 1k 10k out
dune pic opamp.pic
* netlist extracted by dune-pic
X1 0 Vm Vout opamp_ideal
V1 Vin 0 DC 0.5
R1 Vin Vm 1k
R2 Vm Vout 10k
.include opamp_ideal.sub
.dc V1 -1 1 0.25
.end
opamp_ideal.sub — pulled in by .include
* opamp_ideal.sub: a minimal op-amp macromodel for the dune-pic figures.
* A single-pole-free gain block with 741-datasheet typicals:
* open-loop gain 200k, input resistance 2 Meg, output resistance 75.
* (Not a 741 model: no pole, no slew, no output limiting.)
* Pins in the order the prelude's opamp() emits them (D-0020):
* non-inverting input, inverting input, output.
.subckt opamp_ideal inp inm out
rin inp inm 2meg
e1 int 0 inp inm 200k
rout int out 75
.ends opamp_ideal
DC transfer characteristic
-15 V-10 V-5 V0 V5 V10 V15 V-1 V-500 mV0 V500 mV1 Vv(vm)v(x1.int)v(vout)
v(vm)v(x1.int)v(vout)(+3 more vectors)

RC low-pass driven by a 0 -> 5 V step; tau = R1*C1 = 1 ms

corpus/pic/rc.pic.tran#
rc.pic
.PS
# RC low-pass driven by a 0 -> 5 V step; tau = R1*C1 = 1 ms.
spice = 1
Vin: (0,1.5); Vout: (2.5,1.5)
V1: vsource(Vin, (0,0), PULSE(0 5 0 1u 1u 10m 20m), "G₁")
R1: resistor(Vin, Vout, 1k)
C1: capacitor(Vout, (2.5,0), 1u)
line from V1.N to C1.N
ground((1.25,0))
dot at Vin; dot at Vout
"in" above at Vin + (0,0.05)
"out" above at Vout + (0,0.05)
.tran 20u 5m
.PE
the figure — rendered by Dune's rpic
G₁ 1k 1u in out
dune pic rc.pic
* netlist extracted by dune-pic
V1 Vin 0 PULSE(0 5 0 1u 1u 10m 20m)
R1 Vin Vout 1k
C1 Vout 0 1u
.tran 20u 5m
.end
Transient Analysis
0 V1 V2 V3 V4 V5 V0 s1 ms2 ms3 ms4 ms5 msv(vin)v(vout)
v(vin)v(vout)(+1 more vector)

Berkeley's rca3040.cir drawn: the RCA CA3040 wideband amplifier

corpus/pic/rca3040.pic.ac.dc.tran#
rca3040.pic
.PS
# Berkeley's rca3040.cir drawn: the RCA CA3040 wideband amplifier.
# Emitter followers T₁/T₂ drive the pair T₃/T₄, cascoded by T₅/T₆
# (their bases held by the diode string T₇/T₈ under R7); T₉ sinks the
# tail current set by R4/R5/R3, and T₁₀/T₁₁ buffer the two collector
# loads. Elements are in the deck's card order (pins are coordinates,
# so no transistor is referenced before its card), and the figure's
# netlist is the deck's with named nodes (1 In, 2 Vp, 3 Vn, 5 Ba,
# 6 Bb, 7 Tail, 8 Bias, 9 Vt, 10 Ca, 11 Cb, 12 Vcas, 13 Vd, 14 Oa,
# 15 Ob, 16 Out, 17 Outb, 30 B1, 31 B2). Two wires cross without a dot
# (no connection): the cascode bias into T₆ and T₂'s emitter into T₄,
# each over the T₃–T₅ / T₄–T₆ link. The deck's 3-node Q cards keep
# the substrate (CCS) on ground, so the plain npn symbol is used.
spice = 1
maxpswid = 12
In:   (0.2,4.4)
B1:   (1.52,4.4)
B2:   (8.92,4.4)
Vp:   (10.6,8.4)
Vn:   (10.6,0)
Ba:   (2.16,3.2)
Bb:   (9.56,3.85)
Tail: (6.16,2.3)
Bias: (4.4,1.6)
Vt:   (6.16,1.18)
Ca:   (4.76,3.8)
Cb:   (7.56,4.1)
Vcas: (3.4,7)
Vd:   (3.4,5.9)
Oa:   (4.76,6.6)
Ob:   (7.56,6.6)
Out:  (8.56,6.18)
Outb: (5.76,6.18)

.ac dec 10 1 10ghz
.dc vin -0.25 0.25 0.005
.tran 2.0ns 200ns
Vin: vsource(In, (0.2,3.2), sin(0 0.1 50meg 0.5ns) ac 1, "G₁")
Vcc: vsource(Vp, (10.6,7.2), 15.0, "VCC")
Vee: vsource(Vn, (10.6,1), -15.0, "VEE")
RS1: resistor(B1, In, 1k)
RS2: resistor(B2, (7.95,4.4), 1k)
R1: resistor(Ba, (2.16,0), 4.8k)
R2: resistor(Bb, (9.56,0), 4.8k)
R3: resistor(Vt, (6.16,0), 811)
R4: resistor(Bias, (4.4,0), 2.17k)
R5: resistor((3.6,1.6), (3.6,0.6), 820)
R6: resistor((4.76,8.4), Oa, 1.32k)
R7: resistor((3.4,8.4), Vcas, 4.5k)
R8: resistor((7.56,8.4), Ob, 1.32k)
R9: resistor(Out, (8.56,5.3), 5.25k)
R10: resistor(Outb, (5.76,5.3), 5.25k)
Q1: npn((2,4.4), qnl, "T₁")
Q2: npn((9.4,4.4), qnl, "T₂")
Q3: npn((4.6,3.2), qnl, "T₃")
Q4: npn((7.4,3.2), qnl, "T₄")
Q5: npn((4.6,4.8), qnl, "T₅")
Q6: npn((7.4,4.8), qnl, "T₆")
Q7: npn((3.24,6.4), qnl, "T₇")
Q8: npn((3.24,5.4), qnl, "T₈")
Q9: npn((6,1.6), qnl, "T₉")
Q10: npn((8.4,6.6), qnl, "T₁₀")
Q11: npn((5.6,6.6), qnl, "T₁₁")

# supply rails
line from Q1.C to (2.16,8.4) then to Vcc.P
line from Q11.C to (5.76,8.4)
line from Q10.C to (8.56,8.4)
line from Q2.C to (9.56,8.4)
line from R1.N to Vee.P
line from Vee.N to (11,1)
# input followers into the pair
line from Q1.E to Ba then to Q3.B
line from Q2.E to Bb then to (6.75,3.85) then to (6.75,3.2) then to Q4.B
# pair, cascode, tail
line from Q3.C to Q5.E
line from Q4.C to Q6.E
line from Q3.E to (4.76,2.3) then to (7.56,2.3) then to Q4.E
line from Q9.C to Tail
line from Q9.B to (3.6,1.6)
# cascode bias: the T₇/T₈ diode string
line from Q7.C to Vcas
line from Q7.B to (2.76,7) then to Vcas then to (4,7) then to (4,4.1) \
  then to (6.6,4.1) then to (6.6,4.8) then to Q6.B
line from (4,4.8) to Q5.B
line from Q7.E to Q8.C
line from Q8.B to (2.76,5.9) then to Vd
# collector loads into the output followers
line from Oa to Q5.C
line from Oa to Q11.B
line from Ob to Q6.C
line from Ob to Q10.B
dot at (3.4,8.4); dot at (4.76,8.4); dot at (5.76,8.4); dot at (7.56,8.4)
dot at (8.56,8.4); dot at (9.56,8.4)
dot at (4.4,0); dot at (6.16,0); dot at (9.56,0)
dot at Ba; dot at Bb; dot at Tail; dot at Bias; dot at Vcas; dot at Vd
dot at (4,4.8); dot at Oa; dot at Ob
ground(Vin.N); ground(RS2.N); ground(R5.N); ground(Q8.E)
ground(R9.N); ground(R10.N); ground(Vcc.N); ground((11,1))
.model qnl npn bf=80 rb=100 ccs=2pf tf=0.3ns tr=6ns cje=3pf
+ cjc=2pf va 50
.PE
the figure — rendered by Dune's rpic
G₁ VCC VEE 1k 1k 4.8k 4.8k 811 2.17k 820 1.32k 4.5k 1.32k 5.25k 5.25k T₁ T₂ T₃ T₄ T₅ T₆ T₇ T₈ T₉ T₁₀ T₁₁
dune pic rca3040.pic
* netlist extracted by dune-pic
Vin In 0 sin(0 0.1 50meg 0.5ns) ac 1
Vcc Vp 0 15.0
Vee Vn 0 -15.0
RS1 B1 In 1k
RS2 B2 0 1k
R1 Ba Vn 4.8k
R2 Bb Vn 4.8k
R3 Vt Vn 811
R4 Bias Vn 2.17k
R5 Bias 0 820
R6 Vp Oa 1.32k
R7 Vp Vcas 4.5k
R8 Vp Ob 1.32k
R9 Out 0 5.25k
R10 Outb 0 5.25k
Q1 Vp B1 Ba qnl
Q2 Vp B2 Bb qnl
Q3 Ca Ba Tail qnl
Q4 Cb Bb Tail qnl
Q5 Oa Vcas Ca qnl
Q6 Ob Vcas Cb qnl
Q7 Vcas Vcas Vd qnl
Q8 Vd Vd 0 qnl
Q9 Tail Bias Vt qnl
Q10 Vp Ob Out qnl
Q11 Vp Oa Outb qnl
.ac dec 10 1 10ghz
.dc vin -0.25 0.25 0.005
.tran 2.0ns 200ns
.model qnl npn bf=80 rb=100 ccs=2pf tf=0.3ns tr=6ns cje=3pf
+ cjc=2pf va 50
.end
AC Analysismagnitudelog f
100 µV1 mV10 mV100 mV1 V10 V1 Hz1 kHz1 MHz1 GHzv(b1)v(b2)v(ba)v(bb)v(vt)v(bias)
v(b1)v(b2)v(ba)v(bb)v(vt)v(bias)(+15 more vectors)
DC transfer characteristic
-6 V-5 V-4 V-3 V-2 V-1 V0 V1 V-200 mV-100 mV0 V100 mV200 mVv(b1)v(b2)v(ba)v(bb)v(vt)v(bias)
v(b1)v(b2)v(ba)v(bb)v(vt)v(bias)(+15 more vectors)
Transient Analysis
-6 V-5 V-4 V-3 V-2 V-1 V0 V1 V0 s50 ns100 ns150 ns200 nsv(in)v(b1)v(b2)v(ba)v(bb)v(vt)
v(in)v(b1)v(b2)v(ba)v(bb)v(vt)(+15 more vectors)

Half-wave rectifier with a reservoir capacitor: 10 V 60 Hz sine, load R1 || C1 (tau = 100 ms >> 16.7 ms period)

corpus/pic/rect.pic.tran#
rect.pic
.PS
# Half-wave rectifier with a reservoir capacitor: 10 V 60 Hz sine,
# load R1 || C1 (tau = 100 ms >> 16.7 ms period).
spice = 1
Vout: (1.75,1.5)
V1: acsource((0,1.5), (0,0), SIN(0 10 60))
D1: diode(V1.P, Vout, DMOD)
C1: capacitor(Vout, (1.75,0), 100u)
R1: resistor((3,1.5), (3,0), 1k)
line from Vout to R1.P
line from V1.N to R1.N
ground((0.9,0))
dot at Vout; dot at C1.N
"out" above at Vout + (0,0.05)
.model DMOD D(IS=1e-14 RS=0.5)
.tran 0.1m 50m
.PE
the figure — rendered by Dune's rpic
SIN(0 10 60) DMOD 100u 1k out
dune pic rect.pic
* netlist extracted by dune-pic
V1 n1 0 SIN(0 10 60)
D1 n1 Vout DMOD
C1 Vout 0 100u
R1 Vout 0 1k
.model DMOD D(IS=1e-14 RS=0.5)
.tran 0.1m 50m
.end
Transient Analysis
-10 V-5 V0 V5 V10 V0 s10 ms20 ms30 ms40 ms50 msv(n1)v(vout)
v(n1)v(vout)(+1 more vector)

Series RLC driven by a 1 V AC source, output across C1

corpus/pic/rlc.pic.ac#
rlc.pic
.PS
# Series RLC driven by a 1 V AC source, output across C1:
# f0 = 1/(2 pi sqrt(L1 C1)) = 1.59 kHz, Q = sqrt(L1/C1)/R1 = 5.
spice = 1
Vin: (0,1.5); Vout: (3,1.5)
V1: vsource(Vin, (0,0), AC 1)
R1: resistor(Vin, (1.5,1.5), 20)
L1: inductor(R1.N, Vout, 10m)
C1: capacitor(Vout, (3,0), 1u)
line from V1.N to C1.N
ground((1.5,0))
dot at Vout
"out" above at Vout + (0,0.05)
.ac dec 20 100 100k
.PE
the figure — rendered by Dune's rpic
AC 1 20 10m 1u out
dune pic rlc.pic
* netlist extracted by dune-pic
V1 Vin 0 AC 1
R1 Vin n1 20
L1 n1 Vout 10m
C1 Vout 0 1u
.ac dec 20 100 100k
.end
AC Analysismagnitudelog f
100 µV1 mV10 mV100 mV1 V10 V100 Hz1 kHz10 kHz100 kHzv(n1)v(vout)
v(n1)v(vout)(+3 more vectors)

Berkeley's rtlinv.cir drawn: two cascaded RTL inverters. Elements are in the deck's card order, so the figure's netlist is the deck's with named nodes (1 In, 2 B1, 3 Out1, 4 B2, 5 Out2, 6 Vp) and simulates identically

corpus/pic/rtlinv.pic.dc.tran#
rtlinv.pic
.PS
# Berkeley's rtlinv.cir drawn: two cascaded RTL inverters. Elements
# are in the deck's card order, so the figure's netlist is the deck's
# with named nodes (1 In, 2 B1, 3 Out1, 4 B2, 5 Out2, 6 Vp) and
# simulates identically.
spice = 1
In:   (0.3,1.2)
B1:   (1.72,1.2)
Out1: (2.36,1.62)
B2:   (3.72,1.2)
Out2: (4.36,1.62)
Vp:   (5.2,3)

Vcc: vsource(Vp, (5.2,0.3), 5, "VCC")
Vin: vsource(In, (0.3,0.3), pulse(0 5 2ns 2ns 2ns 80ns), "G₁")
RB1: resistor(In, B1, 10k)
RC1: resistor((2.36,3), Out1, 1k)
Q1: npn((2.2,1.2), qnd, "T₁")
RB2: resistor(Out1, (3.4,1.62), 10k)
Q2: npn((4.2,1.2), qnd, "T₂")
RC2: resistor((4.36,3), Out2, 1k)

line from RC1.P to Vcc.P
line from RB2.N to (3.4,1.2) then to Q2.B
line from Q1.E to (Q1.E.x,0.3)
line from Q2.E to (Q2.E.x,0.3)
line from Vin.N to Vcc.N
dot at Out1; dot at RC2.P; dot at (Q1.E.x,0.3); dot at (Q2.E.x,0.3)
ground((1.2,0.3))
.model qnd npn(bf=50 rb=70 rc=40 ccs=2pf tf=0.1ns tr=10ns cje=0.9pf
+   cjc=1.5pf pc=0.85 va=50)
.dc vin 0.0 2.5 0.025
.tran 2ns 200ns
.PE
the figure — rendered by Dune's rpic
VCC G₁ 10k 1k T₁ 10k T₂ 1k
dune pic rtlinv.pic
* netlist extracted by dune-pic
Vcc Vp 0 5
Vin In 0 pulse(0 5 2ns 2ns 2ns 80ns)
RB1 In B1 10k
RC1 Vp Out1 1k
Q1 Out1 B1 0 qnd
RB2 Out1 B2 10k
Q2 Out2 B2 0 qnd
RC2 Vp Out2 1k
.model qnd npn(bf=50 rb=70 rc=40 ccs=2pf tf=0.1ns tr=10ns cje=0.9pf
+   cjc=1.5pf pc=0.85 va=50)
.dc vin 0.0 2.5 0.025
.tran 2ns 200ns
.end
DC transfer characteristic
0 V1 V2 V3 V4 V5 V0 V500 mV1 V1.5 V2 Vv(b1)v(out1)v(b2)v(out2)
v(b1)v(out1)v(b2)v(out2)(+4 more vectors)
Transient Analysis
0 V1 V2 V3 V4 V5 V0 s50 ns100 ns150 ns200 nsv(in)v(b1)v(out1)v(b2)v(out2)
v(in)v(b1)v(out1)v(b2)v(out2)(+3 more vectors)

Reflection on a mismatched line: a 1 V step from a matched 50 ohm source into a 50 ohm, 1 ns line ending in 150 ohm (Gamma = 0.5)

corpus/pic/tline.pic.tran#
tline.pic
.PS
# Reflection on a mismatched line: a 1 V step from a matched 50 ohm
# source into a 50 ohm, 1 ns line ending in 150 ohm (Gamma = 0.5).
# The launched 0.5 V wave reaches the load at TD and doubles to
# 0.75 V there; the reflection is back at the input at 2 TD.
spice = 1
Vin:  (1.4,1.5)
Vend: (3.8,1.5)
V1: vsource((0,1.5), (0,0), PULSE(0 1 0 10p 10p 20n 40n), "G₁")
R1: resistor(V1.P, Vin, 50)
T1: tline(Vin, Vend, Z0=50 TD=1n)
R2: resistor(Vend, (3.8,0), 150)
line from T1.N1 to (T1.N1.x,0)
line from T1.N2 to (T1.N2.x,0)
line from V1.N to R2.N
dot at (T1.N1.x,0); dot at (T1.N2.x,0)
dot at Vin; dot at Vend
"in" above at Vin + (0,0.05)
"end" above at Vend + (0,0.05)
ground((1.2,0))
.tran 10p 5n
.PE
the figure — rendered by Dune's rpic
G₁ 50 Z0=50 TD=1n 150 in end
dune pic tline.pic
* netlist extracted by dune-pic
V1 n1 0 PULSE(0 1 0 10p 10p 20n 40n)
R1 n1 Vin 50
T1 Vin 0 Vend 0 Z0=50 TD=1n
R2 Vend 0 150
.tran 10p 5n
.end
Transient Analysis
0 V200 mV400 mV600 mV800 mV1 V0 s1 ns2 ns3 ns4 ns5 nsv(n1)v(vin)v(vend)
v(n1)v(vin)v(vend)(+5 more vectors)

basic/trpwl.cir drawn: a piecewise-linear source (G₁) and an exponential one (G₂), each into its own RC low-pass (tau = 100 ns both). Card order kept; deck nodes 1 In1, 2 Out1, 3 In2, 4 Out2

corpus/pic/trpwl.pic.tran#
trpwl.pic
.PS
# basic/trpwl.cir drawn: a piecewise-linear source (G₁) and an
# exponential one (G₂), each into its own RC low-pass (tau = 100 ns
# both). Card order kept; deck nodes 1 In1, 2 Out1, 3 In2, 4 Out2.
spice = 1
In1:  (0.3,1.5)
Out1: (1.5,1.5)
In2:  (2.5,1.5)
Out2: (3.7,1.5)

V1: vsource(In1, (0.3,0), pwl(0 0 1u 1 2u 1 3u -1 5u 0), "G₁")
R1: resistor(In1, Out1, 1k)
C1: capacitor(Out1, (1.5,0), 100p)
V2: vsource(In2, (2.5,0), exp(0 2 0.5u 0.3u 2.5u 0.6u), "G₂")
R2: resistor(In2, Out2, 500)
C2: capacitor(Out2, (3.7,0), 200p)

line from V1.N to C2.N
dot at C1.N; dot at V2.N
ground((0.9,0))
.tran 0.02u 6u
.PE
the figure — rendered by Dune's rpic
G₁ 1k 100p G₂ 500 200p
dune pic trpwl.pic
* netlist extracted by dune-pic
V1 In1 0 pwl(0 0 1u 1 2u 1 3u -1 5u 0)
R1 In1 Out1 1k
C1 Out1 0 100p
V2 In2 0 exp(0 2 0.5u 0.3u 2.5u 0.6u)
R2 In2 Out2 500
C2 Out2 0 200p
.tran 0.02u 6u
.end
Transient Analysis
-1 V-500 mV0 V500 mV1 V1.5 V2 V0 s1 µs2 µs3 µs4 µs5 µs6 µsv(in1)v(out1)v(in2)v(out2)
v(in1)v(out1)v(in2)v(out2)(+2 more vectors)

basic/trrlc.cir drawn: a damped 100 kHz sine (delay 2u, theta 2e4) into a series RLC (f0 = 100.7 kHz, Q = 3.2), output across C1. Card order kept; deck nodes 1 In, 2 Vr, 3 Vout

corpus/pic/trrlc.pic.tran#
trrlc.pic
.PS
# basic/trrlc.cir drawn: a damped 100 kHz sine (delay 2u, theta 2e4)
# into a series RLC (f0 = 100.7 kHz, Q = 3.2), output across C1. Card
# order kept; deck nodes 1 In, 2 Vr, 3 Vout.
spice = 1
In:   (0.3,1.5)
Vr:   (1.5,1.5)
Vout: (2.9,1.5)

Vin: vsource(In, (0.3,0), sin(0 1 100k 2u 2e4), "G₁")
R1: resistor(In, Vr, 200)
L1: inductor(Vr, Vout, 1m)
C1: capacitor(Vout, (2.9,0), 2.5n)

line from Vin.N to C1.N
dot at Vr; dot at Vout
ground((1.6,0))
.tran 0.05u 50u
.PE
the figure — rendered by Dune's rpic
G₁ 200 1m 2.5n
dune pic trrlc.pic
* netlist extracted by dune-pic
Vin In 0 sin(0 1 100k 2u 2e4)
R1 In Vr 200
L1 Vr Vout 1m
C1 Vout 0 2.5n
.tran 0.05u 50u
.end
Transient Analysis
-3 V-2 V-1 V0 V1 V2 V3 V0 s10 µs20 µs30 µs40 µs50 µsv(in)v(vr)v(vout)
v(in)v(vr)v(vout)(+2 more vectors)

basic/truic.cir drawn: no source at all — .tran uic starts from the stored energy, C1 charged to 2 V and L1 carrying 1 mA, and the network rings down through R1 and R2. Card order kept; deck nodes 1 Vc, 2 Vl

corpus/pic/truic.pic.tran#
truic.pic
.PS
# basic/truic.cir drawn: no source at all — .tran uic starts from the
# stored energy, C1 charged to 2 V and L1 carrying 1 mA, and the
# network rings down through R1 and R2. Card order kept; deck nodes
# 1 Vc, 2 Vl.
spice = 1
Vc: (1.1,2)
Vl: (2.5,2)

C1: capacitor((0.3,2), (0.3,0), 1u ic=2)
R1: resistor(Vc, (1.1,0), 1k)
L1: inductor(Vc, Vl, 1m ic=1m)
R2: resistor(Vl, (2.5,0), 50)

line from C1.P to R1.P
line from C1.N to R2.N
dot at Vc; dot at R1.N
ground((1.8,0))
.tran 2u 3m uic
.PE
the figure — rendered by Dune's rpic
1u ic=2 1k 1m ic=1m 50
dune pic truic.pic
* netlist extracted by dune-pic
C1 Vc 0 1u ic=2
R1 Vc 0 1k
L1 Vc Vl 1m ic=1m
R2 Vl 0 50
.tran 2u 3m uic
.end
Transient Analysis
-500 mV0 V500 mV1 V1.5 V2 V500 µs1 ms1.5 ms2 ms2.5 ms3 msv(vc)v(vl)
v(vc)v(vl)(+1 more vector)

Double-tuned (coupled-resonator) band-pass: two 10u || 10n tanks

corpus/pic/tuned.pic.ac#
tuned.pic
.PS
# Double-tuned (coupled-resonator) band-pass: two 10u || 10n tanks
# (f0 = 503 kHz, Q = 31.6 with the 1k source and load) coupled by
# k = 0.1. kQ > 1, so the pair is overcoupled: two peaks near
# f0/sqrt(1 +- k) = 480 and 531 kHz, each at the matched-transfer
# limit |v(vout)| = 1/2.
spice = 1
In:   (0.3,2)
Pri:  (1.4,2)
Vout: (4.8,2)

V1: acsource(In, (0.3,0), AC 1)
RS: resistor(In, Pri, 1k)
C1: capacitor(Pri, (1.4,0), 10n)
L1: inductor((2.2,2), (2.2,0), 10u)
L2: inductor((3.2,2), (3.2,0), 10u)
K1: coupling(L1, L2, 0.1)
C2: capacitor((4,2), (4,0), 10n)
RL: resistor(Vout, (4.8,0), 1k)

line from C1.P to L1.P
line from L2.P to RL.P
line from V1.N to RL.N
dot at C1.P; dot at C2.P
dot at C1.N; dot at L1.N; dot at L2.N; dot at C2.N
ground(V1.N)
.ac lin 401 400k 650k
.PE
the figure — rendered by Dune's rpic
AC 1 1k 10n 10u 10u k=0.1 10n 1k
dune pic tuned.pic
* netlist extracted by dune-pic
V1 In 0 AC 1
RS In Pri 1k
C1 Pri 0 10n
L1 Pri 0 10u
L2 Vout 0 10u
K1 L1 L2 0.1
C2 Vout 0 10n
RL Vout 0 1k
.ac lin 401 400k 650k
.end
AC Analysismagnitude
0 V100 mV200 mV300 mV400 mV500 mV600 mV400 kHz450 kHz500 kHz550 kHz600 kHz650 kHzv(pri)v(vout)
v(pri)v(vout)(+4 more vectors)

Voltage-controlled sources in cascade: the 1:2 divider R1/R2 feeds a VCVS (gain 10, loaded by R3), whose output drives a VCCS (1 mS) into RL = 2k. Closed form: v(vx) = vin/2, v(vm) = 5 vin, v(vout) = -1m * 2k * v(vm) = -10 vin

corpus/pic/vcamp.pic.dc#
vcamp.pic
.PS
# Voltage-controlled sources in cascade: the 1:2 divider R1/R2 feeds a
# VCVS (gain 10, loaded by R3), whose output drives a VCCS (1 mS) into
# RL = 2k. Closed form: v(vx) = vin/2, v(vm) = 5 vin, v(vout) =
# -1m * 2k * v(vm) = -10 vin.
spice = 1
Vin:  (0.3,2)
Vx:   (1.6,2)
Vm:   (3,2)
Vout: (6.6,2)

V1: vsource(Vin, (0.3,0), DC 0)
R1: resistor(Vin, Vx, 1k)
R2: resistor(Vx, (1.6,0), 1k)
E1: vcvs(Vm, (3,0), (2.5,1.2), (2.5,0.8), 10)
R3: resistor((4.1,2), (4.1,0), 1k)
G1: vccs((5.5,2), (5.5,0), (5,1.2), (5,0.8), 1m)
RL: resistor(Vout, (6.6,0), 2k)

line from Vx to (2.1,2) then to (2.1,1.2) then to E1.Cp
line from E1.Cn to (2.1,0.8) then to (2.1,0)
line from E1.P to R3.P then to (4.6,2) then to (4.6,1.2) then to G1.Cp
line from G1.Cn to (4.6,0.8) then to (4.6,0)
line from G1.P to RL.P
line from V1.N to RL.N
dot at Vx; dot at R3.P
dot at R2.N; dot at (2.1,0); dot at E1.N; dot at R3.N; dot at (4.6,0); dot at G1.N
ground(V1.N)
.dc V1 -1 1 0.5
.PE
the figure — rendered by Dune's rpic
DC 0 1k 1k 10 + − 1k 1m + − 2k
dune pic vcamp.pic
* netlist extracted by dune-pic
V1 Vin 0 DC 0
R1 Vin Vx 1k
R2 Vx 0 1k
E1 Vm 0 Vx 0 10
R3 Vm 0 1k
G1 Vout 0 Vm 0 1m
RL Vout 0 2k
.dc V1 -1 1 0.5
.end
DC transfer characteristic
-10 V-5 V0 V5 V10 V-1 V-500 mV0 V500 mV1 Vv(vx)v(vm)v(vout)
v(vx)v(vm)v(vout)(+3 more vectors)

Basic 17

Small decks written for Dune to pin each analysis and linear element against ngspice-47.

diode small-signal at forward bias, current-driven

corpus/basic/acdiode.cir.ac#
acdiode.cir
diode small-signal at forward bias, current-driven
* written for Dune (Phase 2 .ac parity); not from Berkeley
ibias 0 1 dc 1m ac 1m
d1 1 0 dmod
rsh 1 0 100k
.model dmod d(is=1e-14 rs=10 cjo=5p tt=10n vj=0.8 m=0.4)
.ac oct 8 1k 100meg
.end
AC Analysismagnitudelog f
10 mV15 mV20 mV25 mV30 mV35 mV40 mV1 kHz10 kHz100 kHz1 MHz10 MHzv(1)
v(1)

rc lowpass bode

corpus/basic/acrc.cir.ac#
acrc.cir
rc lowpass bode
* written for Dune (Phase 2 .ac parity); not from Berkeley
vin 1 0 dc 0 ac 1
r1 1 2 1k
c1 2 0 159.155n
.ac dec 10 10 1meg
.end
AC Analysismagnitudelog f
0 V200 mV400 mV600 mV800 mV1 V10 Hz100 Hz1 kHz10 kHz100 kHz1 MHzv(2)
v(2)(+2 more vectors)

coupled resonator with phase-shifted drive

corpus/basic/acrlc.cir.ac#
acrlc.cir
coupled resonator with phase-shifted drive
* written for Dune (Phase 2 .ac parity); not from Berkeley
vin 1 0 ac 2 45
rs 1 2 50
l1 2 0 10u
l2 3 0 10u
k12 l1 l2 0.3
rl 3 4 5
c2 4 0 253.3p
e1 5 0 3 0 2
re 5 0 1k
.ac lin 50 1meg 5meg
.end
AC Analysismagnitude
0 V5 V10 V15 V20 V25 V1 MHz2 MHz3 MHz4 MHz5 MHzv(2)v(3)v(4)v(5)
v(2)v(3)v(4)v(5)(+5 more vectors)

diode bridge at dc

corpus/basic/bridge.cir.op#
bridge.cir
diode bridge at dc
* written for Dune (Phase 1 .op parity); not from Berkeley
vin inp 0 dc 6
rsrc inp a 10
d1 a p dmod
d2 n a dmod
d3 0 n dmod
d4 p 0 dmod
rload p n 220
.model dmod d(is=1e-12 rs=0.5 n=1.05)
.op
.end
Operating Point
vectorvalue
v(inp)6 V
i(vin)-413.38 mA
v(a)1.8662 V
v(p)933.09 mV
v(n)933.09 mV

diode driven into reverse breakdown

corpus/basic/dbv.cir.op#
dbv.cir
diode driven into reverse breakdown
* written for Dune (Phase 1 .op parity); not from Berkeley
v1 1 0 dc -8
r1 1 2 1k
d1 2 0 zmod
.model zmod d(is=1e-14 bv=5.1 ibv=1m)
.op
.end
Operating Point
vectorvalue
v(1)-8 V
i(v1)2.8727 mA
v(2)-5.1273 V

nested two-source dc sweep

corpus/basic/dc2src.cir.dc#
dc2src.cir
nested two-source dc sweep
* written for Dune (Phase 2 .dc parity); not from Berkeley
v1 1 0 dc 0
v2 2 0 dc 0
r1 1 3 1k
r2 2 3 2k
r3 3 0 1k
e1 4 0 3 0 -1.5
r4 4 0 1k
.dc v1 0 1 0.25 v2 0 2 0.5
.end
DC transfer characteristicnested sweep
-1.5 V-1 V-500 mV0 V500 mV1 V0 V200 mV400 mV600 mV800 mVv(3)v(4)
v(3)v(4)(+5 more vectors)

diode i-v curve

corpus/basic/dcdiode.cir.dc#
dcdiode.cir
diode i-v curve
* written for Dune (Phase 2 .dc parity); not from Berkeley
v1 1 0 dc 0
r1 1 2 100
d1 2 0 dmod
.model dmod d(is=1e-14 rs=1.5 n=1.05)
.dc v1 -5 0.8 0.05
.end
DC transfer characteristic
-5 V-4 V-3 V-2 V-1 V0 V1 V-5 V-4 V-3 V-2 V-1 V0 Vv(2)
v(2)(+2 more vectors)

current sweep into a diode

corpus/basic/dcisweep.cir.dc#
dcisweep.cir
current sweep into a diode
* written for Dune (Phase 2 .dc parity); not from Berkeley
i1 0 1 dc 0
d1 1 0 dmod
r1 1 0 10k
.model dmod d(is=2e-15)
.dc i1 0 5m 0.25m
.end
DC transfer characteristic
0 V100 mV200 mV300 mV400 mV500 mV600 mV700 mV800 mV0 A1 mA2 mA3 mA4 mA5 mAv(1)
v(1)

all four dependent sources

corpus/basic/depsrc.cir.op#
depsrc.cir
all four dependent sources
* written for Dune (Phase 1 .op parity); not from Berkeley
v1 1 0 dc 2
r1 1 0 1k
e1 2 0 1 0 2.5
re 2 0 1k
g1 0 3 1 0 1m
rg 3 0 2k
f1 0 4 v1 10
rf 4 0 100
h1 5 0 v1 -500
rh 5 0 1k
.op
.end
Operating Point
vectorvalue
v(1)2 V
i(v1)-2 mA
v(2)5 V
i(e1)-5 mA
v(3)4 V
v(4)-2 V
v(5)1 V
i(h1)-1 mA

forward diode with series resistance and area

corpus/basic/dfwd.cir.op#
dfwd.cir
forward diode with series resistance and area
* written for Dune (Phase 1 .op parity); not from Berkeley
v1 1 0 dc 0.9
d1 1 0 dmod 2.0
d2 1 2 dmod
r2 2 0 50
.model dmod d(is=2.5e-15 rs=4 n=1.2)
.op
.end
Operating Point
vectorvalue
v(1)900 mV
i(v1)-11.383 mA
v(2)60.248 mV

resistive divider with both source kinds

corpus/basic/divider.cir.op#
divider.cir
resistive divider with both source kinds
* written for Dune (Phase 1 .op parity); not from Berkeley
v1 1 0 dc 5
r1 1 2 1k
r2 2 0 2k
i1 0 3 dc 1m
r3 3 0 4.7k
.op
.end
Operating Point
vectorvalue
v(1)5 V
i(v1)-1.6667 mA
v(2)3.3333 V
v(3)4.7 V

inductors capacitors and coupling at the operating point

corpus/basic/lck.cir.op#
lck.cir
inductors capacitors and coupling at the operating point
* written for Dune (Phase 1 .op parity); not from Berkeley
v1 1 0 dc 3
l1 1 2 10m
r1 2 0 150
l2 3 0 20m
k12 l1 l2 0.95
c1 2 0 10u
c2 3 0 22u
r3 3 0 1k
.op
.end
Operating Point
vectorvalue
v(1)3 V
i(v1)-20 mA
v(2)3 V
i(l1)20 mA
v(3)0 V
i(l2)0 A

half-wave rectifier with filter cap

corpus/basic/trdiode.cir.tran#
trdiode.cir
half-wave rectifier with filter cap
* written for Dune (Phase 2 .tran parity); not from Berkeley
vin 1 0 sin(0 5 50k)
d1 1 2 dmod
rl 2 0 2k
cf 2 0 100n
.model dmod d(is=1e-14 rs=5 cjo=4p tt=5n)
.tran 0.2u 60u
.end
Transient Analysis
-6 V-4 V-2 V0 V2 V4 V6 V0 s10 µs20 µs30 µs40 µs50 µs60 µsv(1)v(2)
v(1)v(2)(+1 more vector)

pulse train into rc

corpus/basic/trpulse.cir.tran#
trpulse.cir
pulse train into rc
* written for Dune (Phase 2 .tran parity); not from Berkeley
vin 1 0 pulse(0 5 1u 0.2u 0.2u 2u 5u)
r1 1 2 1k
c1 2 0 1n
.tran 0.1u 20u
.end
Transient Analysis
0 V1 V2 V3 V4 V5 V0 s5 µs10 µs15 µs20 µsv(1)v(2)
v(1)v(2)(+1 more vector)

pwl and exp sources into rc loads

corpus/basic/trpwl.cir.tran#
trpwl.cir
pwl and exp sources into rc loads
* written for Dune (Phase 2 .tran parity); not from Berkeley
v1 1 0 pwl(0 0 1u 1 2u 1 3u -1 5u 0)
r1 1 2 1k
c1 2 0 100p
v2 3 0 exp(0 2 0.5u 0.3u 2.5u 0.6u)
r2 3 4 500
c2 4 0 200p
.tran 0.02u 6u
.end
Transient Analysis
-1 V-500 mV0 V500 mV1 V1.5 V2 V0 s1 µs2 µs3 µs4 µs5 µs6 µsv(1)v(2)v(3)v(4)
v(1)v(2)v(3)v(4)(+2 more vectors)

damped rlc with a sine drive

corpus/basic/trrlc.cir.tran#
trrlc.cir
damped rlc with a sine drive
* written for Dune (Phase 2 .tran parity); not from Berkeley
vin 1 0 sin(0 1 100k 2u 2e4)
r1 1 2 200
l1 2 3 1m
c1 3 0 2.5n
.tran 0.05u 50u
.end
Transient Analysis
-3 V-2 V-1 V0 V1 V2 V3 V0 s10 µs20 µs30 µs40 µs50 µsv(1)v(2)v(3)
v(1)v(2)v(3)(+2 more vectors)

uic start from stored energy

corpus/basic/truic.cir.tran#
truic.cir
uic start from stored energy
* written for Dune (Phase 2 .tran parity); not from Berkeley
c1 1 0 1u ic=2
r1 1 0 1k
l1 1 2 1m ic=1m
r2 2 0 50
.tran 2u 3m uic
.end
Transient Analysis
-500 mV0 V500 mV1 V1.5 V2 V500 µs1 ms1.5 ms2 ms2.5 ms3 msv(1)v(2)
v(1)v(2)(+1 more vector)

Regression & device probes 74

One deck per fixed bug or ported device/analysis (corpus/regress/), each a minimal circuit with an ngspice golden.

corpus/regress/b1noise.cir is excluded by corpus/SKIP: oracle broken for BSIM1 noise: ngspice-47's b1noi.c reads the state OFFSETS B1gm/B1cd (GENstate+7, GENstate+4) as gm and Id, Dune reads the values (KNOWN_DIFFS.md); the ngspice-47 golden is matched to 1e-5 with that reading emulated by crates/dune-core/src/bsim1.rs::noise_tests.

corpus/regress/b2noise.cir is excluded by corpus/SKIP: oracle broken for BSIM2 noise: same state-offset reading in ngspice-47's b2noi.c (B2gm/B2cd); gated against its ngspice-47 golden by crates/dune-core/src/bsim1.rs::noise_tests.

corpus/regress/devnoise_bjt.cir is excluded by corpus/SKIP: Dune-only device-noise probe (issue #20 item 3, .options devnoise): neither the 3f5 nor ngspice-47 has device noise in the time domain; checked against Dune's own golden (corpus/regress/golden/devnoise_bjt.dune.raw) and physics/statistics in crates/dune-core/tests/devnoise.rs.

corpus/regress/devnoise_diode.cir is excluded by corpus/SKIP: Dune-only device-noise probe (issue #20 item 3, .options devnoise): neither the 3f5 nor ngspice-47 has device noise in the time domain; checked against Dune's own golden (corpus/regress/golden/devnoise_diode.dune.raw) and physics/statistics in crates/dune-core/tests/devnoise.rs.

corpus/regress/devnoise_rc.cir is excluded by corpus/SKIP: Dune-only device-noise probe (issue #20 item 3, .options devnoise): neither the 3f5 nor ngspice-47 has device noise in the time domain; checked against Dune's own golden (corpus/regress/golden/devnoise_rc.dune.raw) and physics/statistics in crates/dune-core/tests/devnoise.rs.

corpus/regress/trbdf2_ring.cir is excluded by corpus/SKIP: Dune-only probe for .options method=trbdf2 (issue #6): ngspice-47 has no TR-BDF2 ("unsupported integration method") and would golden the ringing trap run; checked against the physics in crates/dune-core/tests/robust_tran.rs.

corpus/regress/trnoise_1f_rts.cir is excluded by corpus/SKIP: Dune-only transient-noise probe (issue #13 part 2): ngspice-47 draws other random numbers, so there is no comparable golden sample by sample; checked against Dune's own golden (corpus/regress/golden/trnoise_1f_rts.dune.raw) and closed-form statistics in crates/dune-core/tests/trnoise.rs.

corpus/regress/trnoise_white.cir is excluded by corpus/SKIP: Dune-only transient-noise probe (issue #13 part 2): ngspice-47 draws other random numbers, so there is no comparable golden sample by sample; checked against Dune's own golden (corpus/regress/golden/trnoise_white.dune.raw) and closed-form statistics in crates/dune-core/tests/trnoise.rs.

corpus/regress/trrandom.cir is excluded by corpus/SKIP: Dune-only transient-noise probe (issue #13 part 2): ngspice-47 draws other random numbers, so there is no comparable golden sample by sample; checked against Dune's own golden (corpus/regress/golden/trrandom.dune.raw) and closed-form statistics in crates/dune-core/tests/trnoise.rs.

AC decade grid over a non-whole-decade span lands on FSTOP (ngspice)

corpus/regress/acdec.cir.ac#
acdec.cir
AC decade grid over a non-whole-decade span lands on FSTOP (ngspice)
* Regression: ngspice-47 (acan.c) recomputes the decade step as
* exp(ln(stop/start)/floor(log10(stop/start)*n)) whenever the span
* exceeds one decade, so the sweep ends exactly at FSTOP; the 3f5's
* 10^(1/n) agrees only on whole-decade spans. 10meg->2g spans 2.30
* decades: the grids differ at every point past the first without
* the ngspice form. Under one decade (and stop==start) the 3f5 step
* survives in both programs.
vin 1 0 dc 0 ac 1
r1 1 2 1k
c1 2 0 15.9p
r2 2 3 10k
l1 3 0 1u
.ac dec 10 10meg 2g
.end
AC Analysismagnitudelog f
0 V100 mV200 mV300 mV400 mV500 mV600 mV700 mV10 MHz100 MHz1 GHzv(2)v(3)
v(2)v(3)(+3 more vectors)

BSIM1 common-source stage with source degeneration: harmonics in .disto

corpus/regress/b1disto.cir.disto#
b1disto.cir
BSIM1 common-source stage with source degeneration: harmonics in .disto
* Coverage: b1dset.c's Dderivs transcription of the BSIM1 drain current
* in saturation with vds < VDD (the quadratic Beta0 interpolation and
* its d_dummy quirk), body effect through the 1k source resistor
* (vbs swings), Von's Eta*vds taken with Eta constant, the 40/60
* charges (XPART absent) with b1dset.c's 1/15 saturation drain charge,
* reverse bulk junctions; 2nd and 3rd harmonics of b1disto.c against
* ngspice-47. (XPART=0 on the card would mean 0/100 in ngspice-47:
* the parameter is a flag there, set by its mere presence.)
vdd 5 0 5
vin 1 0 0 distof1 0.02
vbias 2 1 2.0
rg 2 3 10k
m1 4 3 7 6 nmos l=2u w=20u ad=40p as=40p pd=24u ps=24u
rd 5 4 10k
cl 4 0 0.2p
vbb 6 0 -1
rsrc 7 0 1k
.model nmos nmos
+ level=4 tox=3.00000e-2 vdd=5 temp=27
+ dl=7.97991e-1 dw=4.77402e-1
+ vfb=-1.0087 phi=7.96434e-1 k1=1.31191 k2=1.46640e-1
+ eta=-1.0027e-3 muz=5.34334e+2 u0=4.38497e-2 u1=-5.7332e-2
+ x2e=-7.6911e-4 x3e=7.86777e-4 x2mz=8.25434
+ mus=5.40612e+2 x2ms=-1.2992e+1 x3ms=-9.4035
+ x2u0=1.06821e-3 x2u1=-1.9209e-2 x3u1=7.76925e-3
+ n0=1.55 nb=0.09 nd=0.0
+ cgdo=2.70000e-10 cgso=2.70000e-10 cgbo=1.40000e-10
+ rsh=0 cj=2.75e-4 cjsw=1.90e-10 js=1.0e-8
+ pb=0.7 pbsw=0.8 mj=0.5 mjsw=0.33 wdf=0.0
.disto dec 10 1e3 1e10
.end
DISTORTION - 2nd harmonicmagnitudelog f
10 pV1 nV100 nV10 µV1 mV1 kHz100 kHz10 MHz1 GHzv(3)v(4)v(7)
v(3)v(4)v(7)(+8 more vectors)
DISTORTION - 3rd harmonicmagnitudelog f
100 fV10 pV1 nV100 nV1 kHz100 kHz10 MHz1 GHzv(3)v(4)v(7)
v(3)v(4)v(7)(+8 more vectors)

BSIM1 stage in inverse mode: intermodulation in .disto

corpus/regress/b1disto_im.cir.disto#
b1disto_im.cir
BSIM1 stage in inverse mode: intermodulation in .disto
* Coverage: b1dset.c in the inverse mode (drain and source swapped on
* the card, so vds < 0: the chain rule for the current and for the
* 0/100 (XPART=1) gate, bulk and drain charges), a forward-biased
* bulk-drain junction (vbb = +0.45 V over the 1k drain resistor, JS
* raised so it conducts) whose gbd term b1disto.c stamps from the GATE
* in the F1+F2/F1-F2 modes, and IM products f1+f2, f1-f2, 2f1-f2
* against ngspice-47.
vdd 5 0 5
vin 1 0 0 distof1 0.02 distof2 0.015
vbias 2 1 1.6
rg 2 3 10k
m1 8 3 4 6 nmos l=2u w=20u ad=60p as=40p pd=30u ps=24u
rd 5 4 10k
cl 4 0 0.2p
vbb 6 0 0.45
rsd 8 0 1k
.model nmos nmos
+ level=4 tox=3.00000e-2 vdd=5 temp=27
+ dl=7.97991e-1 dw=4.77402e-1
+ vfb=-1.0087 phi=7.96434e-1 k1=1.31191 k2=1.46640e-1
+ eta=-1.0027e-3 muz=5.34334e+2 u0=4.38497e-2 u1=-5.7332e-2
+ x2e=-7.6911e-4 x3e=7.86777e-4 x2mz=8.25434
+ mus=5.40612e+2 x2ms=-1.2992e+1 x3ms=-9.4035
+ x2u0=1.06821e-3 x2u1=-1.9209e-2 x3u1=7.76925e-3
+ n0=1.55 nb=0.09 nd=0.0
+ cgdo=2.70000e-10 cgso=2.70000e-10 cgbo=1.40000e-10 xpart=1
+ rsh=0 cj=2.75e-4 cjsw=1.90e-10 js=1.0e-2
+ pb=0.7 pbsw=0.8 mj=0.5 mjsw=0.33 wdf=0.0
.disto dec 10 1e3 1e10 0.9
.end
DISTORTION - IM: f1+f2magnitudelog f
0 V50 µV100 µV150 µV200 µV250 µV300 µV1 kHz100 kHz10 MHz1 GHzv(3)v(8)v(4)
v(3)v(8)v(4)(+8 more vectors)
DISTORTION - IM: f1-f2magnitudelog f
0 V50 µV100 µV150 µV200 µV250 µV300 µV1 kHz100 kHz10 MHz1 GHzv(3)v(8)v(4)
v(3)v(8)v(4)(+8 more vectors)
DISTORTION - IM: 2f1-f2magnitudelog f
100 fV10 pV1 nV100 nV10 µV1 kHz100 kHz10 MHz1 GHzv(3)v(8)v(4)
v(3)v(8)v(4)(+8 more vectors)

BSIM1 transient overlap caps use drawn W and effective L (b1ld.c)

corpus/regress/b1overlap.cir.tran#
b1overlap.cir
BSIM1 transient overlap caps use drawn W and effective L (b1ld.c)
* Regression: the transient load builds the gate overlap caps from the
* DRAWN width (gs/gd) and the EFFECTIVE length (gb), per b1ld.c, while
* b1temp.c's per-instance values (effective W, drawn L) feed only the
* AC load. Dune once used the b1temp.c values in both places. Here the
* gate pulse (device always cut off) couples through Cgdo onto a
* floating 1 fF drain node, and the stored plateau voltage measures
* the overlap cap directly: drawn vs effective W differs by ~24%.
m1 2 1 0 0 nmos l=2u w=2u ad=0.1p as=0.1p
c1 2 0 1f
rbias 3 2 1g
vdd 3 0 2
vin 1 0 pulse(-2 0 5ns 1ns 1ns 20ns 50ns)
.tran 0.5ns 40ns
.print tran v(1) v(2)
.model nmos nmos
+ level=4 tox=3.00000e-2 vdd=5 temp=27
+ dl=7.97991e-1 dw=4.77402e-1
+ vfb=-1.0087 phi=7.96434e-1 k1=1.31191 k2=1.46640e-1
+ eta=-1.0027e-3 muz=5.34334e+2 u0=4.38497e-2 u1=-5.7332e-2
+ x2e=-7.6911e-4 x3e=7.86777e-4 x2mz=8.25434
+ mus=5.40612e+2 x2ms=-1.2992e+1 x3ms=-9.4035
+ x2u0=1.06821e-3 x2u1=-1.9209e-2 x3u1=7.76925e-3
+ lvfb=-2.1402e-1 wvfb=3.44354e-1 lk1=3.23395e-1 wk1=-5.7698e-1
+ lk2=1.68585e-1 wk2=-1.8796e-1 leta=-9.4847e-3 weta=1.47316e-2
+ lu0=6.38105e-2 wu0=-6.1053e-2 lu1=1.01174 wu1=1.62706e-2
+ lx2e=9.62411e-3 wx2e=-3.7951e-3 lx3e=7.35448e-4 wx3e=-1.7796e-3
+ lx2mz=-2.4197e+1 wx2mz=1.95696e+1 lmus=6.21401e+2 wmus=-1.9190e+2
+ lx2ms=-6.4900e+1 wx2ms=4.29043e+1 lx3ms=1.18239e+2 wx3ms=-2.9747e+1
+ lx2u0=-8.0958e-3 wx2u0=4.03379e-3 lx2u1=-7.4573e-2 wx2u1=1.47520e-2
+ lx3u1=-1.0940e-1 wx3u1=-8.3353e-3
+ n0=1.55 nb=0.09 nd=0.0
+ cgdo=2.70000e-10 cgso=2.70000e-10 cgbo=1.40000e-10 xpart=1.0
+ rsh=35.0 cj=2.75e-4 cjsw=1.90e-10 js=1.0e-8
+ pb=0.7 pbsw=0.8 mj=0.5 mjsw=0.33 wdf=0.0
.end
Transient Analysisvectors from the deck’s .plot/.print
-2 V-1 V0 V1 V2 V3 V0 s10 ns20 ns30 ns40 nsv(1)v(2)
v(1)v(2)(+3 more vectors)

One-BJT common-emitter amplifier: intermodulation in .disto

corpus/regress/bjtdisto2.cir.disto#
bjtdisto2.cir
One-BJT common-emitter amplifier: intermodulation in .disto
* Coverage: every Gummel-Poon nonlinearity bjtdset.c expands - the
* junction and leakage currents (ISE/ISC), Early (VAF/VAR), roll-off
* (IKF/IKR, the qb square root), the bias-dependent base resistance
* with IRB (the tan(z) chain and its power-series inversion), the
* transit time with XTF/VTF/ITF, excess phase (PTF: the delayed-vbe
* rotation of every kernel), the B-C capacitance split by XCJC (qbx
* on the external base) and the substrate capacitance - through the
* IM products f1+f2, f1-f2, 2f1-f2 against ngspice-47.
* Supply, input and substrate are Norton equivalents (a current
* source across a resistor) so every compared vector is a node
* voltage: the residual vs the golden is a uniform ~5e-5 relative
* (ngspice's physical constants move vt by 2.8e-5, and the
* coefficients go as Ic/vt^n), which a branch current crossing zero
* in one component would turn into a pointwise failure of the ruler.
icc 0 5 12
rcc 5 0 1
iin 0 1 0 distof1 2.5u distof2 2.5u
rs 1 0 1k
cin 1 3 10u
rb1 5 3 82k
rb2 3 0 15k
rc 5 4 4.7k
re 6 0 1k
ce 6 0 100u
q1 4 3 6 7 qmod
isub 7 0 2
rsub 7 0 1
.model qmod npn is=1e-15 bf=150 nf=1.01 vaf=60 ikf=20m ise=2e-14 ne=1.6
+ br=3 nr=1.02 var=20 ikr=5m isc=1e-14 nc=1.8
+ rb=150 irb=0.2m rbm=30 re=2 rc=15
+ cje=2p vje=0.8 mje=0.35 tf=0.4n xtf=2 vtf=4 itf=30m ptf=25
+ cjc=1.5p vjc=0.6 mjc=0.4 xcjc=0.6 tr=5n cjs=1p vjs=0.7 mjs=0.4
.disto dec 10 1e3 1e9 0.9
.end
DISTORTION - IM: f1+f2magnitudelog f
100 fV100 pV100 nV100 µV1 kHz100 kHz10 MHz1 GHzv(5)v(1)v(3)v(4)v(6)v(7)
v(5)v(1)v(3)v(4)v(6)v(7)
DISTORTION - IM: f1-f2magnitudelog f
100 fV100 pV100 nV100 µV1 kHz100 kHz10 MHz1 GHzv(5)v(1)v(3)v(4)v(6)v(7)
v(5)v(1)v(3)v(4)v(6)v(7)
DISTORTION - IM: 2f1-f2magnitudelog f
100 fV100 pV100 nV100 µV1 kHz100 kHz10 MHz1 GHzv(5)v(1)v(3)v(4)v(6)v(7)
v(5)v(1)v(3)v(4)v(6)v(7)

One-PNP common-emitter amplifier: harmonics in .disto

corpus/regress/bjtdisto3.cir.disto#
bjtdisto3.cir
One-PNP common-emitter amplifier: harmonics in .disto
* Coverage: the type factors of bjtdset.c (second-order coefficients
* carry BJTtype, third-order ones do not) on a PNP mirror of
* bjtdisto2.cir, through the 2nd and 3rd harmonics. CJS is 0 here:
* ngspice-47 defaults a PNP's substrate to LATERAL (cap on the base),
* the 3f5 and Dune put it on the collector (corpus/KNOWN_DIFFS.md).
* Norton-equivalent supplies, as in bjtdisto2.cir.
icc 5 0 12
rcc 5 0 1
iin 0 1 0 distof1 2.5u
rs 1 0 1k
cin 1 3 10u
rb1 5 3 82k
rb2 3 0 15k
rc 5 4 4.7k
re 6 0 1k
ce 6 0 100u
q1 4 3 6 7 qmod
isub 0 7 2
rsub 7 0 1
.model qmod pnp is=1e-15 bf=150 nf=1.01 vaf=60 ikf=20m ise=2e-14 ne=1.6
+ br=3 nr=1.02 var=20 ikr=5m isc=1e-14 nc=1.8
+ rb=150 irb=0.2m rbm=30 re=2 rc=15
+ cje=2p vje=0.8 mje=0.35 tf=0.4n xtf=2 vtf=4 itf=30m ptf=25
+ cjc=1.5p vjc=0.6 mjc=0.4 xcjc=0.6 tr=5n
.disto dec 10 1e3 1e9
.end
DISTORTION - 2nd harmonicmagnitudelog f
100 fV100 pV100 nV100 µV1 kHz100 kHz10 MHz1 GHzv(5)v(1)v(3)v(4)v(6)
v(5)v(1)v(3)v(4)v(6)(+1 more vector)
DISTORTION - 3rd harmonicmagnitudelog f
100 fV100 pV100 nV100 µV1 kHz100 kHz10 MHz1 GHzv(5)v(1)v(3)v(4)v(6)
v(5)v(1)v(3)v(4)v(6)(+1 more vector)

B source, AC: the operating-point derivatives as small-signal stamps

corpus/regress/bsrc_ac.cir.ac#
bsrc_ac.cir
B source, AC: the operating-point derivatives as small-signal stamps
* Coverage: asrcacld.c (derivatives stored at MODEINITSMSIG), V= and
* I= forms, v(a,b), i(vsrc), and the f^g derivative with a variable
* exponent (the 3f5 writes ln f' where ngspice has ln f).
v1 1 0 dc 0.6 ac 1
r1 1 2 1k
b1 2 0 i=1e-14*(exp(v(2)/0.0258)-1)
c2 2 0 10p
b2 3 0 v=10*tanh(v(2))+v(2)^2
r3 3 4 1k
c4 4 0 1n
vx 4 5 dc 0
r5 5 0 1k
b3 6 0 v=1k*i(vx)*v(2)+v(3,4)
r6 6 0 1k
b4 0 7 i=1m*v(3,4)^2+1m*(v(2)+1)^v(1)
r7 7 0 1k
c7 7 0 2n
.ac dec 10 1k 1g
.end
AC Analysismagnitudelog f
10 µV1 mV100 mV10 V1 kHz100 kHz10 MHz1 GHzv(2)v(3)v(4)v(5)v(6)v(7)
v(2)v(3)v(4)v(5)v(6)v(7)(+5 more vectors)

B source, DC: the 3f5 expression functions and v()/i() references

corpus/regress/bsrc_dc.cir.dc#
bsrc_dc.cir
B source, DC: the 3f5 expression functions and v()/i() references
* Coverage: ptfuncs.c functions on both signs of the swept v(1),
* v(a,b), i(vsrc), the e/pi constants, a constant V= source (the
* branch row the 3f5 leaves empty) and a nonlinear I= load that
* Newton has to solve (no limiting, as in asrcload.c).
v1 1 0 dc 0
v2 2 0 dc 1.5
r1 1 0 1k
b1 3 0 v=v(1)*v(2)+sin(v(1))-cos(v(2))/2+atan(v(1))+tanh(2*v(1))
r3 3 0 1k
b2 4 0 v=exp(v(1))+sqrt(v(2))+ln(v(2)+0.5)+abs(v(1)-0.25)+uramp(v(1))+u(v(1)-0.05)
r4 4 0 1k
b3 0 5 i=1m*v(1,2)^2+2*i(v1)+0.5m*sinh(v(1))-0.1m*cosh(v(1))
r5 5 0 1k
b4 6 0 v=asin(v(1)/2)+acos(v(1)/3)+asinh(v(1))+acosh(v(2)+2)+atanh(v(1)/2)+tan(v(1)/2)
r6 6 0 1k
b5 7 0 v=2*pi-e+sgn(v(1))+v(1)^2
r7 7 0 1k
vx 8 9 dc 0
r8 9 0 1k
b6 8 0 v=2^v(2)+(v(2)+1)^v(1)
b7 10 0 i=1e-14*(exp(v(10)/0.0258)-1)-0.1*i(vx)
r10 1 10 2k
b8 11 0 v=2*pi-e
r11 11 0 1k
.dc v1 -1 1 0.05
.end
DC transfer characteristic
-6 V-4 V-2 V0 V2 V4 V6 V8 V10 V-1 V-500 mV0 V500 mV1 Vv(3)v(4)v(5)v(6)v(7)v(8)
v(3)v(4)v(5)v(6)v(7)v(8)(+14 more vectors)

B source comparator: u() and sgn() jump inside a timestep

corpus/regress/bsrc_step.cir.tran#
bsrc_step.cir
B source comparator: u() and sgn() jump inside a timestep
* Coverage: no corpus deck made a B source jump (bsrc_tran multiplies
* its sgn() by a factor that vanishes with the argument). A 0 -> 5 -> 0
* triangle of 1 ms crosses b1's reference (3.05 V, at 0.305 ms and
* 0.695 ms) and b2's (2.05 V, at 0.205 ms and 0.795 ms) between the
* 20 us points of the .tran grid; b3 has the same sgn() times a
* factor that is zero there, and does not jump.
v1 1 0 pwl(0 0 0.5m 5 1m 0)
r1 1 0 1k
vref 3 0 3.05
r3 3 0 1k
b1 2 0 v=5*u(v(1)-v(3))
r2 2 0 1k
b2 0 4 i=1m*sgn(v(1)-2.05)
r4 4 0 1k
b3 5 0 v=(v(1)-2.05)*sgn(v(1)-2.05)
r5 5 0 1k
.tran 20u 1m
.end
Transient Analysis
-1 V0 V1 V2 V3 V4 V5 V0 s200 µs400 µs600 µs800 µs1 msv(1)v(2)v(4)v(5)
v(1)v(2)v(4)v(5)(+5 more vectors)

B source, transient: expressions of time-varying nodes and branch currents

corpus/regress/bsrc_tran.cir.tran#
bsrc_tran.cir
B source, transient: expressions of time-varying nodes and branch currents
* Coverage: V= and I= sources driven by a sine, with a reactive load
* and an i() reference, through the transient Newton (asrcload.c).
v1 1 0 dc 0 sin(0 1 1meg)
r1 1 0 1k
b1 2 0 v=0.5*v(1)^2+0.1*abs(v(1))+0.2
r2 2 3 1k
c3 3 0 100p
b2 0 4 i=1m*tanh(2*v(3))+0.5*i(v1)
r4 4 0 1k
c4 4 0 50p
b3 5 0 v=uramp(v(1)-0.2)*(1+v(4))
r5 5 0 1k
l5 5 6 10u
r6 6 0 100
b4 7 0 i=1m*(v(7)-0.3)^2*sgn(v(7)-0.3)+0.2*i(v1)
r7 2 7 1k
.tran 10n 3u
.end
Transient Analysis
-1 V-500 mV0 V500 mV1 V1.5 V0 s500 ns1 µs1.5 µs2 µs2.5 µs3 µsv(1)v(2)v(3)v(4)v(5)v(6)
v(1)v(2)v(3)v(4)v(5)v(6)(+5 more vectors)

Semiconductor capacitors: C model CJ/CJSW geometry and DEFW

corpus/regress/cmodel.cir.ac#
cmodel.cir
Semiconductor capacitors: C model CJ/CJSW geometry and DEFW
* Coverage: no corpus deck has a C model. captemp.c (3f5): with no
* value, C = CJ*(W-NARROW)*(L-NARROW) + 2*CJSW*((L-NARROW)+(W-NARROW)),
* W defaulting to DEFW (10u in the code; spice.txt documents 1u). The
* .ac reads each capacitance off an RC low-pass (corner ~1/(2*pi*R*C)).
* c1: L and W given. c2: L only (W = DEFW). c3: explicit value on a
* model card (value wins). NARROW stays 0: ngspice-47 subtracts SHORT
* from L instead, corpus/KNOWN_DIFFS.md.
v1 1 0 dc 0 ac 1
r1 1 2 10k
c1 2 0 cpoly l=100u w=50u
r2 1 3 10k
c2 3 0 cmet l=80u
r3 1 4 10k
c3 4 0 2p cpoly
.model cpoly c cj=3e-4 cjsw=2e-10
.model cmet c (cj=1e-4 cjsw=5e-11 defw=20u)
.ac dec 5 100k 100meg
.end
AC Analysismagnitudelog f
0 V200 mV400 mV600 mV800 mV1 V100 kHz1 MHz10 MHz100 MHzv(2)v(3)v(4)
v(2)v(3)v(4)(+2 more vectors)

Current-controlled switch: W cards keyed by a separate control loop

corpus/regress/csw_rly.cir.dc.tran#
csw_rly.cir
Current-controlled switch: W cards keyed by a separate control loop
* Coverage: no corpus deck has a W card. vi drives 0 -> 5 mA -> 0 through
* the sense source vsense in its own loop; w1 (IT=2.4m, IH=0.9m: closes
* above 3.3 mA, opens below 1.5 mA) charges c3 through RON and lets it
* bleed through rl1 when open, like a relay contact. w5 watches the
* mirrored loop (vsense2 carries 5 mA - i(vsense)), so the rising .dc
* also falls through a window. w2/w3 share a model whose window
* (-0.6m..5.4m) contains the whole control range: CSWload (ngspice)
* holds the state of the last *accepted* point (state1) inside the
* window, which is zero in the operating point, so w2 opens despite its
* ON hint (the 3f5 and SWload keep it closed). w4 has a negative IH.
vi 10 0 dc 0 pwl(0 0 1m 5 2m 0)
rctl 10 11 1k
vsense 11 0 dc 0
vo 12 0 dc 5
e1 13 12 10 0 -1
rctl2 13 14 1k
vsense2 14 0 dc 0
vdd 2 0 dc 10
w1 2 3 vsense wmod
rl1 3 0 1k
c3 3 0 100n
w2 2 4 vsense wwin on
rl2 4 0 1k
w3 2 5 vsense wwin off
rl3 5 0 1k
w4 2 6 vsense wneg
rl4 6 0 1k
w5 2 7 vsense2 wmod
rl5 7 0 1k
.model wmod csw it=2.4m ih=0.9m ron=10 roff=1e6
.model wwin csw it=2.4m ih=3m ron=100 roff=1e5
.model wneg csw it=2.4m ih=-0.7m ron=50 roff=2e5
.dc vi 0 5 0.2
.tran 20u 2m
.end
DC transfer characteristic
0 V2 V4 V6 V8 V10 V0 V1 V2 V3 V4 V5 Vv(3)v(6)v(7)
v(3)v(6)v(7)(+14 more vectors)
Transient Analysis
0 V2 V4 V6 V8 V10 V0 s500 µs1 ms1.5 ms2 msv(10)v(13)v(3)v(6)v(7)
v(10)v(13)v(3)v(6)v(7)(+12 more vectors)

DC sweep of the circuit temperature: .dc temp nested under a source

corpus/regress/dctemp.cir.dc#
dctemp.cir
DC sweep of the circuit temperature: .dc temp nested under a source
* Coverage: the 3f5 DCtrCurv sweeps only V/I sources; ngspice-47
* (dctrcurv.c TEMP_CODE) also takes `temp`, re-running CKTtemp at each
* point (corpus/KNOWN_DIFFS.md). Inner level temp (-25..125 C), outer
* level v1. The diode, the BJT and the TC resistor follow the circuit
* temperature; rfix has an instance temp= and must not move; the scale
* vector is ngspice's `temp-sweep`.
v1 1 0 dc 1
r1 1 2 rtc l=20u w=2u
d1 2 0 dmod
rfix 1 3 rtc l=20u w=2u temp=27
q1 3 3 0 qmod
v2 4 0 dc 5
rc 4 5 2k
q2 5 3 0 qmod
.model rtc r rsh=100 tc1=3e-3 tc2=1e-5
.model dmod d is=1e-14 n=1.05 eg=1.11 xti=3
.model qmod npn is=1e-16 bf=120 xtb=1.5
.dc temp -25 125 25 v1 1 3 1
.end
DC transfer characteristicnested sweep
0 V1 V2 V3 V4 V5 V050100v(2)v(3)v(5)
v(2)v(3)v(5)(+4 more vectors)

Diode reverse breakdown from leakage to high current

corpus/regress/diobv_dc.cir.dc#
diobv_dc.cir
Diode reverse breakdown from leakage to high current
* Coverage: the breakdown match of diotemp.c (xbv from BV/IBV) and the
* breakdown branch of dioload.c, swept from leakage through the knee
* to ~1.5 A. Two corrections of the 3f5 that ngspice-47 carries
* (corpus/KNOWN_DIFFS.md): dn has N=1.47, and the 3f5 matches xbv with
* plain vt while its load uses N*vt (ngspice: NBV*vt, NBV defaults to
* N), so the 3f5 knee sits (N-1)*vt*ln(IBV/IS) = 0.397 V higher; da
* has AREA=10, and the 3f5 matches the per-area saturation current
* against the absolute IBV (ngspice: IS*AREA against IBV), shifting
* the knee by vt*ln(10) = 60 mV. d3 is the same model without area:
* ngspice-47 rejects a model referenced only with a positional area.
* BV is small on purpose: at BV=50 the node test (reltol*50 V = 50 mV)
* exceeds N*vt, and ngspice's Newton stops off the curve by up to
* 0.18 V (path-dependent; see docs/dune-core.md, diode breakdown).
v1 1 0 dc 0
r1 1 2 10
d1 0 2 dn
r2 1 3 10
d2 0 3 da 10
r3 1 4 10
d3 0 4 da
.model dn d(is=6.79e-18 n=1.47 bv=5)
.model da d(is=1e-14 bv=5 ibv=1e-4)
.dc v1 0 20 0.25
.end
DC transfer characteristic
0 V1 V2 V3 V4 V5 V6 V0 V5 V10 V15 V20 Vv(2)v(3)v(4)
v(2)v(3)v(4)(+2 more vectors)

Diode noise: RS thermal, junction shot and flicker in .noise

corpus/regress/dionoise2.cir.noise#
dionoise2.cir
Diode noise: RS thermal, junction shot and flicker in .noise
* Coverage: dionoise.c in its ngspice-47 form - the RS thermal source
* between the anode and its internal node, shot noise of the junction
* current, KF*|Id|^AF/f flicker, and the three sidewall vectors
* (_rsw/_idsw/_1overfsw) ngspice always names, zero without RSW. d2
* has area 2 (RS conductance and current both scale) and sits in the
* signal path to the output, so its generators see a nontrivial
* transfer; d1 shunts the input node. TT and CJO shape the band.
vin 1 0 dc 0 ac 1
rin 1 2 10k
ib 0 2 dc 200u
d1 2 0 dn
d2 2 3 dn 2
rl 3 0 2k
.model dn d is=1e-14 rs=25 n=1.2 tt=5n cjo=2p kf=1e-14 af=1.2
.noise v(3) vin dec 10 1 1g 1
.end
Noise Spectral Density Curveslog f
100 pV/√Hz1 nV/√Hz10 nV/√Hz100 nV/√Hz1 µV/√Hz10 µV/√Hz1 Hz1 kHz1 MHz1 GHzonoise_spectruminoise_spectrum
onoise_spectruminoise_spectrum(+20 more vectors)
Integrated Noise
vectorvalue
v(onoise_total_rin_thermal)2.4164 µV
v(inoise_total_rin_thermal)425.37 µV
v(onoise_total_rin_1overf)0 V
v(inoise_total_rin_1overf)0 V
v(onoise_total_rin)2.4164 µV
v(inoise_total_rin)425.37 µV
v(onoise_total_d1_rs)19.641 µV
v(inoise_total_d1_rs)6.3025 mV
v(onoise_total_d1_id)8.9333 µV
v(inoise_total_d1_id)1.1532 mV
v(onoise_total_d1_1overf)302.87 nV
v(inoise_total_d1_1overf)16.338 µV
v(onoise_total_d1_rsw)0 V
v(inoise_total_d1_rsw)0 V
v(onoise_total_d1_idsw)0 V
v(inoise_total_d1_idsw)0 V
v(onoise_total_d1_1overfsw)0 V
v(inoise_total_d1_1overfsw)0 V
v(onoise_total_d1)21.58 µV
v(inoise_total_d1)6.4071 mV
v(onoise_total_d2_rs)13.936 µV
v(inoise_total_d2_rs)4.4683 mV
v(onoise_total_d2_id)10.955 µV
v(inoise_total_d2_id)1.15 mV
v(onoise_total_d2_1overf)486.01 nV
v(inoise_total_d2_1overf)25.211 µV
v(onoise_total_d2_rsw)0 V
v(inoise_total_d2_rsw)0 V
v(onoise_total_d2_idsw)0 V
v(inoise_total_d2_idsw)0 V
v(onoise_total_d2_1overfsw)0 V
v(inoise_total_d2_1overfsw)0 V
v(onoise_total_d2)17.733 µV
v(inoise_total_d2)4.614 mV
v(onoise_total_rl_thermal)15.344 µV
v(inoise_total_rl_thermal)2.0041 mV
v(onoise_total_rl_1overf)0 V
v(inoise_total_rl_1overf)0 V
v(onoise_total_rl)15.344 µV
v(inoise_total_rl)2.0041 mV
v(onoise_total)31.96 µV
v(inoise_total)8.157 mV

Instance DTEMP= (ngspice-47) in the operating point

corpus/regress/dtemp_op.cir.op#
dtemp_op.cir
Instance DTEMP= (ngspice-47) in the operating point
* Coverage: ngspice-47's instance DTEMP (res.c, dio.c, bjt.c,
* jfet.c, mos1.c, mos2.c, mos3.c, mos6.c; the 3f5 has no DTEMP): an
* instance without TEMP= runs at CKTtemp + DTEMP (*temp.c: "if
* (!tempGiven) temp = CKTtemp + dtemp"), so with .options temp=50
* every device below sits at its own temperature. rboth and dboth
* carry TEMP= and DTEMP= together: TEMP= wins and DTEMP is dropped
* (restemp.c zeroes RESdtemp with "Instance temperature specified,
* dtemp ignored"; the semiconductors simply never read it). Each
* device hangs off its own source, so every current is a separate
* branch vector; the JFET gate is forward biased so its IS(T) shows
* (the 3f5 JFET drain current itself has no temperature dependence).
.options temp=50
v1 1 0 dc 1
r1 1 0 rtc 1k dtemp=40
v2 2 0 dc 1
r2 2 0 rtc 1k
v3 3 0 dc 1
rboth 3 0 rtc 1k temp=0 dtemp=40
v4 4 0 dc 0.6
d1 4 0 dm dtemp=-60
v5 5 0 dc 0.6
dboth 5 0 dm temp=100 dtemp=-60
vb6 6 0 dc 0.68
vc6 16 0 dc 3
q6 16 6 0 qn dtemp=35
vg7 7 0 dc 0.55
vd7 17 0 dc 3
j7 17 7 0 jn dtemp=-45
vg8 8 0 dc 2
vd8 18 0 dc 3
m8 18 8 0 0 nm1 l=4u w=20u dtemp=60
vg9 9 0 dc 2
vd9 19 0 dc 3
m9 19 9 0 0 nm2 l=4u w=10u dtemp=-40
vg10 10 0 dc 2
vd10 20 0 dc 3
m10 20 10 0 0 nm3 l=4u w=10u dtemp=25
vg11 11 0 dc 2
vd11 21 0 dc 3
m11 21 11 0 0 n6 l=3u w=10u dtemp=-70
.model rtc r tc1=3e-3 tc2=2e-5
.model dm d is=1e-14 n=1.05 rs=5 xti=3 eg=1.11
.model qn npn is=1e-16 bf=120 ise=1e-14 ne=1.6 isc=1e-15 rb=100 re=2
+ vaf=60 xtb=1.5
.model jn njf vto=-2 beta=0.4e-3 lambda=0.02 rd=30 rs=20 is=1e-14
.model nm1 nmos level=1 vto=0.8 kp=50u lambda=0.02 phi=0.65 gamma=0.4
+ tpg=1 nsub=2e15 tox=5e-8
.model nm2 nmos level=2 vto=0.7 tox=40n nsub=1e16 uo=600 lambda=0.02
.model nm3 nmos level=3 vto=0.7 tox=30n nsub=1e16 uo=500 theta=0.1
.model n6 nmos level=6 tpg=1 kc=3.8921e-05 nc=1.1739 kv=0.91602 nv=0.87225
+ lambda0=0.013333 lambda1=0.0046901 vt0=0.69486 gamma=0.60309 phi=1
+ tox=1.98e-08 ld=0.1u nsub=5e16 nss=0
.op
.end
Operating Point
vectorvalue
v(1)1 V
i(v1)-788.41 µA
v(2)1 V
i(v2)-926.29 µA
v(3)1 V
i(v3)-1.0711 mA
v(4)600 mV
i(v4)-1.9271 µA
v(5)600 mV
i(v5)-2.1127 mA
v(6)680 mV
i(vb6)-4.7254 µA
v(16)3 V
i(vc6)-644.37 µA
v(7)550 mV
i(vg7)-343.2 nA
v(17)3 V
i(vd7)-2.6376 mA
v(8)2 V
i(vg8)0 A
v(18)3 V
i(vd8)-160.99 µA
v(9)2 V
i(vg9)0 A
v(19)3 V
i(vd9)-91.525 µA
v(10)2 V
i(vg10)0 A
v(20)3 V
i(vd10)-86.688 µA
v(11)2 V
i(vg11)0 A
v(21)3 V
i(vd11)-248.99 µA
  • `rboth`: Instance temperature specified, dtemp ignored

JFET, MESFET and switch noise in one cascade

corpus/regress/fetnoise.cir.noise#
fetnoise.cir
JFET, MESFET and switch noise in one cascade
* Coverage: jfetnoi.c (ngspice-47, default NLEV=2) and mesnoise.c - RD
* and RS thermal, channel thermal 4kT*(2/3)|gm|, KF*|Id|^AF/f flicker -
* and the single thermal generator of a closed S switch (swnoise.c,
* vector onoise_s1) in series with the MESFET load. The JFET stage
* drives the MESFET gate through a coupling capacitor; the MESFET gate
* is biased through 100k from its own source.
vdd 1 0 dc 15
vin 2 0 dc 0 ac 1
j1 3 2 4 jn 2
rd1 1 3 4.7k
rs1 4 0 100
cs1 4 0 10u
c12 3 6 1u
rg2 6 7 100k
vg2 7 0 dc -0.5
z1 8 6 0 zn
s1 9 8 10 0 sw1
rl2 11 9 1k
vdd2 11 0 dc 5
vctl 10 0 dc 5
.model jn njf vto=-2 beta=1.3e-3 lambda=0.01 rd=20 rs=15 cgs=3p cgd=1.5p
+ kf=1e-17 af=1.1
.model zn nmf vto=-1.8 beta=3e-3 b=0.3 alpha=2.5 lambda=0.05 rd=5 rs=5
+ cgs=1p cgd=0.2p kf=1e-16 af=1
.model sw1 sw vt=2.5 vh=0.1 ron=50 roff=1e6
.noise v(8) vin dec 10 10 1g 1
.end
Noise Spectral Density Curveslog f
0 V/√Hz100 nV/√Hz200 nV/√Hz300 nV/√Hz400 nV/√Hz500 nV/√Hz600 nV/√Hz10 Hz1 kHz100 kHz10 MHz1 GHzonoise_spectruminoise_spectrum
onoise_spectruminoise_spectrum(+23 more vectors)
Integrated Noise
vectorvalue
v(onoise_total_j1_rd)77.15 µV
v(inoise_total_j1_rd)20.732 µV
v(onoise_total_j1_rs)78.449 µV
v(inoise_total_j1_rs)19.923 µV
v(onoise_total_j1_id)120.98 µV
v(inoise_total_j1_id)30.749 µV
v(onoise_total_j1_1overf)1.0976 µV
v(inoise_total_j1_1overf)256.25 nV
v(onoise_total_j1)163.54 µV
v(inoise_total_j1)42.098 µV
v(onoise_total_rd1_thermal)54.067 µV
v(inoise_total_rd1_thermal)13.744 µV
v(onoise_total_rd1_1overf)0 V
v(inoise_total_rd1_1overf)0 V
v(onoise_total_rd1)54.067 µV
v(inoise_total_rd1)13.744 µV
v(onoise_total_rs1_thermal)363.15 nV
v(inoise_total_rs1_thermal)85.059 nV
v(onoise_total_rs1_1overf)0 V
v(inoise_total_rs1_1overf)0 V
v(onoise_total_rs1)363.15 nV
v(inoise_total_rs1)85.059 nV
v(onoise_total_rg2_thermal)11.725 µV
v(inoise_total_rg2_thermal)2.9805 µV
v(onoise_total_rg2_1overf)0 V
v(inoise_total_rg2_1overf)0 V
v(onoise_total_rg2)11.725 µV
v(inoise_total_rg2)2.9805 µV
v(onoise_total_z1_rd)9.0961 µV
v(inoise_total_z1_rd)2.9898 µV
v(onoise_total_z1_rs)60.636 µV
v(inoise_total_z1_rs)16.295 µV
v(onoise_total_z1_id)315.45 µV
v(inoise_total_z1_id)87.353 µV
v(onoise_total_z1_1overf)7.2293 µV
v(inoise_total_z1_1overf)1.6936 µV
v(onoise_total_z1)321.43 µV
v(inoise_total_z1)88.926 µV
v(onoise_total_s1)5.5944 µV
v(inoise_total_s1)1.5484 µV
v(onoise_total_rl2_thermal)176.91 nV
v(inoise_total_rl2_thermal)48.964 nV
v(onoise_total_rl2_1overf)0 V
v(inoise_total_rl2_1overf)0 V
v(onoise_total_rl2)176.91 nV
v(inoise_total_rl2)48.964 nV
v(onoise_total)364.9 µV
v(inoise_total)99.4 µV

Instance TEMP= in .dc: BJT, MOS1, MOS2 and MOS6

corpus/regress/itemp_dc.cir.dc#
itemp_dc.cir
Instance TEMP= in .dc: BJT, MOS1, MOS2 and MOS6
* Coverage: the instance TEMP= of the 3f5 tables (bjt.c, mos1.c,
* mos2.c, mos6.c: IOPU "temp") had no .op/.dc probe for these four
* (diode, JFET, MOS3 and R are pinned by dctemp, jfet_iv, mos3_iv and
* rmodel). Each hot/cold device recomputes its own *temp.c data at
* its TEMP= while its twin stays at the circuit temperature
* (.options temp=40, TNOM 27): BJTtemp (IS/BF/ISE/ISC, VJ/CJ), and
* MOS1temp/MOS2temp/MOS6temp (KP/VBI/PHI, the junction saturation
* currents and PB). Every device has its own E-source drive, so each
* drain/collector current is a separate branch vector. The sweep
* starts at 0.65 V so even the cold BJT carries well above the gmin
* level, where ngspice-47 adds a substrate gmin the Dune does not
* (KNOWN_DIFFS, "Substrato do PNP").
.options temp=40
vin 1 0 dc 0.7
vds 2 0 dc 2
eb1 11 0 1 0 1
ec1 12 0 2 0 1
q1 12 11 0 qn temp=120
eb2 21 0 1 0 1
ec2 22 0 2 0 1
q2 22 21 0 qn
eb3 31 0 1 0 1
ec3 32 0 2 0 1
q3 32 31 0 qp2 temp=-30
eg4 41 0 1 0 2
ed4 42 0 2 0 1
m4 42 41 0 0 nm1 l=4u w=20u temp=90
eg5 51 0 1 0 2
ed5 52 0 2 0 1
m5 52 51 0 0 nm1 l=4u w=20u
eg6 61 0 1 0 2
ed6 62 0 2 0 1
m6 62 61 0 0 nm2 l=4u w=10u temp=-10
eg7 71 0 1 0 2
ed7 72 0 2 0 1
m7 72 71 0 0 nm2 l=4u w=10u
eg8 81 0 1 0 2
ed8 82 0 2 0 1
m8 82 81 0 0 n6 l=3u w=10u temp=100
eg9 91 0 1 0 2
ed9 92 0 2 0 1
m9 92 91 0 0 n6 l=3u w=10u
.model qn npn is=1e-16 bf=120 ise=1e-14 ne=1.6 isc=1e-15 rb=100 re=2 vaf=60
+ cje=1p cjc=0.5p xtb=1.5 xti=3.5 eg=1.15
.model qp2 npn is=5e-17 bf=80 br=2 vaf=40 nf=1.02 xtb=0.8 re=5 rc=10 rb=50
.model nm1 nmos level=1 vto=0.8 kp=50u lambda=0.02 phi=0.65 gamma=0.4
+ is=1e-14 tpg=1 nsub=2e15 tox=5e-8
.model nm2 nmos level=2 vto=0.7 tox=40n nsub=1e16 uo=600 lambda=0.02
+ tnom=35
.model n6 nmos level=6 tpg=1 kc=3.8921e-05 nc=1.1739 kv=0.91602 nv=0.87225
+ lambda0=0.013333 lambda1=0.0046901 vt0=0.69486 gamma=0.60309 phi=1
+ tox=1.98e-08 ld=0.1u nsub=5e16 nss=0
.dc vin 0.65 1.2 0.05 vds 0.5 3 1.25
.end
DC transfer characteristicnested sweep
1.2 V1.4 V1.6 V1.8 V2 V2.2 V2.4 V700 mV800 mV900 mV1 V1.1 Vv(41)v(51)v(61)v(71)v(81)v(91)
v(41)v(51)v(61)v(71)v(81)v(91)(+34 more vectors)

Reported iterate: .dc continuation in MODEINITPRED

corpus/regress/iter_dcpred.cir.dc#
iter_dcpred.cir
Reported iterate: .dc continuation in MODEINITPRED
* DCtrCurv rotates the state banks before every point and solves the
* points after the first in MODEINITPRED: the MOSFET starts from its
* extrapolated vbs/vgs/vds (2*state1 - state2), the switch reads the
* previous point's state from the rotated state1 (swload.c). Starting
* the points in INITFLOAT instead moves v(3) by up to 5e-4 V; with the
* C's continuation the sweep matches ngspice-47 to ~1e-15
* (crates/dune-core/tests/iterate.rs).
vdd 1 0 dc 5
vin 2 0 dc 0
rl 1 3 20k
m1 3 2 0 0 nm l=2u w=10u
s1 3 4 2 0 sm
r4 4 0 50k
.model nm nmos(level=1 vto=0.8 kp=50u lambda=0.02 gamma=0.4 phi=0.6)
.model sm sw(vt=2.5 vh=0.5 ron=1k roff=1e9)
.dc vin 0 5 0.25
.end
DC transfer characteristic
0 V1 V2 V3 V4 V5 V0 V1 V2 V3 V4 V5 Vv(3)v(4)
v(3)v(4)(+4 more vectors)

Reported iterate: .op of a slowly converging Newton (triple root)

corpus/regress/iter_op.cir.op#
iter_op.cir
Reported iterate: .op of a slowly converging Newton (triple root)
* The C's NIiter returns converged WITHOUT its final rhs/rhsOld swap
* (niiter.c) and CKTdump reads CKTrhsOld: the reported operating
* point is the iterate the convergence test passed against, one solve
* behind the last one. Here Newton converges linearly (the root of
* the cubic B source is triple, the 1e14 resistor barely lifts it),
* so the two differ by ~1.7e-4 V; ngspice-47 matches to ~1e-16
* (crates/dune-core/tests/iterate.rs).
v1 1 0 dc 1
r1 1 2 1e14
b1 2 0 i=1m*(v(2)-0.5)*(v(2)-0.5)*(v(2)-0.5)
.op
.end
Operating Point
vectorvalue
v(1)1 V
i(v1)-5.005 fA
v(2)499.5 mV

JFET common-source amplifier: gate junction caps in .op/.ac/.tran

corpus/regress/jfet_amp.cir.ac.op.tran#
jfet_amp.cir
JFET common-source amplifier: gate junction caps in .op/.ac/.tran
* Coverage: CGS/CGD depletion charge (jfetload.c), the INITSMSIG
* capacitances read by jfetacld.c, and the transient integration of
* both gate charges (the 1.5 V swing forward-biases the gate past
* FC*PB, into the linearized f1/f2/f3 branch), against ngspice-47.
vdd 1 0 dc 15
vin 5 0 dc 0 ac 1 sin(0 1.5 1meg)
rsig 5 2 10k
j1 3 2 4 jn
rd 1 3 4.7k
rs 4 0 100
.model jn njf vto=-2 beta=1.3e-3 lambda=0.01 rd=20 rs=15 cgs=3p cgd=1.5p
+ pb=0.8 is=2e-14 b=0.95
.ac dec 10 1k 1g
.op
.tran 10n 3u
.end
AC Analysismagnitudelog f
0 V200 mV400 mV600 mV800 mV1 V1.2 V1 kHz100 kHz10 MHz1 GHzv(2)v(3)v(4)
v(2)v(3)v(4)(+4 more vectors)
Operating Point
vectorvalue
v(1)15 V
i(vdd)-2.9073 mA
v(5)0 V
i(vin)1.6518 pA
v(2)16.518 nV
v(3)1.3356 V
v(4)290.73 mV
Transient Analysis
-2 V0 V2 V4 V6 V8 V10 V12 V14 V0 s500 ns1 µs1.5 µs2 µs2.5 µs3 µsv(5)v(2)v(3)v(4)
v(5)v(2)v(3)v(4)(+3 more vectors)

JFET I-V: NJF and PJF output/transfer families with RD/RS

corpus/regress/jfet_iv.cir.dc#
jfet_iv.cir
JFET I-V: NJF and PJF output/transfer families with RD/RS
* Coverage: no corpus deck has a J card. This pins jfetload.c's
* drain current (B != 1 doping tail, LAMBDA, normal and inverse
* mode), the gate diodes and the RD/RS prime nodes against
* ngspice-47. The PJF is driven by mirrored copies of the sweep
* sources so one .dc grid covers both devices; j3 runs hot (TEMP=80
* against TNOM=50) to pin JFETtemp's saturation current and vcrit.
vds 1 0 dc 5
vgs 2 0 dc 0
j1 1 2 0 jn
e1 3 0 1 0 -1
e2 4 0 2 0 -0.8
j2 3 4 0 jp 2
j3 1 2 0 jt temp=80
.model jn njf vto=-2 beta=1e-3 lambda=0.02 rd=50 rs=30 b=0.9
.model jp pjf vto=-1.5 beta=5e-4 lambda=0.03 rd=20 rs=20 b=1.1 is=1e-13
.model jt njf vto=-1.8 beta=4e-4 rd=10 rs=10 is=1e-13 tnom=50
.dc vds -0.5 6 0.25 vgs -2.5 0 0.25
.end
DC transfer characteristicnested sweep
-6 mA-4 mA-2 mA0 A2 mA4 mA0 V1 V2 V3 V4 V5 Vi(vds)i(vgs)i(e1)i(e2)
i(vds)i(vgs)i(e1)i(e2)(+4 more vectors)

JFET .disto: harmonics in normal and inverse mode, NJF and PJF

corpus/regress/jfetdisto.cir.disto#
jfetdisto.cir
JFET .disto: harmonics in normal and inverse mode, NJF and PJF
* Coverage: jfetdset.c/jfetdist.c through the 2nd and 3rd harmonics
* against ngspice-47. j1 is a self-biased common-source NJF stage in
* saturation (RD/RS prime nodes, depletion charges below FC*PB);
* j2 is an NJF wired drain-low, so vds < 0 puts it in inverse mode,
* linear region, with both gate junctions inside -5*vt (the setup's
* inverse-mode second-order cross-over of ggs2/capgs2 is visible);
* j3 is a PJF stage with its gate slightly forward (gate diode past
* FC*PB, the linearized charge). The setup ignores B (plain
* Shichman-Hodges), so the models keep the default B = 1.
vdd 1 0 15
vee 20 0 -15
vin 2 0 dc 0 distof1 0.05
* j1: common source, unbypassed source resistor
j1 3 2 4 jn 2
rd1 1 3 4.7k
rs1 4 0 1k
* j2: inverse mode, gate driven through a coupling cap
c25 2 5 1u
rg2 5 9 100k
vg2 9 0 dc 0.95
j2 7 5 8 jn
r7 7 0 10k
r8 1 8 140k
* j3: PJF, gate slightly forward of its source
c2g 2 10 1u
rg3 10 11 100k
vg3 11 0 dc -0.35
j3 12 10 0 jp
rl3 12 20 3.3k
.model jn njf vto=-2 beta=1.3e-3 lambda=0.02 rd=20 rs=15 cgs=3p cgd=1.5p
+ is=1e-14 pb=0.8 fc=0.5
.model jp pjf vto=-1.5 beta=0.8e-3 lambda=0.03 rd=10 rs=10 cgs=2p cgd=1p
+ is=1e-12 pb=0.6 fc=0.5
.disto dec 10 1e3 1e9
.end
DISTORTION - 2nd harmonicmagnitudelog f
1e-16 V1 pV10 nV100 µV1 kHz100 kHz10 MHz1 GHzv(3)v(4)v(5)v(7)v(8)v(10)
v(3)v(4)v(5)v(7)v(8)v(10)(+11 more vectors)
DISTORTION - 3rd harmonicmagnitudelog f
1e-20 V1e-16 V1 pV10 nV1 kHz100 kHz10 MHz1 GHzv(3)v(4)v(5)v(7)v(8)v(10)
v(3)v(4)v(5)v(7)v(8)v(10)(+11 more vectors)

.options keepopinfo: the AC analysis dumps its operating point first

corpus/regress/keepop.cir.ac#
keepop.cir
.options keepopinfo: the AC analysis dumps its operating point first
* Coverage: CKTkeepOpInfo (acan.c:73 in the 3f5, acan.c:155 in
* ngspice-47) writes a real "AC Operating Point" plot, no scale, the
* CKTdump of the solution after the MODEINITSMSIG load, before the AC
* plot. The diode makes the operating point non-trivial. (.pz/.disto
* name theirs "Distortion Operating Point", .noise "NOISE Operating
* Point" in ngspice only; unit tests pin those, one analysis per deck.)
.options keepopinfo
v1 1 0 dc 1.5 ac 1
r1 1 2 1k
d1 2 3 dmod
r2 3 0 220
c1 2 0 1n
.model dmod d is=1e-14 rs=5 cjo=2p
.ac dec 5 1k 10meg
.end
AC Operating Point
vectorvalue
v(1)1.5 V
i(v1)-697.32 µA
v(2)802.68 mV
v(3)153.41 mV
AC Analysismagnitudelog f
0 V50 mV100 mV150 mV200 mV250 mV1 kHz10 kHz100 kHz1 MHz10 MHzv(2)v(3)
v(2)v(3)(+2 more vectors)

BJTdriver -- 24inch lossy line -- DiodeCircuit (gear, refined step)

corpus/regress/ltra_1_gear.cir.tran#
ltra_1_gear.cir
   BJTdriver -- 24inch lossy line -- DiodeCircuit (gear, refined step)
* Companion of spice3f5/examples/ltra_1.cir (a bistable XFAIL: the
* trapezoidal rule rings on the dioload diode string - series
* resistance plus diffusion charge, no junction capacitance - and
* refining the step does not converge it). Same circuit under
* method=gear at TMAX = 0.02 ns, where nothing rings: the engines
* agree at 0.09 of the ruler. Written for Dune; the deck is Berkeley's.

* This unclassified circuit is from Raytheon, courtesy Gerry Marino.
* It consists of a BJT driver connected by a 24 inch lossy line to a
* passive load consisting mostly of diodes. Each inch 
* of the lossy line is modelled by 10 LRC lumps in the Raytheon
* model.

* The line parameters (derived from the Raytheon input file) are:
* L = 9.13nH per inch
* C = 3.65pF per inch
* R = 0.2 ohms per inch

* the circuit
*tran 0.1ns 60ns 0 0.5ns

v1 1 0 0v pulse(0 4 1ns 1ns 1ns 20ns 40ns)
*v1 1 0 4v pulse(4 0 1ns 1ns 1ns 20ns 40ns)
vcc 10 0 5v
*rseries 1 2 5
x1 1 2 10 bjtdrvr
*t1 2 0 3 0 z0=50.0136 td=4.38119ns rel=10
o2 2 0 3 0 lline
*x2 2 3 oneinch
*x2 100 101 twentyfourinch
*x2 100 101 xtwentyfourinch
vtest1 2 100 0
vtest2 101 3 0
x3 3 4 10 dioload
*rl 3 0 5
*dl 0 3 diod2

.model lline ltra rel=1 r=0.2 g=0 l=9.13e-9 c=3.65e-12 len=24 steplimit compactrel=1.0e-3 compactabs=1.0e-14

.model qmodn npn(bf=100 rb=100 cje=0.09375pF cjc=0.28125pF is=1e-12
+pe=0.5 pc=0.5)

.model qmodpd npn(bf=100 rb=100 cje=0.08187pF cjc=0.2525pF is=1e-12
+pe=0.5 pc=0.5)
*.model qmodpdmine npn(bf=100 rb=100  cje=0.08187pF cjc=0.15pF is=1e-12
.model qmodpdmine npn(bf=100 rb=100  cje=0.08187pF cjc=0.05pF is=1e-12
+pe=0.5 pc=0.5)

.model dmod1 d(n=2.25 is=1.6399e-4 bv=10)

.model dmod2 d

.model dmod d(vj=0.3v)

*.model diod1 d(1.0 tt=0.75ns vj=0.6 rs=909 bv=10)
.model diod1 d(tt=0.75ns vj=0.6 rs=909 bv=10)

*.model diod2 d(1.0 tt=0.5ns vj=0.3 rs=100 bv=10)
.model diod2 d(tt=0.5ns vj=0.3 rs=100 bv=10)

.options itl5=0 acct
+reltol=1e-3 abstol=1e-14
.options method=gear
.tran 0.1ns 60ns 0 0.02ns
.save v(1) v(2) v(3)

*.tran 1e-9 1e-8

* bjt driver - 19=input, 268=output, 20=vcc; wierd node numbers from 
* the Raytheon file

.subckt bjtdrvr 19 268 20
q1 22 18 13 qmodn
q2 18 16 13 qmodn
qd2 21 9 0 qmodn
q4 14 14 0 qmodn
q3 16 15 14 qmodpd
q5 8 13 17 qmodn
q6 25 12 0 qmodn
q7 6 17 0 qmodpd
qd1 26 10 0 qmodn
q8 7 11 10 qmodn
q10 268 17 0 qmodpdmine
*q10 268 17 0 qmodpd
q9 7 10 268 qmodn

d1 0 19 dmod1
d2 18 19 dmod2
d3 13 19 dmod
dq1 18 22 dmod
dq2 16 18 dmod
d502 9 21 dmod
dq3 15 16 dmod
d10 24 8 dmod
d4 15 6 dmod
dq6 12 25 dmod
dq7 17 6 dmod
dd1 17 10 dmod
d7 11 6 dmod
dd2 17 26 dmod
d9 23 6 dmod
dq8 11 7 dmod
d501 17 268 dmod
dq9 10 7 dmod
d14 20 27 dmod
d8 0 268 dmod

r1 18 20 6k
r2 22 20 2.2k
r4 0 13 7k
rd1 9 13 2k
rd2 21 13 3k
r3 16 20 10k
r5 15 20 15k
r9 0 17 4k
r6 24 20 750
r10 12 17 2k
r12 24 11 1.5k
r11 25 17 3k
r15 23 20 10k
r13 0 10 15k
r14 7 27 12

.ends bjtdrvr

* subckt dioload - diode load: input=28, output=4, vcc=5

.subckt dioload 28 4 5
*comment out everything in dioload except d5 and r503, and watch
* the difference in results obtained between a tran 0.1ns 20ns and
* a tran 0.01ns 20ns
c1 28 0 5pF
r503 0 4 5.55
r4 0 28 120k
r5 1 5 7.5k

d5 4 28 diod2
d1 1 28 diod1
d4 2 0 diod1
d3 3 2 diod1
d2 1 3 diod1
.ends dioload

* subckt lump - one RLC lump of the lossy line

*10 segments per inch
.subckt lump 1 2
*r1 1 3 0.02
*c1 3 0 0.365pF
*l1 3 2 0.913nH

l1 1 3 0.913nH
c1 2 0 0.365pF
r1 3 2 0.02

*r1 1 3 0.01
*c1 3 0 0.1825pF
*l1 3 4 0.4565nH
*r2 4 5 0.01
*c2 5 0 0.1825pF
*l2 5 2 0.4565nH

*c1 1 0 0.365pF
*l1 1 2 0.913nH
.ends lump

.subckt oneinch 1 2
x1 1 3 lump
x2 3 4 lump
x3 4 5 lump
x4 5 6 lump
x5 6 7 lump
x6 7 8 lump
x7 8 9 lump
x8 9 10 lump
x9 10 11 lump
x10 11 2 lump
.ends oneinch

.subckt fourinch 1 2
x1 1 3 oneinch
x2 3 4 oneinch
x3 4 5 oneinch
x4 5 2 oneinch
.ends fourinch

.subckt fiveinch 1 2
x1 1 3 oneinch
x2 3 4 oneinch
x3 4 5 oneinch
x4 5 6 oneinch
x5 6 2 oneinch
.ends fiveinch

.subckt twentyfourinch 1 2
x1 1 3 fiveinch
x2 3 4 fiveinch
x3 4 5 fiveinch
x4 5 6 fiveinch
x5 6 2 fourinch
.ends twentyfourinch

*modelling using R and lossless lines
*5 segments per inch
.model llfifth ltra nocontrol noprint rel=10 r=0 g=0 l=9.13e-9
+c=3.65e-12 len=0.2 steplimit quadinterp
.subckt xlump 1 2 
o1 1 0 3 0 llfifth
r1 2 3 0.04
.ends xlump

.subckt xoneinch 1 2
x1 1 3 xlump
x2 3 4 xlump
x3 4 5 xlump
x4 5 6 xlump
x5 6 2 xlump
*x5 6 7 xlump
*x6 7 8 xlump
*x7 8 9 xlump
*x8 9 10 xlump
*x9 10 11 xlump
*x10 11 2 xlump
.ends xoneinch

.subckt xfourinch 1 2
x1 1 3 xoneinch
x2 3 4 xoneinch
x3 4 5 xoneinch
x4 5 2 xoneinch
.ends xfourinch

.subckt xfiveinch 1 2
x1 1 3 xoneinch
x2 3 4 xoneinch
x3 4 5 xoneinch
x4 5 6 xoneinch
x5 6 2 xoneinch
.ends xfiveinch

.subckt xtwentyfourinch 1 2
x1 1 3 xfiveinch
x2 3 4 xfiveinch
x3 4 5 xfiveinch
x4 5 6 xfiveinch
x5 6 2 xfourinch
.ends xtwentyfourinch
Transient Analysis
0 V1 V2 V3 V4 V5 V6 V0 s10 ns20 ns30 ns40 ns50 ns60 nsv(1)v(x1.22)v(x1.18)v(x1.13)v(x1.16)v(x1.21)
v(1)v(x1.22)v(x1.18)v(x1.13)v(x1.16)v(x1.21)(+30 more vectors)
  • model `llfifth`: unrecognized parameter (noprint) - ignored
  • d.x1.d1: breakdown current increased to 6.340e-2 to resolve incompatibility with specified saturation current
  • warning: no .end card

BJTdriver -- 2in st. lin -- 20in coupled line -- 2in st line -- DiodeCircuit (gear, refined step)

corpus/regress/ltra_3_gear.cir.tran#
ltra_3_gear.cir
   BJTdriver -- 2in st. lin -- 20in coupled line -- 2in st line -- DiodeCircuit (gear, refined step)
* Companion of spice3f5/examples/ltra_3.cir (a bistable XFAIL: the
* trapezoidal rule rings on the dioload diode strings and, on some
* platforms, feeds a breakpoint cascade). Same circuit under
* method=gear at TMAX = 0.02 ns, where nothing rings: the engines
* agree at 0.09 of the ruler, the diode-string nodes x3.* included.
* The .save keeps the golden small. Written for Dune; the deck is
* Berkeley's.

* This unclassified circuit is from Raytheon, courtesy Gerry Marino.
* 
*                                      _______
* -------- 2in  _________________ 2in  |     |
* | BJT  |______|               |______|Diode|
* |      |------|               |------|     |
* | Drvr | line |   2-wire      | line |rcvr.|
* --------      |   coupled     |      |_____|
*               |  transmission |
* |-/\/\/\/\----|   line        |-------\/\/\/\/\----|
* |  50ohms     |               |         50ohms     |
* |             |               |                    |
* Ground        -----------------                   Ground
*                      
*
* Each inch of the lossy line is modelled by 10 LRC lumps in the 
* Raytheon model.

* The line parameters (derived from the Raytheon input file) are:
* L = 9.13nH per inch
* C = 3.65pF per inch
* R = 0.2 ohms per inch
* K = 0.482 [coupling coefficient; K = M/sqrt(L1*L2)]
* Cc = 1.8pF per inch
*
* coupled ltra model generated  using the standalone program
* multi_decomp

* the circuit
*tran 0.1ns 60ns

v1 1 0 0v pulse(0 4 1ns 1ns 1ns 20ns 40ns)
*v1 1 0 4v pulse(4 0 1ns 1ns 1ns 20ns 40ns)
vcc 10 0 5v

* series termination
*x1 1 oof 10 bjtdrvr
*rseries oof 2 50

x1 1 2 10 bjtdrvr
rt1 3 0 50


* convolution model
x2 2 3 4 5 conv2wetcmodel

* rlc segments model
*x2 2 3 4 5 rlc2wetcmodel

x3 4 dioload
rt2 5 0 50



*.model qmodn npn(bf=100 rb=100 cje=0.09375pF cjc=0.28125pF is=1e-12
*+pe=0.5 pc=0.5)
.model qmodn npn(bf=100 rb=100 cje=0.09375pF cjc=0.28125pF is=1e-12
+pe=0.5 pc=0.5)

.model qmodpd npn(bf=100 rb=100 cje=0.08187pF cjc=0.2525pF is=1e-12
+pe=0.5 pc=0.5)
*.model qmodpd npn(bf=100 rb=100  cje=0.08187pF cjc=0.15pF is=1e-12
.model qmodpdmine npn(bf=100 rb=100  cje=0.08187pF cjc=0.05pF is=1e-12
+pe=0.5 pc=0.5)

.model dmod1 d(n=2.25 is=1.6399e-4 bv=10)
*.model dmod1 d

.model dmod2 d

.model dmod d(vj=0.3v)

*.model diod1 d(1.0 tt=0.75ns vj=0.6 rs=909 bv=10)
.model diod1 d(tt=0.75ns vj=0.6 rs=909 bv=10)

*.model diod2 d(1.0 tt=0.5ns vj=0.3 rs=100 bv=10)
.model diod2 d(tt=0.5ns vj=0.3 rs=100 bv=10)

.options itl5=0 acct reltol=1e-3 abstol=1e-12
.options method=gear
.tran 0.1ns 60ns 0 0.02ns
.save v(x3.1) v(x3.2) v(x3.3) v(x3.4) v(1) v(2) v(3) v(4) v(5)
*.tran 1e-9 1e-8

* bjt driver - 19=input, 268=output, 20=vcc; wierd node numbers from 
* the Raytheon file

.subckt bjtdrvr 19 268 20
q1 22 18 13 qmodn
q2 18 16 13 qmodn
qd2 21 9 0 qmodn
q4 14 14 0 qmodn
q3 16 15 14 qmodpd
q5 8 13 17 qmodn
q6 25 12 0 qmodn
q7 6 17 0 qmodpd
qd1 26 10 0 qmodn
q8 7 11 10 qmodn
*q10 268 17 0 qmodpd
q10 268 17 0 qmodpdmine
q9 7 10 268 qmodn

d1 0 19 dmod1
d2 18 19 dmod2
d3 13 19 dmod
dq1 18 22 dmod
dq2 16 18 dmod
d502 9 21 dmod
dq3 15 16 dmod
d10 24 8 dmod
d4 15 6 dmod
dq6 12 25 dmod
dq7 17 6 dmod
dd1 17 10 dmod
d7 11 6 dmod
dd2 17 26 dmod
d9 23 6 dmod
dq8 11 7 dmod
d501 17 268 dmod
dq9 10 7 dmod
d14 20 27 dmod
d8 0 268 dmod

r1 18 20 6k
r2 22 20 2.2k
r4 0 13 7k
rd1 9 13 2k
rd2 21 13 3k
r3 16 20 10k
r5 15 20 15k
r9 0 17 4k
r6 24 20 750
r10 12 17 2k
r12 24 11 1.5k
r11 25 17 3k
r15 23 20 10k
r13 0 10 15k
r14 7 27 12

.ends bjtdrvr

* subckt dioload - diode load: input=28, output=4, vcc=5

.subckt dioload 28
*comment out everything in dioload except d5 and r503, and watch
* the difference in results obtained between a tran 0.1ns 20ns and
* a tran 0.01ns 20ns
vccint 5 0 5v

c1 28 0 5pF
r503 0 4 5.55
r4 0 28 120k
r5 1 5 7.5k

d5 4 28 diod2
d1 1 28 diod1
d4 2 0 diod1
d3 3 2 diod1
d2 1 3 diod1
.ends dioload

* subckt rlclump - one RLC lump of the lossy line

.subckt rlclump 1 2
*r1 1 3 0.02
*c1 3 0 0.365pF
*l1 3 2 0.913nH

l1 1 3 0.913nH
c1 2 0 0.365pF
r1 3 2 0.02

*r1 1 3 0.01
*c1 3 0 0.1825pF
*l1 3 4 0.4565nH
*r2 4 5 0.01
*c2 5 0 0.1825pF
*l2 5 2 0.4565nH

*c1 1 0 0.365pF
*l1 1 2 0.913nH
.ends lump

.subckt rlconeinch 1 2
x1 1 3 rlclump
x2 3 4 rlclump
x3 4 5 rlclump
x4 5 6 rlclump
x5 6 7 rlclump
x6 7 8 rlclump
x7 8 9 rlclump
x8 9 10 rlclump
x9 10 11 rlclump
x10 11 2 rlclump
.ends rlconeinch

.subckt rlctwoinch 1 2
x1 1 3 rlconeinch
x2 3 2 rlconeinch
.ends rlctwoinch

.subckt rlcfourinch 1 2
x1 1 3 rlconeinch
x2 3 4 rlconeinch
x3 4 5 rlconeinch
x4 5 2 rlconeinch
.ends rlcfourinch

.subckt rlcfiveinch 1 2
x1 1 3 rlconeinch
x2 3 4 rlconeinch
x3 4 5 rlconeinch
x4 5 6 rlconeinch
x5 6 2 rlconeinch
.ends rlcfiveinch

.subckt rlctwentyrlcfourinch 1 2
x1 1 3 rlcfiveinch
x2 3 4 rlcfiveinch
x3 4 5 rlcfiveinch
x4 5 6 rlcfiveinch
x5 6 2 rlcfourinch
.ends rlctwentyrlcfourinch

.subckt rlclumpstub A B C D
x1 A int1 rlcfiveinch
x2 int1 int2 rlcfiveinch
x3 int2 1 rlcfiveinch
x4 1 2 rlcfourinch
x5 1 int3 rlcfiveinch
x6 int3 B rlconeinch
x7 2 C rlcfiveinch
x8 2 D rlcfourinch
.ends rlclumpstub

.subckt ltrastub A B C D
o1 A 0 1 0 lline15in
o2 1 0 B 0 lline6in
o3 1 0 2 0 lline4in
o4 2 0 C 0 lline5in
o5 2 0 D 0 lline4in
.ends ltrastub

*modelling using R and lossless lines

*5 segments per inch
.model llfifth ltra nocontrol rel=10 r=0 g=0 l=9.13e-9
+c=3.65e-12 len=0.2 steplimit quadinterp

.subckt xlump 1 2 
o1 1 0 3 0 llfifth
r1 2 3 0.04
.ends xlump

.subckt xoneinch 1 2
x1 1 3 xlump
x2 3 4 xlump
x3 4 5 xlump
x4 5 6 xlump
x5 6 2 xlump
*x5 6 7 xlump
*x6 7 8 xlump
*x7 8 9 xlump
*x8 9 10 xlump
*x9 10 11 xlump
*x10 11 2 xlump
.ends xoneinch

.subckt xFourinch 1 2
x1 1 3 xoneinch
x2 3 4 xoneinch
x3 4 5 xoneinch
x4 5 2 xoneinch
.ends xfourinch

.subckt xfiveinch 1 2
x1 1 3 xoneinch
x2 3 4 xoneinch
x3 4 5 xoneinch
x4 5 6 xoneinch
x5 6 2 xoneinch
.ends xfiveinch

.subckt xlumpstub A B C D
x1 A int1 xfiveinch
x2 int1 int2 xfiveinch
x3 int2 1 xfiveinch
x4 1 2 xfourinch
x5 1 int3 xfiveinch
x6 int3 B xoneinch
x7 2 C xfiveinch
x8 2 D xfourinch
.ends xlumpstub

* modelling a 2 wire coupled system using RLC lumps
* 10 segments per inch
*
* 1---xxxxx----2
* 3---xxxxx----4

.subckt rlc2wlump 1 3 2 4
l1 1 5 0.913nH
c1 2 0 0.365pF
r1 5 2 0.02
l2 3 6 0.913nH
c2 4 0 0.365pF
r2 6 4 0.02
cmut 2 4 0.18pF
k12 l1 l2 0.482
.ends rlc2wlump

.subckt rlc2woneinch 1 2 3 4
x1 1 2 5 6 rlc2wlump
x2 5 6 7 8  rlc2wlump
x3 7 8 9 10 rlc2wlump
x4 9 10 11 12 rlc2wlump
x5 11 12 13 14 rlc2wlump
x6 13 14 15 16 rlc2wlump
x7 15 16 17 18 rlc2wlump
x8 17 18 19 20 rlc2wlump
x9 19 20 21 22 rlc2wlump
x10 21 22 3 4 rlc2wlump
.ends rlc2woneinch

.subckt rlc2wfiveinch 1 2 3 4
x1 1 2 5 6 rlc2woneinch
x2 5 6 7 8 rlc2woneinch
x3 7 8 9 10 rlc2woneinch
x4 9 10 11 12 rlc2woneinch
x5 11 12 3 4 rlc2woneinch
.ends rlc2wfiveinch

.subckt rlc2wtwentyinch 1 2 3 4
x1 1 2 5 6 rlc2wfiveinch
x2 5 6 7 8 rlc2wfiveinch
x3 7 8 9 10 rlc2wfiveinch
x4 9 10 3 4 rlc2wfiveinch
.ends rlc2wtwentyinch

.subckt rlc2wetcmodel 1 2 3 4
x1 1 5 rlctwoinch
x2 5 2 6 4 rlc2wtwentyinch
x3 6 3 rlctwoinch
.ends rlc2wetcmodel

* Subcircuit conv2wtwentyinch
* conv2wtwentyinch is a subcircuit that models a 2-conductor transmission line with
* the following parameters: l=9.13e-09, c=3.65e-12, r=0.2, g=0,
* inductive_coeff_of_coupling k=0.482, inter-line capacitance cm=1.8e-12,
* length=20. Derived parameters are: lm=4.40066e-09, ctot=5.45e-12.
* 
* It is important to note that the model is a simplified one - the
* following assumptions are made: 1. The self-inductance l, the
* self-capacitance ctot (note: not c), the series resistance r and the
* parallel capacitance g are the same for all lines, and 2. Each line
* is coupled only to the two lines adjacent to it, with the same
* coupling parameters cm and lm. The first assumption imply that edge
* effects have to be neglected. The utility of these assumptions is
* that they make the sL+R and sC+G matrices symmetric, tridiagonal and
* Toeplitz, with useful consequences.
* 
* It may be noted that a symmetric two-conductor line will be
* accurately represented by this model.

* Lossy line models
.model mod1_conv2wtwentyinch ltra rel=1.2 nocontrol r=0.2 l=4.72933999088e-09 g=0 c=7.25000000373e-12 len=20
.model mod2_conv2wtwentyinch ltra rel=1.2 nocontrol r=0.2 l=1.35306599818e-08 g=0 c=3.65000000746e-12 len=20

* subcircuit m_conv2wtwentyinch - modal transformation network for conv2wtwentyinch
.subckt m_conv2wtwentyinch 1 2 3 4
v1 5 0 0v
v2 6 0 0v
f1 0 3 v1 0.707106779721
f2 0 3 v2 -0.707106782652
f3 0 4 v1 0.707106781919
f4 0 4 v2 0.707106780454
e1 7 5 3 0 0.707106780454
e2 1 7 4 0 0.707106782652
e3 8 6 3 0 -0.707106781919
e4 2 8 4 0 0.707106779721
.ends m_conv2wtwentyinch

* Subckt conv2wtwentyinch
.subckt conv2wtwentyinch 1 2 3 4
x1 1 2 5 6 m_conv2wtwentyinch
o1 5 0 7 0 mod1_conv2wtwentyinch
o2 6 0 8 0 mod2_conv2wtwentyinch
x2 3 4 7 8 m_conv2wtwentyinch
.ends conv2wtwentyinch

.model convtwoinch ltra r=0.2 l=9.13e-9 c=3.65e-12 len=2.0 rel=1.2 nocontrol
.subckt conv2wetcmodel 1 2 3 4
o1 1 0 5 0 convtwoinch
x1 5 2 6 4 conv2wtwentyinch
o2 6 0 3 0 convtwoinch
.ends conv2wetcmodel
Transient Analysis
0 V1 V2 V3 V4 V5 V6 V0 s10 ns20 ns30 ns40 ns50 ns60 nsv(1)v(x1.22)v(x1.18)v(x1.13)v(x1.16)v(x1.21)
v(1)v(x1.22)v(x1.18)v(x1.13)v(x1.16)v(x1.21)(+62 more vectors)
  • d.x1.d1: breakdown current increased to 6.340e-2 to resolve incompatibility with specified saturation current
  • warning: .ends lump closes .subckt rlclump
  • warning: no .end card

LTRA RLC line under .options trytocompact

corpus/regress/ltra_compact.cir.tran#
ltra_compact.cir
LTRA RLC line under .options trytocompact
* Pins the history compaction of ltraacct.c (CKTtryToCompact): with
* no interpolation flag on the model, LTRAsetup switches to linear
* interpolation (and warns); after every accepted point where the last
* three samples of v1, v2, i1, i2 are straight within COMPACTREL/
* COMPACTABS (default RELTOL/ABSTOL), the middle one leaves the
* history. The flat tops and bottoms of the pulse are where it
* compacts. ltra_lin.cir is the same deck with LININTERP and no
* compaction; dune-core's engine tests measure both histories.
v1 1 0 pulse(0 1 2ns 1ns 1ns 40ns 100ns)
rs 1 2 50
o1 2 0 3 0 lline
rl 3 0 50
.model lline ltra r=0.5 l=9.13e-9 c=3.65e-12 len=1
.options trytocompact
.tran 0.2ns 100ns
.end
Transient Analysis
-200 mV0 V200 mV400 mV600 mV800 mV1 V0 s20 ns40 ns60 ns80 ns100 nsv(1)v(2)v(3)
v(1)v(2)v(3)(+3 more vectors)
  • o1: using linear interpolation because trytocompact option specified

LTRA RLC line, linear interpolation, no compaction

corpus/regress/ltra_lin.cir.tran#
ltra_lin.cir
LTRA RLC line, linear interpolation, no compaction
* The reference for ltra_compact.cir: the same line and stimulus with
* LININTERP on the model and no trytocompact, so the two decks differ
* only by the history compaction.
v1 1 0 pulse(0 1 2ns 1ns 1ns 40ns 100ns)
rs 1 2 50
o1 2 0 3 0 lline
rl 3 0 50
.model lline ltra r=0.5 l=9.13e-9 c=3.65e-12 len=1 lininterp
.tran 0.2ns 100ns
.end
Transient Analysis
-200 mV0 V200 mV400 mV600 mV800 mV1 V0 s20 ns40 ns60 ns80 ns100 nsv(1)v(2)v(3)
v(1)v(2)v(3)(+3 more vectors)

LTRA RC line (L=0): the erfc-kernel convolution case

corpus/regress/ltra_rc.cir.tran#
ltra_rc.cir
LTRA RC line (L=0): the erfc-kernel convolution case
* Coverage: no corpus deck reaches LTRArcCoeffsSetup; this and
* ltra_rg.cir pin the RC and RG regimes against ngspice-47.
v1 1 0 pulse(0 4 1ns 1ns 1ns 20ns 40ns)
rs 1 2 10
o1 2 0 3 0 lline
rl 3 0 100
.model lline ltra rel=1 r=0.2 l=0 c=3.65e-12 len=24
.tran 0.1ns 60ns
.end
Transient Analysis
-1 V0 V1 V2 V3 V4 V0 s10 ns20 ns30 ns40 ns50 ns60 nsv(1)v(2)v(3)
v(1)v(2)v(3)(+3 more vectors)

LTRA RG line (no L, no C): the frequency-independent attenuator

corpus/regress/ltra_rg.cir.tran#
ltra_rg.cir
LTRA RG line (no L, no C): the frequency-independent attenuator
* Coverage: no corpus deck reaches the RG case; stamped like DC
* with the exp(-sqrt(RG)len) attenuation.
v1 1 0 pulse(0 4 1ns 1ns 1ns 20ns 40ns)
rs 1 2 10
o1 2 0 3 0 lline
rl 3 0 100
.model lline ltra rel=1 r=0.2 g=1e-3 len=24
.tran 0.1ns 60ns
.end
Transient Analysis
0 V1 V2 V3 V4 V0 s10 ns20 ns30 ns40 ns50 ns60 nsv(1)v(2)v(3)
v(1)v(2)v(3)(+3 more vectors)
  • `o1`: lossy line series inductance not given, assumed zero
  • `o1`: lossy line parallel capacitance not given, assumed zero

LTRA recursive convolution (ltrafit): RLC and RC lines, 300 ns history

corpus/regress/ltrafit.cir.tran#
ltrafit.cir
LTRA recursive convolution (ltrafit): RLC and RC lines, 300 ns history
* Gate of Dune's opt-in recursive mode (issue #8): ngspice-47 runs the
* faithful coefficient walk (it ignores the unknown option), Dune the
* exponential-sum recursion. Mismatched loads keep both lines
* reflecting for the whole run, the load capacitors make the
* integration method matter (tests/ltra_fit.rs reruns it under
* method=trbdf2); 3000+ accepted points exercise the snapshot
* pruning; R/2L*TSTOP = 3.3 reaches the h1' tail.
v1 1 0 pulse(0 4 1ns 1ns 1ns 20ns 40ns)
rs 1 2 10
o1 2 0 3 0 rlcline
rl 3 0 100
cl 3 0 2pF
rs2 1 4 10
o2 4 0 5 0 rcline
rl2 5 0 100
cl2 5 0 2pF
.model rlcline ltra r=0.2 l=9.13e-9 c=3.65e-12 len=24
.model rcline ltra r=0.2 l=0 c=3.65e-12 len=24
.options ltrafit
.tran 0.1ns 300ns
.end
Transient Analysis
-1 V0 V1 V2 V3 V4 V5 V0 s50 ns100 ns150 ns200 ns250 ns300 nsv(1)v(2)v(3)v(4)v(5)
v(1)v(2)v(3)v(4)v(5)(+5 more vectors)
  • `o1`: ltrafit RLC, T=4.381e-9s, R/2L=1.095e7/s: 30 real poles (5 panels x 6 Gauss points); kernel error max/L1 on [0.000e0s, 3.000e-7s] / max at the 4373 history lags: h1' 1.9e-11/1.3e-11/1.9e-11, h2 1.3e-10/7.7e-11/1.3e-10, h3' 2.1e-11/1.5e-11/2.0e-11
  • `o2`: ltrafit RC, RCl²=4.205e-10s, exact window 5.256e-11s: 96 real poles (16 panels x 6 Gauss points); kernel error max/L1 on [5.256e-11s, 3.000e-7s] / max at the 4373 history lags: h1 8.5e-10/2.4e-8/1.5e-9, h2 5.9e-9/4.1e-8/5.9e-9, h3 6.2e-9/6.2e-8/6.1e-9

MESFET amplifier: Statz gate charge in .ac and .tran

corpus/regress/mes_amp.cir.ac.tran#
mes_amp.cir
MESFET amplifier: Statz gate charge in .ac and .tran
* Coverage: qggnew's total gate charge and its four-point split
* (mesload.c), including the forward-gate extension past vmax, the
* INITSMSIG capacitances read by mesacl.c, against ngspice-47.
vdd 1 0 dc 5
vin 5 0 dc -0.5 ac 1 sin(-0.5 1.5 1g)
rsig 5 2 50
z1 3 2 0 zn
rl 1 3 1k
cl 3 0 50f
.model zn nmf vto=-1.8 beta=3e-3 b=0.3 alpha=2.5 lambda=0.05 rd=5 rs=5
+ cgs=1p cgd=0.2p pb=0.8
.ac dec 10 1meg 100g
.tran 10p 4n
.end
AC Analysismagnitudelog f
0 V1 V2 V3 V4 V5 V1 MHz10 MHz100 MHz1 GHz10 GHz100 GHzv(2)v(3)
v(2)v(3)(+4 more vectors)
Transient Analysis
-2 V-1 V0 V1 V2 V3 V4 V0 s1 ns2 ns3 ns4 nsv(5)v(2)v(3)
v(5)v(2)v(3)(+3 more vectors)

MESFET I-V: NMF and PMF output/transfer families with RD/RS

corpus/regress/mes_iv.cir.dc#
mes_iv.cir
MESFET I-V: NMF and PMF output/transfer families with RD/RS
* Coverage: no corpus deck has a Z card. This pins mesload.c's
* Statz drain current (cubic below 3/ALPHA, doping-tail B, LAMBDA,
* normal and inverse mode) and the gate diodes at CONSTvt0 against
* ngspice-47. The PMF is driven by mirrored copies of the sweep
* sources so one .dc grid covers both devices. The area goes in as
* AREA= because ngspice-47 drops the positional area of a Z card.
vds 1 0 dc 3
vgs 2 0 dc 0
z1 1 2 0 zn
e1 3 0 1 0 -1.2
e2 4 0 2 0 -0.7
z2 3 4 0 zp area=1.5
.model zn nmf vto=-1.8 beta=3e-3 b=0.3 alpha=2.5 lambda=0.05 rd=5 rs=5
.model zp pmf vto=-1.2 beta=2e-3 b=0.5 alpha=3 lambda=0.02 rd=10 rs=8
.dc vds -0.3 4 0.1 vgs -2 0.2 0.2
.end
DC transfer characteristicnested sweep
-5 V-4 V-3 V-2 V-1 V0 V1 V0 V1 V2 V3 Vv(3)
v(3)(+7 more vectors)

MESFET .disto: intermodulation in normal and inverse mode, NMF and PMF

corpus/regress/mesdisto.cir.disto#
mesdisto.cir
MESFET .disto: intermodulation in normal and inverse mode, NMF and PMF
* Coverage: mesdset.c/mesdisto.c through the IM products (f1+f2, f1-f2,
* 2f1-f2) against ngspice-47. z1 is a common-source NMF stage in
* saturation; z4 has its gate forward of both channel ends (vnew1
* above vmax: the clamped branch of the charge model); z2 is wired
* drain-low, so vds < 0 puts it in inverse mode, linear region; z3 is
* a PMF stage in the linear region (vds < 3/alpha). The setup's
* charges are its own qgs = vgs*cgsnew model, not the load's qggnew
* split (kept literally, as in both the 3f5 and ngspice). Both inputs
* ride the same gate source.
vdd 1 0 5
vee 20 0 -5
vin 2 0 dc 0 distof1 0.02 distof2 0.02
* z1: common source, unbypassed source resistor, saturation
c2a 2 21 1u
rga 21 22 100k
vga 22 0 dc -0.6
z1 3 21 4 zn area=1.5
rd1 1 3 330
rs1 4 0 10
* z4: gate forward (vgs, vgd ~ 0.45 V), vds small
c2b 2 23 1u
rgb 23 24 20k
vgb 24 0 dc 2
z4 25 23 26 zn
rd4 25 0 100
rs4 26 0 50
* z2: inverse mode
c25 2 5 1u
rg2 5 9 100k
vg2 9 0 dc 1.2
z2 7 5 8 zn
r7 7 0 2k
r8 1 8 2.2k
* z3: PMF, linear region
c2g 2 10 1u
rg3 10 11 100k
vg3 11 0 dc 0.5
z3 12 10 0 zp
rl3 12 20 20k
.model zn nmf vto=-1.8 beta=3e-3 b=0.3 alpha=2.5 lambda=0.05 rd=5 rs=5
+ cgs=1p cgd=0.2p pb=0.8 is=1e-14
.model zp pmf vto=-1.2 beta=1.5e-3 b=0.5 alpha=2 lambda=0.03 rd=8 rs=8
+ cgs=0.6p cgd=0.15p pb=0.7 is=1e-13
.disto dec 10 1e4 1e9 0.9
.end
DISTORTION - IM: f1+f2magnitudelog f
100 pV10 nV1 µV100 µV10 kHz100 kHz1 MHz10 MHz100 MHz1 GHzv(21)v(3)v(4)v(23)v(25)v(26)
v(21)v(3)v(4)v(23)v(25)v(26)(+19 more vectors)
DISTORTION - IM: f1-f2magnitudelog f
100 pV10 nV1 µV100 µV10 mV10 kHz100 kHz1 MHz10 MHz100 MHz1 GHzv(21)v(3)v(4)v(23)v(25)v(26)
v(21)v(3)v(4)v(23)v(25)v(26)(+19 more vectors)
DISTORTION - IM: 2f1-f2magnitudelog f
100 fV100 pV100 nV100 µV10 kHz100 kHz1 MHz10 MHz100 MHz1 GHzv(21)v(3)v(4)v(23)v(25)v(26)
v(21)v(3)v(4)v(23)v(25)v(26)(+19 more vectors)

Simple mixer circuit - diffpair fed by modulated Iee (harmonics)

corpus/regress/mixdisto_hd.cir.disto#
mixdisto_hd.cir
Simple mixer circuit - diffpair fed by modulated Iee (harmonics)
* Derived from spice3f5/examples/mixdisto.cir (in corpus/SKIP: the
* upstream deck keeps its .disto lines commented out, so ngspice -b
* has no analysis to run). This is its first setup, uncommented:
* harmonic analysis with both inputs on DISTOF1. Coverage: BJT .disto
* (bjtdset.c/bjtdisto.c) for ic, ib, qbe (tf), qbc, qsc, three
* transistors with the substrate on vee; the output is v(6).
v1 1 0  0v ac 1.0 distof1 0.001
v2 7 0 0v ac 1.0 distof1 0.001
.disto dec 20 1.0e3 1.0e8

q1 3 1 4 2 mod1
q2 6 0 4 2 mod1
rc1 5 3 10k
rc2 5 6 10k
vcc 5 0 10v
qee 4 7 8 2 mod1
re 8 2 9K
vee 2 0 -10v

.model mod1 npn is=1e-16 bf=100 cjs=2.0e-12 tf=0.3e-9 cje=3.0e-12 cjc=2.0e-12  vaf=50
.end
DISTORTION - 2nd harmonicmagnitudelog f
100 nV1 µV10 µV100 µV1 mV1 kHz10 kHz100 kHz1 MHz10 MHz100 MHzv(3)v(4)v(6)v(8)
v(3)v(4)v(6)v(8)(+8 more vectors)
DISTORTION - 3rd harmonicmagnitudelog f
100 pV1 nV10 nV100 nV1 µV10 µV1 kHz10 kHz100 kHz1 MHz10 MHz100 MHzv(3)v(4)v(6)v(8)
v(3)v(4)v(6)v(8)(+8 more vectors)

Simple mixer circuit - diffpair fed by modulated Iee (intermodulation)

corpus/regress/mixdisto_im.cir.disto#
mixdisto_im.cir
Simple mixer circuit - diffpair fed by modulated Iee (intermodulation)
* Derived from spice3f5/examples/mixdisto.cir (in corpus/SKIP: the
* upstream .disto lines are comments). This is its second setup,
* uncommented: v2 moves to DISTOF2 and F2OVERF1 = 0.9, giving the IM
* products f1+f2, f1-f2 and 2f1-f2 (the DFnF12/DFn2F12 multi-variable
* loads of dloadfns.c). The output is v(6).
v1 1 0  0v ac 1.0 distof1 0.001
v2 7 0 0v ac 1.0 distof2 0.001
.disto dec 20 1.0e3 1.0e8 0.9

q1 3 1 4 2 mod1
q2 6 0 4 2 mod1
rc1 5 3 10k
rc2 5 6 10k
vcc 5 0 10v
qee 4 7 8 2 mod1
re 8 2 9K
vee 2 0 -10v

.model mod1 npn is=1e-16 bf=100 cjs=2.0e-12 tf=0.3e-9 cje=3.0e-12 cjc=2.0e-12  vaf=50
.end
DISTORTION - IM: f1+f2magnitudelog f
100 nV1 µV10 µV100 µV1 mV1 kHz10 kHz100 kHz1 MHz10 MHz100 MHzv(3)v(4)v(6)v(8)
v(3)v(4)v(6)v(8)(+8 more vectors)
DISTORTION - IM: f1-f2magnitudelog f
100 nV1 µV10 µV100 µV1 mV1 kHz10 kHz100 kHz1 MHz10 MHz100 MHzv(3)v(4)v(6)v(8)
v(3)v(4)v(6)v(8)(+8 more vectors)
DISTORTION - IM: 2f1-f2magnitudelog f
0 V500 nV1 µV1.5 µV2 µV2.5 µV3 µV1 kHz10 kHz100 kHz1 MHz10 MHz100 MHzv(3)v(4)v(6)v(8)
v(3)v(4)v(6)v(8)(+8 more vectors)

MOS2 common-source stage: intermodulation in .disto

corpus/regress/mos2disto.cir.disto#
mos2disto.cir
MOS2 common-source stage: intermodulation in .disto
* Coverage: mos2dset.c's Dderivs chain through the Grove-Frohman
* current - narrow-channel factor (DELTA), the XJ short-channel
* correction of gamma, and the NSUB channel-length modulation from
* XD (LAMBDA=0) - plus the shared MOS load, through f1+f2, f1-f2 and
* 2f1-f2. GAMMA=0 keeps
* the deck off the two places where mos2dset.c reads storage it never
* wrote (d_dumarg with GAMMA>0, d_xlamda with LAMBDA>0 or no NSUB);
* see the rustdoc of Mos2I::disto_coeffs.
vdd 5 0 5
vin 1 0 0 distof1 0.02 distof2 0.02
vbias 2 1 1.6
rg 2 3 10k
m1 4 3 0 6 nmod l=3u w=30u ad=60p as=60p pd=34u ps=34u
rd 5 4 10k
cl 4 0 0.2p
vbb 6 0 -1
.model nmod nmos level=2 vto=0.8 kp=40u gamma=0 phi=0.65 nsub=2e15 xj=0.4u
+ delta=0.5 tox=40n cj=0.3m mj=0.45 cjsw=0.5n mjsw=0.33 pb=0.8
+ cgso=0.2n cgdo=0.2n cgbo=0.1n is=1e-15 rd=20 rs=20
.disto dec 10 1e3 1e10 0.9
.end
DISTORTION - IM: f1+f2magnitudelog f
10 pV1 nV100 nV10 µV1 mV1 kHz100 kHz10 MHz1 GHzv(3)v(4)
v(3)v(4)(+8 more vectors)
DISTORTION - IM: f1-f2magnitudelog f
1 pV1 nV1 µV1 mV1 kHz100 kHz10 MHz1 GHzv(3)v(4)
v(3)v(4)(+8 more vectors)
DISTORTION - IM: 2f1-f2magnitudelog f
10 pV1 nV100 nV10 µV1 kHz100 kHz10 MHz1 GHzv(3)v(4)
v(3)v(4)(+8 more vectors)

MOS3 CMOS inverter: Meyer caps and bulk junctions in .op/.ac/.tran

corpus/regress/mos3_inv.cir.ac.op.tran#
mos3_inv.cir
MOS3 CMOS inverter: Meyer caps and bulk junctions in .op/.ac/.tran
* Coverage: a level-3 inverter chain switching rail to rail (x1 drives
* x2 through every region, so DEVqmeyer's gate charges and the CJ/CJSW
* bottom and sidewall junction charges integrate across the full
* swing) and a self-biased level-3 amplifier (rf feedback, source
* degeneration with the bulk at ground, so gmbs and the reverse-biased
* source junction show in .ac) against ngspice-47. Every switching
* node carries at least 50 fF so no near-floating node crosses vds=0
* on a pulse edge.
vdd 1 0 dc 3.3
vin 2 0 dc 0 pulse(0 3.3 2n 1n 1n 8n 20n)
mn1 3 2 0 0 n3 l=1u w=4u ad=8p as=8p pd=12u ps=12u
mp1 3 2 1 1 p3 l=1u w=10u ad=20p as=20p pd=24u ps=24u
c3 3 0 50f
mn2 4 3 0 0 n3 l=1u w=4u ad=8p as=8p pd=12u ps=12u
mp2 4 3 1 1 p3 l=1u w=10u ad=20p as=20p pd=24u ps=24u
c4 4 0 100f
vac 5 0 dc 0 ac 1
cin 5 6 10p
rf 7 6 200k
mn3 7 6 8 0 n3 l=2u w=20u ad=40p as=40p pd=44u ps=44u
rs3 8 0 500
rl 1 7 10k
c7 7 0 0.2p
.model n3 nmos level=3 vto=0.6 nsub=4e16 tox=1.5e-8 xj=0.15u ld=0.05u u0=450
+ theta=0.06 eta=0.2 delta=0.6 vmax=1.6e5 kappa=0.4 nfs=6e11 rsh=15
+ cj=4e-4 mj=0.45 cjsw=3e-10 mjsw=0.3 cgso=2e-10 cgdo=2e-10 cgbo=1e-10
.model p3 pmos level=3 vto=-0.7 nsub=3e16 tox=1.5e-8 xj=0.2u ld=0.06u u0=180
+ theta=0.05 eta=0.15 delta=0.5 kappa=0.6 nfs=4e11 rsh=25
+ cj=5e-4 mj=0.5 cjsw=3.5e-10 mjsw=0.33 cgso=2.5e-10 cgdo=2.5e-10 cgbo=1e-10
.ac dec 10 10k 10g
.op
.tran 0.1n 40n
.end
AC Analysismagnitudelog f
0 V1 V2 V3 V4 V10 kHz1 MHz100 MHz10 GHzv(6)v(7)v(8)
v(6)v(7)v(8)(+8 more vectors)
Operating Point
vectorvalue
v(1)3.3 V
i(vdd)-194.08 µA
v(2)0 V
i(vin)0 A
v(3)3.3 V
v(4)9.9129 nV
v(5)0 V
i(vac)0 A
v(6)1.3592 V
v(7)1.3592 V
v(8)97.042 mV
Transient Analysis
-500 mV0 V500 mV1 V1.5 V2 V2.5 V3 V3.5 V0 s10 ns20 ns30 ns40 nsv(2)v(3)v(4)v(5)
v(2)v(3)v(4)v(5)(+7 more vectors)

MOS3 I-V: level-3 NMOS/PMOS output and transfer families

corpus/regress/mos3_iv.cir.dc#
mos3_iv.cir
MOS3 I-V: level-3 NMOS/PMOS output and transfer families
* Coverage: no corpus deck has a level-3 card. This pins moseq3
* (mos3load.c) against ngspice-47: the ETA static feedback, the XJ
* short-channel factor, the DELTA narrow-width term (W=2u), THETA
* mobility degradation, VMAX velocity saturation with the KAPPA
* lateral-field channel-length modulation (n3), the plain depletion
* CLM of line510 without VMAX (p3), and the NFS weak-inversion
* exponential (the vgs grid starts in subthreshold). RD/RS come from
* RSH*NRD/NRS (prime nodes). Each device has its own E-source drive
* so every drain current is a separate branch vector; m3 runs hot
* (TEMP=80, no NFS: the hard cutoff at von) to pin MOS3temp.
vds 1 0 dc 3
vgs 2 0 dc 1
e1 11 0 1 0 1
e2 12 0 2 0 1
m1 11 12 0 0 n3 l=2u w=2u nrd=2 nrs=2
e3 21 0 1 0 -1
e4 22 0 2 0 -1
m2 21 22 0 0 p3 l=3u w=6u nrd=1 nrs=1
e5 31 0 1 0 1
m3 31 2 0 0 n3h l=4u w=10u temp=80
vbb 4 0 dc -1
e6 41 0 1 0 1
m4 41 2 0 4 n3 l=2u w=2u nrd=2 nrs=2
.model n3 nmos level=3 vto=0.7 nsub=3e16 tox=2e-8 xj=0.2u ld=0.05u u0=500
+ theta=0.08 eta=0.3 delta=1.2 vmax=1.5e5 kappa=0.5 nfs=8e11 rsh=20
.model p3 pmos level=3 vto=-0.8 gamma=0.6 nsub=2e16 tox=2e-8 xj=0.25u ld=0.08u
+ u0=200 theta=0.05 eta=0.2 delta=0.8 kappa=0.8 nfs=5e11 rsh=30
.model n3h nmos level=3 vto=0.6 kp=6e-5 phi=0.7 nsub=1e16 tox=2.5e-8 theta=0.1
+ vmax=2e5 kappa=0.3 tnom=40
.dc vgs 0 4 0.1 vds 0 5 1
.end
DC transfer characteristicnested sweep
-600 µA-400 µA-200 µA0 A200 µA400 µA0 V1 V2 V3 Vi(e1)i(e3)i(e5)i(e6)
i(e1)i(e3)i(e5)i(e6)(+14 more vectors)

MOS3 PMOS common-source stage: intermodulation in .disto

corpus/regress/mos3disto.cir.disto#
mos3disto.cir
MOS3 PMOS common-source stage: intermodulation in .disto
* Coverage: mos3dset.c's Dderivs chain through the semi-empirical
* current - short-channel factor (XJ, the depletion-width polynomial),
* narrow width (DELTA), static feedback (ETA), mobility modulation
* (THETA, including the C's Beta-before-TimesDeriv order that leaves
* an extra fgate in every coefficient) and channel-length modulation
* (KAPPA) - on a PMOS, through f1+f2, f1-f2 and 2f1-f2.
vdd 5 0 -5
vin 1 0 0 distof1 0.02 distof2 0.02
vbias 2 1 -1.6
rg 2 3 10k
m1 4 3 0 6 nmod l=2u w=20u ad=40p as=40p pd=24u ps=24u
rd 5 4 10k
cl 4 0 0.2p
vbb 6 0 1
.model nmod pmos level=3 vto=-0.8 kp=50u gamma=0.5 phi=0.65 nsub=1e16 xj=0.3u
+ theta=0.05 eta=0.5 kappa=0.4 delta=0.3 tox=20n cj=0.3m mj=0.45 cjsw=0.5n mjsw=0.33 pb=0.8
+ cgso=0.2n cgdo=0.2n cgbo=0.1n is=1e-15 rd=20 rs=20
.disto dec 10 1e3 1e10 0.9
.end
DISTORTION - IM: f1+f2magnitudelog f
100 pV10 nV1 µV100 µV1 kHz100 kHz10 MHz1 GHzv(3)v(4)
v(3)v(4)(+8 more vectors)
DISTORTION - IM: f1-f2magnitudelog f
10 pV1 nV100 nV10 µV1 mV1 kHz100 kHz10 MHz1 GHzv(3)v(4)
v(3)v(4)(+8 more vectors)
DISTORTION - IM: 2f1-f2magnitudelog f
100 pV10 nV1 µV100 µV1 kHz100 kHz10 MHz1 GHzv(3)v(4)
v(3)v(4)(+8 more vectors)

mosamp2 - mos amplifier - transient (refined step)

corpus/regress/mosamp2_fine.cir.tran#
mosamp2_fine.cir
mosamp2 - mos amplifier - transient (refined step)
* Converged companion of spice3f5/examples/mosamp2.cir (an XFAIL: at
* the default step the LTE controller is bistable on the Meyer
* charges and each engine takes its own branch). Same circuit,
* TMAX = 10 ns: the engines agree at 0.07 of the ruler. Written for
* Dune; the deck is Berkeley's. The .save keeps the golden small.
.options acct abstol=10n  vntol=10n
.tran 0.1us 10us 0 10ns
.save v(20) v(66) v(15) v(5) v(12) v(11) v(10)
m1  15 15  1 32 m w=88.9u  l=25.4u
m2   1  1  2 32 m w=12.7u  l=266.7u
m3   2  2 30 32 m w=88.9u  l=25.4u
m4  15  5  4 32 m w=12.7u  l=106.7u
m5   4  4 30 32 m w=88.9u  l=12.7u
m6  15 15  5 32 m w=44.5u  l=25.4u
m7   5 20  8 32 m w=482.6u l=12.7u
m8   8  2 30 32 m w=88.9u  l=25.4u
m9  15 15  6 32 m w=44.5u  l=25.4u
m10  6 21  8 32 m w=482.6u l=12.7u
m11 15  6  7 32 m w=12.7u  l=106.7u
m12  7  4 30 32 m w=88.9u  l=12.7u
m13 15 10  9 32 m w=139.7u l=12.7u
m14  9 11 30 32 m w=139.7u l=12.7u
m15 15 15 12 32 m w=12.7u  l=207.8u
m16 12 12 11 32 m w=54.1u  l=12.7u
m17 11 11 30 32 m w=54.1u  l=12.7u
m18 15 15 10 32 m w=12.7u  l=45.2u
m19 10 12 13 32 m w=270.5u l=12.7u
m20 13  7 30 32 m w=270.5u l=12.7u
m21 15 10 14 32 m w=254u   l=12.7u
m22 14 11 30 32 m w=241.3u l=12.7u
m23 15 20 16 32 m w=19u    l=38.1u
m24 16 14 30 32 m w=406.4u l=12.7u
m25 15 15 20 32 m w=38.1u  l=42.7u
m26 20 16 30 32 m w=381u   l=25.4u
m27 20 15 66 32 m w=22.9u  l=7.6u
cc 7 9 40pf
cl 66 0 70pf
vin 21 0 pulse(0 5 1ns 1ns 1ns 5us 10us)
vccp 15 0 dc +15
vddn 30 0 dc -15
vb 32 0 dc -20
.model m nmos(nsub=2.2e15 uo=575 ucrit=49k uexp=0.1 tox=0.11u xj=2.95u
+   level=2 cgso=1.5n cgdo=1.5n cbd=4.5f cbs=4.5f ld=2.4485u nss=3.2e10
+   kp=2e-5 phi=0.6 )
.print tran v(20) v(66)
.plot  tran v(20) v(66)
.end
Transient Analysisvectors from the deck’s .plot/.print
-1 V0 V1 V2 V3 V4 V5 V6 V7 V0 s2 µs4 µs6 µs8 µs10 µsv(20)v(66)
v(20)v(66)(+22 more vectors)

MOS1 common-source stage: harmonics in .disto

corpus/regress/mosdisto.cir.disto#
mosdisto.cir
MOS1 common-source stage: harmonics in .disto
* Coverage: mos1dset.c's closed-form drain-current derivatives in
* saturation with body effect (dvon/dvbs to third order) and channel-
* length modulation, the bulk junction diodes, the bottom/sidewall
* depletion and Meyer gate-capacitance coefficients, and the shared
* mos1dist.c load, through the 2nd and 3rd harmonics against
* ngspice-47.
vdd 5 0 5
vin 1 0 0 distof1 0.02
vbias 2 1 1.3
rg 2 3 10k
m1 4 3 0 6 nmod l=2u w=20u ad=40p as=40p pd=24u ps=24u
rd 5 4 10k
cl 4 0 0.2p
vbb 6 0 -1
.model nmod nmos level=1 vto=0.8 kp=50u gamma=0.5 phi=0.65 lambda=0.03
+ tox=20n cj=0.3m mj=0.45 cjsw=0.5n mjsw=0.33 pb=0.8 cgso=0.2n cgdo=0.2n cgbo=0.1n
+ is=1e-15 rd=20 rs=20
.disto dec 10 1e3 1e10
.end
DISTORTION - 2nd harmonicmagnitudelog f
100 pV10 nV1 µV100 µV1 kHz100 kHz10 MHz1 GHzv(3)v(4)
v(3)v(4)(+8 more vectors)
DISTORTION - 3rd harmonicmagnitudelog f
1 fV1 pV1 nV1 µV1 kHz100 kHz10 MHz1 GHzv(3)v(4)
v(3)v(4)(+8 more vectors)

MOSFET noise: levels 1, 2 and 3 in a capacitively coupled cascade

corpus/regress/mosnoise.cir.noise#
mosnoise.cir
MOSFET noise: levels 1, 2 and 3 in a capacitively coupled cascade
* Coverage: mos1noi.c/mos2noi.c/mos3noi.c in their ngspice-47 form at
* the default NLEV=2 - RD/RS thermal (here from RSH*NRD/NRS, so the
* #drain/#source prime nodes exist), channel thermal 4kT*(2/3)|gm| and
* the flicker density KF*gm^2/(f^AF*W*Leff*Cox) (the 3f5 used
* KF*|Id|^AF/(f*W*Leff*Cox^2)). nm1 has no TOX, so its flicker term
* falls back to Cox for tox=1e-7 as in mos1noi.c. Each stage is biased
* by its own gate source through 1meg, whose thermal noise also shows.
vdd 1 0 dc 5
vin 2 0 dc 1.5 ac 1
m1 3 2 0 0 nm1 l=2u w=20u nrd=2 nrs=1
rl1 1 3 10k
c12 3 6 1u
rg2 6 7 1meg
vb2 7 0 dc 1.2
m2 4 6 0 0 nm2 l=3u w=30u nrd=1.5 nrs=1.5
rl2 1 4 10k
c23 4 8 1u
rg3 8 9 1meg
vb3 9 0 dc 1.1
m3 5 8 0 0 nm3 l=2u w=10u nrd=1 nrs=2
rl3 1 5 20k
.model nm1 nmos level=1 vto=0.8 kp=50u lambda=0.02 rsh=20 ld=0.2u
+ kf=1e-26 af=1.2
.model nm2 nmos level=2 vto=0.7 tox=40n nsub=1e16 uo=600 lambda=0.02
+ rsh=15 ld=0.1u kf=2e-26 af=1
.model nm3 nmos level=3 vto=0.7 tox=30n nsub=1e16 uo=500 theta=0.1
+ rsh=10 rd=5 ld=0.1u kf=5e-27 af=0.8
.noise v(5) vin dec 10 10 100meg 1
.end
Noise Spectral Density Curveslog f
0 V/√Hz1 µV/√Hz2 µV/√Hz3 µV/√Hz4 µV/√Hz5 µV/√Hz6 µV/√Hz10 Hz1 kHz100 kHz10 MHzonoise_spectruminoise_spectrum
onoise_spectruminoise_spectrum(+30 more vectors)
Integrated Noise
vectorvalue
v(onoise_total_m1_rd)1.2621 µV
v(inoise_total_m1_rd)53.324 nV
v(onoise_total_m1_rs)137.61 µV
v(inoise_total_m1_rs)5.8141 µV
v(onoise_total_m1_id)1.1578 mV
v(inoise_total_m1_id)48.915 µV
v(onoise_total_m1_1overf)39.903 µV
v(inoise_total_m1_1overf)1.6558 µV
v(onoise_total_m1)1.1666 mV
v(inoise_total_m1)49.288 µV
v(onoise_total_rl1_thermal)663.93 µV
v(inoise_total_rl1_thermal)28.05 µV
v(onoise_total_rl1_1overf)0 V
v(inoise_total_rl1_1overf)0 V
v(onoise_total_rl1)663.93 µV
v(inoise_total_rl1)28.05 µV
v(onoise_total_rg2_thermal)66.393 µV
v(inoise_total_rg2_thermal)2.805 µV
v(onoise_total_rg2_1overf)0 V
v(inoise_total_rg2_1overf)0 V
v(onoise_total_rg2)66.393 µV
v(inoise_total_rg2)2.805 µV
v(onoise_total_m2_rd)179.97 nV
v(inoise_total_m2_rd)7.6066 nV
v(onoise_total_m2_rs)44.691 µV
v(inoise_total_m2_rs)1.8882 µV
v(onoise_total_m2_id)382.4 µV
v(inoise_total_m2_id)16.162 µV
v(onoise_total_m2_1overf)11.479 µV
v(inoise_total_m2_1overf)477.03 nV
v(onoise_total_m2)385.17 µV
v(inoise_total_m2)16.279 µV
v(onoise_total_rl2_thermal)315.35 µV
v(inoise_total_rl2_thermal)13.328 µV
v(onoise_total_rl2_1overf)0 V
v(inoise_total_rl2_1overf)0 V
v(onoise_total_rl2)315.35 µV
v(inoise_total_rl2)13.328 µV
v(onoise_total_rg3_thermal)31.535 µV
v(inoise_total_rg3_thermal)1.3328 µV
v(onoise_total_rg3_1overf)0 V
v(inoise_total_rg3_1overf)0 V
v(onoise_total_rg3)31.535 µV
v(inoise_total_rg3)1.3328 µV
v(onoise_total_m3_rd)39.476 nV
v(inoise_total_m3_rd)1.6685 nV
v(onoise_total_m3_rs)18.545 µV
v(inoise_total_m3_rs)783.84 nV
v(onoise_total_m3_id)233.36 µV
v(inoise_total_m3_id)9.8634 µV
v(onoise_total_m3_1overf)17.022 µV
v(inoise_total_m3_1overf)709.98 nV
v(onoise_total_m3)234.71 µV
v(inoise_total_m3)9.9199 µV
v(onoise_total_rl3_thermal)179.58 µV
v(inoise_total_rl3_thermal)7.5903 µV
v(onoise_total_rl3_1overf)0 V
v(inoise_total_rl3_1overf)0 V
v(onoise_total_rl3)179.58 µV
v(inoise_total_rl3)7.5903 µV
v(onoise_total)1.4637 mV
v(inoise_total)61.842 µV

NLEV/GDSNOI noise selectors of the MOSFETs and the JFET

corpus/regress/nlevnoise.cir.noise#
nlevnoise.cir
NLEV/GDSNOI noise selectors of the MOSFETs and the JFET
* Coverage: the non-default branches of ngspice-47's mos1noi.c,
* mos2noi.c, mos3noi.c and jfetnoi.c: flicker NLEV=0
* KF*|Id|^AF/(f*Leff^2*Cox) on m1, NLEV=1 KF*|Id|^AF/(f*W*Leff*Cox)
* on m2, and the NLEV=3 channel noise
* (2/3)*beta*vgst*(1+a+a^2)/(1+a)*GDSNOI with its flicker in the
* NLEV=2 form on m3 (saturation, a = 0) and m4 (linear region), and on
* the JFET j1 (saturation) and j2 (linear region). m1 has no TOX: the
* tox = 1e-7 fallback of mos1noi.c's Cox.
vdd 1 0 5
vin 2 0 dc 1.5 ac 1
m1 3 2 0 0 nm1 l=2u w=20u nrd=2 nrs=1
rl1 1 3 10k
c12 3 6 1u
rg2 6 7 1meg
vb2 7 0 dc 1.2
m2 4 6 0 0 nm2 l=3u w=30u nrd=1.5 nrs=1.5
rl2 1 4 10k
c23 4 8 1u
rg3 8 9 1meg
vb3 9 0 dc 1.1
m3 5 8 0 0 nm3 l=2u w=10u nrd=1 nrs=2
rl3 1 5 20k
c34 5 10 1u
rg4 10 11 1meg
vb4 11 0 dc 3
m4 12 10 0 0 nm1n3 l=2u w=10u
rl4 1 12 6k
c45 12 13 1u
rg5 13 14 1meg
vb5 14 0 dc -0.8
j1 15 13 0 jn3
rl5 1 15 1.5k
c56 15 16 1u
rg6 16 17 1meg
vb6 17 0 dc 0
j2 18 16 0 jn3
rl6 1 18 20k
.model nm1 nmos level=1 vto=0.8 kp=50u lambda=0.02 rsh=20 ld=0.2u
+ kf=1e-26 af=1.2 nlev=0
.model nm2 nmos level=2 vto=0.7 tox=40n nsub=1e16 uo=600 lambda=0.02
+ rsh=15 ld=0.1u kf=2e-26 af=1 nlev=1
.model nm3 nmos level=3 vto=0.7 tox=30n nsub=1e16 uo=500 theta=0.1
+ rsh=10 rd=5 ld=0.1u kf=5e-27 af=0.8 nlev=3 gdsnoi=1.5
.model nm1n3 nmos level=1 vto=0.8 kp=50u tox=20n lambda=0.02 rd=10 rs=10
+ kf=1e-26 af=1.1 nlev=3 gdsnoi=0.8
.model jn3 njf vto=-2 beta=1.3e-3 lambda=0.01 rd=20 rs=15 kf=1e-17 af=1.1
+ nlev=3 gdsnoi=1.2
.noise v(18) vin dec 10 10 100meg 1
.end
Noise Spectral Density Curveslog f
1 nV/√Hz10 nV/√Hz100 nV/√Hz1 µV/√Hz10 µV/√Hz100 µV/√Hz10 Hz1 kHz100 kHz10 MHzonoise_spectruminoise_spectrum
onoise_spectruminoise_spectrum(+63 more vectors)
Integrated Noise
vectorvalue
v(onoise_total_m1_rd)149.5 nV
v(inoise_total_m1_rd)53.783 nV
v(onoise_total_m1_rs)16.3 µV
v(inoise_total_m1_rs)5.8642 µV
v(onoise_total_m1_id)137.14 µV
v(inoise_total_m1_id)49.337 µV
v(onoise_total_m1_1overf)456.43 µV
v(inoise_total_m1_1overf)154.62 µV
v(onoise_total_m1)476.86 µV
v(inoise_total_m1)162.4 µV
v(onoise_total_rl1_thermal)78.642 µV
v(inoise_total_rl1_thermal)28.292 µV
v(onoise_total_rl1_1overf)0 V
v(inoise_total_rl1_1overf)0 V
v(onoise_total_rl1)78.642 µV
v(inoise_total_rl1)28.292 µV
v(onoise_total_rg2_thermal)7.8642 µV
v(inoise_total_rg2_thermal)2.8292 µV
v(onoise_total_rg2_1overf)0 V
v(inoise_total_rg2_1overf)0 V
v(onoise_total_rg2)7.8642 µV
v(inoise_total_rg2)2.8292 µV
v(onoise_total_m2_rd)21.299 nV
v(inoise_total_m2_rd)7.6732 nV
v(onoise_total_m2_rs)5.2934 µV
v(inoise_total_m2_rs)1.9045 µV
v(onoise_total_m2_id)45.255 µV
v(inoise_total_m2_id)16.304 µV
v(onoise_total_m2_1overf)46.822 µV
v(inoise_total_m2_1overf)15.865 µV
v(onoise_total_m2)65.333 µV
v(inoise_total_m2)22.828 µV
v(onoise_total_rl2_thermal)37.321 µV
v(inoise_total_rl2_thermal)13.445 µV
v(onoise_total_rl2_1overf)0 V
v(inoise_total_rl2_1overf)0 V
v(onoise_total_rl2)37.321 µV
v(inoise_total_rl2)13.445 µV
v(onoise_total_rg3_thermal)3.7321 µV
v(inoise_total_rg3_thermal)1.3445 µV
v(onoise_total_rg3_1overf)0 V
v(inoise_total_rg3_1overf)0 V
v(onoise_total_rg3)3.7321 µV
v(inoise_total_rg3)1.3445 µV
v(onoise_total_m3_rd)4.6715 nV
v(inoise_total_m3_rd)1.6832 nV
v(onoise_total_m3_rs)2.1948 µV
v(inoise_total_m3_rs)790.7 nV
v(onoise_total_m3_id)33.848 µV
v(inoise_total_m3_id)12.196 µV
v(onoise_total_m3_1overf)2.0737 µV
v(inoise_total_m3_1overf)711.88 nV
v(onoise_total_m3)33.982 µV
v(inoise_total_m3)12.242 µV
v(onoise_total_rl3_thermal)21.251 µV
v(inoise_total_rl3_thermal)7.6569 µV
v(onoise_total_rl3_1overf)0 V
v(inoise_total_rl3_1overf)0 V
v(onoise_total_rl3)21.251 µV
v(inoise_total_rl3)7.6569 µV
v(onoise_total_rg4_thermal)3.0054 µV
v(inoise_total_rg4_thermal)1.0828 µV
v(onoise_total_rg4_1overf)0 V
v(inoise_total_rg4_1overf)0 V
v(onoise_total_rg4)3.0054 µV
v(inoise_total_rg4)1.0828 µV
v(onoise_total_m4_rd)223.58 nV
v(inoise_total_m4_rd)81.077 nV
v(onoise_total_m4_rs)704.47 nV
v(inoise_total_m4_rs)253.96 nV
v(onoise_total_m4_id)6.9299 µV
v(inoise_total_m4_id)2.5027 µV
v(onoise_total_m4_1overf)170.37 nV
v(inoise_total_m4_1overf)57.526 nV
v(onoise_total_m4)6.9713 µV
v(inoise_total_m4)2.5175 µV
v(onoise_total_rl4_thermal)5.1097 µV
v(inoise_total_rl4_thermal)1.8453 µV
v(onoise_total_rl4_1overf)0 V
v(inoise_total_rl4_1overf)0 V
v(onoise_total_rl4)5.1097 µV
v(inoise_total_rl4)1.8453 µV
v(onoise_total_rg5_thermal)395.79 nV
v(inoise_total_rg5_thermal)142.94 nV
v(onoise_total_rg5_1overf)0 V
v(inoise_total_rg5_1overf)0 V
v(onoise_total_rg5)395.79 nV
v(inoise_total_rg5)142.94 nV
v(onoise_total_j1_rd)3.5065 nV
v(inoise_total_j1_rd)1.2687 nV
v(onoise_total_j1_rs)532.35 nV
v(inoise_total_j1_rs)192.61 nV
v(onoise_total_j1_id)1.5318 µV
v(inoise_total_j1_id)554.23 nV
v(onoise_total_j1_1overf)13.488 nV
v(inoise_total_j1_1overf)4.5738 nV
v(onoise_total_j1)1.6217 µV
v(inoise_total_j1)586.77 nV
v(onoise_total_rl5_thermal)1.1862 µV
v(inoise_total_rl5_thermal)429.19 nV
v(onoise_total_rl5_1overf)0 V
v(inoise_total_rl5_1overf)0 V
v(onoise_total_rl5)1.1862 µV
v(inoise_total_rl5)429.19 nV
v(onoise_total_rg6_thermal)45.942 nV
v(inoise_total_rg6_thermal)16.623 nV
v(onoise_total_rg6_1overf)0 V
v(inoise_total_rg6_1overf)0 V
v(onoise_total_rg6)45.942 nV
v(inoise_total_rg6)16.623 nV
v(onoise_total_j2_rd)5.6915 µV
v(inoise_total_j2_rd)2.0593 µV
v(onoise_total_j2_rs)5.0509 µV
v(inoise_total_j2_rs)1.8275 µV
v(onoise_total_j2_id)13.924 µV
v(inoise_total_j2_id)5.0378 µV
v(onoise_total_j2_1overf)25.69 nV
v(inoise_total_j2_1overf)8.7114 nV
v(onoise_total_j2)15.867 µV
v(inoise_total_j2)5.7411 µV
v(onoise_total_rl6_thermal)2.0933 µV
v(inoise_total_rl6_thermal)757.38 nV
v(onoise_total_rl6_1overf)0 V
v(inoise_total_rl6_1overf)0 V
v(onoise_total_rl6)2.0933 µV
v(inoise_total_rl6)757.38 nV
v(onoise_total)491.19 µV
v(inoise_total)167.75 µV

Instance temperature in the thermal noise generators

corpus/regress/noisetemp.cir.noise#
noisetemp.cir
Instance temperature in the thermal noise generators
* Coverage: ngspice-47's NevalSrcInstanceTemp - the resistive and
* channel thermal generators of the BJT (rc/rb/re), diode (rs), JFET
* (rd/rs/id) and MOS1/2/3 (rd/rs/id) use the instance TEMP= when the
* card gives one (the 3f5's NevalSrc always used the circuit
* temperature). Every device below sits at its own temperature and
* drives the shared output node; one MOS2 stays at the circuit
* temperature as the control. The instance temperature also moves
* the operating point, which the density vectors check as well.
vcc 9 0 10
vin b1 bb dc 0 ac 1
vbb bb 0 dc 0.68
rl 9 out 2k
q1 out b1 0 qn temp=100
j1 out g1 s1 jn temp=80
vg1 g1 0 dc 0
rs1 s1 0 1k
m1 out g2 0 0 nm1 l=4u w=20u nrd=2 nrs=2 temp=60
vg2 g2 0 dc 1.1
m2 out g3 0 0 nm2 l=4u w=10u nrd=2 nrs=2 temp=-20
m3 out g3 0 0 nm3 l=4u w=10u nrd=2 nrs=2 temp=45
m4 out g3 0 0 nm2 l=4u w=10u nrd=2 nrs=2
vg3 g3 0 dc 1.0
d1 out dx dm temp=120
rdx dx 0 20k
.model qn npn is=1e-16 bf=120 rb=200 rc=20 re=3 vaf=60
.model jn njf vto=-2 beta=0.4e-3 lambda=0.02 rd=30 rs=20
.model nm1 nmos level=1 vto=0.8 kp=50u lambda=0.02 rsh=40
.model nm2 nmos level=2 vto=0.7 tox=40n nsub=1e16 uo=600 lambda=0.02 rsh=30
.model nm3 nmos level=3 vto=0.7 tox=30n nsub=1e16 uo=500 theta=0.1 rsh=20
.model dm d is=1e-14 rs=500 n=1.1
.noise v(out) vin dec 5 1k 10meg 1
.end
Noise Spectral Density Curveslog f
0 V/√Hz20 nV/√Hz40 nV/√Hz60 nV/√Hz80 nV/√Hz100 nV/√Hz120 nV/√Hz1 kHz10 kHz100 kHz1 MHz10 MHzonoise_spectruminoise_spectrum
onoise_spectruminoise_spectrum(+48 more vectors)
Integrated Noise
vectorvalue
v(onoise_total_rl_thermal)15.929 µV
v(inoise_total_rl_thermal)287.88 nV
v(onoise_total_rl_1overf)0 V
v(inoise_total_rl_1overf)0 V
v(onoise_total_rl)15.929 µV
v(inoise_total_rl)287.88 nV
v(onoise_total_q1_rc)58.861 nV
v(inoise_total_q1_rc)1.0638 nV
v(onoise_total_q1_rb)355.2 µV
v(inoise_total_q1_rb)6.4195 µV
v(onoise_total_q1_re)43.525 µV
v(inoise_total_q1_re)786.64 nV
v(onoise_total_q1_ic)97.729 µV
v(inoise_total_q1_ic)1.7663 µV
v(onoise_total_q1_ib)60.843 µV
v(inoise_total_q1_ib)1.0996 µV
v(onoise_total_q1_1overf)0 V
v(inoise_total_q1_1overf)0 V
v(onoise_total_q1)375.91 µV
v(inoise_total_q1)6.794 µV
v(onoise_total_j1_rd)25.487 nV
v(inoise_total_j1_rd)460.63 pV
v(onoise_total_j1_rs)1.8148 µV
v(inoise_total_j1_rs)32.799 nV
v(onoise_total_j1_id)9.7934 µV
v(inoise_total_j1_id)177 nV
v(onoise_total_j1_1overf)0 V
v(inoise_total_j1_1overf)0 V
v(onoise_total_j1)9.9602 µV
v(inoise_total_j1)180.01 nV
v(onoise_total_rs1_thermal)11.83 µV
v(inoise_total_rs1_thermal)213.81 nV
v(onoise_total_rs1_1overf)0 V
v(inoise_total_rs1_1overf)0 V
v(onoise_total_rs1)11.83 µV
v(inoise_total_rs1)213.81 nV
v(onoise_total_m1_rd)1.5696 nV
v(inoise_total_m1_rd)28.367 pV
v(onoise_total_m1_rs)528.03 nV
v(inoise_total_m1_rs)9.5432 nV
v(onoise_total_m1_id)5.4096 µV
v(inoise_total_m1_id)97.768 nV
v(onoise_total_m1_1overf)0 V
v(inoise_total_m1_1overf)0 V
v(onoise_total_m1)5.4353 µV
v(inoise_total_m1)98.233 nV
v(onoise_total_m2_rd)404.9 pV
v(inoise_total_m2_rd)7.3178 pV
v(onoise_total_m2_rs)216.46 nV
v(inoise_total_m2_rs)3.9122 nV
v(onoise_total_m2_id)2.9885 µV
v(inoise_total_m2_id)54.012 nV
v(onoise_total_m2_1overf)0 V
v(inoise_total_m2_1overf)0 V
v(onoise_total_m2)2.9963 µV
v(inoise_total_m2)54.153 nV
v(onoise_total_m3_rd)285.33 pV
v(inoise_total_m3_rd)5.1569 pV
v(onoise_total_m3_rs)233.54 nV
v(inoise_total_m3_rs)4.2207 nV
v(onoise_total_m3_id)3.733 µV
v(inoise_total_m3_id)67.468 nV
v(onoise_total_m3_1overf)0 V
v(inoise_total_m3_1overf)0 V
v(onoise_total_m3)3.7403 µV
v(inoise_total_m3)67.6 nV
v(onoise_total_m4_rd)588.36 pV
v(inoise_total_m4_rd)10.633 pV
v(onoise_total_m4_rs)241.25 nV
v(inoise_total_m4_rs)4.3601 nV
v(onoise_total_m4_id)3.2741 µV
v(inoise_total_m4_id)59.173 nV
v(onoise_total_m4_1overf)0 V
v(inoise_total_m4_1overf)0 V
v(onoise_total_m4)3.2829 µV
v(inoise_total_m4)59.333 nV
v(onoise_total_d1_rs)882.86 nV
v(inoise_total_d1_rs)15.956 nV
v(onoise_total_d1_id)357.59 nV
v(inoise_total_d1_id)6.4627 nV
v(onoise_total_d1_1overf)0 V
v(inoise_total_d1_1overf)0 V
v(onoise_total_d1_rsw)0 V
v(inoise_total_d1_rsw)0 V
v(onoise_total_d1_idsw)0 V
v(inoise_total_d1_idsw)0 V
v(onoise_total_d1_1overfsw)0 V
v(inoise_total_d1_1overfsw)0 V
v(onoise_total_d1)952.52 nV
v(inoise_total_d1)17.215 nV
v(onoise_total_rdx_thermal)4.8788 µV
v(inoise_total_rdx_thermal)88.175 nV
v(onoise_total_rdx_1overf)0 V
v(inoise_total_rdx_1overf)0 V
v(onoise_total_rdx)4.8788 µV
v(inoise_total_rdx)88.175 nV
v(onoise_total)376.69 µV
v(inoise_total)6.8079 µV

off bjt behind an unscaled pulse source - NEWCONV trap regression

corpus/regress/offbjt.cir.tran#
offbjt.cir
off bjt behind an unscaled pulse source - NEWCONV trap regression
* An `off` BJT whose base is driven by a transient-function source
* (source stepping cannot scale it to zero) used to pin the device
* at zero bias in INITFIX forever: with gmin inside gbe/gbc the
* BJTconvTest current never settled (gmu = gmin/BR) and every CKTop
* strategy looped. Fixed by the ngspice junction form (gmin on the
* leakage branches), dynamic gmin stepping, and the ngspice TRANOP
* source scaling that lets source stepping zero this pulse.
vin b 0 pulse(-1.6 -1.2 10ns 400ns 400ns 100ns 10000ns)
vc c 0 2
re e 0 260
q1 c b e qstd off
.model qstd npn(is=1.0e-16 bf=50 br=0.1 rb=50 rc=10 va=50)
.tran 50ns 1us
.end
Transient Analysis
-2 V-1.5 V-1 V-500 mV0 V0 s200 ns400 ns600 ns800 ns1 µsv(b)v(e)
v(b)v(e)(+3 more vectors)

floating off-diode chain - CKTop fallback: true gmin stepping

corpus/regress/opfall_gmin.cir.op#
opfall_gmin.cir
floating off-diode chain - CKTop fallback: true gmin stepping
* Nodes 2 and 3 have no DC path but the junctions' own gmin: they sit
* at the 1000 V rail. The diagonal gmin of the dynamic stepping pulls
* them to ground instead, reverse-biasing d1 past its BV=1000 into
* breakdown, and with both diodes `off` the INITFIX pass never settles
* (direct Newton fails too). ngspice-47 (set ngdebug): dynamic gmin
* fails at every factor, the true gmin stepping (new_gmin, cktop.c,
* stepping the devices' CKTgmin from 1e-3) completes.
v1 1 0 1000
r1 1 0 1k
d1 1 2 dhv off
d2 2 3 dlo off
.model dlo d(is=2.63e-17 n=1.02 rs=0.0163 bv=50)
.model dhv d(is=5.37e-11 n=1.05 rs=0.085 bv=1000)
.op
.end
Operating Point
vectorvalue
v(1)1 kV
i(v1)-1000 mA
v(2)1 kV
v(3)1 kV

off diode reverse-biased by a dc source - CKTop fallback: source stepping

corpus/regress/opfall_src.cir.op#
opfall_src.cir
off diode reverse-biased by a dc source - CKTop fallback: source stepping
* An `off` junction is held at vd = 0 through INITFIX (dioload.c),
* where DIOconvTest compares cd = 0 with cdhat = gd*(vd_nodes - 0):
* with the source at full value the node sits at 10 V and the test
* fails at every iteration, so Newton never leaves INITFIX. Diagonal
* gmin (dynamic) and device gmin (true) stepping change gd, not the
* bias, and fail the same way. Gillespie source stepping (srcsteps=1,
* the ngspice-47 default) first solves with the source at zero, where
* the held vd = 0 is the solution, leaves INITFIX, and ramps srcFact
* 0.1% -> 100% in 17 steps (set ngdebug in ngspice-47 shows the same
* sequence).
v1 1 0 10
r1 1 2 1k
d1 0 2 dmod off
.model dmod d(is=1e-14 n=1)
.op
.end
Operating Point
vectorvalue
v(1)10 V
i(v1)-10.01 pA
v(2)10 V

off bjt behind an unscaled pulse source - CKTop fallback: transient op

corpus/regress/opfall_tran.cir.op#
opfall_tran.cir
off bjt behind an unscaled pulse source - CKTop fallback: transient op
* `.op` of the offbjt.cir circuit. The pulse has no DC value, so in
* MODEDCOP the source takes its t=0 transient value unscaled by
* srcFact (vsrcload.c: only a `dc` value is scaled outside TRANOP):
* source stepping cannot zero it, and the `off` BJT in INITFIX never
* passes BJTconvTest. In ngspice-47 dynamic gmin, true gmin and
* Gillespie source stepping all fail (set ngdebug shows each), and
* only the default transient operating point (OPtran, optran.c,
* `optran 1 1 1 100n 10u 0`) closes it.
vin b 0 pulse(-1.6 -1.2 10ns 400ns 400ns 100ns 10000ns)
vc c 0 1
re e 0 260
q1 c b e qstd off
.model qstd npn(is=1.0e-16 bf=50 br=0.1 rb=50 rc=10 va=50)
.op
.end
Operating Point
vectorvalue
v(b)-1.6 V
i(vin)4.201 pA
v(c)1 V
i(vc)-2.601 pA
v(e)-416 pV

BJT pole-zero: common-emitter stage with series resistances

corpus/regress/pz_bjt.cir.pz#
pz_bjt.cir
BJT pole-zero: common-emitter stage with series resistances
* Coverage: .pz through bjtpzld.c. A resistively loaded NPN
* common-emitter stage driven from a source resistance, with RB/RC/RE
* (the series conductances stamped as siemens: the 3f5's bjtpzld.c
* stamps RC*area and RE*area instead, see KNOWN_DIFFS), the
* depletion/diffusion capacitances CJE+TF, CJC split by XCJC (cqbx on
* the external base), and CJS on the substrate. The Miller feedback
* through CJC gives a right-half-plane zero.
vcc 1 0 dc 12
vin 2 0 dc 0.7
rsig 2 3 1k
q1 4 3 5 0 qn
re1 5 0 10
rl 1 4 4.7k
cl 4 0 0.5p
.pz 3 0 4 0 vol pz
.model qn npn is=1e-15 bf=120 br=2 vaf=60 rb=150 rbm=40 irb=1m
+ rc=25 re=4 cje=1.2p vje=0.8 mje=0.4 cjc=0.6p vjc=0.7 mjc=0.35
+ xcjc=0.6 tf=0.25n tr=8n cjs=0.3p
.end
Pole-Zero Analysis
realimag
pole 1-791.19G0
pole 2-149.044G0
pole 3-1.5754G0
pole 4-158.842M0
zero 1-630.169G0
zero 2-13.861G0
zero 310.9898G0

BSIM1 pole-zero: common-source stage and a reversed follower

corpus/regress/pz_bsim1.cir.pz#
pz_bsim1.cir
BSIM1 pole-zero: common-source stage and a reversed follower
* Coverage: .pz through b1pzld.c on the b1overlap card (DL/DW != 0,
* so the per-instance b1temp.c overlaps — effective W, drawn L — are
* the ones the small-signal loads read; XPART=1 charge partition).
* m1 is a resistively loaded common-source stage driven from a source
* resistance; m2 follows m1's drain with its drain and source pins
* swapped on the card (vds < 0: the reversed-mode xrev stamps).
vdd 1 0 dc 5
vin 2 0 dc 1.5
rsig 2 3 10k
m1 4 3 0 0 nmos l=4u w=20u ad=40p as=40p pd=44u ps=44u
rl 1 4 20k
m2 5 4 1 0 nmos l=4u w=40u ad=80p as=80p pd=84u ps=84u
rf 5 0 10k
.pz 3 0 5 0 vol pz
.model nmos nmos
+ level=4 tox=3.00000e-2 vdd=5 temp=27
+ dl=7.97991e-1 dw=4.77402e-1
+ vfb=-1.0087 phi=7.96434e-1 k1=1.31191 k2=1.46640e-1
+ eta=-1.0027e-3 muz=5.34334e+2 u0=4.38497e-2 u1=-5.7332e-2
+ x2e=-7.6911e-4 x3e=7.86777e-4 x2mz=8.25434
+ mus=5.40612e+2 x2ms=-1.2992e+1 x3ms=-9.4035
+ x2u0=1.06821e-3 x2u1=-1.9209e-2 x3u1=7.76925e-3
+ lvfb=-2.1402e-1 wvfb=3.44354e-1 lk1=3.23395e-1 wk1=-5.7698e-1
+ lk2=1.68585e-1 wk2=-1.8796e-1 leta=-9.4847e-3 weta=1.47316e-2
+ lu0=6.38105e-2 wu0=-6.1053e-2 lu1=1.01174 wu1=1.62706e-2
+ lx2e=9.62411e-3 wx2e=-3.7951e-3 lx3e=7.35448e-4 wx3e=-1.7796e-3
+ lx2mz=-2.4197e+1 wx2mz=1.95696e+1 lmus=6.21401e+2 wmus=-1.9190e+2
+ lx2ms=-6.4900e+1 wx2ms=4.29043e+1 lx3ms=1.18239e+2 wx3ms=-2.9747e+1
+ lx2u0=-8.0958e-3 wx2u0=4.03379e-3 lx2u1=-7.4573e-2 wx2u1=1.47520e-2
+ lx3u1=-1.0940e-1 wx3u1=-8.3353e-3
+ n0=1.55 nb=0.09 nd=0.0
+ cgdo=2.70000e-10 cgso=2.70000e-10 cgbo=1.40000e-10 xpart=1.0
+ rsh=35.0 cj=2.75e-4 cjsw=1.90e-10 js=1.0e-8
+ pb=0.7 pbsw=0.8 mj=0.5 mjsw=0.33 wdf=0.0
.end
Pole-Zero Analysis
realimag
pole 1-2.49969T0
pole 2-1.30923T0
pole 3-263.256G0
pole 4-12.5577G0
pole 5-716.447M0
zero 1-1.07446T0
zero 2-287.804G0
zero 3-41.0059G0
zero 433.7978G0

BSIM2 pole-zero: common-source stage and a reversed follower

corpus/regress/pz_bsim2.cir.pz#
pz_bsim2.cir
BSIM2 pole-zero: common-source stage and a reversed follower
* Coverage: .pz through b2pzld.c on the bsim2tst card (overlaps from
* pParam, XPART=0 charge partition, AD/AS/PD/PS junctions). m1 is a
* resistively loaded common-source stage driven from a source
* resistance; m2 follows m1's drain with its drain and source pins
* swapped on the card (vds < 0: the reversed-mode xrev stamps).
vdd 1 0 dc 5
vin 2 0 dc 1.5
rsig 2 3 10k
m1 4 3 0 0 nmos l=10u w=50u ad=100p as=100p pd=40u ps=40u
rl 1 4 20k
m2 5 4 1 0 nmos l=10u w=100u ad=200p as=200p pd=80u ps=80u
rf 5 0 10k
.pz 3 0 5 0 vol pz
.model nmos nmos level=5 
+ vfb =  -0.7919 lvfb =  -0.0266 wvfb =   0.0000 
+ phi =   0.8039  lphi =   0.0042  wphi =   0.0000 
+ k1  =   0.7286  lk1  =   0.0309  wk1  =   0.0000 
+ k2  =  -0.0506  lk2  =   0.0786  wk2  =   0.0000 
+ mu0 = 453.2926  dl =   0.1553  dw =   0.0000 
+ mu0b =  -5.4925  lmu0b =  -1.9192  wmu0b =   0.0000 
+ mus0 = 781.7117  lmus0 =  25.2769  wmus0 =   0.0000 
+ musb =  25.5724  lmusb = -10.0060  wmusb =   0.0000 
+ mu20 =   0.9390  lmu20 =  -0.0840  wmu20 =   0.0000 
+ mu2b =   0.0753  lmu2b =  -0.0148  wmu2b =   0.0000 
+ mu2g =   0.1804  lmu2g =   0.0181  wmu2g =   0.0000 
+ mu30 =  44.9689  lmu30 =  -0.0933  wmu30 =   0.0000 
+ mu3b =   0.5871  lmu3b =   1.0793  wmu3b =   0.0000 
+ mu3g = -11.6723  lmu3g =   0.6804  wmu3g =   0.0000 
+ mu40 =   0.2682  lmu40 =   2.3969  wmu40 =   0.0000 
+ mu4b =  -0.3179  lmu4b =   0.1264  wmu4b =   0.0000 
+ mu4g =  -0.2654  lmu4g =  -0.5702  wmu4g =   0.0000 
+ ua0 =   0.0441  lua0 =   0.2283  wua0 =   0.0000 
+ uab =  -0.0045  luab =  -0.0105  wuab =   0.0000 
+ ub0 =   0.0125  lub0 =  -0.0051  wub0 =   0.0000 
+ ubb =  -0.0015  lubb =   0.0010  wubb =   0.0000 
+ u10 =   0.1262  lu10 =   0.5563  wu10 =   0.0000 
+ u1d =  -0.2967  lu1d =  -0.0062  wu1d =   0.0000 
+ u1b =   0.0960  lu1b =  -0.0345  wu1b =   0.0000 
+ eta0 =  -0.0373  leta0 =   0.0271  weta0 =   0.0000 
+ etab =   0.0004  letab =  -0.0041  wetab =   0.0000 
+ n0 =   0.8032  ln0 =   0.1734  wn0 =   0.0000 
+ nd =   0.0105  lnd =  -0.0091  wnd =   0.0000 
+ nb =   0.5978  lnb =  -0.1638  wnb =   0.0000 
+ vof0 =   1.4977  lvof0 =  -0.1766  wvof0 =   0.0000 
+ vofd =   0.1795  lvofd =  -0.1247  wvofd =   0.0000 
+ vofb =   0.8368  lvofb =  -0.3432  wvofb =   0.0000 
+ ai0 =  32.0150  lai0 =   8.2816  wai0 =   0.0000 
+ aib = -19.5396  laib =   4.9347  waib =   0.0000 
+ bi0 =  37.6044  lbi0 =  -1.8713  wbi0 =   0.0000 
+ bib =  -2.5109  lbib =   0.7903  wbib =   0.0000 
+ vghigh =   0.2342  lvghigh =  -0.0007  wvghigh =   0.0000 
+ vglow =  -0.1023  lvglow =   0.0038  wvglow =   0.0000 
+ tox = 0.0150 temp = 27 vdd = 5.0 vgg = 5.0 vbb =  -3.0 
+ cgdo = 1.0e-10 cgso = 1.0e-10 cgbo = 2.5e-11 
+ xpart = 0  
+ rsh = 0 cj = 0.0002 cjsw = 1.0e-10 
+ js = 5e-5 pb = 0.7 pbsw = 0.8 
+ mj = 0.5 mjsw = 0.33 wdf = 0 
+ dell = 0 
.end
Pole-Zero Analysis
realimag
pole 1-9.42006G0
pole 2-53.7169M0
zero 1-39.1745G0
zero 21.28041G0

JFET pole-zero: common-source stage with series resistances

corpus/regress/pz_jfet.cir.pz#
pz_jfet.cir
JFET pole-zero: common-source stage with series resistances
* Coverage: .pz through jfetpzld.c. A resistively loaded N-channel
* JFET common-source stage driven from a source resistance, with
* CGS/CGD gate junction capacitances and RD/RS series resistances
* (stamped as conductances times AREA, like ngspice: the 3f5's
* jfetpzld.c stamps RD*area and RS*area instead, see KNOWN_DIFFS).
vdd 1 0 dc 12
vin 2 0 dc -0.5
rsig 2 3 10k
j1 4 3 0 jn area=1.5
rl 1 4 2k
cl 4 0 1p
.pz 3 0 4 0 vol pz
.model jn njf vto=-2 beta=1e-3 lambda=0.01 rd=50 rs=30 cgs=2p cgd=1p
+ pb=0.8 is=1e-14
.end
Pole-Zero Analysis
realimag
pole 1-88.0292G0
pole 2-23.7592G0
pole 3-347.29M0
zero 1-30.1316G0
zero 26.31342G0

MESFET pole-zero: common-source stage with series resistances

corpus/regress/pz_mes.cir.pz#
pz_mes.cir
MESFET pole-zero: common-source stage with series resistances
* Coverage: .pz through mespzld.c. A resistively loaded Statz MESFET
* common-source stage driven from a source resistance, with CGS/CGD
* and RD/RS series conductances (AREA given by keyword: ngspice drops
* the positional one, see KNOWN_DIFFS).
vdd 1 0 dc 5
vin 2 0 dc -0.5
rsig 2 3 1k
z1 4 3 0 mz area=1.5
rl 1 4 1k
cl 4 0 0.2p
.pz 3 0 4 0 vol pz
.model mz nmf vto=-1.5 beta=2.5e-3 b=0.3 alpha=2 lambda=0.05
+ rd=20 rs=15 cgs=0.5p cgd=0.1p pb=0.8
.end
Pole-Zero Analysis
realimag
pole 1-855.597G0
pole 2-182.632G0
pole 3-3.15871G0
zero 1-211.987G0
zero 228.4978G0

MOS1 pole-zero: common-source stage and a reversed follower

corpus/regress/pz_mos1.cir.pz#
pz_mos1.cir
MOS1 pole-zero: common-source stage and a reversed follower
* Coverage: .pz through mos1pzld.c. m1 is a resistively loaded
* common-source stage driven from a source resistance (Meyer gate
* capacitances, CGSO/CGDO/CGBO overlaps, AD/AS bottom and PD/PS
* sidewall junctions, RD/RS series conductances); m2 follows m1's
* drain with its drain and source pins swapped on the card (vds < 0,
* so the reversed-mode xrev stamps carry the transconductance).
vdd 1 0 dc 5
vin 2 0 dc 1.2
rsig 2 3 10k
m1 4 3 0 0 n1 l=2u w=20u ad=40p as=40p pd=44u ps=44u
rl 1 4 20k
m2 5 4 1 0 n1 l=2u w=40u ad=80p as=80p pd=84u ps=84u
rf 5 0 10k
.pz 3 0 5 0 vol pz
.model n1 nmos level=1 vto=0.7 kp=60u gamma=0.4 phi=0.65 lambda=0.03
+ tox=2e-8 ld=0.1u rd=40 rs=30 cj=3e-4 mj=0.5 cjsw=2.5e-10 mjsw=0.33
+ cgso=2e-10 cgdo=2e-10 cgbo=1e-10
.end
Pole-Zero Analysis
realimag
pole 1-2.57081T0
pole 2-1.2257T0
pole 3-493.945G0
pole 4-7.29264G0
pole 5-1.20643G0
zero 1-1.19739T0
zero 2-558.018G0
zero 3-7.79538G0
zero 479.202G0

MOS2 pole-zero: common-source stage and a reversed follower

corpus/regress/pz_mos2.cir.pz#
pz_mos2.cir
MOS2 pole-zero: common-source stage and a reversed follower
* Coverage: .pz through mos2pzld.c. m1 is a resistively loaded
* common-source stage driven from a source resistance (Meyer gate
* capacitances, CGSO/CGDO/CGBO overlaps, AD/AS bottom and PD/PS
* sidewall junctions, RD/RS series conductances); m2 follows m1's
* drain with its drain and source pins swapped on the card (vds < 0,
* so the reversed-mode xrev stamps carry the transconductance).
vdd 1 0 dc 5
vin 2 0 dc 1.2
rsig 2 3 10k
m1 4 3 0 0 n1 l=2u w=20u ad=40p as=40p pd=44u ps=44u
rl 1 4 20k
m2 5 4 1 0 n1 l=2u w=40u ad=80p as=80p pd=84u ps=84u
rf 5 0 10k
.pz 3 0 5 0 vol pz
.model n1 nmos level=2 vto=0.7 kp=60u gamma=0.4 phi=0.65 lambda=0.03 nsub=2e16 u0=600 ucrit=1e4 uexp=0.1 xj=0.3u
+ tox=2e-8 ld=0.1u rd=40 rs=30 cj=3e-4 mj=0.5 cjsw=2.5e-10 mjsw=0.33
+ cgso=2e-10 cgdo=2e-10 cgbo=1e-10
.end
Pole-Zero Analysis
realimag
pole 1-2.63436T0
pole 2-1.2281T0
pole 3-491.742G0
pole 4-6.27109G0
pole 5-1.26975G0
zero 1-1.19753T0
zero 2-536.778G0
zero 3-6.80174G0
zero 458.9619G0

MOS3 pole-zero: common-source stage and a reversed follower

corpus/regress/pz_mos3.cir.pz#
pz_mos3.cir
MOS3 pole-zero: common-source stage and a reversed follower
* Coverage: .pz through mos3pzld.c, on the mos3_inv n3 card (VMAX,
* KAPPA, THETA, ETA, NFS; CJ/CJSW junctions through RSH-free AD/AS).
* m1 is a resistively loaded common-source stage driven from a source
* resistance; m2 follows m1's drain with its drain and source pins
* swapped on the card (vds < 0: the reversed-mode xrev stamps).
vdd 1 0 dc 3.3
vin 2 0 dc 0.9
rsig 2 3 10k
m1 4 3 0 0 n3 l=1u w=10u ad=20p as=20p pd=24u ps=24u
rl 1 4 20k
m2 5 4 1 0 n3 l=1u w=20u ad=40p as=40p pd=44u ps=44u
rf 5 0 10k
.pz 3 0 5 0 vol pz
.model n3 nmos level=3 vto=0.6 nsub=4e16 tox=1.5e-8 xj=0.15u ld=0.05u u0=450
+ theta=0.06 eta=0.2 delta=0.6 vmax=1.6e5 kappa=0.4 nfs=6e11 rd=20 rs=15
+ cj=4e-4 mj=0.45 cjsw=3e-10 mjsw=0.3 cgso=2e-10 cgdo=2e-10 cgbo=1e-10
.end
Pole-Zero Analysis
realimag
pole 1-7.09554T0
pole 2-3.42902T0
pole 3-2.16719T0
pole 4-15.9229G0
pole 5-507.812M0
zero 1-3.40903T0
zero 2-2.28787T0
zero 315.1098G0
zero 4185.304G0

Switch pole-zero: S and W switches in an RC ladder

corpus/regress/pz_sw.cir.pz#
pz_sw.cir
Switch pole-zero: S and W switches in an RC ladder
* Coverage: .pz through swpzload.c/cswpzld.c, which stamp the
* conductance of the state the INITSMSIG load left in state0 (ngspice
* copies state1 there: zero after a bare operating point, so both
* switches show their ROFF here even though their controls are above
* threshold). s1 couples the input RC to the middle node, w1 (sensing
* the current of vsense) the middle node to the output RC.
vctl 10 0 dc 5
rctl 10 11 1k
vsense 11 0 dc 0
rsig 1 2 1k
c2 2 0 10p
s1 2 3 10 0 smod
c3 3 0 20p
r3 3 0 10k
w1 3 4 vsense wmod
c4 4 0 5p
r4 4 0 5k
vin 1 0 dc 0
.pz 2 0 4 0 vol pz
.model smod sw vt=2.5 vh=0.2 ron=100 roff=1meg
.model wmod csw it=2m ih=0.5m ron=50 roff=2meg
.end
Pole-Zero Analysis
realimag
pole 1-40.1001M0
pole 2-5.07493M0

Semiconductor resistors: R model geometry, TC1/TC2, TNOM and instance TEMP

corpus/regress/rmodel.cir.op#
rmodel.cir
Semiconductor resistors: R model geometry, TC1/TC2, TNOM and instance TEMP
* Coverage: no corpus deck has an R model. restemp.c (3f5): with no
* value, R = RSH*(L-NARROW)/(W-NARROW), W defaulting to DEFW (10u in the
* code; spice.txt documents 1u); then G = 1/(R*(1+TC1*dT+TC2*dT^2)),
* dT = TEMP - TNOM, TEMP from the instance TEMP= or .options temp.
* r1: geometry + DEFW + circuit temp (60 C) against TNOM=20 C.
* r2: explicit value on a model card (value wins, TC still applies).
* r3: instance temp=150 C. r4: plain resistor with temp= (default
* model: TC=0, so temp changes nothing). NARROW stays 0 and every
* model card has RSH: ngspice-47 changed the geometry formula to
* (L-2*SHORT)/(W-2*NARROW) and the no-RSH fallback from 1k to 1 mOhm
* (corpus/KNOWN_DIFFS.md; both pinned by unit tests instead).
.options temp=60
v1 1 0 dc 2
r1 1 2 rpoly l=40u
r2 2 3 750 rpoly
r3 3 4 rpoly l=12u w=3u temp=150
r4 4 0 470 temp=-40
v2 6 0 dc 1
r6 6 0 rhot l=25u w=5u
.model rpoly r rsh=50 defw=4u tc1=2.5e-3 tc2=1.2e-5 tnom=20
.model rhot r (rsh=200 tc1=-1.5e-3 tc2=4e-6)
.op
.end
Operating Point
vectorvalue
v(1)2 V
i(v1)-919.73 µA
v(2)1.4853 V
v(3)713.3 mV
v(4)432.27 mV
v(6)1 V
i(v2)-1.0473 mA

Resistor thermal noise at the instance temperature

corpus/regress/rnoisetemp.cir.noise#
rnoisetemp.cir
Resistor thermal noise at the instance temperature
* Coverage: ngspice-47's resnoise.c evaluates the thermal generator
* with NevalSrcInstanceTemp at CKTtemp + dtemp, dtemp = REStemp -
* CKTtemp when TEMP= is given, else RESdtemp - the resistor's own
* temperature (the 3f5's NevalSrc used CKTtemp for every resistor).
* rhot has TEMP=150, rcold DTEMP=-200 (73 K), rtc a TC model at
* DTEMP=60 (its conductance moves too, so the density sees both the
* temperature and the conductance), rref stays at the circuit
* temperature as the control. A bridge keeps every generator's gain
* to the output distinct, so each per-device vector pins its own T.
.options temp=40
vin in 0 dc 0 ac 1
rs in a 1k
rhot a out 2k temp=150
rcold a 0 3k dtemp=-200
rtc out 0 rtc 5k dtemp=60
rref out b 1.5k
cb b 0 1n
.model rtc r tc1=4e-3 tc2=1e-5
.noise v(out) vin dec 4 1k 10meg 1
.end
Noise Spectral Density Curveslog f
2 nV/√Hz4 nV/√Hz6 nV/√Hz8 nV/√Hz10 nV/√Hz12 nV/√Hz14 nV/√Hz16 nV/√Hz18 nV/√Hz1 kHz10 kHz100 kHz1 MHz10 MHzonoise_spectruminoise_spectrum
onoise_spectruminoise_spectrum(+15 more vectors)
Integrated Noise
vectorvalue
v(onoise_total_rs_thermal)3.0888 µV
v(inoise_total_rs_thermal)13.185 µV
v(onoise_total_rs_1overf)0 V
v(inoise_total_rs_1overf)0 V
v(onoise_total_rs)3.0888 µV
v(inoise_total_rs)13.185 µV
v(onoise_total_rhot_thermal)6.7704 µV
v(inoise_total_rhot_thermal)28.901 µV
v(onoise_total_rhot_1overf)0 V
v(inoise_total_rhot_1overf)0 V
v(onoise_total_rhot)6.7704 µV
v(inoise_total_rhot)28.901 µV
v(onoise_total_rcold_thermal)1.072 µV
v(inoise_total_rcold_thermal)4.5759 µV
v(onoise_total_rcold_1overf)0 V
v(inoise_total_rcold_1overf)0 V
v(onoise_total_rcold)1.072 µV
v(inoise_total_rcold)4.5759 µV
v(onoise_total_rtc_thermal)4.7669 µV
v(inoise_total_rtc_thermal)20.348 µV
v(onoise_total_rtc_1overf)0 V
v(inoise_total_rtc_1overf)0 V
v(onoise_total_rtc)4.7669 µV
v(inoise_total_rtc)20.348 µV
v(onoise_total_rref_thermal)9.0731 µV
v(inoise_total_rref_thermal)39.095 µV
v(onoise_total_rref_1overf)0 V
v(inoise_total_rref_1overf)0 V
v(onoise_total_rref)9.0731 µV
v(inoise_total_rref)39.095 µV
v(onoise_total)12.711 µV
v(inoise_total)54.521 µV

schmitt ckt - ecl compatible schmitt trigger (refined step)

corpus/regress/schmitt_fine.cir.tran#
schmitt_fine.cir
schmitt ckt - ecl compatible schmitt trigger (refined step)
* Converged companion of spice3f5/examples/schmitt.cir (an XFAIL: at the
* default step the regenerative edges ring with an engine-dependent
* phase). Same circuit, TMAX = 1 ns: both engines resolve the edges and
* agree at 0.004 of the ruler. Written for Dune; the deck is Berkeley's.
.width in=72
.opt acct list node lvlcod=2
.tran 10ns 1000ns 0 1ns
vin 1 0 pulse(-1.6 -1.2 10ns 400ns 400ns 100ns 10000ns)
vee 8 0 -5
rin 1 2 50
rc1 0 3 50
r1 3 5 185
r2 5 8 760
rc2 0 6 100
re 4 8 260
rth1 7 8 125
rth2 7 0 85
cload 7 0 5pf
q1 3 2 4 qstd off
q2 6 5 4 qstd
q3 0 6 7 qstd
q4 0 6 7 qstd
.model qstd npn(is=1.0e-16 bf=50 br=0.1 rb=50 rc=10 tf=0.12ns tr=5ns
+   cje=0.4pf pe=0.8 me=0.4 cjc=0.5pf pc=0.8 mc=0.333 ccs=1pf va=50)
.print tran v(1) v(3) v(5) v(6)
.plot tran v(3) v(5) v(6) v(1)
.end
Transient Analysisvectors from the deck’s .plot/.print
-2 V-1.5 V-1 V-500 mV0 V0 s200 ns400 ns600 ns800 ns1 µsv(3)v(5)v(6)v(1)
v(3)v(5)v(6)v(1)(+6 more vectors)
  • warning: .width without out= has no effect
  • warning: option lvlcod is an obsolete SPICE2 option; ignored

AC sensitivity: RLC ladder with coupled inductors and controlled sources

corpus/regress/sens_ac.cir.sens#
sens_ac.cir
AC sensitivity: RLC ladder with coupled inductors and controlled sources
* Coverage: no corpus deck has a .sens card. This pins sens_sens
* (ckt/cktsens.c, AC form) against ngspice-47: at each frequency the
* complex AC system is solved, then each parameter's DEVacLoad stamps
* are differenced and Y^-1 (dI - dY E) / delta is solved against the
* factored complex matrix. The filters keep every R/C/L/V/I/E/F/G/H
* vector, so the deck pins ngspice-47's AC walk of those tables
* (acmag/acphase, the AC-only capacitance and inductance, r_ac), and
* drop only the coupling kab: ngspice-47's AC sensitivity of a K
* coefficient is wrong (3.6e7 here, against -0.256+0.120j from a
* finite difference of two ngspice .ac runs, which Dune matches;
* corpus/KNOWN_DIFFS.md). One frequency on purpose: from the second
* frequency on, ngspice-47 also gets the VCCS/CCCS gains wrong (it
* redoes CKTsetup per frequency; see sens_acsweep.cir), and a
* nonlinear device would enter with gd = capd = 0 for the same reason.
vin 1 0 dc 1 ac 1 30
r1 1 2 1k
l1 2 3 10m
c1 3 0 100n
l2 4 0 5m
kab l1 l2 0.6
r4 4 0 200
i1 0 3 dc 0 ac 0.5m
e1 5 0 3 0 2
r5 5 6 1k
c2 6 0 47n
g1 0 6 4 0 1m
vs 6 7 0
r7 7 0 500
f1 0 8 vs 3
r8 8 9 1k
h1 9 0 vs 100
.sens v(8) r* c* l* v* ?1* ac lin 1 2k 2k
.end
Sensitivity Analysis
42 nonzero of 227 sensitivities shown; the other 185 are exactly 0.
vector2 kHz
v(c2)-1.3129e+7 − j8.6638e+6
v(c2_m)-6.1706e-1 − j4.0720e-1
v(c2_scale)-6.1706e-1 − j4.0720e-1
v(c1)-3.2458e+7 + j3.4628e+6
v(c1_m)-3.2458e+0 + j3.4628e-1
v(c1_scale)-3.2458e+0 + j3.4628e-1
v(f1_gain)8.6625e-1 − j8.7972e-1
v(h1_gain)8.6625e-4 − j8.7972e-4
v(l2)6.0826e+0 + j5.4984e+0
v(l2_m)-3.0413e-2 − j2.7492e-2
v(l2_scale)3.0413e-2 + j2.7492e-2
v(l1)7.3152e+0 − j3.2313e+1
v(l1_m)-7.3152e-2 + j3.2313e-1
v(l1_scale)7.3152e-2 − j3.2313e-1
v(i1_m)6.2963e-1 − j1.1822e+0
v(i1_acmag)1.2593e+3 − j2.3644e+3
v(i1_acphase)2.0634e-2 + j1.0989e-2
v(r8)2.5988e-3 − j2.6392e-3
v(r8_ac)2.5988e-3 − j2.6392e-3
v(r8_m)-2.5988e+0 + j2.6392e+0
v(r8_scale)2.5988e+0 − j2.6392e+0
v(r7)-2.6130e-3 + j1.2752e-3
v(r7_ac)-2.6130e-3 + j1.2752e-3
v(r7_m)1.3065e+0 − j6.3758e-1
v(r7_scale)-1.3065e+0 + j6.3758e-1
v(r5)-2.0782e-3 + j1.7487e-3
v(r5_ac)-2.0782e-3 + j1.7487e-3
v(r5_m)2.0782e+0 − j1.7488e+0
v(r5_scale)-2.0782e+0 + j1.7487e+0
v(r4)2.6072e-5 − j1.5206e-4
v(r4_ac)2.6072e-5 − j1.5206e-4
v(r4_m)-5.2144e-3 + j3.0411e-2
v(r4_scale)5.2144e-3 − j3.0411e-2
v(r1)-2.5714e-3 − j5.8212e-4
v(r1_ac)-2.5714e-3 − j5.8212e-4
v(r1_m)2.5714e+0 + j5.8213e-1
v(r1_scale)-2.5714e+0 − j5.8212e-1
v(g1_gain)-8.2295e+1 + j6.6397e+1
v(e1_gain)1.3838e+0 − j1.3968e+0
v(vs_acmag)-2.2209e+0 − j7.8338e-1
v(vin_acmag)2.0558e+0 − j1.5449e+0
v(vin_acphase)2.6964e-2 + j3.5880e-2

AC sensitivity sweep: RLC ladder and voltage-output controlled sources

corpus/regress/sens_acsweep.cir.sens#
sens_acsweep.cir
AC sensitivity sweep: RLC ladder and voltage-output controlled sources
* Coverage: the frequency stepping of sens_sens (ckt/cktsens.c) against
* ngspice-47. count_steps gives LIN its point count, but inc_freq tests
* the step type against LINEAR (3) instead of SENS_LINEAR (15), so a
* linear sweep multiplies by its step too: 100, 1e4, 1e6 Hz here
* (kept by Dune). Only devices whose AC sensitivity ngspice-47 keeps
* right past the first frequency are present (R, C, L, V, I, E, H):
* it redoes CKTsetup before every frequency, and from the second one
* on its VCCS/CCCS gain and K coupling vectors come out wrong
* (corpus/KNOWN_DIFFS.md; sens_ac.cir pins those at one frequency).
vin 1 0 dc 0 ac 1 -45
r1 1 2 1k
l1 2 3 10m
c1 3 0 100n
i1 0 3 dc 0 ac 0.2m 90
e1 5 0 3 0 2
r5 5 6 1k
c2 6 0 47n
vs 6 7 0
r7 7 0 500
h1 8 0 vs 100
r8 8 0 1k
.sens v(8) ac lin 3 100 400
.end
Sensitivity Analysis
29 nonzero of 181 sensitivities shown; the other 152 are exactly 0 at every point.
vector100 Hz10 kHz1 MHz
v(c2)-1.5710e+4 − j1.8447e+41.4326e+5 + j6.5819e+4-6.8341e-1 + j8.6364e+0
v(c2_m)-7.3838e-4 − j8.6700e-46.7334e-3 + j3.0935e-3-3.2120e-8 + j4.0591e-7
v(c2_scale)-7.3838e-4 − j8.6700e-46.7334e-3 + j3.0935e-3-3.2120e-8 + j4.0591e-7
v(c1)-4.9585e+4 − j5.3002e+41.0969e+5 − j2.6879e+4-2.7997e-1 + j4.0625e+0
v(c1_m)-4.9585e-3 − j5.3002e-31.0969e-2 − j2.6879e-3-2.7997e-8 + j4.0625e-7
v(c1_scale)-4.9585e-3 − j5.3002e-31.0969e-2 − j2.6879e-3-2.7997e-8 + j4.0625e-7
v(h1_gain)8.8815e-4 − j7.4144e-4-9.8760e-5 + j3.7469e-52.7996e-10 − j4.0624e-9
v(l1)-1.3373e-2 − j1.9226e-35.9290e-1 + j4.7779e-1-2.3216e-6 − j2.5241e-6
v(l1_m)1.3373e-4 + j1.9226e-5-5.9290e-3 − j4.7779e-32.3216e-8 + j2.5241e-8
v(l1_scale)-1.3373e-4 − j1.9226e-55.9290e-3 + j4.7779e-3-2.3216e-8 − j2.5241e-8
v(i1_m)1.7648e-3 + j2.6565e-22.5642e-3 − j1.9705e-34.3799e-9 − j4.3112e-7
v(i1_acmag)8.8239e+0 + j1.3283e+21.2821e+1 − j9.8524e+02.1899e-5 − j2.1556e-3
v(i1_acphase)-4.6365e-4 + j3.0801e-53.4391e-5 + j4.4754e-57.5245e-9 + j7.6449e-11
v(r7)-6.0195e-5 + j4.8273e-500
v(r7_ac)-6.0195e-5 + j4.8273e-51.5562e-5 + j1.6267e-6-6.1491e-11 + j8.1204e-10
v(r7_m)3.0097e-2 − j2.4137e-2-7.7809e-3 − j8.1337e-43.0746e-8 − j4.0602e-7
v(r7_scale)-3.0097e-2 + j2.4137e-27.7809e-3 + j8.1337e-4-3.0745e-8 + j4.0602e-7
v(r5)-5.9456e-5 + j4.9140e-500
v(r5_ac)-5.9456e-5 + j4.9140e-58.8285e-6 − j1.4667e-6-2.9371e-11 + j4.0613e-10
v(r5_m)5.9456e-2 − j4.9140e-2-8.8285e-3 + j1.4667e-32.9371e-8 − j4.0613e-7
v(r5_scale)-5.9456e-2 + j4.9140e-28.8285e-3 − j1.4667e-3-2.9371e-8 + j4.0613e-7
v(r1)-3.0600e-6 + j2.1284e-500
v(r1_ac)-3.0600e-6 + j2.1284e-57.6043e-6 − j9.4363e-6-4.0172e-13 + j3.6949e-13
v(r1_m)3.0600e-3 − j2.1284e-2-7.6043e-3 + j9.4363e-34.0172e-10 − j3.6949e-10
v(r1_scale)-3.0600e-3 + j2.1284e-27.6043e-3 − j9.4363e-3-4.0172e-10 + j3.6949e-10
v(e1_gain)4.4408e-2 − j3.7072e-2-4.9380e-3 + j1.8734e-31.3998e-8 − j2.0312e-7
v(vs_acmag)-6.6680e-2 − j1.3124e-3-1.3228e-1 − j6.6658e-2-1.9999e-1 − j1.3544e-3
v(vin_acmag)8.7050e-2 − j1.0071e-1-1.2440e-2 + j5.7173e-32.3617e-8 + j2.4881e-8
v(vin_acphase)1.7577e-3 + j1.5193e-3-9.9786e-5 − j2.1712e-4-4.3426e-10 + j4.1219e-10

DC sensitivity: divider, diodes and every controlled source

corpus/regress/sens_dc.cir.sens#
sens_dc.cir
DC sensitivity: divider, diodes and every controlled source
* Coverage: no corpus deck has a .sens card. This pins sens_sens
* (ckt/cktsens.c, DC form) against ngspice-47: each parameter is
* moved by 1e-6 of its value (1e-6 when zero), the one device is
* reloaded into an empty matrix, and Y^-1 (dI - dY E) / delta gives
* the output's sensitivity. dx1 has area 2, dx2 a series RS (internal
* node; dx2:rs still comes out zero in both, since the series
* conductance is set in DIOsetup, which the walk runs before the
* perturbation) and dx3 runs at TEMP=60, so its EG sensitivity is
* live. dx4 shares dx1's model: dx1:is and dx4:is are separate
* vectors (sgen_next moves the model parameter but reloads only the
* one instance); it also keeps ngspice's unused-model pruning from
* dropping dmoda, which takes the numeric area "2.0" for dx1's model
* name otherwise. v1 is both the input and the current sense of the
* F/H pair.
* The filters (ngspice's extension of the card) keep the diodes to
* the parameters the 3f5 model has: ngspice-47 also perturbs its own
* extensions (isr, jtun, ikf, ...), several of which only switch on
* once "given", so their values are artifacts of the perturbation
* (corpus/KNOWN_DIFFS.md). At most six filters: dot_sens grows its
* filter array once, to 7 slots, and writes past it after that
* (ngspice-47 heap overflow; 8+ filters gave garbage output here).
v1 1 0 dc 5
r1 1 2 1k
r2 2 0 2k
dx1 2 3 dmoda 2.0
r3 3 0 4.7k
dx2 3 0 dmodb
i1 0 3 dc 0.2m
dx3 2 9 dmodc temp=60
r9 9 0 10k
dx4 9 0 dmoda
e1 4 0 2 0 0.5
r4 4 5 1k
g1 0 5 3 0 0.2m
r5 5 0 2.2k
f1 0 7 v1 2
r7 7 8 1k
h1 8 0 v1 300
r8 7 5 3.3k
.model dmoda d is=2e-14 n=1.2
.model dmodb d is=5e-15 rs=10
.model dmodc d is=1e-14 n=1.05 eg=1.15 xti=2.5
.sens v(7) r* ?1* dx?:is dx?:? dx?:eg dx?_*
.end
Sensitivity Analysis
52 nonzero of 265 sensitivities shown; the other 213 are exactly 0.
vectorvalue
v(f1_gain)-2.8544e+0
v(h1_gain)-2.8544e-3
v(dx4:is)-1.8776e+12
v(dx4:n)7.8841e-1
v(dx4_temp)-1.6350e-3
v(dx4_area)-3.7551e-2
v(dx4_m)-3.7551e-2
v(dx3:is)-3.6535e+12
v(dx3:n)9.0229e-1
v(dx3:eg)-1.3326e-1
v(dx3_temp)-2.0883e-3
v(dx3_area)-3.6535e-2
v(dx3_m)-3.6535e-2
v(dx2:is)-3.3954e+12
v(dx2:n)4.4307e-1
v(dx2_temp)-1.1209e-3
v(dx2_area)-2.4069e-2
v(dx2_m)-2.4069e-2
v(dx1:is)-9.8296e+11
v(dx1:n)3.9266e-1
v(dx1_temp)-9.3632e-4
v(dx1_area)-9.8296e-3
v(dx1_m)-1.9659e-2
v(i1)2.2274e+1
v(i1_m)4.4549e-3
v(r8)-3.5366e-4
v(r8_m)1.1671e+0
v(r8_scale)-1.1671e+0
v(r7)-4.2986e-3
v(r7_m)4.2986e+0
v(r7_scale)-4.2986e+0
v(r5)-1.7854e-5
v(r5_m)3.9279e-2
v(r5_scale)-3.9279e-2
v(r4)-1.8495e-4
v(r4_m)1.8496e-1
v(r4_scale)-1.8495e-1
v(r9)1.6773e-7
v(r9_m)-1.6773e-3
v(r9_scale)1.6773e-3
v(r3)6.9156e-7
v(r3_m)-3.2503e-3
v(r3_scale)3.2503e-3
v(r2)1.4807e-5
v(r2_m)-2.9614e-2
v(r2_scale)2.9614e-2
v(r1)6.4173e-3
v(r1_m)-6.4173e+0
v(r1_scale)6.4173e+0
v(g1_gain)9.4539e+1
v(e1_gain)1.9708e-1
v(v1)-1.7974e+0

DC sensitivity to the resistor temperature parameters

corpus/regress/sens_rtemp.cir.sens#
sens_rtemp.cir
DC sensitivity to the resistor temperature parameters
* Coverage: the 3f5's sens walk (ckt/cktsens.c) perturbs a parameter
* with sens_setp and then calls sens_temp = DEVtemperature before
* reloading the device, so REStemp recomputes RESconduct from the
* moved model tc1/tc2 (resmpar.c) or instance temp (resparam.c):
* d/dTC1 = dV/dR * R * dT, d/dTC2 = dV/dR * R * dT^2 and d/dTEMP =
* dV/dR * R * (TC1 + 2 TC2 dT). r2 sits at the circuit temperature
* (.options temp=60, TNOM 27), r3 has TEMP=100 on the same model,
* r1 is a plain resistor (default model, TC1 = TC2 = 0: its tc1/tc2
* sensitivities are live, its temp one is zero). The filters keep
* ngspice-47's own :tce out of the walk: perturbing it raises
* REStceGiven for good, which switches every later perturbation of
* that model to the exponential form at TCE = 0 (KNOWN_DIFFS).
.options temp=60
v1 1 0 dc 5
r1 1 2 1k
r2 2 0 rtc 2k
r3 2 0 rtc 3k temp=100
.model rtc r tc1=2e-3 tc2=1e-5
.sens v(2) r?:tc1 r?:tc2 r?_temp r?
.end
Sensitivity Analysis
11 nonzero of 12 sensitivities shown; the other 1 are exactly 0.
vectorvalue
v(r3:tc1)2.7868e+1
v(r3:tc2)2.0344e+3
v(r3)1.5261e-4
v(r3_temp)1.3209e-3
v(r2:tc1)2.3437e+1
v(r2:tc2)7.7341e+2
v(r2)3.8240e-4
v(r2_temp)1.8891e-3
v(r1:tc1)-4.0346e+1
v(r1:tc2)-1.3300e+3
v(r1)-1.2226e-3

Switch hysteresis: S cards swept through VT+-VH both ways in .tran/.dc

corpus/regress/sw_hyst.cir.ac.dc.tran#
sw_hyst.cir
Switch hysteresis: S cards swept through VT+-VH both ways in .tran/.dc
* Coverage: no corpus deck has an S card. A slow triangle (0 -> 5 -> 0 V)
* drives s1 through its whole window (VT=2.4, VH=0.9: closes above 3.3,
* opens below 1.5) into a 1k load, in .tran and in a .dc. s6/s7 watch the
* mirror 5-v(1), so the one rising .dc also falls through their windows
* (ngspice runs two .dc cards in reverse deck order, Dune in deck order,
* so a second, falling .dc cannot be paired). s2/s3 share a model whose
* window (-0.6..5.4) contains the whole control range, so they keep the
* ON/OFF hint of the operating point all the way through (s2 on, s3 off). s4 has the default RON (1 ohm) and
* ROFF (1/GMIN); s5 has a negative VH, ngspice's inverted-window state
* machine (the 3f5 took |VH|). The 40u step lets swtrunc.c (ngspice)
* shorten the steps that approach each threshold. The .ac pins
* ngspice's INITSMSIG, which reads the switch state from state1: zero
* after a bare operating point, so s2 is open in AC although the
* operating point has it closed.
vc 1 0 dc 0 pwl(0 0 1m 5 2m 0)
rc 1 0 1k
vdd 2 0 dc 10 ac 1
s1 2 3 1 0 shys
rl1 3 0 1k
s2 2 4 1 0 swin on
rl2 4 0 1k
s3 2 5 1 0 swin off
rl3 5 0 1k
s4 2 6 1 0 sdef
rl4 6 0 1k
s5 2 7 1 0 sneg
rl5 7 0 1k
vo 9 0 dc 5
e1 8 9 1 0 -1
s6 2 10 8 0 shys
rl6 10 0 1k
s7 2 11 8 0 sneg
rl7 11 0 1k
.model shys sw vt=2.4 vh=0.9 ron=10 roff=1e6
.model swin sw vt=2.4 vh=3 ron=100 roff=1e5
.model sdef sw vt=2.4 vh=0.9
.model sneg sw vt=2.4 vh=-0.7 ron=50 roff=2e5
.ac lin 1 1k 1k
.dc vc 0 5 0.2
.tran 40u 2m
.end
AC Analysis
vector1 kHz
v(1)0 V
i(vc)0 A
v(2)1 V
i(vdd)-31.75 µA
v(3)999 µV
v(4)9.901 mV
v(5)9.901 mV
v(6)1000 pV
v(7)4.9751 mV
v(9)0 V
i(vo)0 A
v(8)0 V
i(e1)0 A
v(10)999 µV
v(11)4.9751 mV
DC transfer characteristic
0 V2 V4 V6 V8 V10 V0 V1 V2 V3 V4 V5 Vv(3)v(6)v(7)v(10)v(11)
v(3)v(6)v(7)v(10)v(11)(+10 more vectors)
Transient Analysis
0 V2 V4 V6 V8 V10 V0 s500 µs1 ms1.5 ms2 msv(1)v(3)v(6)v(7)v(8)v(10)
v(1)v(3)v(6)v(7)v(8)v(10)(+9 more vectors)

Transfer function: BJT stage with controlled-source feedback

corpus/regress/tf_amp.cir.tf#
tf_amp.cir
Transfer function: BJT stage with controlled-source feedback
* Coverage: no corpus deck has a .tf card. This pins TFanal
* (ckt/tfanal.c) against ngspice-47: one extra solve of the factored
* operating-point Jacobian with a unit excitation on the input
* source's branch gives the gain and the input resistance; a unit
* current into the output node gives the output resistance. A
* common-emitter BJT (biased off the operating point, so the
* Jacobian holds its small-signal gm/gpi/go) drives a VCVS buffer,
* a VCCS feeds part of the output back to the base, and an F/H pair
* adds a current-controlled path, so gain, Rin and Rout are all
* nontrivial. The output is a node pair, so the third vector is
* named output_impedance_at_V(out,ref).
vin 1 0 dc 0.75
rs 1 2 2k
vcc 9 0 dc 10
rb 9 2 200k
rc 9 3 4.7k
q1 3 2 4 qn
re 4 0 330
vsense 4 5 0
r5 5 0 1meg
e1 6 0 3 0 0.5
ro 6 7 1k
rl 7 0 10k
g1 2 0 7 0 -2e-6
f1 7 0 vsense 0.1
h1 8 0 vsense 50
rref 8 0 1k
.model qn npn is=1e-15 bf=120 br=2 vaf=60 rb=50 re=2 rc=20
.tf v(7,8) vin
.end
Transfer Function
vectorvalue
v(Transfer_function)-5.0859 V
v(vin#Input_impedance)30.071 kV
v(output_impedance_at_V(7,8))890.6 V

TRA ideal line: open and shorted stubs in .ac, DC form in .op

corpus/regress/tra_ac.cir.ac.op#
tra_ac.cir
TRA ideal line: open and shorted stubs in .ac, DC form in .op
* Coverage: TRAacLoad and the MODEDC stamps of TRAload. A 50-ohm line
* (TD=1ns) carries the source to a 50-ohm load; an open stub t2
* (quarter wave at 250MHz: TD=1ns) hangs at its far end, a shorted
* stub t3 (Z0=100, NL=0.25 at F=125MHz -> TD=2ns) at the source end,
* so the sweep shows the notches and resonances of both. The sweep
* spans whole decades: ngspice-47 stretches a DEC step so the last
* point lands on FSTOP, the 3f5 does not. In .op the
* line is the 3f5 DC form: v1 = v2, i1 = -i2 (up to the (1-GMIN)
* factor), so the DC divider reads through the lines and the shorted
* stub t3 carries a real DC current into rsh; rb closes t2's far end.
vin 1 0 dc 1 ac 1
rs 1 2 50
t1 2 0 3 0 z0=50 td=1ns
rl 3 0 50
t2 3 0 4 0 z0=50 td=1ns
t3 2 0 5 0 z0=100 f=125meg nl=0.25
rsh 5 0 1
rb 4 0 1k
.ac dec 50 10meg 1g
.op
.end
AC Analysismagnitudelog f
0 V200 mV400 mV600 mV800 mV1 V10 MHz100 MHz1 GHzv(2)v(3)v(4)v(5)
v(2)v(3)v(4)v(5)(+14 more vectors)
Operating Point
vectorvalue
v(1)1 V
i(vin)-19.616 mA
v(2)19.212 mV
v(3)19.212 mV
v(t1#i1)403.46 µV
v(t1#i2)-403.46 µV
v(t1#int1)-960.61 µV
v(t1#int2)39.385 mV
v(4)19.212 mV
v(t2#i1)19.212 µV
v(t2#i2)-19.212 µV
v(t2#int1)18.252 mV
v(t2#int2)20.173 mV
v(5)19.212 mV
v(t3#i1)19.212 mV
v(t3#i2)-19.212 mV
v(t3#int1)-1.902 V
v(t3#int2)1.9404 V

TRA ideal line: matched delay, mismatched reflections, F/NL delay form

corpus/regress/tra_pulse.cir.tran#
tra_pulse.cir
TRA ideal line: matched delay, mismatched reflections, F/NL delay form
* Coverage: no corpus deck has a T card. Line t1 (Z0=50, TD=10ns) is
* driven through 50 ohms and terminated in 50 ohms: the edge reappears
* at node 3 one delay later, at half amplitude. t2 (Z0=75) feeds t3
* (Z0=50, TD from F/NL: 0.5/100MEG = 5ns) into 200 ohms || 2pF, so the
* 75/50 and 50/200 junctions bounce the wave back and forth (the
* capacitor gives the LTE control something to cut steps on). The
* triangles on v2 reverse their slope (a PULSE with PW=0 would take
* PW=TSTOP instead), which is what plants TRAaccept's delayed
* breakpoints and arms TRAtrunc.
v1 1 0 pulse(0 2 1ns 1ns 1ns 15ns 60ns)
rs1 1 2 50
t1 2 0 3 0 z0=50 td=10ns
rl1 3 0 50
v2 4 0 pwl(0 0 2ns 0 5ns 1 8ns 0 30ns 0 33ns -0.5 36ns 0)
rs2 4 5 50
t2 5 0 6 0 z0=75 td=3ns
t3 6 0 7 0 z0=50 f=100meg nl=0.5
rl3 7 0 200
cl3 7 0 2p
.tran 0.1ns 80ns
.end
Transient Analysis
-500 mV0 V500 mV1 V1.5 V2 V0 s20 ns40 ns60 ns80 nsv(1)v(2)v(3)v(4)v(5)v(6)
v(1)v(2)v(3)v(4)v(5)v(6)(+15 more vectors)

TRA ideal line: charged lines discharging under UIC

corpus/regress/tra_uic.cir.tran#
tra_uic.cir
TRA ideal line: charged lines discharging under UIC
* Coverage: the MODEUIC branch of TRAload's MODEINITTRAN seed, which
* takes the line's own IC= values instead of the operating point.
* t1 starts charged to 1 V at both ends with no current (IC=V1,I1,V2,I2)
* and discharges into a matched 50 ohms at port 1: a 0.5 V step that
* lasts 2*TD, the textbook charged-line pulse generator. t2 uses the
* keyword forms (ZO=, V1=, I2=): it starts at 0.5 V on port 1 with 2 mA
* entering port 2, between mismatched 25 and 150 ohm ends, so the
* reflections ring down over several round trips.
r1 1 0 50
t1 1 0 2 0 z0=50 td=5ns ic=1,0,1,0
r2 2 0 1meg
r3 3 0 25
t2 3 0 4 0 zo=75 td=2ns v1=0.5 i2=2ma
r4 4 0 150
.tran 0.1ns 40ns uic
.end
Transient Analysis
-200 mV0 V200 mV400 mV600 mV800 mV1 V10 ns20 ns30 ns40 nsv(1)v(2)v(3)v(4)
v(1)v(2)v(3)v(4)(+8 more vectors)

uic: .ic biases the semiconductors through their getic (bjtgetic.c ...)

corpus/regress/uic_getic.cir.tran#
uic_getic.cir
uic: .ic biases the semiconductors through their getic (bjtgetic.c ...)
* regression (issue #20): under UIC the 3f5 copies the .ic node
* values into every BJT/diode/MOS/JFET initial condition not given on
* the card (DEVsetic); Dune ported only CAPgetic, so these devices
* started from zero junction voltages and their charges kicked the
* first steps. q2 keeps its own IC= VBE (VCE still from the nodes);
* the diode's IC= is overwritten by its nodes in both C codes (the
* DIO_IC case never sets DIOinitCondGiven).
vcc 9 0 5
rc 9 2 2k
rb 9 1 200k
cb 1 0 10p
q1 2 1 0 qn
rc2 9 4 2k
q2 4 1 0 qn ic=0.6
d1 5 0 dd ic=0.2
rd 9 5 10k
cd 5 0 20p
m1 6 7 0 0 nm l=2u w=20u
rm 9 6 5k
rg 9 7 100k
cg 7 0 5p
.model qn npn bf=100 cje=2p cjc=1p tf=0.3n is=1e-15 rb=50
.model dd d is=1e-14 cjo=5p tt=1n
.model nm nmos level=1 vto=0.8 kp=50u cgso=1n cgdo=1n cbd=50f cbs=50f
.ic v(1)=0.72 v(2)=2.5 v(4)=1.5 v(5)=0.65 v(6)=3 v(7)=2
.tran 0.2n 40n uic
.end
Transient Analysis
500 mV1 V1.5 V2 V2.5 V3 V3.5 V10 ns20 ns30 ns40 nsv(2)v(1)v(4)v(5)v(6)v(7)
v(2)v(1)v(4)v(5)v(6)v(7)(+2 more vectors)

uic: .ic seeds capacitors without ic= (cktic.c + capgetic.c)

corpus/regress/uic_ic.cir.tran#
uic_ic.cir
uic: .ic seeds capacitors without ic= (cktic.c + capgetic.c)
* regression (issue #20): under UIC the .ic node values never reached
* CKTrhs nor the capacitors' initial conditions, so an LC tank kicked
* by .ic started at rest. c2's own ic= wins over the .ic of its node.
l1 1 0 1m
c1 1 0 1u
r1 1 0 100
c2 2 0 1u ic=0.2
r2 2 0 1k
.ic v(1)=0.5 v(2)=0.7
.tran 5u 1m uic
.end
Transient Analysis
-400 mV-200 mV0 V200 mV400 mV600 mV200 µs400 µs600 µs800 µs1 msv(1)v(2)
v(1)v(2)(+1 more vector)

URC line with ISPERL: the URCsetup ladder of R and diodes

corpus/regress/urc_diode.cir.dc.tran#
urc_diode.cir
URC line with ISPERL: the URCsetup ladder of R and diodes
* Coverage: ISPERL given turns every shunt into a diode (CJO = c1,
* IS = i1, RS = L*lumps*RSPERL, area = p^(i-1)), urcsetup.c's other
* branch.
v1 1 0 dc 0 pulse(-1 1 10n 20n 20n 100n 300n)
rs 1 2 1k
u1 2 3 0 dmod l=10u
rl 3 0 100k
.model dmod urc k=1.6 fmax=10g rperl=100meg cperl=100n isperl=1n rsperl=10k
.dc v1 -1 1 0.05
.tran 2n 400n
.end
DC transfer characteristic
-1 V-500 mV0 V500 mV1 V-1 V-500 mV0 V500 mV1 Vv(2)v(3)
v(2)v(3)(+9 more vectors)
Transient Analysis
-1 V-500 mV0 V500 mV1 V0 s100 ns200 ns300 ns400 nsv(1)v(2)v(3)
v(1)v(2)v(3)(+8 more vectors)

URC line: the URCsetup ladder (geometric R/C lumps), tran + ac

corpus/regress/urc_line.cir.ac.tran#
urc_line.cir
URC line: the URCsetup ladder (geometric R/C lumps), tran + ac
* Coverage: the 3f5 URC has no load of its own; urcsetup.c expands
* each U card into lumped R/C sections. u1 takes the lump count from
* the K/FMAX rule (10 lumps), u2 gives N=4; the inner nodes
* (u1#hi1, u1#lo1, ...) are saved like ngspice saves them.
v1 1 0 dc 0 ac 1 pulse(0 1 10n 2n 2n 200n 500n)
rs 1 2 100
u1 2 3 0 umod l=1m
rl 3 0 20k
u2 3 4 0 umod2 l=2m n=4
cl 4 0 0.5p
.model umod urc k=1.5 fmax=1g rperl=10meg cperl=10n
.model umod2 urc(rperl=1meg cperl=2n k=2)
.ac dec 10 10k 10g
.tran 2n 1u
.end
AC Analysismagnitudelog f
1e-26 V1e-22 V1e-18 V10 fV100 pV1 µV10 mV10 kHz1 MHz100 MHz10 GHzv(2)v(3)v(4)
v(2)v(3)v(4)(+28 more vectors)
Transient Analysis
0 V200 mV400 mV600 mV800 mV1 V0 s200 ns400 ns600 ns800 ns1 µsv(1)v(2)v(3)v(4)
v(1)v(2)v(3)v(4)(+27 more vectors)

Berkeley SPICE3f5 examples 19

The example decks shipped with the SPICE3f5 source distribution, run unchanged.

corpus/spice3f5/examples/mixdisto.cir is excluded by corpus/SKIP: no analysis card (the .disto lines are commented out upstream); ngspice-47 -b writes an empty rawfile; its two setups run uncommented as regress/mixdisto_hd.cir and regress/mixdisto_im.cir.

BJT Noise Test

corpus/spice3f5/examples/bjtnoise.cir.noise#
bjtnoise.cir
BJT Noise Test

vcc 4 0 50
vin 1 0 ac

ccouple 1 2 1

ibias 0 2 100uA

rload 4 3 1k

q1 3 2 0 0 test

.model test npn kf=1e-20 af=1 bf=100 rb=10
.noise v(3) vin dec 10 10 100k 1
.end
Noise Spectral Density Curveslog f
0 V/√Hz50 nV/√Hz100 nV/√Hz150 nV/√Hz200 nV/√Hz10 Hz100 Hz1 kHz10 kHz100 kHzonoise_spectruminoise_spectrum
onoise_spectruminoise_spectrum(+10 more vectors)
Integrated Noise
vectorvalue
v(onoise_total_rload_thermal)1.2874 µV
v(inoise_total_rload_thermal)3.4585 nV
v(onoise_total_rload_1overf)0 V
v(inoise_total_rload_1overf)0 V
v(onoise_total_rload)1.2874 µV
v(inoise_total_rload)3.4585 nV
v(onoise_total_q1_rc)0 V
v(inoise_total_q1_rc)0 V
v(onoise_total_q1_rb)47.923 µV
v(inoise_total_q1_rb)128.74 nV
v(onoise_total_q1_re)0 V
v(inoise_total_q1_re)0 V
v(onoise_total_q1_ic)17.9 µV
v(inoise_total_q1_ic)48.087 nV
v(onoise_total_q1_ib)6.6631 µV
v(inoise_total_q1_ib)17.9 nV
v(onoise_total_q1_1overf)11.297 nV
v(inoise_total_q1_1overf)30.349 pV
v(onoise_total_q1)51.589 µV
v(inoise_total_q1)138.59 nV
v(onoise_total)51.605 µV
v(inoise_total)138.63 nV

Test of MOS BSIM1 implementation; DC transfer curve

corpus/spice3f5/examples/bsim1tst.cir.dc#
bsim1tst.cir
Test of MOS BSIM1 implementation; DC transfer curve
****************************************************************** 
MN1 13 2 0 4 NMOS L=10U W=50.0U AD=100P AS=100P PD=40U PS=40U   
MN2 23 2 0 5 NMOS L=10U W=50.0U AD=100P AS=100P PD=40U PS=40U   
MN3 33 2 0 6 NMOS L=10U W=50.0U AD=100P AS=100P PD=40U PS=40U   
MN4 43 2 0 7 NMOS L=10U W=50.0U AD=100P AS=100P PD=40U PS=40U   
MN5 53 2 0 8 NMOS L=10U W=50.0U AD=100P AS=100P PD=40U PS=40U   
VDS 3 0 0.05    
VGS 2 0 0
V1 3 13 0       
V2 3 23 0       
V3 3 33 0       
V4 3 43 0       
V5 3 53 0       
VBS1 4 0 0      
VBS2 5 0 -1
VBS3 6 0 -2     
VBS4 7 0 -3
VBS5 8 0 -4     
*************************************************************** 
.OPTIONS LIMPTS=5000 ACCT       
.DC VGS 0 5 0.01
.PRINT DC I(V1) I(V2) I(V3) I(V4) I(V5) 
*.PLOT DC I(V1) I(V2) I(V3) I(V4) I(V5) 
*.OPTIONS LIMPTS=501 ACCT       
*VGS  2  0  PWL(0 0 5 5)
*.TRAN 0 5 0.01
*.PRINT TRAN I(V1) I(V2) I(V3) I(V4) I(V5) 
***** MODEL PARAMETERS TEMP2 ********************       
.MODEL  NMOS   NMOS     
+           LEVEL = 4.00000E+000
+             TOX = 3.00000E-002
+             VDD = 5.00000E+000
+            TEMP = 2.70000E+001
+              DL = 7.97991E-001
+              DW = 4.77402E-001
+             VFB = -1.0087E+000
+             PHI = 7.96434E-001
+              K1 = 1.31191E+000
+              K2 = 1.46640E-001
+             ETA = -1.0027E-003
+             MUZ = 5.34334E+002
+              U0 = 4.38497E-002
+              U1 = -5.7332E-002
+             X2E = -7.6911E-004
+             X3E = 7.86777E-004
+            X2MZ = 8.25434E+000
+             MUS = 5.40612E+002
+            X2MS = -1.2992E+001
+            X3MS = -9.4035E+000
+            X2U0 = 1.06821E-003
+            X2U1 = -1.9209E-002
+            X3U1 = 7.76925E-003
+            LVFB = -2.1402E-001
+            WVFB = 3.44354E-001
+             LK1 = 3.23395E-001
+             WK1 = -5.7698E-001
+             LK2 = 1.68585E-001
+             WK2 = -1.8796E-001
+            LETA = -9.4847E-003
+            WETA = 1.47316E-002
+             LU0 = 6.38105E-002
+             WU0 = -6.1053E-002
+             LU1 = 1.01174E+000
+             WU1 = 1.62706E-002
+            LX2E = 9.62411E-003
+            WX2E = -3.7951E-003
+            LX3E = 7.35448E-004
+            WX3E = -1.7796E-003
+           LX2MZ = -2.4197E+001
+           WX2MZ = 1.95696E+001
+            LMUS = 6.21401E+002
+            WMUS = -1.9190E+002
+           LX2MS = -6.4900E+001
+           WX2MS = 4.29043E+001
+           LX3MS = 1.18239E+002
+           WX3MS = -2.9747E+001
+           LX2U0 = -8.0958E-003
+           WX2U0 = 4.03379E-003
+           LX2U1 = -7.4573E-002
+           WX2U1 = 1.47520E-002
+           LX3U1 = -1.0940E-001
+           WX3U1 = -8.3353E-003
+              N0 = 1.55
+              NB = 0.09
+              ND = 0.0 
+             LN0 = 0.0 
+             WN0 = 0.0 
+             LNB = 0.0 
+             WNB = 0.0 
+             LND = 0.0 
+             WND = 0.0 
+            CGDO = 2.70000E-010
+            CGSO = 2.70000E-010
+            CGBO = 1.40000E-010
+           XPART = 1.0
+             RSH = 35.0
+              CJ = 2.75E-4     
+             CJSW = 1.90E-10   
+             JS = 1.0E-8     
+              PB = 0.7
+             PBSW = 0.8
+              MJ = 0.5 
+             MJSW = 0.33       
+             WDF = 0.0
*****                                        *****      
.END
DC transfer characteristicvectors from the deck’s .plot/.print
0 A10 µA20 µA30 µA40 µA50 µA60 µA0 V1 V2 V3 V4 V5 Vi(v1)i(v2)i(v3)i(v4)i(v5)
i(v1)i(v2)i(v3)i(v4)i(v5)(+19 more vectors)
  • warning: option limpts is an obsolete SPICE2 option; ignored

Test of MOS BSIM2 implementation; DC transfer curve

corpus/spice3f5/examples/bsim2tst.cir.dc#
bsim2tst.cir
Test of MOS BSIM2 implementation; DC transfer curve
****************************************************************** 
MN1 13 2 0 4 NMOS L=10U W=50.0U AD=100P AS=100P PD=40U PS=40U   
MN2 23 2 0 5 NMOS L=10U W=50.0U AD=100P AS=100P PD=40U PS=40U   
MN3 33 2 0 6 NMOS L=10U W=50.0U AD=100P AS=100P PD=40U PS=40U   
MN4 43 2 0 7 NMOS L=10U W=50.0U AD=100P AS=100P PD=40U PS=40U   
MN5 53 2 0 8 NMOS L=10U W=50.0U AD=100P AS=100P PD=40U PS=40U   
VDS 3 0 0.05    
VGS 2 0 0
V1 3 13 0       
V2 3 23 0       
V3 3 33 0       
V4 3 43 0       
V5 3 53 0       
VBS1 4 0 0      
VBS2 5 0 -1
VBS3 6 0 -2     
VBS4 7 0 -3
VBS5 8 0 -4     
*************************************************************** 
.OPTIONS LIMPTS=5000 ACCT       
.DC VGS 0 5 0.01
.PRINT DC I(V1) I(V2) I(V3) I(V4) I(V5) 
*.PLOT DC I(V1) I(V2) I(V3) I(V4) I(V5) 
*.OPTIONS LIMPTS=501 ACCT       
*VGS  2  0  PWL(0 0 5 5)
*.TRAN 0 5 0.01
*.PRINT TRAN I(V1) I(V2) I(V3) I(V4) I(V5) 
***** MODEL PARAMETERS TEMP2 ********************       
* This file contains the BSIM2 process file parameters as they should
* be input to the .model card of spice3c1.
.model nmos nmos level=5 
+ vfb =  -0.7919 lvfb =  -0.0266 wvfb =   0.0000 
+ phi =   0.8039  lphi =   0.0042  wphi =   0.0000 
+ k1  =   0.7286  lk1  =   0.0309  wk1  =   0.0000 
+ k2  =  -0.0506  lk2  =   0.0786  wk2  =   0.0000 
+ mu0 = 453.2926  dl =   0.1553  dw =   0.0000 
+ mu0b =  -5.4925  lmu0b =  -1.9192  wmu0b =   0.0000 
+ mus0 = 781.7117  lmus0 =  25.2769  wmus0 =   0.0000 
+ musb =  25.5724  lmusb = -10.0060  wmusb =   0.0000 
+ mu20 =   0.9390  lmu20 =  -0.0840  wmu20 =   0.0000 
+ mu2b =   0.0753  lmu2b =  -0.0148  wmu2b =   0.0000 
+ mu2g =   0.1804  lmu2g =   0.0181  wmu2g =   0.0000 
+ mu30 =  44.9689  lmu30 =  -0.0933  wmu30 =   0.0000 
+ mu3b =   0.5871  lmu3b =   1.0793  wmu3b =   0.0000 
+ mu3g = -11.6723  lmu3g =   0.6804  wmu3g =   0.0000 
+ mu40 =   0.2682  lmu40 =   2.3969  wmu40 =   0.0000 
+ mu4b =  -0.3179  lmu4b =   0.1264  wmu4b =   0.0000 
+ mu4g =  -0.2654  lmu4g =  -0.5702  wmu4g =   0.0000 
+ ua0 =   0.0441  lua0 =   0.2283  wua0 =   0.0000 
+ uab =  -0.0045  luab =  -0.0105  wuab =   0.0000 
+ ub0 =   0.0125  lub0 =  -0.0051  wub0 =   0.0000 
+ ubb =  -0.0015  lubb =   0.0010  wubb =   0.0000 
+ u10 =   0.1262  lu10 =   0.5563  wu10 =   0.0000 
+ u1d =  -0.2967  lu1d =  -0.0062  wu1d =   0.0000 
+ u1b =   0.0960  lu1b =  -0.0345  wu1b =   0.0000 
+ eta0 =  -0.0373  leta0 =   0.0271  weta0 =   0.0000 
+ etab =   0.0004  letab =  -0.0041  wetab =   0.0000 
+ n0 =   0.8032  ln0 =   0.1734  wn0 =   0.0000 
+ nd =   0.0105  lnd =  -0.0091  wnd =   0.0000 
+ nb =   0.5978  lnb =  -0.1638  wnb =   0.0000 
+ vof0 =   1.4977  lvof0 =  -0.1766  wvof0 =   0.0000 
+ vofd =   0.1795  lvofd =  -0.1247  wvofd =   0.0000 
+ vofb =   0.8368  lvofb =  -0.3432  wvofb =   0.0000 
+ ai0 =  32.0150  lai0 =   8.2816  wai0 =   0.0000 
+ aib = -19.5396  laib =   4.9347  waib =   0.0000 
+ bi0 =  37.6044  lbi0 =  -1.8713  wbi0 =   0.0000 
+ bib =  -2.5109  lbib =   0.7903  wbib =   0.0000 
+ vghigh =   0.2342  lvghigh =  -0.0007  wvghigh =   0.0000 
+ vglow =  -0.1023  lvglow =   0.0038  wvglow =   0.0000 
+ tox = 0.0150 temp = 27 vdd = 5.0 vgg = 5.0 vbb =  -3.0 
+ cgdo = 1.0e-10 cgso = 1.0e-10 cgbo = 2.5e-11 
+ xpart = 0  
+ rsh = 0 cj = 0.0002 cjsw = 1.0e-10 
+ js = 5e-5 pb = 0.7 pbsw = 0.8 
+ mj = 0.5 mjsw = 0.33 wdf = 0 
+ dell = 0 
*****                                        *****      
.END
DC transfer characteristicvectors from the deck’s .plot/.print
0 A20 µA40 µA60 µA80 µA0 V1 V2 V3 V4 V5 Vi(v1)i(v2)i(v3)i(v4)i(v5)
i(v1)i(v2)i(v3)i(v4)i(v5)(+19 more vectors)
  • warning: option limpts is an obsolete SPICE2 option; ignored

difpair ckt - simple differential pair

corpus/spice3f5/examples/diffpair.cir.tran#
diffpair.cir
difpair ckt - simple differential pair
*.width in=72
.opt acct list node lvlcod=2
*.tf v(5) vin
*.dc vin -0.25 0.25 0.005
*.ac dec 10 1 10ghz
.tran 5ns 500ns
vin 1 0 sin(0 0.1 5meg) ac 1
vcc 8 0 12
vee 9 0 -12
q1 4 2 6 qnl
q2 5 3 6 qnl
rs1 1 2 1k
rs2 3 0 1k
rc1 4 8 10k
rc2 5 8 10k
q3 6 7 9 qnl
q4 7 7 9 qnl
rbias 7 8 20k
.model qnl npn(bf=80 rb=100 ccs=2pf tf=0.3ns tr=6ns cje=3pf cjc=2pf
+   va=50)
.print dc v(4) v(5)
.plot dc v(5)
.print ac vm(5) vp(5)
.plot ac vm(5) vp(5)
.print tran v(4) v(5)
.plot tran v(5)
.end
Transient Analysisvectors from the deck’s .plot/.print
3 V4 V5 V6 V7 V8 V0 s100 ns200 ns300 ns400 ns500 nsv(5)v(4)
v(5)v(4)(+10 more vectors)
  • warning: option lvlcod is an obsolete SPICE2 option; ignored

Diode-Resistor circuit

corpus/spice3f5/examples/diodisto.cir.disto#
diodisto.cir
	Diode-Resistor circuit

r1 2 0 1k
d1 1 2 diode
vcc 1 3 5v ac 0.001 sin(5 0.01 1000) distof1 0.01 distof2 0.01
vcc2 3 0 0v
*.model diode D
.model diode D is=1.0e-14 tt=0.1n cjo=2p
*.disto dec 1 1000.0 1000.0 
*.disto dec 20 1.0e3 1.0e8 
.disto dec 20 1.0e3 1.0e8 0.9
*the output is v(2)
.end
DISTORTION - IM: f1+f2magnitudelog f
68.2 nV68.2 nV68.3 nV68.3 nV68.4 nV68.4 nV68.5 nV1 kHz10 kHz100 kHz1 MHz10 MHz100 MHzv(2)
v(2)(+4 more vectors)
DISTORTION - IM: f1-f2magnitudelog f
68.2 nV68.2 nV68.3 nV68.3 nV68.4 nV68.4 nV68.5 nV1 kHz10 kHz100 kHz1 MHz10 MHz100 MHzv(2)
v(2)(+4 more vectors)
DISTORTION - IM: 2f1-f2magnitudelog f
77.2 pV77.4 pV77.6 pV77.8 pV78 pV78.2 pV78.4 pV1 kHz10 kHz100 kHz1 MHz10 MHz100 MHzv(2)
v(2)(+4 more vectors)

BJTdriver -- 24inch lossy line -- DiodeCircuit

corpus/spice3f5/examples/ltra_1.cir.tran#
ltra_1.cir
   BJTdriver -- 24inch lossy line -- DiodeCircuit

* This unclassified circuit is from Raytheon, courtesy Gerry Marino.
* It consists of a BJT driver connected by a 24 inch lossy line to a
* passive load consisting mostly of diodes. Each inch 
* of the lossy line is modelled by 10 LRC lumps in the Raytheon
* model.

* The line parameters (derived from the Raytheon input file) are:
* L = 9.13nH per inch
* C = 3.65pF per inch
* R = 0.2 ohms per inch

* the circuit
*tran 0.1ns 60ns 0 0.5ns

v1 1 0 0v pulse(0 4 1ns 1ns 1ns 20ns 40ns)
*v1 1 0 4v pulse(4 0 1ns 1ns 1ns 20ns 40ns)
vcc 10 0 5v
*rseries 1 2 5
x1 1 2 10 bjtdrvr
*t1 2 0 3 0 z0=50.0136 td=4.38119ns rel=10
o2 2 0 3 0 lline
*x2 2 3 oneinch
*x2 100 101 twentyfourinch
*x2 100 101 xtwentyfourinch
vtest1 2 100 0
vtest2 101 3 0
x3 3 4 10 dioload
*rl 3 0 5
*dl 0 3 diod2

.model lline ltra rel=1 r=0.2 g=0 l=9.13e-9 c=3.65e-12 len=24 steplimit compactrel=1.0e-3 compactabs=1.0e-14

.model qmodn npn(bf=100 rb=100 cje=0.09375pF cjc=0.28125pF is=1e-12
+pe=0.5 pc=0.5)

.model qmodpd npn(bf=100 rb=100 cje=0.08187pF cjc=0.2525pF is=1e-12
+pe=0.5 pc=0.5)
*.model qmodpdmine npn(bf=100 rb=100  cje=0.08187pF cjc=0.15pF is=1e-12
.model qmodpdmine npn(bf=100 rb=100  cje=0.08187pF cjc=0.05pF is=1e-12
+pe=0.5 pc=0.5)

.model dmod1 d(n=2.25 is=1.6399e-4 bv=10)

.model dmod2 d

.model dmod d(vj=0.3v)

*.model diod1 d(1.0 tt=0.75ns vj=0.6 rs=909 bv=10)
.model diod1 d(tt=0.75ns vj=0.6 rs=909 bv=10)

*.model diod2 d(1.0 tt=0.5ns vj=0.3 rs=100 bv=10)
.model diod2 d(tt=0.5ns vj=0.3 rs=100 bv=10)

.options itl5=0 acct
+reltol=1e-3 abstol=1e-14
.tran 0.1ns 60ns
.save v(1) v(2) v(3)

*.tran 1e-9 1e-8

* bjt driver - 19=input, 268=output, 20=vcc; wierd node numbers from 
* the Raytheon file

.subckt bjtdrvr 19 268 20
q1 22 18 13 qmodn
q2 18 16 13 qmodn
qd2 21 9 0 qmodn
q4 14 14 0 qmodn
q3 16 15 14 qmodpd
q5 8 13 17 qmodn
q6 25 12 0 qmodn
q7 6 17 0 qmodpd
qd1 26 10 0 qmodn
q8 7 11 10 qmodn
q10 268 17 0 qmodpdmine
*q10 268 17 0 qmodpd
q9 7 10 268 qmodn

d1 0 19 dmod1
d2 18 19 dmod2
d3 13 19 dmod
dq1 18 22 dmod
dq2 16 18 dmod
d502 9 21 dmod
dq3 15 16 dmod
d10 24 8 dmod
d4 15 6 dmod
dq6 12 25 dmod
dq7 17 6 dmod
dd1 17 10 dmod
d7 11 6 dmod
dd2 17 26 dmod
d9 23 6 dmod
dq8 11 7 dmod
d501 17 268 dmod
dq9 10 7 dmod
d14 20 27 dmod
d8 0 268 dmod

r1 18 20 6k
r2 22 20 2.2k
r4 0 13 7k
rd1 9 13 2k
rd2 21 13 3k
r3 16 20 10k
r5 15 20 15k
r9 0 17 4k
r6 24 20 750
r10 12 17 2k
r12 24 11 1.5k
r11 25 17 3k
r15 23 20 10k
r13 0 10 15k
r14 7 27 12

.ends bjtdrvr

* subckt dioload - diode load: input=28, output=4, vcc=5

.subckt dioload 28 4 5
*comment out everything in dioload except d5 and r503, and watch
* the difference in results obtained between a tran 0.1ns 20ns and
* a tran 0.01ns 20ns
c1 28 0 5pF
r503 0 4 5.55
r4 0 28 120k
r5 1 5 7.5k

d5 4 28 diod2
d1 1 28 diod1
d4 2 0 diod1
d3 3 2 diod1
d2 1 3 diod1
.ends dioload

* subckt lump - one RLC lump of the lossy line

*10 segments per inch
.subckt lump 1 2
*r1 1 3 0.02
*c1 3 0 0.365pF
*l1 3 2 0.913nH

l1 1 3 0.913nH
c1 2 0 0.365pF
r1 3 2 0.02

*r1 1 3 0.01
*c1 3 0 0.1825pF
*l1 3 4 0.4565nH
*r2 4 5 0.01
*c2 5 0 0.1825pF
*l2 5 2 0.4565nH

*c1 1 0 0.365pF
*l1 1 2 0.913nH
.ends lump

.subckt oneinch 1 2
x1 1 3 lump
x2 3 4 lump
x3 4 5 lump
x4 5 6 lump
x5 6 7 lump
x6 7 8 lump
x7 8 9 lump
x8 9 10 lump
x9 10 11 lump
x10 11 2 lump
.ends oneinch

.subckt fourinch 1 2
x1 1 3 oneinch
x2 3 4 oneinch
x3 4 5 oneinch
x4 5 2 oneinch
.ends fourinch

.subckt fiveinch 1 2
x1 1 3 oneinch
x2 3 4 oneinch
x3 4 5 oneinch
x4 5 6 oneinch
x5 6 2 oneinch
.ends fiveinch

.subckt twentyfourinch 1 2
x1 1 3 fiveinch
x2 3 4 fiveinch
x3 4 5 fiveinch
x4 5 6 fiveinch
x5 6 2 fourinch
.ends twentyfourinch

*modelling using R and lossless lines
*5 segments per inch
.model llfifth ltra nocontrol noprint rel=10 r=0 g=0 l=9.13e-9
+c=3.65e-12 len=0.2 steplimit quadinterp
.subckt xlump 1 2 
o1 1 0 3 0 llfifth
r1 2 3 0.04
.ends xlump

.subckt xoneinch 1 2
x1 1 3 xlump
x2 3 4 xlump
x3 4 5 xlump
x4 5 6 xlump
x5 6 2 xlump
*x5 6 7 xlump
*x6 7 8 xlump
*x7 8 9 xlump
*x8 9 10 xlump
*x9 10 11 xlump
*x10 11 2 xlump
.ends xoneinch

.subckt xfourinch 1 2
x1 1 3 xoneinch
x2 3 4 xoneinch
x3 4 5 xoneinch
x4 5 2 xoneinch
.ends xfourinch

.subckt xfiveinch 1 2
x1 1 3 xoneinch
x2 3 4 xoneinch
x3 4 5 xoneinch
x4 5 6 xoneinch
x5 6 2 xoneinch
.ends xfiveinch

.subckt xtwentyfourinch 1 2
x1 1 3 xfiveinch
x2 3 4 xfiveinch
x3 4 5 xfiveinch
x4 5 6 xfiveinch
x5 6 2 xfourinch
.ends xtwentyfourinch
Known-marginal vs the oracle XFAIL · Transient Analysis

the dioload diode string either rings or not depending on last-ulp differences (libm, faer SIMD LU): arm64 PASSes at 0.037, x86_64 rings and lands at 9.1 (worst v(3); 4.7 before D-0041's reported iterate moved the ringing branch) - D-0022 | companion regress/ltra_1_gear (same deck, method=gear, TMAX=0.02ns) PASSes at 0.09 - the trap ring does not converge with the step (arm64: PASS at 0.05/0.02ns, FAIL 7.8 at 0.01ns)

Transient Analysis
0 V1 V2 V3 V4 V5 V6 V0 s10 ns20 ns30 ns40 ns50 ns60 nsv(1)v(x1.22)v(x1.18)v(x1.13)v(x1.16)v(x1.21)
v(1)v(x1.22)v(x1.18)v(x1.13)v(x1.16)v(x1.21)(+30 more vectors)
  • model `llfifth`: unrecognized parameter (noprint) - ignored
  • d.x1.d1: breakdown current increased to 6.340e-2 to resolve incompatibility with specified saturation current
  • warning: no .end card

Example 3 for interconnect simulation

corpus/spice3f5/examples/ltra_2.cir.tran#
ltra_2.cir
 	Example 3 for interconnect simulation

* From neug1, Mosaic aluminum lines. 2um thick, 11um wide. Assuming
* 10um above the ground.
* Material: aluminum; resistivity (sigma) = 2.74uohm-cm = 2.74e-8 ohm-m 
* Dielectric: SiO2, dielectric constant (epsilon) =3.7 
* epsilon0 = 8.85e-12 MKS units
* mu0 = 4e-7*PI
* speed of light in free space = 1/sqrt(mu0*epsilon0) = 2.9986e8 MKS units
*
*  Line parameter calculations:
*  capacitance: parallel plate
*  C = epsilon*epsilon0 * A / l
*  C = 3.7*8.85e-12 * 11e-6 * 1(metre) / 10e-6 = 36.02e-12 F/m
*    + 30% = 46.8e-12 F/m = 0.468pF/cm
*
*  C_freespace = 46.8e-12/epsilon = 12.65e-12 F/m
*  speed of light in free space v0 = 2.9986e8 = 1/sqrt(L0*C0)
*  => L0 = 1/C0*v0^2
*  L0 = 1/(12.65e-12 * 8.9916e16) = 1/113.74e4 = 0.008792e-4 H/m
*    = 0.8792 uH/m = 8.792nH/cm
*  
*  R = sigma * l / A = 2.74e-8 * 1 / (11e-6*2e-6) = 1245.45 ohms/m
*    = 12.45ohms/cm
*
*  transmission line parameters:
*  	nominal z0 = sqrt(L/C) = 137 ohms
*	td = sqrt(LC) = 64.14e-12 secs/cm = 0.064ns/cm
*
*


vcc vcc 0 5
*v1 1 0 0v pulse(0 5 1ns 0.1ns 0.1ns 5ns 100ns)
v1 1 0 0v pulse(0 5 0.1ns 0.1ns 0.1ns 1ns 100ns)
rs 1 2 10
*xdrv 1 2 vcc bjtdrvr
*xrcv 3 4 vcc bjtdrvr
*xrcv 3 4 vcc dioload
d1 3 vcc diod
d2 0 3 diod
*cl 3 0 1pF
*o1 2 0 3 0 lline
x1 2 3 sixteencm
*x1 2 3 xonecm

.model diod d
.model lline ltra rel=1.8 r=12.45 g=0 l=8.792e-9 c=0.468e-12 len=16 steplimit

* 1cm
* 2cm
* 4cm
* 6cm
* 8cm
* 10cm
* 12cm
*.tran 0.001ns 15ns 0 0.1ns
* 24cm
.tran 0.001ns 10ns 0 0.1ns
* onecm10
*.tran 0.001ns 10ns 0 0.01ns


* 1. define the subckt r10 to be one tenth of the resistance per cm.
* 2. define the subckt onecm to be one of onecm10 (modelled using
* 10 segments), onecm8, onecm4, onecm2 and lump1. Then use
* the subckts onecm, fourcm, fivecm, tencm, twelvecm,
* twentyfourcm in the circuit. The line is modelled as rlc segments.
* 3. define the subckt xonecm to be one of xonecm10, xonecm8,
* xonecm4, xonecm2 and xlump1. Use the subckts xonecm,
* xfourcm, xfivecm, xtencm, xtwelvecm, xtwentyfourcm in the
* circuit. The line will be modelled as r-lossless lumps.

.subckt xonecm 1 2
*x1 1 2 xlump1
x1 1 2 xonecm4
.ends xonecm

.subckt onecm 1 2
*x1 1 2 lump1
x1 1 2 onecm4
.ends onecm

.subckt r10 1 2
r1 1 2 1.245
.ends r10

* ECL driver and diode receiver models - from Raytheon

.model qmodn npn(bf=100 rb=100 cje=0.09375pF cjc=0.28125pF is=1e-12
+pe=0.5 pc=0.5)

.model qmodpd npn(bf=100 rb=100 cje=0.08187pF cjc=0.2525pF is=1e-12
+pe=0.5 pc=0.5)
*.model qmodpdmine npn(bf=100 rb=100  cje=0.08187pF cjc=0.15pF is=1e-12
.model qmodpdmine npn(bf=100 rb=100  cje=0.08187pF cjc=0.05pF is=1e-12
+pe=0.5 pc=0.5)

.model dmod1 d(n=2.25 is=1.6399e-4 bv=10)

.model dmod2 d

.model dmod d(vj=0.3v)

*.model diod1 d(1.0 tt=0.75ns vj=0.6 rs=909 bv=10)
.model diod1 d(tt=0.75ns vj=0.6 rs=909 bv=10)

*.model diod2 d(1.0 tt=0.5ns vj=0.3 rs=100 bv=10)
.model diod2 d(tt=0.5ns vj=0.3 rs=100 bv=10)

* bjt driver - 19=input, 268=output, 20=vcc; wierd node numbers from 
* the Raytheon file

.subckt bjtdrvr 19 268 20
q1 22 18 13 qmodn
q2 18 16 13 qmodn
qd2 21 9 0 qmodn
q4 14 14 0 qmodn
q3 16 15 14 qmodpd
q5 8 13 17 qmodn
q6 25 12 0 qmodn
q7 6 17 0 qmodpd
qd1 26 10 0 qmodn
q8 7 11 10 qmodn
q10 268 17 0 qmodpdmine
*q10 268 17 0 qmodpd
q9 7 10 268 qmodn

d1 0 19 dmod1
d2 18 19 dmod2
d3 13 19 dmod
dq1 18 22 dmod
dq2 16 18 dmod
d502 9 21 dmod
dq3 15 16 dmod
d10 24 8 dmod
d4 15 6 dmod
dq6 12 25 dmod
dq7 17 6 dmod
dd1 17 10 dmod
d7 11 6 dmod
dd2 17 26 dmod
d9 23 6 dmod
dq8 11 7 dmod
d501 17 268 dmod
dq9 10 7 dmod
d14 20 27 dmod
d8 0 268 dmod

r1 18 20 6k
r2 22 20 2.2k
r4 0 13 7k
rd1 9 13 2k
rd2 21 13 3k
r3 16 20 10k
r5 15 20 15k
r9 0 17 4k
r6 24 20 750
r10 12 17 2k
r12 24 11 1.5k
r11 25 17 3k
r15 23 20 10k
r13 0 10 15k
r14 7 27 12

.ends bjtdrvr

* subckt dioload - diode load: input=28, output=4, vcc=5

.subckt dioload 28 4 5
c1 28 0 5pF
r503 0 4 5.55
r4 0 28 120k
r5 1 5 7.5k

d5 4 28 diod2
d1 1 28 diod1
d4 2 0 diod1
d3 3 2 diod1
d2 1 3 diod1
.ends dioload

* End ECL driver and Diode receiver models from Raytheon

*10 segments per cm
.subckt lump10 1 2
l1 1 3 0.0.8792nH
c1 2 0 0.0468pF
x1 3 2 r10
.ends lump10

*1 segment per cm
.subckt lump1 1 2
l1 1 3 8.792nH
c1 2 0 0.468pF
x1 3 4 r10
x2 4 5 r10
x3 5 6 r10
x4 6 7 r10
x5 7 8 r10
x6 8 9 r10
x7 9 10 r10
x8 10 11 r10
x9 11 12 r10
x10 12 2 r10
.ends lump1

*2 segments per cm
.subckt lump2 1 2
l1 1 3 4.396nH
c1 2 0 0.234pF
x1 3 4 r10
x2 4 5 r10
x3 5 6 r10
x4 6 7 r10
x5 7 2 r10
.ends lump2

*4 segments per cm
.subckt lump4 1 2
l1 1 3 2.198nH
c1 2 0 0.117pF
x1 3 4 r10
x2 4 5 r10
x3 5 2 r10
x4 5 2 r10
.ends lump4

*8 segments per cm
.subckt lump8 1 2
l1 1 3 1.099nH
c1 2 0 0.0585pF
x1 3 4 r10
x2 4 2 r10
x3 4 2 r10
x4 4 2 r10
x5 4 2 r10
.ends lump8

.subckt onecm10 1 2
x1 1 3 lump10
x2 3 4 lump10
x3 4 5 lump10
x4 5 6 lump10
x5 6 7 lump10
x6 7 8 lump10
x7 8 9 lump10
x8 9 10 lump10
x9 10 11 lump10
x10 11 2 lump10
.ends onecm10

.subckt onecm8 1 2
x1 1 3 lump8
x2 3 4 lump8
x3 4 5 lump8
x4 5 6 lump8
x5 6 7 lump8
x6 7 8 lump8
x7 8 9 lump8
x8 9 2 lump8
.ends onecm8

.subckt onecm4 1 2
x1 1 3 lump4
x2 3 4 lump4
x3 4 5 lump4
x4 5 2 lump4
.ends onecm4

.subckt onecm2 1 2
x1 1 3 lump2
x2 3 2 lump2
.ends onecm2

.subckt twocm 1 2
x1 1 3 onecm
x2 3 2 onecm
.ends twocm

.subckt threecm 1 2
x1 1 3 onecm
x2 3 4 onecm
x3 4 2 onecm
.ends threecm

.subckt fourcm 1 2
x1 1 3 onecm
x2 3 4 onecm
x3 4 5 onecm
x4 5 2 onecm
.ends fourcm

.subckt fivecm 1 2
x1 1 3 onecm
x2 3 4 onecm
x3 4 5 onecm
x4 5 6 onecm
x5 6 2 onecm
.ends fivecm

.subckt sixcm 1 2
x1 1 3 fivecm
x2 3 2 onecm
.ends sixcm

.subckt sevencm 1 2
x1 1 3 sixcm
x2 3 2 onecm
.ends sevencm

.subckt eightcm 1 2
x1 1 3 sevencm
x2 3 2 onecm
.ends eightcm

.subckt ninecm 1 2
x1 1 3 eightcm
x2 3 2 onecm
.ends ninecm

.subckt tencm 1 2
x1 1 3 fivecm
x2 3 2 fivecm
.ends tencm

.subckt elevencm 1 2
x1 1 3 tencm
x2 3 2 onecm
.ends elevencm

.subckt twelvecm 1 2
x1 1 3 tencm
x2 3 4 onecm
x3 4 2 onecm
.ends twelvecm

.subckt sixteencm 1 2
x1 1 3 eightcm
x2 3 2 eightcm
.ends sixteencm

.subckt twentyfourcm 1 2
x1 1 3 twelvecm
x2 3 2 twelvecm
.ends twentyfourcm


*modelling using R and lossless lines
* 10 segments per cm
.model lless10 ltra nocontrol rel=10 r=0 g=0 l=8.792e-9
+c=0.468e-12 len=0.1 steplimit quadinterp

* 8 segments per cm
.model lless8 ltra nocontrol rel=10 r=0 g=0 l=8.792e-9
+c=0.468e-12 len=0.125 steplimit quadinterp

* 4 segments per cm
.model lless4 ltra nocontrol rel=10 r=0 g=0 l=8.792e-9
+c=0.468e-12 len=0.25 steplimit quadinterp

* 2 segments per cm
.model lless2 ltra nocontrol rel=10 r=0 g=0 l=8.792e-9
+c=0.468e-12 len=0.5 steplimit quadinterp

* 1 segment per cm
.model lless1 ltra nocontrol rel=10 r=0 g=0 l=8.792e-9
+c=0.468e-12 len=1 steplimit quadinterp

*10 segments per cm
.subckt xlump10 1 2
o1 1 0 3 0 lless10
x1 3 2 r10
.ends xlump10

*1 segment per cm
.subckt xlump1 1 2
o1 1 0 3 0 lless1
x1 3 4 r10
x2 4 5 r10
x3 5 6 r10
x4 6 7 r10
x5 7 8 r10
x6 8 9 r10
x7 9 10 r10
x8 10 11 r10
x9 11 12 r10
x10 12 2 r10
.ends xlump1

*2 segments per cm
.subckt xlump2 1 2
o1 1 0 3 0 lless2
x1 3 4 r10
x2 4 5 r10
x3 5 6 r10
x4 6 7 r10
x5 7 2 r10
.ends xlump2

*4 segments per cm
.subckt xlump4 1 2
o1 1 0 3 0 lless4
x1 3 4 r10
x2 4 5 r10
x3 5 2 r10
x4 5 2 r10
.ends xlump4

*8 segments per cm
.subckt xlump8 1 2
o1 1 0 3 0 lless8
x1 3 4 r10
x2 4 2 r10
x3 4 2 r10
x4 4 2 r10
x5 4 2 r10
.ends xlump8

.subckt xonecm10 1 2
x1 1 3 xlump10
x2 3 4 xlump10
x3 4 5 xlump10
x4 5 6 xlump10
x5 6 7 xlump10
x6 7 8 xlump10
x7 8 9 xlump10
x8 9 10 xlump10
x9 10 11 xlump10
x10 11 2 xlump10
.ends xonecm10

.subckt xonecm8 1 2
x1 1 3 xlump8
x2 3 4 xlump8
x3 4 5 xlump8
x4 5 6 xlump8
x5 6 7 xlump8
x6 7 8 xlump8
x7 8 9 xlump8
x8 9 2 xlump8
.ends xonecm8

.subckt xonecm4 1 2
x1 1 3 xlump4
x2 3 4 xlump4
x3 4 5 xlump4
x4 5 2 xlump4
.ends xonecm4

.subckt xonecm2 1 2
x1 1 3 xlump2
x2 3 2 xlump2
.ends xonecm2


.subckt xtwocm 1 2
x1 1 3 xonecm
x2 3 2 xonecm
.ends xtwocm

.subckt xthreecm 1 2
x1 1 3 xonecm
x2 3 4 xonecm
x3 4 2 xonecm
.ends xthreecm

.subckt xfourcm 1 2
x1 1 3 xonecm
x2 3 4 xonecm
x3 4 5 xonecm
x4 5 2 xonecm
.ends xfourcm

.subckt xfivecm 1 2
x1 1 3 xonecm
x2 3 4 xonecm
x3 4 5 xonecm
x4 5 6 xonecm
x5 6 2 xonecm
.ends xfivecm

.subckt xsixcm 1 2
x1 1 3 xfivecm
x2 3 2 xonecm
.ends xsixcm

.subckt xsevencm 1 2
x1 1 3 xsixcm
x2 3 2 xonecm
.ends xsevencm

.subckt xeightcm 1 2
x1 1 3 xsevencm
x2 3 2 xonecm
.ends xeightcm

.subckt xninecm 1 2
x1 1 3 xeightcm
x2 3 2 xonecm
.ends xninecm

.subckt xtencm 1 2
x1 1 3 xfivecm
x2 3 2 xfivecm
.ends xtencm

.subckt xelevencm 1 2
x1 1 3 xtencm
x2 3 2 xonecm
.ends xelevencm

.subckt xtwelvecm 1 2
x1 1 3 xtencm
x2 3 4 xonecm
x3 4 2 xonecm
.ends xtwelvecm

.subckt xsixteencm 1 2
x1 1 3 xeightcm
x2 3 2 xeightcm
.ends xsixteencm

.subckt xtwentyfourcm 1 2
x1 1 3 xtwelvecm
x2 3 2 xtwelvecm
.ends xtwentyfourcm
Transient Analysis
-1 V0 V1 V2 V3 V4 V5 V6 V0 s2 ns4 ns6 ns8 ns10 nsv(1)v(2)v(3)v(x1.x1.x1.x1.x1.x1.x1.x1.3)v(x1.x1.x1.x1.x1.x1.x1.3)v(x1.x1.x1.x1.x1.x1.x1.x1.4)
v(1)v(2)v(3)v(x1.x1.x1.x1.x1.x1.x1.x1.3)v(x1.x1.x1.x1.x1.x1.x1.3)v(x1.x1.x1.x1.x1.x1.x1.x1.4)(+319 more vectors)
  • warning: no .end card

BJTdriver -- 2in st. lin -- 20in coupled line -- 2in st line -- DiodeCircuit

corpus/spice3f5/examples/ltra_3.cir.tran#
ltra_3.cir
   BJTdriver -- 2in st. lin -- 20in coupled line -- 2in st line -- DiodeCircuit

* This unclassified circuit is from Raytheon, courtesy Gerry Marino.
* 
*                                      _______
* -------- 2in  _________________ 2in  |     |
* | BJT  |______|               |______|Diode|
* |      |------|               |------|     |
* | Drvr | line |   2-wire      | line |rcvr.|
* --------      |   coupled     |      |_____|
*               |  transmission |
* |-/\/\/\/\----|   line        |-------\/\/\/\/\----|
* |  50ohms     |               |         50ohms     |
* |             |               |                    |
* Ground        -----------------                   Ground
*                      
*
* Each inch of the lossy line is modelled by 10 LRC lumps in the 
* Raytheon model.

* The line parameters (derived from the Raytheon input file) are:
* L = 9.13nH per inch
* C = 3.65pF per inch
* R = 0.2 ohms per inch
* K = 0.482 [coupling coefficient; K = M/sqrt(L1*L2)]
* Cc = 1.8pF per inch
*
* coupled ltra model generated  using the standalone program
* multi_decomp

* the circuit
*tran 0.1ns 60ns

v1 1 0 0v pulse(0 4 1ns 1ns 1ns 20ns 40ns)
*v1 1 0 4v pulse(4 0 1ns 1ns 1ns 20ns 40ns)
vcc 10 0 5v

* series termination
*x1 1 oof 10 bjtdrvr
*rseries oof 2 50

x1 1 2 10 bjtdrvr
rt1 3 0 50


* convolution model
x2 2 3 4 5 conv2wetcmodel

* rlc segments model
*x2 2 3 4 5 rlc2wetcmodel

x3 4 dioload
rt2 5 0 50



*.model qmodn npn(bf=100 rb=100 cje=0.09375pF cjc=0.28125pF is=1e-12
*+pe=0.5 pc=0.5)
.model qmodn npn(bf=100 rb=100 cje=0.09375pF cjc=0.28125pF is=1e-12
+pe=0.5 pc=0.5)

.model qmodpd npn(bf=100 rb=100 cje=0.08187pF cjc=0.2525pF is=1e-12
+pe=0.5 pc=0.5)
*.model qmodpd npn(bf=100 rb=100  cje=0.08187pF cjc=0.15pF is=1e-12
.model qmodpdmine npn(bf=100 rb=100  cje=0.08187pF cjc=0.05pF is=1e-12
+pe=0.5 pc=0.5)

.model dmod1 d(n=2.25 is=1.6399e-4 bv=10)
*.model dmod1 d

.model dmod2 d

.model dmod d(vj=0.3v)

*.model diod1 d(1.0 tt=0.75ns vj=0.6 rs=909 bv=10)
.model diod1 d(tt=0.75ns vj=0.6 rs=909 bv=10)

*.model diod2 d(1.0 tt=0.5ns vj=0.3 rs=100 bv=10)
.model diod2 d(tt=0.5ns vj=0.3 rs=100 bv=10)

.options itl5=0 acct reltol=1e-3 abstol=1e-12
.tran 0.1ns 60ns


*.tran 1e-9 1e-8

* bjt driver - 19=input, 268=output, 20=vcc; wierd node numbers from 
* the Raytheon file

.subckt bjtdrvr 19 268 20
q1 22 18 13 qmodn
q2 18 16 13 qmodn
qd2 21 9 0 qmodn
q4 14 14 0 qmodn
q3 16 15 14 qmodpd
q5 8 13 17 qmodn
q6 25 12 0 qmodn
q7 6 17 0 qmodpd
qd1 26 10 0 qmodn
q8 7 11 10 qmodn
*q10 268 17 0 qmodpd
q10 268 17 0 qmodpdmine
q9 7 10 268 qmodn

d1 0 19 dmod1
d2 18 19 dmod2
d3 13 19 dmod
dq1 18 22 dmod
dq2 16 18 dmod
d502 9 21 dmod
dq3 15 16 dmod
d10 24 8 dmod
d4 15 6 dmod
dq6 12 25 dmod
dq7 17 6 dmod
dd1 17 10 dmod
d7 11 6 dmod
dd2 17 26 dmod
d9 23 6 dmod
dq8 11 7 dmod
d501 17 268 dmod
dq9 10 7 dmod
d14 20 27 dmod
d8 0 268 dmod

r1 18 20 6k
r2 22 20 2.2k
r4 0 13 7k
rd1 9 13 2k
rd2 21 13 3k
r3 16 20 10k
r5 15 20 15k
r9 0 17 4k
r6 24 20 750
r10 12 17 2k
r12 24 11 1.5k
r11 25 17 3k
r15 23 20 10k
r13 0 10 15k
r14 7 27 12

.ends bjtdrvr

* subckt dioload - diode load: input=28, output=4, vcc=5

.subckt dioload 28
*comment out everything in dioload except d5 and r503, and watch
* the difference in results obtained between a tran 0.1ns 20ns and
* a tran 0.01ns 20ns
vccint 5 0 5v

c1 28 0 5pF
r503 0 4 5.55
r4 0 28 120k
r5 1 5 7.5k

d5 4 28 diod2
d1 1 28 diod1
d4 2 0 diod1
d3 3 2 diod1
d2 1 3 diod1
.ends dioload

* subckt rlclump - one RLC lump of the lossy line

.subckt rlclump 1 2
*r1 1 3 0.02
*c1 3 0 0.365pF
*l1 3 2 0.913nH

l1 1 3 0.913nH
c1 2 0 0.365pF
r1 3 2 0.02

*r1 1 3 0.01
*c1 3 0 0.1825pF
*l1 3 4 0.4565nH
*r2 4 5 0.01
*c2 5 0 0.1825pF
*l2 5 2 0.4565nH

*c1 1 0 0.365pF
*l1 1 2 0.913nH
.ends lump

.subckt rlconeinch 1 2
x1 1 3 rlclump
x2 3 4 rlclump
x3 4 5 rlclump
x4 5 6 rlclump
x5 6 7 rlclump
x6 7 8 rlclump
x7 8 9 rlclump
x8 9 10 rlclump
x9 10 11 rlclump
x10 11 2 rlclump
.ends rlconeinch

.subckt rlctwoinch 1 2
x1 1 3 rlconeinch
x2 3 2 rlconeinch
.ends rlctwoinch

.subckt rlcfourinch 1 2
x1 1 3 rlconeinch
x2 3 4 rlconeinch
x3 4 5 rlconeinch
x4 5 2 rlconeinch
.ends rlcfourinch

.subckt rlcfiveinch 1 2
x1 1 3 rlconeinch
x2 3 4 rlconeinch
x3 4 5 rlconeinch
x4 5 6 rlconeinch
x5 6 2 rlconeinch
.ends rlcfiveinch

.subckt rlctwentyrlcfourinch 1 2
x1 1 3 rlcfiveinch
x2 3 4 rlcfiveinch
x3 4 5 rlcfiveinch
x4 5 6 rlcfiveinch
x5 6 2 rlcfourinch
.ends rlctwentyrlcfourinch

.subckt rlclumpstub A B C D
x1 A int1 rlcfiveinch
x2 int1 int2 rlcfiveinch
x3 int2 1 rlcfiveinch
x4 1 2 rlcfourinch
x5 1 int3 rlcfiveinch
x6 int3 B rlconeinch
x7 2 C rlcfiveinch
x8 2 D rlcfourinch
.ends rlclumpstub

.subckt ltrastub A B C D
o1 A 0 1 0 lline15in
o2 1 0 B 0 lline6in
o3 1 0 2 0 lline4in
o4 2 0 C 0 lline5in
o5 2 0 D 0 lline4in
.ends ltrastub

*modelling using R and lossless lines

*5 segments per inch
.model llfifth ltra nocontrol rel=10 r=0 g=0 l=9.13e-9
+c=3.65e-12 len=0.2 steplimit quadinterp

.subckt xlump 1 2 
o1 1 0 3 0 llfifth
r1 2 3 0.04
.ends xlump

.subckt xoneinch 1 2
x1 1 3 xlump
x2 3 4 xlump
x3 4 5 xlump
x4 5 6 xlump
x5 6 2 xlump
*x5 6 7 xlump
*x6 7 8 xlump
*x7 8 9 xlump
*x8 9 10 xlump
*x9 10 11 xlump
*x10 11 2 xlump
.ends xoneinch

.subckt xFourinch 1 2
x1 1 3 xoneinch
x2 3 4 xoneinch
x3 4 5 xoneinch
x4 5 2 xoneinch
.ends xfourinch

.subckt xfiveinch 1 2
x1 1 3 xoneinch
x2 3 4 xoneinch
x3 4 5 xoneinch
x4 5 6 xoneinch
x5 6 2 xoneinch
.ends xfiveinch

.subckt xlumpstub A B C D
x1 A int1 xfiveinch
x2 int1 int2 xfiveinch
x3 int2 1 xfiveinch
x4 1 2 xfourinch
x5 1 int3 xfiveinch
x6 int3 B xoneinch
x7 2 C xfiveinch
x8 2 D xfourinch
.ends xlumpstub

* modelling a 2 wire coupled system using RLC lumps
* 10 segments per inch
*
* 1---xxxxx----2
* 3---xxxxx----4

.subckt rlc2wlump 1 3 2 4
l1 1 5 0.913nH
c1 2 0 0.365pF
r1 5 2 0.02
l2 3 6 0.913nH
c2 4 0 0.365pF
r2 6 4 0.02
cmut 2 4 0.18pF
k12 l1 l2 0.482
.ends rlc2wlump

.subckt rlc2woneinch 1 2 3 4
x1 1 2 5 6 rlc2wlump
x2 5 6 7 8  rlc2wlump
x3 7 8 9 10 rlc2wlump
x4 9 10 11 12 rlc2wlump
x5 11 12 13 14 rlc2wlump
x6 13 14 15 16 rlc2wlump
x7 15 16 17 18 rlc2wlump
x8 17 18 19 20 rlc2wlump
x9 19 20 21 22 rlc2wlump
x10 21 22 3 4 rlc2wlump
.ends rlc2woneinch

.subckt rlc2wfiveinch 1 2 3 4
x1 1 2 5 6 rlc2woneinch
x2 5 6 7 8 rlc2woneinch
x3 7 8 9 10 rlc2woneinch
x4 9 10 11 12 rlc2woneinch
x5 11 12 3 4 rlc2woneinch
.ends rlc2wfiveinch

.subckt rlc2wtwentyinch 1 2 3 4
x1 1 2 5 6 rlc2wfiveinch
x2 5 6 7 8 rlc2wfiveinch
x3 7 8 9 10 rlc2wfiveinch
x4 9 10 3 4 rlc2wfiveinch
.ends rlc2wtwentyinch

.subckt rlc2wetcmodel 1 2 3 4
x1 1 5 rlctwoinch
x2 5 2 6 4 rlc2wtwentyinch
x3 6 3 rlctwoinch
.ends rlc2wetcmodel

* Subcircuit conv2wtwentyinch
* conv2wtwentyinch is a subcircuit that models a 2-conductor transmission line with
* the following parameters: l=9.13e-09, c=3.65e-12, r=0.2, g=0,
* inductive_coeff_of_coupling k=0.482, inter-line capacitance cm=1.8e-12,
* length=20. Derived parameters are: lm=4.40066e-09, ctot=5.45e-12.
* 
* It is important to note that the model is a simplified one - the
* following assumptions are made: 1. The self-inductance l, the
* self-capacitance ctot (note: not c), the series resistance r and the
* parallel capacitance g are the same for all lines, and 2. Each line
* is coupled only to the two lines adjacent to it, with the same
* coupling parameters cm and lm. The first assumption imply that edge
* effects have to be neglected. The utility of these assumptions is
* that they make the sL+R and sC+G matrices symmetric, tridiagonal and
* Toeplitz, with useful consequences.
* 
* It may be noted that a symmetric two-conductor line will be
* accurately represented by this model.

* Lossy line models
.model mod1_conv2wtwentyinch ltra rel=1.2 nocontrol r=0.2 l=4.72933999088e-09 g=0 c=7.25000000373e-12 len=20
.model mod2_conv2wtwentyinch ltra rel=1.2 nocontrol r=0.2 l=1.35306599818e-08 g=0 c=3.65000000746e-12 len=20

* subcircuit m_conv2wtwentyinch - modal transformation network for conv2wtwentyinch
.subckt m_conv2wtwentyinch 1 2 3 4
v1 5 0 0v
v2 6 0 0v
f1 0 3 v1 0.707106779721
f2 0 3 v2 -0.707106782652
f3 0 4 v1 0.707106781919
f4 0 4 v2 0.707106780454
e1 7 5 3 0 0.707106780454
e2 1 7 4 0 0.707106782652
e3 8 6 3 0 -0.707106781919
e4 2 8 4 0 0.707106779721
.ends m_conv2wtwentyinch

* Subckt conv2wtwentyinch
.subckt conv2wtwentyinch 1 2 3 4
x1 1 2 5 6 m_conv2wtwentyinch
o1 5 0 7 0 mod1_conv2wtwentyinch
o2 6 0 8 0 mod2_conv2wtwentyinch
x2 3 4 7 8 m_conv2wtwentyinch
.ends conv2wtwentyinch

.model convtwoinch ltra r=0.2 l=9.13e-9 c=3.65e-12 len=2.0 rel=1.2 nocontrol
.subckt conv2wetcmodel 1 2 3 4
o1 1 0 5 0 convtwoinch
x1 5 2 6 4 conv2wtwentyinch
o2 6 0 3 0 convtwoinch
.ends conv2wetcmodel
Known-marginal vs the oracle XFAIL · Transient Analysis

trap ringing in the dioload diode string (x3.1-x3.4: rs + diffusion charge, no cjo): ngspice's golden rings period-2 for whole intervals while Dune's Newton gives up mid-ring at 8.49ns and the order-1 restart damps it; ngspice's own TMAX=0.01ns rerun differs from its default-step golden by 26.9x the allowance on v(x3.2). Without the x3.* vectors the deck passes at 0.42 (line currents worst), and at TMAX=0.01ns Dune's LTRA matches ngspice's to 1.2e-3 V on v(5). Bistable across platforms (D-0022): on x86_64 the ring plus ltraacct.c's slope-breakpoint rule self-sustains a breakpoint cascade (22k breakpoints by 12.75ns, 1e-15s steps, O(n) convolution each) that only Dune's transient step budget stops | companion regress/ltra_3_gear (same deck, method=gear, TMAX=0.02ns) PASSes at 0.07, x3.* nodes included

Transient Analysis
0 V1 V2 V3 V4 V5 V6 V0 s10 ns20 ns30 ns40 ns50 ns60 nsv(1)v(x1.22)v(x1.18)v(x1.13)v(x1.16)v(x1.21)
v(1)v(x1.22)v(x1.18)v(x1.13)v(x1.16)v(x1.21)(+62 more vectors)
  • d.x1.d1: breakdown current increased to 6.340e-2 to resolve incompatibility with specified saturation current
  • warning: .ends lump closes .subckt rlclump
  • warning: no .end card

*** NDINV * 4

corpus/spice3f5/examples/mos6inv.cir.tran#
mos6inv.cir
*** NDINV * 4
XNDINV1 1 11 12 13 2 100 NDINV
XNDINV2 2 21 22 23 3 100 NDINV
XNDINV3 3 31 32 33 4 100 NDINV
XNDINV4 4 41 42 43 5 100 NDINV

.SUBCKT NDINV 10 11 21 31 41 100
MP11  11 100 100 100   P12L5   L=1.2U W=5U
MP12  11 100 100 100   P12L5   L=1.2U W=5U
MP13  11 100 100 100   P12L5   L=1.2U W=5U
MP14  11  10 100 100   P12L5   L=1.2U W=5U
MN11  11 100  12   0   N10L5   L=1.0U W=5U
MN12  12 100  13   0   N10L5   L=1.0U W=5U
MN13  13 100  14   0   N10L5   L=1.0U W=5U
MN14  14  10   0   0   N10L5   L=1.0U W=5U

MP21  23   0 100 100   P12L5   L=1.2U W=20U
MP22  22  11  23 100   P12L5   L=1.2U W=20U
MP23  21   0  22 100   P12L5   L=1.2U W=20U
MN21  21   0   0   0   N10L5   L=1.0U W=5U
MN22  21  11   0   0   N10L5   L=1.0U W=5U
MN23  21   0   0   0   N10L5   L=1.0U W=5U

MP31  31  21 100 100   P12L5   L=1.2U W=10U
MP32  31 100 100 100   P12L5   L=1.2U W=10U
MN31  31  21  32   0   N10L5   L=1.0U W=5U
MN32  32 100   0   0   N10L5   L=1.0U W=5U

MP41  41  31 100 100   P12L5   L=1.2U W=10U
MN41  41  31   0   0   N10L5   L=1.0U W=5U

C11   11   0  1P
C21   21   0  1P
C31   31   0  1P
C41   41   0  1P
.ENDS

VDD 100    0  5
VIN  1    0  DC 0 PWL(0 0 2N 5)

.TRAN 0.5N 150N
.PRINT TRAN V(1) V(2) V(3) V(4) V(5)
.PRINT TRAN V(11) V(12) V(13) V(41) V(42) V(43)
.OPTIONS ACCT

**** LEVEL 1 NMOS ****
.MODEL N10L1 NMOS
+ LEVEL=1 TPG=1
+ KP=2.33082E-05
+ LAMBDA=0.013333 VT0=0.69486 GAMMA=0.60309 PHI=1
+ TOX=1.9800000E-08  XJ=0.2U            LD=0.1U           NSUB=4.9999999E+16
+ NSS=0.0000000E+00
+ CJ=4.091E-4        MJ=0.307           PB=1.0
+ CJSW=3.078E-10     MJSW=1.0E-2        
+ CGSO=3.93E-10      CGDO=3.93E-10
**** LEVEL 1 PMOS ****
.MODEL P12L1 PMOS
+ LEVEL=1 TPG=-1
+ KP=7.69968E-06
+ LAMBDA=0.018966 VT0=-0.60865 GAMMA=0.89213 PHI=1
+ TOX=1.9800000E-08  XJ=0.4U            LD=0.28U           NSUB=4.9999999E+17
+ NSS=0.0000000E+00
+ CJ=6.852E-4        MJ=0.429           PB=1.0
+ CJSW=5.217E-10     MJSW=0.351
+ CGSO=7.29E-10      CGDO=7.29E-10
**** LEVEL 3 NMOS ****
.MODEL  N10L3  NMOS
+ LEVEL=3            TPG=+1
+ GAMMA=1.140501     THETA=0.8109787    KAPPA=0.1579183    ETA=5.0622310E-02
+ DELTA=0.000000E+00 UO=812.5126        VMAX=1186662.      VTO=0.8
+ TOX=1.9800000E-08  XJ=0.2U            LD=0.1U            NSUB=4.9999999E+16
+ NSS=0.0000000E+00
+ CJ=4.091E-4        MJ=0.307           PB=1.0
+ CJSW=3.078E-10     MJSW=1.0E-2        
+ CGSO=3.93E-10      CGDO=3.93E-10
**** LEVEL 3 PMOS ****
.MODEL  P12L3  PMOS
+ LEVEL=3            TPG=-1
+ GAMMA=1.211640     THETA=0.1184638    KAPPA=0.2162577    ETA=2.7580135E-02
+ DELTA=0.000000E+00 UO=89.16160        VMAX=5.9000000E+07 VTO=-0.8
+ TOX=1.9800000E-08  XJ=0.4U            LD=0.28U           NSUB=4.9999999E+17
+ NSS=0.0000000E+00
+ CJ=6.852E-4        MJ=0.429           PB=1.0
+ CJSW=5.217E-10     MJSW=0.351
+ CGSO=7.29E-10      CGDO=7.29E-10
**** LEVEL 6 NMOS ****
.MODEL N10L5 NMOS
+ LEVEL=6 TPG=1
+ KC=3.8921e-05 NC=1.1739 KV=0.91602 NV=0.87225
+ LAMBDA0=0.013333 LAMBDA1=0.0046901 VT0=0.69486 GAMMA=0.60309 PHI=1
+ TOX=1.9800000E-08  XJ=0.2U            LD=0.1U           NSUB=4.9999999E+16
+ NSS=0.0000000E+00
+ CJ=4.091E-4        MJ=0.307           PB=1.0
+ CJSW=3.078E-10     MJSW=1.0E-2        
+ CGSO=3.93E-10      CGDO=3.93E-10
**** LEVEL 6 PMOS ****
.MODEL P12L5 PMOS
+ LEVEL=6 TPG=-1
+ KC=6.42696E-06 NC=1.6536 KV=0.92145 NV=0.88345
+ LAMBDA0=0.018966 LAMBDA1=0.0084012 VT0=-0.60865 GAMMA=0.89213 PHI=1
+ TOX=1.9800000E-08  XJ=0.4U            LD=0.28U           NSUB=4.9999999E+17
+ NSS=0.0000000E+00
+ CJ=6.852E-4        MJ=0.429           PB=1.0
+ CJSW=5.217E-10     MJSW=0.351
+ CGSO=7.29E-10      CGDO=7.29E-10
.END
Transient Analysisvectors from the deck’s .plot/.print
-1 V0 V1 V2 V3 V4 V5 V6 V0 s50 ns100 ns150 nsv(1)v(2)v(3)v(4)v(5)v(11)
v(1)v(2)v(3)v(4)v(5)v(11)(+38 more vectors)
  • model `n10l1`: unrecognized parameter (xj) - ignored
  • model `p12l1`: unrecognized parameter (xj) - ignored
  • model `n10l5`: unrecognized parameter (xj) - ignored
  • model `p12l5`: unrecognized parameter (xj) - ignored

mosamp2 - mos amplifier - transient

corpus/spice3f5/examples/mosamp2.cir.tran#
mosamp2.cir
mosamp2 - mos amplifier - transient
.options acct abstol=10n  vntol=10n
.tran 0.1us 10us
m1  15 15  1 32 m w=88.9u  l=25.4u
m2   1  1  2 32 m w=12.7u  l=266.7u
m3   2  2 30 32 m w=88.9u  l=25.4u
m4  15  5  4 32 m w=12.7u  l=106.7u
m5   4  4 30 32 m w=88.9u  l=12.7u
m6  15 15  5 32 m w=44.5u  l=25.4u
m7   5 20  8 32 m w=482.6u l=12.7u
m8   8  2 30 32 m w=88.9u  l=25.4u
m9  15 15  6 32 m w=44.5u  l=25.4u
m10  6 21  8 32 m w=482.6u l=12.7u
m11 15  6  7 32 m w=12.7u  l=106.7u
m12  7  4 30 32 m w=88.9u  l=12.7u
m13 15 10  9 32 m w=139.7u l=12.7u
m14  9 11 30 32 m w=139.7u l=12.7u
m15 15 15 12 32 m w=12.7u  l=207.8u
m16 12 12 11 32 m w=54.1u  l=12.7u
m17 11 11 30 32 m w=54.1u  l=12.7u
m18 15 15 10 32 m w=12.7u  l=45.2u
m19 10 12 13 32 m w=270.5u l=12.7u
m20 13  7 30 32 m w=270.5u l=12.7u
m21 15 10 14 32 m w=254u   l=12.7u
m22 14 11 30 32 m w=241.3u l=12.7u
m23 15 20 16 32 m w=19u    l=38.1u
m24 16 14 30 32 m w=406.4u l=12.7u
m25 15 15 20 32 m w=38.1u  l=42.7u
m26 20 16 30 32 m w=381u   l=25.4u
m27 20 15 66 32 m w=22.9u  l=7.6u
cc 7 9 40pf
cl 66 0 70pf
vin 21 0 pulse(0 5 1ns 1ns 1ns 5us 10us)
vccp 15 0 dc +15
vddn 30 0 dc -15
vb 32 0 dc -20
.model m nmos(nsub=2.2e15 uo=575 ucrit=49k uexp=0.1 tox=0.11u xj=2.95u
+   level=2 cgso=1.5n cgdo=1.5n cbd=4.5f cbs=4.5f ld=2.4485u nss=3.2e10
+   kp=2e-5 phi=0.6 )
.print tran v(20) v(66)
.plot  tran v(20) v(66)
.end
Known-marginal vs the oracle XFAIL · Transient Analysis

Meyer charge is step-path dependent and the step controller is bistable here: ngspice rides a 0.1-1ns LTE limit cycle for 2us while Dune cruises at TMAX; ngspice's own 0.5ns rerun differs from its default-step golden by 0.87x the allowance, and Dune at 0.5ns matches that rerun to 8mV (op/DC/AC match at 1e-5) - D-0011 | companion regress/mosamp2_fine (same deck, TMAX=10ns) PASSes at 0.05

Transient Analysisvectors from the deck’s .plot/.print
-1 V0 V1 V2 V3 V4 V5 V6 V7 V0 s2 µs4 µs6 µs8 µs10 µsv(20)v(66)
v(20)v(66)(+22 more vectors)

mosmem - mos memory cell

corpus/spice3f5/examples/mosmem.cir.tran#
mosmem.cir
mosmem - mos memory cell
.width in=72
.opt abstol=1u
.opt acct list node
.tran 20ns 2us
vdd 9 0 dc 5
vs 7 0 pulse(2 0 520ns 20ns 20ns 500ns 2000ns)
vw 1 0 pulse(0 2 20ns 20ns 500ns 200ns)
vwb 2 0 pulse(2 0 20ns 20ns 20ns 2000ns 2000ns)
m1 3 1 0 0 mod w=250u l=5u
m2 4 2 0 0 mod w=250u l=5u
m3 9 9 3 0 mod w=5u   l=5u
m4 9 9 4 0 mod w=5u   l=5u
m5 5 7 3 0 mod w=50u  l=5u
m6 6 7 4 0 mod w=50u  l=5u
m7 5 6 0 0 mod w=250u  l=5u
m8 6 5 0 0 mod w=250u  l=5u
m9 9 9 5 0 mod w=5u   l=5u
m10 9 9 6 0 mod w=5u  l=5u
m11 8 4 0 0 mod w=250u l=5u
m12 9 9 8 0 mod w=5u   l=5u
.model mod nmos(vto=0.5 phi=0.7 kp=1.0e-6 gamma=1.83 lambda=0.115
+   level=1 cgso=1u cgdo=1u cbd=50p cbs=50p)
.print dc v(5) v(6)
.plot dc v(6)
.plot tran v(6) v(5) v(7) v(1) v(2)
.end
Transient Analysisvectors from the deck’s .plot/.print
-500 mV0 V500 mV1 V1.5 V2 V2.5 V3 V0 s500 ns1 µs1.5 µs2 µsv(6)v(5)v(7)v(1)v(2)
v(6)v(5)v(7)v(1)v(2)(+8 more vectors)
  • warning: .width without out= has no effect

test pz

corpus/spice3f5/examples/pz2.cir.pz#
pz2.cir
test pz
iin	1	0	ac
r1	1	0	1.019524e+9Ohms
l1	1	0	1H

gm2	2	0	1 0 1
r2	2	0	8.296965e+08Ohms
l2	2	0	1H

gm3	3	0	2 0 1
r3	3	0	8.652054e+07Ohms
l3	3	0	1H

gm4	4	0	3 0 1
r4	4	0	1.060594e+07Ohms
l4	4	0	1H

*gm5	5	0	4 0 1
*r5	5	0	10Ohms
*l5	5	0	0.66mH

.pz	1 0	4 0	cur pol
.print pz all
.end
Pole-Zero Analysis
realimag
pole 1-1.01952G0
pole 2-829.697M0
pole 3-86.5205M0
pole 4-10.6059M0

test pz

corpus/spice3f5/examples/pzt.cir.pz#
pzt.cir
test pz
iin	1	0	ac
r1	1	0	1Ohms
l1	1	0	0.05H

gm2	2	0	1 0 1
r2	2	0	1Ohms
l2	2	0	0.05H

gm3	3	0	2 0 1
r3	3	0	1Ohms
l3	3	0	0.05H

*gm4	4	0	3 0 1
*r4	4	0	1Ohms
*l4	4	0	0.05H

*gm5	5	0	4 0 1
*r5	5	0	10Ohms
*l5	5	0	0.66mH

.pz	1 0	3 0	cur pol
.print pz all
.end
Pole-Zero Analysis
realimag
pole 1-200
pole 2-200
pole 3-200

Basic RC circuit

corpus/spice3f5/examples/rc.cir.tran#
rc.cir
Basic RC circuit
r 1 2 1.0
*l 1 2 1.0
c 2 0 1.0
vin 1 0  pulse (0 1) ac 1
.tran  0.1 7.0
*.ac dec 10 .01 10
.plot tran  v(2) i(vin)
*.plot ac  vdb(2) xlog
.end
Transient Analysisvectors from the deck’s .plot/.print
0 V200 mV400 mV600 mV800 mV1 V0 s1 s2 s3 s4 s5 s6 s7 sv(2)
v(2)
-1 A-800 mA-600 mA-400 mA-200 mA0 A0 s1 s2 s3 s4 s5 s6 s7 si(vin)
i(vin)(+1 more vector)

rca3040 ckt - rca 3040 wideband amplifier

corpus/spice3f5/examples/rca3040.cir.ac.dc.tran#
rca3040.cir
rca3040 ckt - rca 3040 wideband amplifier
.ac dec 10 1 10ghz
.dc vin -0.25 0.25 0.005
.tran 2.0ns 200ns
vin 1 0 sin(0 0.1 50meg 0.5ns) ac 1
vcc     2       0       15.0
vee     3       0       -15.0
rs1     30      1       1k
rs2     31      0       1k
r1      5       3       4.8k
r2      6       3       4.8k
r3      9       3       811
r4      8       3       2.17k
r5      8       0       820
r6      2       14      1.32k
r7      2       12      4.5k
r8      2       15      1.32k
r9      16      0       5.25k
r10     17      0       5.25k
q1      2       30      5       qnl
q2      2       31      6       qnl
q3      10      5       7       qnl
q4      11      6       7       qnl
q5      14      12      10      qnl
q6      15      12      11      qnl
q7      12      12      13      qnl
q8      13      13      0       qnl
q9      7       8       9       qnl
q10     2       15      16      qnl
q11     2       14      17      qnl
.model qnl npn bf=80 rb=100 ccs=2pf tf=0.3ns tr=6ns cje=3pf
+ cjc=2pf va 50
.end
AC Analysismagnitudelog f
100 µV1 mV10 mV100 mV1 V10 V1 Hz1 kHz1 MHz1 GHzv(30)v(31)v(5)v(6)v(9)v(8)
v(30)v(31)v(5)v(6)v(9)v(8)(+15 more vectors)
DC transfer characteristic
-6 V-5 V-4 V-3 V-2 V-1 V0 V1 V-200 mV-100 mV0 V100 mV200 mVv(30)v(31)v(5)v(6)v(9)v(8)
v(30)v(31)v(5)v(6)v(9)v(8)(+15 more vectors)
Transient Analysis
-6 V-5 V-4 V-3 V-2 V-1 V0 V1 V0 s50 ns100 ns150 ns200 nsv(1)v(30)v(31)v(5)v(6)v(9)
v(1)v(30)v(31)v(5)v(6)v(9)(+15 more vectors)

simple resistor circuit

corpus/spice3f5/examples/resnoise.cir.noise#
resnoise.cir
simple resistor circuit
*simple resistor circuit to test which ones of vspice, uf77spice and
* spice3 give the correct results

iin 1 0 1m AC
rl 1 0 1k

*.control
*noise v(1) iin dec 1 1k 1k 1
*setplot noise3
*print onoise.spectrum > spice3.noise.out
*.endc

.noise v(1) iin dec 10 10 100k 1
.print noise "onoise-spectrum"

.end
Noise Spectral Density Curveslog fvectors from the deck’s .plot/.print
3.6 nV/√Hz3.8 nV/√Hz4 nV/√Hz4.2 nV/√Hz4.4 nV/√Hz4.6 nV/√Hz10 Hz100 Hz1 kHz10 kHz100 kHzonoise_spectrum
onoise_spectrum(+4 more vectors)
Integrated Noise
vectorvalue
v(onoise_total_rl_thermal)1.2874 µV
i(inoise_total_rl_thermal)1.2874 nA
v(onoise_total_rl_1overf)0 V
i(inoise_total_rl_1overf)0 A
v(onoise_total_rl)1.2874 µV
i(inoise_total_rl)1.2874 nA
v(onoise_total)1.2874 µV
i(inoise_total)1.2874 nA

rtlinv ckt - cascaded rtl inverters

corpus/spice3f5/examples/rtlinv.cir.dc.tran#
rtlinv.cir
rtlinv ckt - cascaded rtl inverters
.width in=72
.opt acct list node lvlcod=2
.dc vin 0.0 2.5 0.025
.tran 2ns 200ns
vcc 6 0 5
vin 1 0 pulse(0 5 2ns 2ns 2ns 80ns)
rb1 1 2 10k
rc1 6 3 1k
q1 3 2 0 qnd
rb2 3 4 10k
q2 5 4 0 qnd
rc2 6 5 1k
.model qnd npn(bf=50 rb=70 rc=40 ccs=2pf tf=0.1ns tr=10ns cje=0.9pf
+   cjc=1.5pf pc=0.85 va=50)
.print dc v(3) v(5)
.plot dc v(3)
.print tran v(3) v(5)
.plot tran v(3) v(5) v(1)
.end
DC transfer characteristicvectors from the deck’s .plot/.print
0 V1 V2 V3 V4 V5 V0 V500 mV1 V1.5 V2 Vv(3)v(5)
v(3)v(5)(+6 more vectors)
Transient Analysisvectors from the deck’s .plot/.print
0 V1 V2 V3 V4 V5 V0 s50 ns100 ns150 ns200 nsv(3)v(5)v(1)
v(3)v(5)v(1)(+5 more vectors)
  • warning: .width without out= has no effect
  • warning: option lvlcod is an obsolete SPICE2 option; ignored

schmitt ckt - ecl compatible schmitt trigger

corpus/spice3f5/examples/schmitt.cir.tran#
schmitt.cir
schmitt ckt - ecl compatible schmitt trigger
.width in=72
.opt acct list node lvlcod=2
.tran 10ns 1000ns
vin 1 0 pulse(-1.6 -1.2 10ns 400ns 400ns 100ns 10000ns)
vee 8 0 -5
rin 1 2 50
rc1 0 3 50
r1 3 5 185
r2 5 8 760
rc2 0 6 100
re 4 8 260
rth1 7 8 125
rth2 7 0 85
cload 7 0 5pf
q1 3 2 4 qstd off
q2 6 5 4 qstd
q3 0 6 7 qstd
q4 0 6 7 qstd
.model qstd npn(is=1.0e-16 bf=50 br=0.1 rb=50 rc=10 tf=0.12ns tr=5ns
+   cje=0.4pf pe=0.8 me=0.4 cjc=0.5pf pc=0.8 mc=0.333 ccs=1pf va=50)
.print tran v(1) v(3) v(5) v(6)
.plot tran v(3) v(5) v(6) v(1)
.end
Known-marginal vs the oracle XFAIL · Transient Analysis

regenerative edges: trap-ringing phase differs between engines beyond any pointwise ruler (D-0011); node voltages agree except inside the switching windows | companion regress/schmitt_fine (same deck, TMAX=1ns) PASSes at 0.004

Transient Analysisvectors from the deck’s .plot/.print
-2 V-1.5 V-1 V-500 mV0 V0 s200 ns400 ns600 ns800 ns1 µsv(3)v(5)v(6)v(1)
v(3)v(5)v(6)v(1)(+6 more vectors)
  • warning: .width without out= has no effect
  • warning: option lvlcod is an obsolete SPICE2 option; ignored

test circuit #1 for pz analysis:high pass filter

corpus/spice3f5/examples/simplepz.cir.pz#
simplepz.cir
test circuit #1 for pz analysis:high pass filter
r1 1 0 1k
r2 2 0 1k
c1 1 2 1.0e-12
.pz 1 0 2 0 cur pz
.print pz all
.end
Pole-Zero Analysis
realimag
pole 1-500M0
zero 100

BSIM3v3 6

BSIM3v3 probes (corpus/regress/bsim3_*), compared against ngspice-47.

BSIM3v3.3 capMod 0/1/2 and XPART partitions in .tran/.ac, pass-gate reverse mode

corpus/regress/bsim3_cap.cir.ac.tran#
bsim3_cap.cir
BSIM3v3.3 capMod 0/1/2 and XPART partitions in .tran/.ac, pass-gate reverse mode
* Coverage: three NMOS pass gates (capmod=0 xpart=0 i.e. 40/60,
* capmod=1 xpart=0.5 i.e. 50/50, capmod=2 xpart=1 i.e. 0/100) with
* CGSL/CGDL/CKAPPA overlap models, each charging a 100 fF load from a
* pulsed source and discharging it again, so vds changes sign every
* half period (inverse-mode charge swap) while the gate stays high;
* plus a pmos pass gate on capmod=2 with the default 40/60. The .ac
* sweep sees the same capacitance matrices at the operating point.
vg 9 0 dc 3.3
vgp 19 0 dc 0
vin 1 0 dc 0.2 ac 1 pulse(0.2 2 1n 1n 1n 9n 20n)
rs 1 2 100
m0 2 9 3 0 n0 l=0.5u w=4u ad=4p as=4p pd=10u ps=10u
c3 3 0 100f
m1 2 9 4 0 nc1 l=0.5u w=4u ad=4p as=4p pd=10u ps=10u
c4 4 0 100f
m2 2 9 5 0 nc2 l=0.5u w=4u ad=4p as=4p pd=10u ps=10u
c5 5 0 100f
vdd 20 0 dc 3.3
m5 2 19 6 20 pc2 l=0.5u w=8u ad=8p as=8p pd=18u ps=18u
c6 6 0 100f
.ac dec 5 1meg 10g
.tran 0.05n 40n
.model n0 nmos
+Level=        8 version=3.3.0
+Tnom=27.0
+Nch= 2.498E+17  Tox=9E-09 Xj=1.00000E-07
+Lint=9.36e-8 Wint=1.47e-7
+Vth0= .6322    K1= .756  K2= -3.83e-2  K3= -2.612
+Dvt0= 2.812  Dvt1= 0.462  Dvt2=-9.17e-2
+Nlx= 3.52291E-08  W0= 1.163e-6
+K3b= 2.233
+Vsat= 86301.58  Ua= 6.47e-9  Ub= 4.23e-18  Uc=-4.706281E-11
+Rdsw= 650  U0= 388.3203 wr=1
+A0= .3496967 Ags=.1    B0=0.546    B1= 1
+Dwg = -6.0E-09 Dwb = -3.56E-09 Prwb = -.213
+Keta=-3.605872E-02  A1= 2.778747E-02  A2= .9
+Voff=-6.735529E-02  NFactor= 1.139926  Cit= 1.622527E-04
+Cdsc=-2.147181E-05
+Cdscb= 0  Dvt0w =  0 Dvt1w =  0 Dvt2w =  0
+Cdscd =  0 Prwg =  0
+Eta0= 1.0281729E-02  Etab=-5.042203E-03
+Dsub= .31871233
+Pclm= 1.114846  Pdiblc1= 2.45357E-03  Pdiblc2= 6.406289E-03
+Drout= .31871233  Pscbe1= 5000000  Pscbe2= 5E-09 Pdiblcb = -.234
+Pvag= 0 delta=0.01
+Wl =  0 Ww = -1.420242E-09 Wwl =  0
+Wln =  0 Wwn =  .2613948 Ll =  1.300902E-10
+Lw =  0 Lwl =  0 Lln =  .316394
+Lwn =  0
+kt1=-.3  kt2=-.051
+At= 22400
+Ute=-1.48
+Ua1= 3.31E-10  Ub1= 2.61E-19 Uc1= -3.42e-10
+Kt1l=0 Prt=764.3
+vgs_max=4 vds_max=4 vbs_max=4
+capmod=0 xpart=0
.model nc1 nmos
+Level=        8 version=3.3.0
+Tnom=27.0
+Nch= 2.498E+17  Tox=9E-09 Xj=1.00000E-07
+Lint=9.36e-8 Wint=1.47e-7
+Vth0= .6322    K1= .756  K2= -3.83e-2  K3= -2.612
+Dvt0= 2.812  Dvt1= 0.462  Dvt2=-9.17e-2
+Nlx= 3.52291E-08  W0= 1.163e-6
+K3b= 2.233
+Vsat= 86301.58  Ua= 6.47e-9  Ub= 4.23e-18  Uc=-4.706281E-11
+Rdsw= 650  U0= 388.3203 wr=1
+A0= .3496967 Ags=.1    B0=0.546    B1= 1
+Dwg = -6.0E-09 Dwb = -3.56E-09 Prwb = -.213
+Keta=-3.605872E-02  A1= 2.778747E-02  A2= .9
+Voff=-6.735529E-02  NFactor= 1.139926  Cit= 1.622527E-04
+Cdsc=-2.147181E-05
+Cdscb= 0  Dvt0w =  0 Dvt1w =  0 Dvt2w =  0
+Cdscd =  0 Prwg =  0
+Eta0= 1.0281729E-02  Etab=-5.042203E-03
+Dsub= .31871233
+Pclm= 1.114846  Pdiblc1= 2.45357E-03  Pdiblc2= 6.406289E-03
+Drout= .31871233  Pscbe1= 5000000  Pscbe2= 5E-09 Pdiblcb = -.234
+Pvag= 0 delta=0.01
+Wl =  0 Ww = -1.420242E-09 Wwl =  0
+Wln =  0 Wwn =  .2613948 Ll =  1.300902E-10
+Lw =  0 Lwl =  0 Lln =  .316394
+Lwn =  0
+kt1=-.3  kt2=-.051
+At= 22400
+Ute=-1.48
+Ua1= 3.31E-10  Ub1= 2.61E-19 Uc1= -3.42e-10
+Kt1l=0 Prt=764.3
+vgs_max=4 vds_max=4 vbs_max=4
+capmod=1 xpart=0.5 cgsl=2e-10 cgdl=2e-10 ckappa=0.8
.model nc2 nmos
+Level=        8 version=3.3.0
+Tnom=27.0
+Nch= 2.498E+17  Tox=9E-09 Xj=1.00000E-07
+Lint=9.36e-8 Wint=1.47e-7
+Vth0= .6322    K1= .756  K2= -3.83e-2  K3= -2.612
+Dvt0= 2.812  Dvt1= 0.462  Dvt2=-9.17e-2
+Nlx= 3.52291E-08  W0= 1.163e-6
+K3b= 2.233
+Vsat= 86301.58  Ua= 6.47e-9  Ub= 4.23e-18  Uc=-4.706281E-11
+Rdsw= 650  U0= 388.3203 wr=1
+A0= .3496967 Ags=.1    B0=0.546    B1= 1
+Dwg = -6.0E-09 Dwb = -3.56E-09 Prwb = -.213
+Keta=-3.605872E-02  A1= 2.778747E-02  A2= .9
+Voff=-6.735529E-02  NFactor= 1.139926  Cit= 1.622527E-04
+Cdsc=-2.147181E-05
+Cdscb= 0  Dvt0w =  0 Dvt1w =  0 Dvt2w =  0
+Cdscd =  0 Prwg =  0
+Eta0= 1.0281729E-02  Etab=-5.042203E-03
+Dsub= .31871233
+Pclm= 1.114846  Pdiblc1= 2.45357E-03  Pdiblc2= 6.406289E-03
+Drout= .31871233  Pscbe1= 5000000  Pscbe2= 5E-09 Pdiblcb = -.234
+Pvag= 0 delta=0.01
+Wl =  0 Ww = -1.420242E-09 Wwl =  0
+Wln =  0 Wwn =  .2613948 Ll =  1.300902E-10
+Lw =  0 Lwl =  0 Lln =  .316394
+Lwn =  0
+kt1=-.3  kt2=-.051
+At= 22400
+Ute=-1.48
+Ua1= 3.31E-10  Ub1= 2.61E-19 Uc1= -3.42e-10
+Kt1l=0 Prt=764.3
+vgs_max=4 vds_max=4 vbs_max=4
+capmod=2 xpart=1 cgsl=1.5e-10 cgdl=1.5e-10 ckappa=0.6 dlc=2e-8
.model pc2 pmos
+Level=        8 version=3.3.0
+Tnom=27.0
+Nch= 3.533024E+17  Tox=9E-09 Xj=1.00000E-07
+Lint=6.23e-8 Wint=1.22e-7
+Vth0=-.6732829 K1= .8362093  K2=-8.606622E-02  K3= 1.82
+Dvt0= 1.903801  Dvt1= .5333922  Dvt2=-.1862677
+Nlx= 1.28e-8  W0= 2.1e-6
+K3b= -0.24 Prwg=-0.001 Prwb=-0.323
+Vsat= 103503.2  Ua= 1.39995E-09  Ub= 1.e-19  Uc=-2.73e-11
+Rdsw= 460  U0= 138.7609
+A0= .4716551 Ags=0.12
+Keta=-1.871516E-03  A1= .3417965  A2= 0.83
+Voff=-.074182  NFactor= 1.54389  Cit=-1.015667E-03
+Cdsc= 8.937517E-04
+Cdscb= 1.45e-4  Cdscd=1.04e-4
+Dvt0w=0.232 Dvt1w=4.5e6 Dvt2w=-0.0023
+Eta0= 6.024776E-02  Etab=-4.64593E-03
+Dsub= .23222404
+Pclm= .989  Pdiblc1= 2.07418E-02  Pdiblc2= 1.33813E-3
+Drout= .3222404  Pscbe1= 118000  Pscbe2= 1E-09
+Pvag= 0
+kt1= -0.25  kt2= -0.032 prt=64.5
+At= 33000
+Ute= -1.5
+Ua1= 4.312e-9 Ub1= 6.65e-19  Uc1= 0
+Kt1l=0
+vgs_max=4 vds_max=4 vbs_max=4
+capmod=2 cgsl=1e-10 cgdl=1e-10 cjswg=3e-10 mjswg=0.4 pbswg=0.8
.end
AC Analysismagnitudelog f
1 nV1 µV1 mV1 V1 MHz10 MHz100 MHz1 GHz10 GHzv(2)v(3)v(4)v(5)v(6)
v(2)v(3)v(4)v(5)v(6)(+8 more vectors)
Transient Analysis
0 V500 mV1 V1.5 V2 V2.5 V0 s10 ns20 ns30 ns40 nsv(1)v(2)v(3)v(4)v(5)v(6)
v(1)v(2)v(3)v(4)v(5)v(6)(+7 more vectors)

BSIM3v3.3 CMOS inverter chain and amplifier: capMod 3 charges in .op/.ac/.tran

corpus/regress/bsim3_inv.cir.ac.op.tran#
bsim3_inv.cir
BSIM3v3.3 CMOS inverter chain and amplifier: capMod 3 charges in .op/.ac/.tran
* Coverage: two inverters from the Berkeley 0.35um BSIM3v3.3.0 cards
* (ngspice-47 examples/mos) switching rail to rail, so the default
* charge-thickness capMod 3 gate charges, the bias-dependent capMod
* overlap charges (CGSL/CGDL default 0 -> constant CGSO/CGDO from
* XJ), and the bottom/sidewall/gate-edge junction charges integrate
* across the whole swing in both drain-source orientations; plus a
* self-biased NMOS amplifier (rf feedback, source degeneration,
* bulk at ground) for gm/gds/gmbs and the Meyer-free capacitance
* matrix in .ac. Every switching node carries >= 50 fF so no
* near-floating node crosses vds=0 on a pulse edge.
vdd 1 0 dc 3.3
vin 2 0 dc 0 pulse(0 3.3 2n 0.5n 0.5n 8n 20n)
mn1 3 2 0 0 n1 l=0.35u w=2u ad=2p as=2p pd=6u ps=6u
mp1 3 2 1 1 p1 l=0.35u w=5u ad=5p as=5p pd=12u ps=12u
c3 3 0 50f
mn2 4 3 0 0 n1 l=0.35u w=2u ad=2p as=2p pd=6u ps=6u
mp2 4 3 1 1 p1 l=0.35u w=5u ad=5p as=5p pd=12u ps=12u
c4 4 0 100f
vac 5 0 dc 0 ac 1
cin 5 6 10p
rf 7 6 200k
mn3 7 6 8 0 n1 l=1u w=20u ad=20p as=20p pd=44u ps=44u
rs3 8 0 200
rl 1 7 5k
c7 7 0 0.2p
.ac dec 10 10k 10g
.op
.tran 0.05n 40n
.model n1 nmos
+Level=        8 version=3.3.0
+Tnom=27.0
+Nch= 2.498E+17  Tox=9E-09 Xj=1.00000E-07
+Lint=9.36e-8 Wint=1.47e-7
+Vth0= .6322    K1= .756  K2= -3.83e-2  K3= -2.612
+Dvt0= 2.812  Dvt1= 0.462  Dvt2=-9.17e-2
+Nlx= 3.52291E-08  W0= 1.163e-6
+K3b= 2.233
+Vsat= 86301.58  Ua= 6.47e-9  Ub= 4.23e-18  Uc=-4.706281E-11
+Rdsw= 650  U0= 388.3203 wr=1
+A0= .3496967 Ags=.1    B0=0.546    B1= 1
+Dwg = -6.0E-09 Dwb = -3.56E-09 Prwb = -.213
+Keta=-3.605872E-02  A1= 2.778747E-02  A2= .9
+Voff=-6.735529E-02  NFactor= 1.139926  Cit= 1.622527E-04
+Cdsc=-2.147181E-05
+Cdscb= 0  Dvt0w =  0 Dvt1w =  0 Dvt2w =  0
+Cdscd =  0 Prwg =  0
+Eta0= 1.0281729E-02  Etab=-5.042203E-03
+Dsub= .31871233
+Pclm= 1.114846  Pdiblc1= 2.45357E-03  Pdiblc2= 6.406289E-03
+Drout= .31871233  Pscbe1= 5000000  Pscbe2= 5E-09 Pdiblcb = -.234
+Pvag= 0 delta=0.01
+Wl =  0 Ww = -1.420242E-09 Wwl =  0
+Wln =  0 Wwn =  .2613948 Ll =  1.300902E-10
+Lw =  0 Lwl =  0 Lln =  .316394
+Lwn =  0
+kt1=-.3  kt2=-.051
+At= 22400
+Ute=-1.48
+Ua1= 3.31E-10  Ub1= 2.61E-19 Uc1= -3.42e-10
+Kt1l=0 Prt=764.3
+vgs_max=4 vds_max=4 vbs_max=4
.model p1 pmos
+Level=        8 version=3.3.0
+Tnom=27.0
+Nch= 3.533024E+17  Tox=9E-09 Xj=1.00000E-07
+Lint=6.23e-8 Wint=1.22e-7
+Vth0=-.6732829 K1= .8362093  K2=-8.606622E-02  K3= 1.82
+Dvt0= 1.903801  Dvt1= .5333922  Dvt2=-.1862677
+Nlx= 1.28e-8  W0= 2.1e-6
+K3b= -0.24 Prwg=-0.001 Prwb=-0.323
+Vsat= 103503.2  Ua= 1.39995E-09  Ub= 1.e-19  Uc=-2.73e-11
+Rdsw= 460  U0= 138.7609
+A0= .4716551 Ags=0.12
+Keta=-1.871516E-03  A1= .3417965  A2= 0.83
+Voff=-.074182  NFactor= 1.54389  Cit=-1.015667E-03
+Cdsc= 8.937517E-04
+Cdscb= 1.45e-4  Cdscd=1.04e-4
+Dvt0w=0.232 Dvt1w=4.5e6 Dvt2w=-0.0023
+Eta0= 6.024776E-02  Etab=-4.64593E-03
+Dsub= .23222404
+Pclm= .989  Pdiblc1= 2.07418E-02  Pdiblc2= 1.33813E-3
+Drout= .3222404  Pscbe1= 118000  Pscbe2= 1E-09
+Pvag= 0
+kt1= -0.25  kt2= -0.032 prt=64.5
+At= 33000
+Ute= -1.5
+Ua1= 4.312e-9 Ub1= 6.65e-19  Uc1= 0
+Kt1l=0
+vgs_max=4 vds_max=4 vbs_max=4
.end
AC Analysismagnitudelog f
0 V500 mV1 V1.5 V2 V2.5 V3 V10 kHz1 MHz100 MHz10 GHzv(6)v(7)v(8)
v(6)v(7)v(8)(+8 more vectors)
Operating Point
vectorvalue
v(1)3.3 V
i(vdd)-349.42 µA
v(2)0 V
i(vin)0 A
v(3)3.3 V
v(4)161.23 nV
v(5)0 V
i(vac)0 A
v(6)1.5529 V
v(7)1.5529 V
v(8)69.883 mV
Transient Analysis
-500 mV0 V500 mV1 V1.5 V2 V2.5 V3 V3.5 V0 s10 ns20 ns30 ns40 nsv(2)v(3)v(4)v(5)
v(2)v(3)v(4)v(5)(+7 more vectors)

BSIM3v3.3 output families: NMOS and PMOS 0.35um (Berkeley cards)

corpus/regress/bsim3_iv.cir.dc#
bsim3_iv.cir
BSIM3v3.3 output families: NMOS and PMOS 0.35um (Berkeley cards)
* Coverage: drain sweep 0..3.3 V at five gate biases for an NMOS and
* a PMOS (mirrored through E sources, so one two-source .dc drives
* both) from the Berkeley BSIM3v3.3.0 model cards shipped with
* ngspice-47 (examples/mos/modelcard.{nmos,pmos}): linear,
* saturation, CLM/DIBL/SCBE output conductance and the substrate
* current, plus a reverse-biased body and a second NMOS with
* RSH/NRD/NRS (prime nodes, Rds from RDSW) and M=2.
vds 1 0 dc 0
vgs 2 0 dc 0
vbn 3 0 dc -0.5
m1 1 2 0 3 n1 l=0.35u w=2u ad=2p as=2p pd=6u ps=6u
m2 1 2 0 0 n1r l=0.5u w=4u ad=4p as=4p pd=10u ps=10u nrd=2 nrs=2 m=2
ep1 11 0 1 0 -1
ep2 12 0 2 0 -1
vmp 13 11 dc 0
mp1 13 12 0 0 p1 l=0.35u w=5u ad=5p as=5p pd=12u ps=12u
.dc vds 0 3.3 0.05 vgs 0.5 3.3 0.7
.model n1 nmos
+Level=        8 version=3.3.0
+Tnom=27.0
+Nch= 2.498E+17  Tox=9E-09 Xj=1.00000E-07
+Lint=9.36e-8 Wint=1.47e-7
+Vth0= .6322    K1= .756  K2= -3.83e-2  K3= -2.612
+Dvt0= 2.812  Dvt1= 0.462  Dvt2=-9.17e-2
+Nlx= 3.52291E-08  W0= 1.163e-6
+K3b= 2.233
+Vsat= 86301.58  Ua= 6.47e-9  Ub= 4.23e-18  Uc=-4.706281E-11
+Rdsw= 650  U0= 388.3203 wr=1
+A0= .3496967 Ags=.1    B0=0.546    B1= 1
+Dwg = -6.0E-09 Dwb = -3.56E-09 Prwb = -.213
+Keta=-3.605872E-02  A1= 2.778747E-02  A2= .9
+Voff=-6.735529E-02  NFactor= 1.139926  Cit= 1.622527E-04
+Cdsc=-2.147181E-05
+Cdscb= 0  Dvt0w =  0 Dvt1w =  0 Dvt2w =  0
+Cdscd =  0 Prwg =  0
+Eta0= 1.0281729E-02  Etab=-5.042203E-03
+Dsub= .31871233
+Pclm= 1.114846  Pdiblc1= 2.45357E-03  Pdiblc2= 6.406289E-03
+Drout= .31871233  Pscbe1= 5000000  Pscbe2= 5E-09 Pdiblcb = -.234
+Pvag= 0 delta=0.01
+Wl =  0 Ww = -1.420242E-09 Wwl =  0
+Wln =  0 Wwn =  .2613948 Ll =  1.300902E-10
+Lw =  0 Lwl =  0 Lln =  .316394
+Lwn =  0
+kt1=-.3  kt2=-.051
+At= 22400
+Ute=-1.48
+Ua1= 3.31E-10  Ub1= 2.61E-19 Uc1= -3.42e-10
+Kt1l=0 Prt=764.3
+vgs_max=4 vds_max=4 vbs_max=4
.model p1 pmos
+Level=        8 version=3.3.0
+Tnom=27.0
+Nch= 3.533024E+17  Tox=9E-09 Xj=1.00000E-07
+Lint=6.23e-8 Wint=1.22e-7
+Vth0=-.6732829 K1= .8362093  K2=-8.606622E-02  K3= 1.82
+Dvt0= 1.903801  Dvt1= .5333922  Dvt2=-.1862677
+Nlx= 1.28e-8  W0= 2.1e-6
+K3b= -0.24 Prwg=-0.001 Prwb=-0.323
+Vsat= 103503.2  Ua= 1.39995E-09  Ub= 1.e-19  Uc=-2.73e-11
+Rdsw= 460  U0= 138.7609
+A0= .4716551 Ags=0.12
+Keta=-1.871516E-03  A1= .3417965  A2= 0.83
+Voff=-.074182  NFactor= 1.54389  Cit=-1.015667E-03
+Cdsc= 8.937517E-04
+Cdscb= 1.45e-4  Cdscd=1.04e-4
+Dvt0w=0.232 Dvt1w=4.5e6 Dvt2w=-0.0023
+Eta0= 6.024776E-02  Etab=-4.64593E-03
+Dsub= .23222404
+Pclm= .989  Pdiblc1= 2.07418E-02  Pdiblc2= 1.33813E-3
+Drout= .3222404  Pscbe1= 118000  Pscbe2= 1E-09
+Pvag= 0
+kt1= -0.25  kt2= -0.032 prt=64.5
+At= 33000
+Ute= -1.5
+Ua1= 4.312e-9 Ub1= 6.65e-19  Uc1= 0
+Kt1l=0
+vgs_max=4 vds_max=4 vbs_max=4
.model n1r nmos
+Level=        8 version=3.3.0
+Tnom=27.0
+Nch= 2.498E+17  Tox=9E-09 Xj=1.00000E-07
+Lint=9.36e-8 Wint=1.47e-7
+Vth0= .6322    K1= .756  K2= -3.83e-2  K3= -2.612
+Dvt0= 2.812  Dvt1= 0.462  Dvt2=-9.17e-2
+Nlx= 3.52291E-08  W0= 1.163e-6
+K3b= 2.233
+Vsat= 86301.58  Ua= 6.47e-9  Ub= 4.23e-18  Uc=-4.706281E-11
+Rdsw= 650  U0= 388.3203 wr=1
+A0= .3496967 Ags=.1    B0=0.546    B1= 1
+Dwg = -6.0E-09 Dwb = -3.56E-09 Prwb = -.213
+Keta=-3.605872E-02  A1= 2.778747E-02  A2= .9
+Voff=-6.735529E-02  NFactor= 1.139926  Cit= 1.622527E-04
+Cdsc=-2.147181E-05
+Cdscb= 0  Dvt0w =  0 Dvt1w =  0 Dvt2w =  0
+Cdscd =  0 Prwg =  0
+Eta0= 1.0281729E-02  Etab=-5.042203E-03
+Dsub= .31871233
+Pclm= 1.114846  Pdiblc1= 2.45357E-03  Pdiblc2= 6.406289E-03
+Drout= .31871233  Pscbe1= 5000000  Pscbe2= 5E-09 Pdiblcb = -.234
+Pvag= 0 delta=0.01
+Wl =  0 Ww = -1.420242E-09 Wwl =  0
+Wln =  0 Wwn =  .2613948 Ll =  1.300902E-10
+Lw =  0 Lwl =  0 Lln =  .316394
+Lwn =  0
+kt1=-.3  kt2=-.051
+At= 22400
+Ute=-1.48
+Ua1= 3.31E-10  Ub1= 2.61E-19 Uc1= -3.42e-10
+Kt1l=0 Prt=764.3
+vgs_max=4 vds_max=4 vbs_max=4
+rsh=40 alpha0=1e-6 beta0=20
.end
DC transfer characteristicnested sweep
-3 mA-2 mA-1 mA0 A1 mA2 mA0 V500 mV1 V1.5 V2 V2.5 V3 Vi(vds)i(vbn)i(ep1)i(vmp)
i(vds)i(vbn)i(ep1)i(vmp)(+8 more vectors)

BSIM3v3.3 noise: common-source stage with SPICE2 and BSIM3 noise models

corpus/regress/bsim3_noise.cir.noise#
bsim3_noise.cir
BSIM3v3.3 noise: common-source stage with SPICE2 and BSIM3 noise models
* Coverage: .noise of a self-biased common-source stage from the
* Berkeley 0.35um cards: the NMOS uses noimod=1 (default; SPICE2
* channel thermal 4kT*2/3*|gm+gds+gmbs| and KF*|Id|^AF/(f^EF*Leff^2*Cox)
* flicker) with RSH/NRD/NRS for the series-resistance generators; the
* PMOS current-source load uses noimod=2 (BSIM3 Qinv thermal noise and
* the NOIA/NOIB/NOIC strong-inversion flicker of b3noi.c) with
* capMod 2 so Qinv comes from the capMod 2 inversion charge.
vdd 1 0 dc 3.3
vac 5 0 dc 0 ac 1
cin 5 6 10p
rf 7 6 500k
mn 7 6 0 0 nn l=1u w=10u ad=10p as=10p pd=22u ps=22u nrd=1 nrs=1
vbp 9 0 dc 2.2
mp 7 9 1 1 pn l=2u w=20u ad=20p as=20p pd=42u ps=42u
c7 7 0 0.5p
.noise v(7) vac dec 10 100 1g 10
.model nn nmos
+Level=        8 version=3.3.0
+Tnom=27.0
+Nch= 2.498E+17  Tox=9E-09 Xj=1.00000E-07
+Lint=9.36e-8 Wint=1.47e-7
+Vth0= .6322    K1= .756  K2= -3.83e-2  K3= -2.612
+Dvt0= 2.812  Dvt1= 0.462  Dvt2=-9.17e-2
+Nlx= 3.52291E-08  W0= 1.163e-6
+K3b= 2.233
+Vsat= 86301.58  Ua= 6.47e-9  Ub= 4.23e-18  Uc=-4.706281E-11
+Rdsw= 650  U0= 388.3203 wr=1
+A0= .3496967 Ags=.1    B0=0.546    B1= 1
+Dwg = -6.0E-09 Dwb = -3.56E-09 Prwb = -.213
+Keta=-3.605872E-02  A1= 2.778747E-02  A2= .9
+Voff=-6.735529E-02  NFactor= 1.139926  Cit= 1.622527E-04
+Cdsc=-2.147181E-05
+Cdscb= 0  Dvt0w =  0 Dvt1w =  0 Dvt2w =  0
+Cdscd =  0 Prwg =  0
+Eta0= 1.0281729E-02  Etab=-5.042203E-03
+Dsub= .31871233
+Pclm= 1.114846  Pdiblc1= 2.45357E-03  Pdiblc2= 6.406289E-03
+Drout= .31871233  Pscbe1= 5000000  Pscbe2= 5E-09 Pdiblcb = -.234
+Pvag= 0 delta=0.01
+Wl =  0 Ww = -1.420242E-09 Wwl =  0
+Wln =  0 Wwn =  .2613948 Ll =  1.300902E-10
+Lw =  0 Lwl =  0 Lln =  .316394
+Lwn =  0
+kt1=-.3  kt2=-.051
+At= 22400
+Ute=-1.48
+Ua1= 3.31E-10  Ub1= 2.61E-19 Uc1= -3.42e-10
+Kt1l=0 Prt=764.3
+vgs_max=4 vds_max=4 vbs_max=4
+rsh=30 kf=2e-26 af=1.2 ef=1.05
.model pn pmos
+Level=        8 version=3.3.0
+Tnom=27.0
+Nch= 3.533024E+17  Tox=9E-09 Xj=1.00000E-07
+Lint=6.23e-8 Wint=1.22e-7
+Vth0=-.6732829 K1= .8362093  K2=-8.606622E-02  K3= 1.82
+Dvt0= 1.903801  Dvt1= .5333922  Dvt2=-.1862677
+Nlx= 1.28e-8  W0= 2.1e-6
+K3b= -0.24 Prwg=-0.001 Prwb=-0.323
+Vsat= 103503.2  Ua= 1.39995E-09  Ub= 1.e-19  Uc=-2.73e-11
+Rdsw= 460  U0= 138.7609
+A0= .4716551 Ags=0.12
+Keta=-1.871516E-03  A1= .3417965  A2= 0.83
+Voff=-.074182  NFactor= 1.54389  Cit=-1.015667E-03
+Cdsc= 8.937517E-04
+Cdscb= 1.45e-4  Cdscd=1.04e-4
+Dvt0w=0.232 Dvt1w=4.5e6 Dvt2w=-0.0023
+Eta0= 6.024776E-02  Etab=-4.64593E-03
+Dsub= .23222404
+Pclm= .989  Pdiblc1= 2.07418E-02  Pdiblc2= 1.33813E-3
+Drout= .3222404  Pscbe1= 118000  Pscbe2= 1E-09
+Pvag= 0
+kt1= -0.25  kt2= -0.032 prt=64.5
+At= 33000
+Ute= -1.5
+Ua1= 4.312e-9 Ub1= 6.65e-19  Uc1= 0
+Kt1l=0
+vgs_max=4 vds_max=4 vbs_max=4
+noimod=2 capmod=2 noia=6e18 noib=1e3 noic=1e-12 em=3e7 ef=0.95
.end
Noise Spectral Density Curveslog f
100 pV/√Hz10 nV/√Hz1 µV/√Hz100 µV/√Hz100 Hz10 kHz1 MHz100 MHzonoise_spectruminoise_spectrum
onoise_spectruminoise_spectrum(+13 more vectors)
Integrated Noise
vectorvalue
v(onoise_total_rf_thermal)147.24 µV
v(inoise_total_rf_thermal)262.83 µV
v(onoise_total_rf_1overf)0 V
v(inoise_total_rf_1overf)0 V
v(onoise_total_rf)147.24 µV
v(inoise_total_rf)262.83 µV
v(onoise_total.mn.rd)782.12 nV
v(inoise_total.mn.rd)6.7708 µV
v(onoise_total.mn.rs)62.322 µV
v(inoise_total.mn.rs)34.526 µV
v(onoise_total.mn.id)557.87 µV
v(inoise_total.mn.id)306.7 µV
v(onoise_total.mn.1overf)1.0727 mV
v(inoise_total.mn.1overf)5.601 mV
v(onoise_total.mn)1.2107 mV
v(inoise_total.mn)5.6095 mV
v(onoise_total.mp.rd)0 V
v(inoise_total.mp.rd)0 V
v(onoise_total.mp.rs)0 V
v(inoise_total.mp.rs)0 V
v(onoise_total.mp.id)459.03 µV
v(inoise_total.mp.id)252.36 µV
v(onoise_total.mp.1overf)58.52 µV
v(inoise_total.mp.1overf)194.87 µV
v(onoise_total.mp)462.75 µV
v(inoise_total.mp)318.84 µV
v(onoise_total)1.3044 mV
v(inoise_total)5.6247 mV

BSIM3v3.3 pole-zero: common-source stage with Miller capacitance

corpus/regress/bsim3_pz.cir.pz#
bsim3_pz.cir
BSIM3v3.3 pole-zero: common-source stage with Miller capacitance
* Coverage: .pz of a resistively loaded common-source stage on the
* Berkeley 0.35um NMOS card (capMod 3 intrinsic capacitance matrix,
* CGSO/CGDO/CGBO overlaps, bulk junctions) driven from a source
* resistance, so the gate-drain feedback gives a right-half-plane
* zero and two poles (b3pzld.c, the AC stamps at complex s).
vdd 1 0 dc 3.3
vin 2 0 dc 0.9
rsig 2 3 10k
m1 4 3 0 0 n1 l=0.35u w=10u ad=10p as=10p pd=22u ps=22u
rl 1 4 5k
cl 4 0 50f
.pz 3 0 4 0 vol pz
.model n1 nmos
+Level=        8 version=3.3.0
+Tnom=27.0
+Nch= 2.498E+17  Tox=9E-09 Xj=1.00000E-07
+Lint=9.36e-8 Wint=1.47e-7
+Vth0= .6322    K1= .756  K2= -3.83e-2  K3= -2.612
+Dvt0= 2.812  Dvt1= 0.462  Dvt2=-9.17e-2
+Nlx= 3.52291E-08  W0= 1.163e-6
+K3b= 2.233
+Vsat= 86301.58  Ua= 6.47e-9  Ub= 4.23e-18  Uc=-4.706281E-11
+Rdsw= 650  U0= 388.3203 wr=1
+A0= .3496967 Ags=.1    B0=0.546    B1= 1
+Dwg = -6.0E-09 Dwb = -3.56E-09 Prwb = -.213
+Keta=-3.605872E-02  A1= 2.778747E-02  A2= .9
+Voff=-6.735529E-02  NFactor= 1.139926  Cit= 1.622527E-04
+Cdsc=-2.147181E-05
+Cdscb= 0  Dvt0w =  0 Dvt1w =  0 Dvt2w =  0
+Cdscd =  0 Prwg =  0
+Eta0= 1.0281729E-02  Etab=-5.042203E-03
+Dsub= .31871233
+Pclm= 1.114846  Pdiblc1= 2.45357E-03  Pdiblc2= 6.406289E-03
+Drout= .31871233  Pscbe1= 5000000  Pscbe2= 5E-09 Pdiblcb = -.234
+Pvag= 0 delta=0.01
+Wl =  0 Ww = -1.420242E-09 Wwl =  0
+Wln =  0 Wwn =  .2613948 Ll =  1.300902E-10
+Lw =  0 Lwl =  0 Lln =  .316394
+Lwn =  0
+kt1=-.3  kt2=-.051
+At= 22400
+Ute=-1.48
+Ua1= 3.31E-10  Ub1= 2.61E-19 Uc1= -3.42e-10
+Kt1l=0 Prt=764.3
+vgs_max=4 vds_max=4 vbs_max=4
.end
Pole-Zero Analysis
realimag
pole 1-7.94781G0
zero 1266.222G0

BSIM3v3.3 transfer families at 85 C: subthreshold, body effect, DELVTO/MULU0

corpus/regress/bsim3_vg.cir.dc#
bsim3_vg.cir
BSIM3v3.3 transfer families at 85 C: subthreshold, body effect, DELVTO/MULU0
* Coverage: gate sweep 0..1.6 V in 20 mV steps (deep subthreshold
* through strong inversion, so all three Vgsteff branches and the
* n/Cdsc/Cit swing) at three body biases (Vbseff smoothing, K1/K2,
* DVT/DVT2W short-channel terms, K3/K3B narrow width) for the
* Berkeley 0.35um NMOS and PMOS (mirrored through E sources), with
* .options temp=85 against TNOM=27 so UTE/KT1/KT2/UA1/UB1/UC1/AT/PRT
* and the junction temperature laws all act; a third NMOS carries
* DELVTO and MULU0, a fourth a binned card (LVTH0/WU0/PK1-style L/W
* terms, BINUNIT=1) at a short, narrow geometry.
.options temp=85
vd 1 0 dc 0.1
vg 2 0 dc 0
vb 3 0 dc 0
m1 1 2 0 3 n1 l=0.35u w=2u ad=2p as=2p pd=6u ps=6u
m3 1 2 0 3 n1 l=0.35u w=2u ad=2p as=2p pd=6u ps=6u delvto=0.05 mulu0=0.9
m4 1 2 0 3 nb l=0.4u w=1u ad=1p as=1p pd=4u ps=4u
ep1 11 0 1 0 -1
ep2 12 0 2 0 -1
ep3 13 0 3 0 -1
vmp 14 11 dc 0
mp1 14 12 0 13 p1 l=0.35u w=5u ad=5p as=5p pd=12u ps=12u
.dc vg 0 1.6 0.02 vb 0 -2 -1
.model n1 nmos
+Level=        8 version=3.3.0
+Tnom=27.0
+Nch= 2.498E+17  Tox=9E-09 Xj=1.00000E-07
+Lint=9.36e-8 Wint=1.47e-7
+Vth0= .6322    K1= .756  K2= -3.83e-2  K3= -2.612
+Dvt0= 2.812  Dvt1= 0.462  Dvt2=-9.17e-2
+Nlx= 3.52291E-08  W0= 1.163e-6
+K3b= 2.233
+Vsat= 86301.58  Ua= 6.47e-9  Ub= 4.23e-18  Uc=-4.706281E-11
+Rdsw= 650  U0= 388.3203 wr=1
+A0= .3496967 Ags=.1    B0=0.546    B1= 1
+Dwg = -6.0E-09 Dwb = -3.56E-09 Prwb = -.213
+Keta=-3.605872E-02  A1= 2.778747E-02  A2= .9
+Voff=-6.735529E-02  NFactor= 1.139926  Cit= 1.622527E-04
+Cdsc=-2.147181E-05
+Cdscb= 0  Dvt0w =  0 Dvt1w =  0 Dvt2w =  0
+Cdscd =  0 Prwg =  0
+Eta0= 1.0281729E-02  Etab=-5.042203E-03
+Dsub= .31871233
+Pclm= 1.114846  Pdiblc1= 2.45357E-03  Pdiblc2= 6.406289E-03
+Drout= .31871233  Pscbe1= 5000000  Pscbe2= 5E-09 Pdiblcb = -.234
+Pvag= 0 delta=0.01
+Wl =  0 Ww = -1.420242E-09 Wwl =  0
+Wln =  0 Wwn =  .2613948 Ll =  1.300902E-10
+Lw =  0 Lwl =  0 Lln =  .316394
+Lwn =  0
+kt1=-.3  kt2=-.051
+At= 22400
+Ute=-1.48
+Ua1= 3.31E-10  Ub1= 2.61E-19 Uc1= -3.42e-10
+Kt1l=0 Prt=764.3
+vgs_max=4 vds_max=4 vbs_max=4
.model p1 pmos
+Level=        8 version=3.3.0
+Tnom=27.0
+Nch= 3.533024E+17  Tox=9E-09 Xj=1.00000E-07
+Lint=6.23e-8 Wint=1.22e-7
+Vth0=-.6732829 K1= .8362093  K2=-8.606622E-02  K3= 1.82
+Dvt0= 1.903801  Dvt1= .5333922  Dvt2=-.1862677
+Nlx= 1.28e-8  W0= 2.1e-6
+K3b= -0.24 Prwg=-0.001 Prwb=-0.323
+Vsat= 103503.2  Ua= 1.39995E-09  Ub= 1.e-19  Uc=-2.73e-11
+Rdsw= 460  U0= 138.7609
+A0= .4716551 Ags=0.12
+Keta=-1.871516E-03  A1= .3417965  A2= 0.83
+Voff=-.074182  NFactor= 1.54389  Cit=-1.015667E-03
+Cdsc= 8.937517E-04
+Cdscb= 1.45e-4  Cdscd=1.04e-4
+Dvt0w=0.232 Dvt1w=4.5e6 Dvt2w=-0.0023
+Eta0= 6.024776E-02  Etab=-4.64593E-03
+Dsub= .23222404
+Pclm= .989  Pdiblc1= 2.07418E-02  Pdiblc2= 1.33813E-3
+Drout= .3222404  Pscbe1= 118000  Pscbe2= 1E-09
+Pvag= 0
+kt1= -0.25  kt2= -0.032 prt=64.5
+At= 33000
+Ute= -1.5
+Ua1= 4.312e-9 Ub1= 6.65e-19  Uc1= 0
+Kt1l=0
+vgs_max=4 vds_max=4 vbs_max=4
.model nb nmos
+Level=        8 version=3.3.0
+Tnom=27.0
+Nch= 2.498E+17  Tox=9E-09 Xj=1.00000E-07
+Lint=9.36e-8 Wint=1.47e-7
+Vth0= .6322    K1= .756  K2= -3.83e-2  K3= -2.612
+Dvt0= 2.812  Dvt1= 0.462  Dvt2=-9.17e-2
+Nlx= 3.52291E-08  W0= 1.163e-6
+K3b= 2.233
+Vsat= 86301.58  Ua= 6.47e-9  Ub= 4.23e-18  Uc=-4.706281E-11
+Rdsw= 650  U0= 388.3203 wr=1
+A0= .3496967 Ags=.1    B0=0.546    B1= 1
+Dwg = -6.0E-09 Dwb = -3.56E-09 Prwb = -.213
+Keta=-3.605872E-02  A1= 2.778747E-02  A2= .9
+Voff=-6.735529E-02  NFactor= 1.139926  Cit= 1.622527E-04
+Cdsc=-2.147181E-05
+Cdscb= 0  Dvt0w =  0 Dvt1w =  0 Dvt2w =  0
+Cdscd =  0 Prwg =  0
+Eta0= 1.0281729E-02  Etab=-5.042203E-03
+Dsub= .31871233
+Pclm= 1.114846  Pdiblc1= 2.45357E-03  Pdiblc2= 6.406289E-03
+Drout= .31871233  Pscbe1= 5000000  Pscbe2= 5E-09 Pdiblcb = -.234
+Pvag= 0 delta=0.01
+Wl =  0 Ww = -1.420242E-09 Wwl =  0
+Wln =  0 Wwn =  .2613948 Ll =  1.300902E-10
+Lw =  0 Lwl =  0 Lln =  .316394
+Lwn =  0
+kt1=-.3  kt2=-.051
+At= 22400
+Ute=-1.48
+Ua1= 3.31E-10  Ub1= 2.61E-19 Uc1= -3.42e-10
+Kt1l=0 Prt=764.3
+vgs_max=4 vds_max=4 vbs_max=4
+lvth0=0.02 wvth0=-0.01 pvth0=0.005 lu0=10 wu0=-20 lk1=0.02 wk1=0.01 pk1=-0.002
+lua=1e-10 wvsat=-2000 lrdsw=50 wpclm=0.05 ldvt0=0.1 wnfactor=0.05
.end
DC transfer characteristicnested sweep
-150 µA-100 µA-50 µA0 A50 µA100 µA0 V500 mV1 V1.5 Vi(vd)i(ep1)i(vmp)
i(vd)i(ep1)i(vmp)(+11 more vectors)

S-parameters 3

ngspice-style .sp analyses (corpus/regress/sp_*).

S-parameters of a passive RLC two-port, ports of different Z0 (ngspice .sp)

corpus/regress/sp_2port.cir.ac.op.sp#
sp_2port.cir
S-parameters of a passive RLC two-port, ports of different Z0 (ngspice .sp)
* Coverage: two RF ports (PORTNUM) with Z0 = 50 and 75 ohm around an
* RLC T-network with a shunt resonator, dec sweep across the
* resonance. Port 1 also carries a DC value and an AC stimulus: .op
* sees the source behind its 50 ohm reference resistor (internal node
* v1#res), .ac drives through it, and .sp ignores the AC stimulus
* (MODESP) and excites the ports itself. S/Y/Z against ngspice-47.
* The cards follow ngspice's run order (its analysis table, not the
* deck), which Dune's card-order run must match plot by plot.
v1 in 0 dc 1 ac 1 portnum 1
v2 out 0 dc 0 portnum 2 z0 75
r1 in a 10
l1 a mid 100n
c1 mid 0 10p
l2 mid b 1u
c2 b 0 100p
r2 b 0 1k
r3 mid out 22
rl out 0 300
.ac dec 5 1meg 1g
.op
.sp dec 10 1meg 1g
.end
AC Analysismagnitudelog f
1 µV100 µV10 mV1 V1 MHz10 MHz100 MHz1 GHzv(in)v(out)v(a)v(mid)v(b)
v(in)v(out)v(a)v(mid)v(b)(+6 more vectors)
Operating Point
vectorvalue
v(in)631.77 mV
i(v1)-7.3646 mA
v(v1#res)1 V
v(out)408.39 mV
i(v2)5.4451 mA
v(v2#res)0 V
v(a)558.13 mV
v(mid)558.13 mV
i(l1)7.3646 mA
v(b)558.13 mV
i(l2)558.13 µA
SP Analysismagnitudelog f
0200m400m600m800m11 MHz10 MHz100 MHz1 GHzS_1_1S_1_2S_2_1S_2_2
S_1_1S_1_2S_2_1S_2_2(+19 more vectors)

S-parameters of a MOS common-source stage (ngspice .sp, non-reciprocal)

corpus/regress/sp_amp.cir.sp#
sp_amp.cir
S-parameters of a MOS common-source stage (ngspice .sp, non-reciprocal)
* Coverage: an active two-port between PORTNUM sources, so S21 and
* S12 differ by the transistor's gain (S12 only through the overlap
* and junction capacitances); the ports have no DC value and sit
* behind 50 ohm. The span is not a whole number of decades: span.c
* steps by 10^(1/n) from FSTART (the 3f5 rule), unlike ngspice-47's
* .ac, which re-spaces the points onto FSTOP. MOS1 keeps the
* operating point free of the Boltzmann/charge constants, which
* differ between the 3f5 and ngspice (KNOWN_DIFFS).
vdd vdd 0 dc 5
v1 p1 0 portnum 1
v2 p2 0 portnum 2
cin p1 g 10n
rg1 vdd g 300k
rg2 g 0 100k
m1 d g s 0 nm w=50u l=2u ad=100p as=100p pd=54u ps=54u
rs s 0 200
cs s 0 1n
rd vdd d 2k
cout d p2 10n
.model nm nmos level=1 vto=0.7 kp=60u lambda=0.02 gamma=0.4 phi=0.65
+ cgso=0.3n cgdo=0.3n cbd=50f cbs=50f mj=0.5 pb=0.8 rd=10 rs=10
.sp dec 10 1meg 500meg
.end
SP Analysismagnitudelog f
1µ100µ10m11 MHz10 MHz100 MHzS_1_1S_1_2S_2_1S_2_2
S_1_1S_1_2S_2_1S_2_2(+19 more vectors)

S-parameter noise of a BJT common-emitter stage (ngspice .sp DONOISE=1)

corpus/regress/sp_noise.cir.sp#
sp_noise.cir
S-parameter noise of a BJT common-emitter stage (ngspice .sp DONOISE=1)
* Coverage: the .sp noise correlation matrix Cy (written by ngspice as
* i(Cy_i_j)) from the transistor's shot and thermal generators and the
* bias resistors' thermal noise carried to the ports through the
* adjoint solves, plus the two-port noise parameters NF, NFmin, SOpt
* and Rn at the port-1 reference. The transistor has flicker noise
* (KF=1e-12, comparable to the base shot noise at 2 MHz), which .sp
* drops (N_GAIN path of NevalSrc). Cy itself (~1e-23 A^2/Hz) sits far
* below the comparison's abstol floor, so the gate on the noise path
* is NF/NFmin/Rn/SOpt, which are ratios of Cy entries.
vcc vcc 0 dc 12
v1 p1 0 portnum 1
v2 p2 0 portnum 2 z0 75
cin p1 b 10n
rb1 vcc b 47k
rb2 b 0 10k
q1 c b e qn
re e 0 470
ce e 0 100n
rc vcc c 1k
cout c p2 10n
.model qn npn is=1e-16 bf=120 vaf=60 rb=50 rc=5 re=1 cje=1p cjc=0.5p tf=50p kf=1e-12
.sp oct 2 2meg 64meg 1
.end
SP Analysismagnitudelog f
100µ1m10m100m11010 MHzS_1_1S_1_2S_2_1S_2_2
S_1_1S_1_2S_2_1S_2_2(+27 more vectors)