diff options
author | rahulp13 | 2020-03-03 05:31:58 +0530 |
---|---|---|
committer | rahulp13 | 2020-03-03 05:31:58 +0530 |
commit | dfc268e0863c913a1b8726cd54eea3b40caf7c67 (patch) | |
tree | 1cd82634684da5ae86b558d44756189e080545d4 /Windows/spice/examples/various | |
parent | fd62c52150c7d1f81da8060b2f5db6b94d174ccf (diff) | |
download | eSim-dfc268e0863c913a1b8726cd54eea3b40caf7c67.tar.gz eSim-dfc268e0863c913a1b8726cd54eea3b40caf7c67.tar.bz2 eSim-dfc268e0863c913a1b8726cd54eea3b40caf7c67.zip |
upgrade ngspice to v31
Diffstat (limited to 'Windows/spice/examples/various')
17 files changed, 911 insertions, 2 deletions
diff --git a/Windows/spice/examples/various/3d_loop.sp b/Windows/spice/examples/various/3d_loop.sp new file mode 100644 index 00000000..5f64efd1 --- /dev/null +++ b/Windows/spice/examples/various/3d_loop.sp @@ -0,0 +1,179 @@ +testing loops +*variables are global +*vector reside only in the plot where they where created + +.param rr = 10k + +R1 r2 0 r = {rr + 40*TEMPER} +V1 r2 0 1 + +.control +*create a new plot as our base plot +setplot new +set curplottitle = "crossplot" +set plotname=$curplot + +let aa = 5 +let bb = 3 +let cc = 6 +set aa="$&aa" +set bb="$&bb" +set cc="$&cc" + +* generate vector with all (here 90) elements +let result=vector(90) +settype current result +* reshape vector to format 5 x 3 x 6 +*reshape result [5][3][6] +reshape result [$aa][$bb][$cc] + +* vector to store temperature +let tvect=vector(5) +* vector to store voltage +let vvect=vector(6) +* vector to store parameter values +let pvect=vector(3) + +*index for storing in vectors tvect and result + +let indexp = 0 + +foreach pvar 9.5k 10k 10.5k + let indexv = 0 + alterparam rr = $pvar + let pvect[indexp] = $pvar + mc_source + foreach var -40 -20 0 20 40 + set temp = $var + dc v1 0 5 1 + *store name of the actual dc plot + set dcplotname = $curplot + * back to the base plot + setplot $plotname + let result[indexv][indexp] = {$dcplotname}.v1#branch + let tvect[indexv] = $var + if indexv = 0 + let vvect = {$dcplotname}.r2 + end + let indexv = indexv + 1 +* destroy $dcplotname + end + let indexp = indexp + 1 + remcirc +end + +settype voltage vvect +setscale vvect + +let indexplot = 0 +while indexplot < indexp +*plot result[0][indexplot] result[1][indexplot] result[2][indexplot] result[3][indexplot] result[4][indexplot] +let indexplot = indexplot + 1 +end + + +plot ++result[0][0] result[1][0] result[2][0] result[3][0] result[4][0] ++result[0][1] result[1][1] result[2][1] result[3][1] result[4][1] ++result[0][2] result[1][2] result[2][2] result[3][2] result[4][2] + +write 3d_loop_i_vs_v.out ++result[0][0] result[1][0] result[2][0] result[3][0] result[4][0] ++result[0][1] result[1][1] result[2][1] result[3][1] result[4][1] ++result[0][2] result[1][2] result[2][2] result[3][2] result[4][2] + +*transpoe a 3D vector +let aai = 0 +let bbi = 0 +let cci = 0 +let result1 = vector(90) +settype current result1 +* reshape vector to format 3 x 6 x 5 +reshape result1 [$bb][$cc][$aa] + +* shift from vector format 5 x 3 x 6 to 3 x 6 x 5 +*echo test output > resultout.txt +while aai < aa + let bbi = 0 + while bbi < bb + let cci = 0 + while cci < cc + let result1[bbi][cci][aai] = result[aai][bbi][cci] +* print bbi cci aai >> resultout.txt +* print result1[bbi][cci][aai] >> resultout.txt + let cci = cci + 1 + end + let bbi = bbi + 1 + end + let aai = aai + 1 +end + +settype temp-sweep tvect +setscale tvect + +* current through v1 versus temperature +plot ++result1[0][0] result1[1][0] result1[2][0] ++result1[0][1] result1[1][1] result1[2][1] ++result1[0][2] result1[1][2] result1[2][2] ++result1[0][3] result1[1][3] result1[2][3] ++result1[0][4] result1[1][4] result1[2][4] ++result1[0][5] result1[1][5] result1[2][5] + +write 3d_loop_i_vs_t.out ++result1[0][0] result1[1][0] result1[2][0] ++result1[0][1] result1[1][1] result1[2][1] ++result1[0][2] result1[1][2] result1[2][2] ++result1[0][3] result1[1][3] result1[2][3] ++result1[0][4] result1[1][4] result1[2][4] ++result1[0][5] result1[1][5] result1[2][5] + +*plot result1 + +*transpoe a 3D vector +let aai = 0 +let bbi = 0 +let cci = 0 +let result2 = vector(90) +settype current result2 +* reshape vector to format 6 x 5 x 3 +reshape result2 [$cc][$aa][$bb] + +* shift from vector format 3 x 6 x 5 to 6 x 5 x 3 +*echo test output > resultout.txt +while aai < aa + let bbi = 0 + while bbi < bb + let cci = 0 + while cci < cc + let result2[cci][aai][bbi] = result1[bbi][cci][aai] +* print cci aai bbi >> resultout.txt +* print result2[cci][aai][bbi] >> resultout.txt + let cci = cci + 1 + end + let bbi = bbi + 1 + end + let aai = aai + 1 +end + +settype impedance pvect +setscale pvect + +* current through v1 versus parameter rr +plot ++result2[0][0] result2[1][0] result2[2][0] result2[3][0] result2[4][0] result2[5][0] ++result2[0][1] result2[1][1] result2[2][1] result2[3][1] result2[4][1] result2[5][1] ++result2[0][2] result2[1][2] result2[2][2] result2[3][2] result2[4][2] result2[5][2] ++result2[0][3] result2[1][3] result2[2][3] result2[3][3] result2[4][3] result2[5][3] ++result2[0][4] result2[1][4] result2[2][4] result2[3][4] result2[4][4] result2[5][4] + +write 3d_loop_i_vs_para.out ++result2[0][0] result2[1][0] result2[2][0] result2[3][0] result2[4][0] result2[5][0] ++result2[0][1] result2[1][1] result2[2][1] result2[3][1] result2[4][1] result2[5][1] ++result2[0][2] result2[1][2] result2[2][2] result2[3][2] result2[4][2] result2[5][2] ++result2[0][3] result2[1][3] result2[2][3] result2[3][3] result2[4][3] result2[5][3] ++result2[0][4] result2[1][4] result2[2][4] result2[3][4] result2[4][4] result2[5][4] + +.endc + +.end diff --git a/Windows/spice/examples/various/alterparam.sp b/Windows/spice/examples/various/alterparam.sp new file mode 100644 index 00000000..663f73a2 --- /dev/null +++ b/Windows/spice/examples/various/alterparam.sp @@ -0,0 +1,40 @@ +*test alterparam +.param vv = 1 +.param rr = 'vv + 1' + +R1 1 0 {rr + 1} +v1 1 0 1 + +.subckt subr in out rint1 = 6 + .param rint = 5 + .param rint2 = 8 + R0 in out 'rint' + R1 in out 'rint1' + R2 in out 'rint2' +.ends + +Xr 2 0 subr rint = 7 rint1 = 9 +v2 2 0 1 + +.control +op +print v1#branch v2#branch +echo +listing expand +alterparam vv = 2 +reset +op +print v1#branch v2#branch +echo +listing expand +alterparam subr rint = 13 +alterparam subr rint1 = 15 +alterparam subr rint2 = 17 +reset +op +print v1#branch v2#branch +echo +listing expand +.endc + +.end diff --git a/Windows/spice/examples/various/bjt_ac_par.sp b/Windows/spice/examples/various/bjt_ac_par.sp new file mode 100644 index 00000000..048eb6f3 --- /dev/null +++ b/Windows/spice/examples/various/bjt_ac_par.sp @@ -0,0 +1,30 @@ +Plot inner small signal parameter + +v1 1 0 dc 10.0 +rc 1 c 2k +vb b 0 dc 0.6 +q1 c b 0 bfs17 + +.MODEL BFS17 NPN (level=1 IS=0.48F NF=1.008 BF=99.655 VAF=90.000 IKF=0.190 ++ ISE=7.490F NE=1.762 NR=1.010 BR=38.400 VAR=7.000 IKR=93.200M ++ ISC=0.200F NC=1.042 ++ RB=1.500 IRB=0.100M RBM=1.200 ++ RE=0.500 RC=2.680 ++ CJE=1.325P VJE=0.700 MJE=0.220 FC=0.890 ++ CJC=1.050P VJC=0.610 MJC=0.240 XCJC=0.400 ++ TF=56.940P TR=1.000N PTF=21.000 ++ XTF=68.398 VTF=0.600 ITF=0.700 ++ XTB=1.600 EG=1.110 XTI=3.000 ++ KF=1.000F AF=1.000) + +.control +save @q1[gm] @q1[pi] @q1[go] +save @q1[qbe] @q1[qbc] +save @q1[cmu] @q1[cpi] +dc vb 0.4 1 0.01 +plot @q1[gm] @q1[gpi] @q1[go] +plot @q1[qbe] @q1[qbc] +plot @q1[cmu] @q1[cpi] +.endc + +.end diff --git a/Windows/spice/examples/various/bjtnoise.cir b/Windows/spice/examples/various/bjtnoise.cir new file mode 100644 index 00000000..002c0d85 --- /dev/null +++ b/Windows/spice/examples/various/bjtnoise.cir @@ -0,0 +1,29 @@ +BJT Noise Test + +vcc 4 0 50 +vin 1 0 ac 1 + +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 cjc=4e-12 +.noise v(3) vin dec 10 1k 100Meg 1 + +.control +run +setplot +setplot noise1 +plot ally +plot inoise_spectrum onoise_spectrum +setplot noise2 +print all +echo +print inoise_total onoise_total +.endc + +.end diff --git a/Windows/spice/examples/various/compose-examples.cir b/Windows/spice/examples/various/compose-examples.cir new file mode 100644 index 00000000..25206cee --- /dev/null +++ b/Windows/spice/examples/various/compose-examples.cir @@ -0,0 +1,32 @@ +compose examples + +.control +compose vec1 values (-3) (-5) 4 6 +echo $&vec1 +echo +compose vec2 values (-3) (-5*PI) 4 6*e +echo $&vec2 +echo +compose vec3 start=-3 stop=7 step = 2 +echo $&vec3 +echo +compose vec4 start=-3 stop=7 step = 2 lin=19 +*warning, step is ignored +echo $&vec4 +echo +compose vec5 dec=3 start=0.1 stop=10 +echo $&vec5 +echo +compose vec6 dec=3 start=-0.1 stop=10 +*error, value is negative +echo $&vec6 +echo +compose vec7 log=3 start=0.1 stop=10 +echo $&vec7 +echo +compose vec8 gauss=10 mean=1 sd=0.2 +echo $&vec8 +echo +.endc + +.end diff --git a/Windows/spice/examples/various/dc_loop.sp b/Windows/spice/examples/various/dc_loop.sp new file mode 100644 index 00000000..19511593 --- /dev/null +++ b/Windows/spice/examples/various/dc_loop.sp @@ -0,0 +1,48 @@ +testing loops +*variables are global +*vector reside only in the plot where they where created + +R1 r2 0 r = {5k + 50*TEMPER} +V1 r2 0 1 + +.control +*create a new plot as our base plot +setplot new +set curplottitle = "crossplot" +set plotname=$curplot + +* generate vector with all (here 30) elements +let result=vector(30) +* reshape vector to format 5 x 6 +reshape result [5][6] +* vector to store temperature +let tvect=vector(5) + +*index for storing in vectors tvect and result +let index = 0 + +foreach var -40 -20 0 20 40 + set temp = $var + dc v1 0 5 1 + *store name of the actual dc plot + set dcplotname = $curplot + * back to the base plot + setplot $plotname + let result[index] = {$dcplotname}.v1#branch + let tvect[index] = $var + settype current result + let index = index + 1 + destroy $dcplotname +end + +settype temp-sweep tvect +setscale tvect + +transpose result + +plot result +write dc_loop.out result[0] result[1] result[2] result[3] result[4] result[5] + +.endc + +.end diff --git a/Windows/spice/examples/various/diode_ac_par.sp b/Windows/spice/examples/various/diode_ac_par.sp new file mode 100644 index 00000000..b2d53631 --- /dev/null +++ b/Windows/spice/examples/various/diode_ac_par.sp @@ -0,0 +1,28 @@ +Plot inner small signal parameter + +v1 1 0 dc 0 +d1 1 0 myd +.model myd D(IS = 1.50E-07 ++ N = 1.0 ++ RS = 9 ++ TT = 100n ++ CJ0 = 1.01p ++ VJ = 0.44 ++ M = 0.5 ++ EG = 1.11 ++ XTI = 3 ++ KF = 0 ++ AF = 1 ++ FC = 0.5 ++ BV = 22 ++ IBV = 10u) + +.control +save @d1[gd] @d1[cd] @d1[qd] +dc v1 -5 .1 0.01 +plot @d1[gd] +plot @d1[cd] +plot @d1[qd] +.endc +* +.END diff --git a/Windows/spice/examples/various/i(xxx)_tests.cir b/Windows/spice/examples/various/i(xxx)_tests.cir new file mode 100644 index 00000000..0bbd3c2d --- /dev/null +++ b/Windows/spice/examples/various/i(xxx)_tests.cir @@ -0,0 +1,89 @@ +i(XXX) test +* Restrictions of function i(device): +* O.K. when device and i(device) are at top level. +* O.K. when device and i(device) are in the same +* subcircuit at first subcircuit level. +* O.K. when device and i(device) are in the same +* subcircuit at some deeper subcircuit level. + +* source at top level, function i(XXX) at top level +*o.k. +R1 1 0 1 +V1 1 0 1 +R2 2 0 '5 * i(R1)' +V2 2 0 1 + +* source at top level, function i(XXX) at subckt level +* geht nicht! +*.subckt contr1 n1 n2 +*RS1 n1 n2 '6 * i(R1)' +*.ends + +*XR1 3 0 contr1 +*V3 3 0 1 + +* source at subckt level, function i(XXX) at same subckt +* o.k. +.subckt contr2 n1 n2 +RS1 n1 n2 '6 * i(RS2)' +RS2 1 0 1 +V1 1 0 1 +.ends + +XR2 4 0 contr2 +V4 4 0 1 + +* source at subckt level, function i(XXX) at same subckt level +* but different subcircuit: should not do! +* does not do! +*.subckt contr3 n1 n2 +*RS1 n1 n2 '6 * i(RS2)' +*.ends + +*XR3 5 0 contr3 +*V5 5 0 1 + + +* source at subckt level, function i(XXX) at top level +* geht nicht! + +*.subckt contr4 n1 n2 +*RS41 n1 n2 7 +*VS41 n1 n2 1 +*.ends + +*XR4 6 0 contr4 +*R6 7 0 '10*i(r.xr4.rs41)' +*V6 7 0 1 + + +* source at second subckt level, function i(XXX) at same subckt +* o.k. +.subckt contr5 n1 n2 +XR2 n1 n2 contr2 +.ends + +XR8 8 0 contr5 +V8 8 0 1 + +* MOS device, first node only +vd d 0 1 +vg g 0 1 +vb b 0 0 +vs s 0 0 +m1 d g s b n1 W=10u L=1u +RM 10 0 '1E6 * i(M1)' +VRM 10 0 1 + +* reuse i(M1) +BMM 11 0 V='1E6 * i(M1)' +RMM 11 0 1 + +.include modelcard.nmos + +.control +op +print i(V1) i(V2) i(V4) i(V8) i(VRM) i(BMM) +.endc + +.end diff --git a/Windows/spice/examples/various/model-name-check.cir b/Windows/spice/examples/various/model-name-check.cir new file mode 100644 index 00000000..248f5ad1 --- /dev/null +++ b/Windows/spice/examples/various/model-name-check.cir @@ -0,0 +1,68 @@ +* model name check + +V1 1 0 1 +R1 1 2 1k + +D1 2 0 DMOD +.model DMOD D (is=1e-13 bv=50) +* o.k. + +D2 2 0 _DMOD +.model _DMOD D (is=1e-13 bv=50) +* o.k. + +D3 2 0 1n4001 +.model 1n4001 D (is=1e-13 bv=50) +* o.k. + +D4 2 0 22N4 +.model 22N4 D (is=1e-13 bv=50) +* o.k. + +D5 2 0 1e34 +.model 1e34 D (is=1e-13 bv=50) +* not o.k. + +D6 2 0 74ls4444 +.model 74ls4444 D (is=1e-13 bv=50) +* o.k. + +D7 2 0 ^274ls4444 +.model ^274ls4444 D (is=1e-13 bv=50) +* not o.k. + +D8 2 0 74!4444 +.model 74!4444 D (is=1e-13 bv=50) +* o.k. + +D9 2 0 12p4444 +.model 12p4444 D (is=1e-13 bv=50) +* o.k. + +D10 2 0 17n +.model 17n D (is=1e-13 bv=50) +* not o.k. + +D11 2 0 17nB +.model 17nB D (is=1e-13 bv=50) +* o.k. + +D12 2 0 17e12n +.model 17e12n D (is=1e-13 bv=50) +* not o.k. + +D13 2 0 17e12Meg +.model 17e12Meg D (is=1e-13 bv=50) +* not o.k. + +D14 2 0 17e12Megg +.model 17e12Megg D (is=1e-13 bv=50) +* o.k. + +D15 2 0 20.5pF +.model 20.5pF D (is=1e-13 bv=50) +* not o.k. + +.end + + diff --git a/Windows/spice/examples/various/modelcard.nmos b/Windows/spice/examples/various/modelcard.nmos index 9a9bd56c..9512b41d 100644 --- a/Windows/spice/examples/various/modelcard.nmos +++ b/Windows/spice/examples/various/modelcard.nmos @@ -1,6 +1,5 @@ .model N1 NMOS +Level= 8 version=3.3.0 -+Lmin= .35 Lmax= 20 Wmin= .6 Wmax= 20 +Tnom=27.0 +Nch= 2.498E+17 Tox=9E-09 Xj=1.00000E-07 +Lint=9.36e-8 Wint=1.47e-7 diff --git a/Windows/spice/examples/various/modelcard.pmos b/Windows/spice/examples/various/modelcard.pmos index 1f67f274..e64c8cee 100644 --- a/Windows/spice/examples/various/modelcard.pmos +++ b/Windows/spice/examples/various/modelcard.pmos @@ -1,6 +1,5 @@ .model P1 PMOS +Level= 8 version=3.3.0 -+Lmin= .35 Lmax= 20 Wmin= .6 Wmax= 20 +Tnom=27.0 +Nch= 3.533024E+17 Tox=9E-09 Xj=1.00000E-07 +Lint=6.23e-8 Wint=1.22e-7 diff --git a/Windows/spice/examples/various/nmos_pmos_BSIM330.sp b/Windows/spice/examples/various/nmos_pmos_BSIM330.sp new file mode 100644 index 00000000..20b266e7 --- /dev/null +++ b/Windows/spice/examples/various/nmos_pmos_BSIM330.sp @@ -0,0 +1,44 @@ +*****Single NMOS and PMOS Transistor For BSIM3 threshold voltage check (Id-Vgs) (Id-Vds) *** + +M1 2 1 3 4 n1 W=1u L=0.35u Pd=1.5u Ps=1.5u ad=1.5p as=1.5p +vgs 1 0 3.5 +vds 2 0 0.1 +vss 3 0 0 +vbs 4 0 0 + +M2 22 11 33 44 p1 W=2.5u L=0.35u Pd=3u Ps=3u ad=2.5p as=2.5p +vgsp 11 0 -3.5 +vdsp 22 0 -0.1 +vssp 33 0 0 +vbsp 44 0 0 + +.options Temp=27.0 + +* BSIM3v3.3.0 model with modified default parameters 0.18µm +.model n1 nmos level=49 version=3.3.0 tox=3.5n nch=2.4e17 nsub=5e16 vth0=0.15 +.model p1 pmos level=49 version=3.3.0 tox=3.5n nch=2.5e17 nsub=5e16 vth0=-0.15 + +*.include ./Modelcards/modelcard.nmos $ Berkeley model cards limited to L >= 0.35µm +*.include ./Modelcards/modelcard.pmos $ Berkeley model cards limited to L >= 0.35µm + +* update of the default parameters required +*.model n1 NMOS level=49 version=3.3.0 $ nearly no current due to VT > 2 V ? +*.model p1 PMOS level=49 version=3.3.0 + +.control +dc vgs 0 1.5 0.05 vbs 0 -2.5 -0.5 +plot vss#branch +dc vds 0 2 0.05 vgs 0 2 0.4 +plot vss#branch +dc vgsp 0 -1.5 -0.05 vbsp 0 2.5 0.5 +plot vssp#branch +dc vdsp 0 -2 -0.05 vgsp 0 -2 -0.4 +plot vssp#branch +.endc + +.end + + + + + diff --git a/Windows/spice/examples/various/nmos_pmos_plotting.sp b/Windows/spice/examples/various/nmos_pmos_plotting.sp new file mode 100644 index 00000000..3ff61126 --- /dev/null +++ b/Windows/spice/examples/various/nmos_pmos_plotting.sp @@ -0,0 +1,49 @@ +*****Single NMOS and PMOS Transistor For BSIM3 threshold voltage check (Id-Vgs) (Id-Vds) *** + +M1 2 1 3 4 n1 W=1u L=0.35u Pd=1.5u Ps=1.5u ad=1.5p as=1.5p +vgs 1 0 3.5 +vds 2 0 0.1 +vss 3 0 0 +vbs 4 0 0 + +M2 22 11 33 44 p1 W=2.5u L=0.35u Pd=3u Ps=3u ad=2.5p as=2.5p +vgsp 11 0 -3.5 +vdsp 22 0 -0.1 +vssp 33 0 0 +vbsp 44 0 0 + +.options Temp=27.0 + +* BSIM3v3.3.0 model with modified default parameters 0.18µm +.model n1 nmos level=49 version=3.3.0 tox=3.5n nch=2.4e17 nsub=5e16 vth0=0.15 +.model p1 pmos level=49 version=3.3.0 tox=3.5n nch=2.5e17 nsub=5e16 vth0=-0.15 + +*.include ./Modelcards/modelcard.nmos $ Berkeley model cards limited to L >= 0.35µm +*.include ./Modelcards/modelcard.pmos $ Berkeley model cards limited to L >= 0.35µm + +* update of the default parameters required +*.model n1 NMOS level=49 version=3.3.0 $ nearly no current due to VT > 2 V ? +*.model p1 PMOS level=49 version=3.3.0 + +.control +* various plot font sizes +dc vgs 0 1.5 0.05 vbs 0 -2.5 -0.5 +plot vss#branch ylabel 'output current' +set wfont_size=18 +dc vds 0 2 0.05 vgs 0 2 0.4 +plot vss#branch ylabel 'output current' +set wfont_size=20 +dc vgsp 0 -1.5 -0.05 vbsp 0 2.5 0.5 +plot vssp#branch ylabel 'output current' +set wfont=Times +set wfont_size=18 +dc vdsp 0 -2 -0.05 vgsp 0 -2 -0.4 +plot vssp#branch ylabel 'output current' +.endc + +.end + + + + + diff --git a/Windows/spice/examples/various/ro_17_4.cir b/Windows/spice/examples/various/ro_17_4.cir new file mode 100644 index 00000000..9a4704f7 --- /dev/null +++ b/Windows/spice/examples/various/ro_17_4.cir @@ -0,0 +1,195 @@ +*****************==== 17-Stage CMOS RO ====******************* +*********** Benchmarking Implementation of BSIM4 by Jane Xi 11/05/2002. + +* this variant improves current memeasurement +* by setting 'xmu' + +vdd 1 0 2.0 +mp1 3 2 1 1 p1 l=0.1u w=10u ad=5p pd=6u as=5p ps=6u +mn1 3 2 0 0 n1 l=0.1u w=5u ad=5p pd=6u as=5p ps=6u +mp2 4 3 1 1 p1 l=0.1u w=10u ad=5p pd=6u as=5p ps=6u +mn2 4 3 0 0 n1 l=0.1u w=5u ad=5p pd=6u as=5p ps=6u +mp3 5 4 1 1 p1 l=0.1u w=10u ad=5p pd=6u as=5p ps=6u +mn3 5 4 0 0 n1 l=0.1u w=5u ad=5p pd=6u as=5p ps=6u +mp4 6 5 1 1 p1 l=0.1u w=10u ad=5p pd=6u as=5p ps=6u +mn4 6 5 0 0 n1 l=0.1u w=5u ad=5p pd=6u as=5p ps=6u +mp5 7 6 1 1 p1 l=0.1u w=10u ad=5p pd=6u as=5p ps=6u +mn5 7 6 0 0 n1 l=0.1u w=5u ad=5p pd=6u as=5p ps=6u +mp6 8 7 1 1 p1 l=0.1u w=10u ad=5p pd=6u as=5p ps=6u +mn6 8 7 0 0 n1 l=0.1u w=5u ad=5p pd=6u as=5p ps=6u +mp7 9 8 1 1 p1 l=0.1u w=10u ad=5p pd=6u as=5p ps=6u +mn7 9 8 0 0 n1 l=0.1u w=5u ad=5p pd=6u as=5p ps=6u +mp8 10 9 1 1 p1 l=0.1u w=10u ad=5p pd=6u as=5p ps=6u +mn8 10 9 0 0 n1 l=0.1u w=5u ad=5p pd=6u as=5p ps=6u +mp9 11 10 1 1 p1 l=0.1u w=10u ad=5p pd=6u as=5p ps=6u +mn9 11 10 0 0 n1 l=0.1u w=5u ad=5p pd=6u as=5p ps=6u +mp10 12 11 1 1 p1 l=0.1u w=10u ad=5p pd=6u as=5p ps=6u +mn10 12 11 0 0 n1 l=0.1u w=5u ad=5p pd=6u as=5p ps=6u + +mp11 13 12 1 1 p1 l=0.1u w=10u ad=5p pd=6u as=5p ps=6u +mn11 13 12 0 0 n1 l=0.1u w=5u ad=5p pd=6u as=5p ps=6u +mp12 14 13 1 1 p1 l=0.1u w=10u ad=5p pd=6u as=5p ps=6u +mn12 14 13 0 0 n1 l=0.1u w=5u ad=5p pd=6u as=5p ps=6u +mp13 15 14 1 1 p1 l=0.1u w=10u ad=5p pd=6u as=5p ps=6u +mn13 15 14 0 0 n1 l=0.1u w=5u ad=5p pd=6u as=5p ps=6u +mp14 16 15 1 1 p1 l=0.1u w=10u ad=5p pd=6u as=5p ps=6u +mn14 16 15 0 0 n1 l=0.1u w=5u ad=5p pd=6u as=5p ps=6u +mp15 17 16 1 1 p1 l=0.1u w=10u ad=5p pd=6u as=5p ps=6u +mn15 17 16 0 0 n1 l=0.1u w=5u ad=5p pd=6u as=5p ps=6u +mp16 18 17 1 1 p1 l=0.1u w=10u ad=5p pd=6u as=5p ps=6u +mn16 18 17 0 0 n1 l=0.1u w=5u ad=5p pd=6u as=5p ps=6u +mp17 2 18 1 1 p1 l=0.1u w=10u ad=5p pd=6u as=5p ps=6u +mn17 2 18 0 0 n1 l=0.1u w=5u ad=5p pd=6u as=5p ps=6u +c1 18 0 .1p + +* .ic v(2)=1.0 v(3)=1.0 v(4)=1.0 +* .ic v(2)=2.0 v(3)=0.0 v(4)=2.0 +* .ic v(2)=2.0 v(3)=0.0 v(4)=2.0 v(5)=0.0 v(6)=2.0 +* .ic v(7)=0.0 v(8)=2.0 v(9)=0.0 v(10)=2.0 v(11)=0.0 v(12)=2.0 +* .ic v(13)=0.0 v(14)=2.0 v(15)=0.0 v(16)=2.0 v(17)=0.0 v(18)=2.0 +* .ic V(10)=5 v(2)=5 v(3)=5 v(4)=5 v(5)=5 v(6)=5 + +* .ic v(18)=1 + +.tran .1ns 150ns uic + +* .option xmu = 0.49 +* .print tran v(5) + +.control + +* reduce current ringing +option xmu = 0.49 +* set xmu=0.49 + +set num_threads=4 +set noinit +run + +* current and output in a single plot +plot v(18) 1000*(-I(vdd)) ylimit -1 6 + +.endc + +* Short channel models from CMOS Circuit Design, Layout, and Simulation, +* 50nm BSIM4 models VDD=1V, see CMOSedu.com +* +.model N1 nmos level = 54 version = 4.5.0 ++binunit = 1 paramchk= 1 mobmod = 0 ++capmod = 2 igcmod = 1 igbmod = 1 geomod = 0 ++diomod = 1 rdsmod = 0 rbodymod= 1 rgatemod= 1 ++permod = 1 acnqsmod= 0 trnqsmod= 0 ++tnom = 27 toxe = 1.4e-009 toxp = 7e-010 toxm = 1.4e-009 ++epsrox = 3.9 wint = 5e-009 lint = 1.2e-008 ++ll = 0 wl = 0 lln = 1 wln = 1 ++lw = 0 ww = 0 lwn = 1 wwn = 1 ++lwl = 0 wwl = 0 xpart = 0 toxref = 1.4e-009 ++vth0 = 0.22 k1 = 0.35 k2 = 0.05 k3 = 0 ++k3b = 0 w0 = 2.5e-006 dvt0 = 2.8 dvt1 = 0.52 ++dvt2 = -0.032 dvt0w = 0 dvt1w = 0 dvt2w = 0 ++dsub = 2 minv = 0.05 voffl = 0 dvtp0 = 1e-007 ++dvtp1 = 0.05 lpe0 = 5.75e-008 lpeb = 2.3e-010 xj = 2e-008 ++ngate = 5e+020 ndep = 2.8e+018 nsd = 1e+020 phin = 0 ++cdsc = 0.0002 cdscb = 0 cdscd = 0 cit = 0 ++voff = -0.15 nfactor = 1.2 eta0 = 0.15 etab = 0 ++vfb = -0.55 u0 = 0.032 ua = 1.6e-010 ub = 1.1e-017 ++uc = -3e-011 vsat = 1.1e+005 a0 = 2 ags = 1e-020 ++a1 = 0 a2 = 1 b0 = -1e-020 b1 = 0 ++keta = 0.04 dwg = 0 dwb = 0 pclm = 0.18 ++pdiblc1 = 0.028 pdiblc2 = 0.022 pdiblcb = -0.005 drout = 0.45 ++pvag = 1e-020 delta = 0.01 pscbe1 = 8.14e+008 pscbe2 = 1e-007 ++fprout = 0.2 pdits = 0.2 pditsd = 0.23 pditsl = 2.3e+006 ++rsh = 3 rdsw = 150 rsw = 150 rdw = 150 ++rdswmin = 0 rdwmin = 0 rswmin = 0 prwg = 0 ++prwb = 6.8e-011 wr = 1 alpha0 = 0.074 alpha1 = 0.005 ++beta0 = 30 agidl = 0.0002 bgidl = 2.1e+009 cgidl = 0.0002 ++egidl = 0.8 ++aigbacc = 0.012 bigbacc = 0.0028 cigbacc = 0.002 ++nigbacc = 1 aigbinv = 0.014 bigbinv = 0.004 cigbinv = 0.004 ++eigbinv = 1.1 nigbinv = 3 aigc = 0.017 bigc = 0.0028 ++cigc = 0.002 aigsd = 0.017 bigsd = 0.0028 cigsd = 0.002 ++nigc = 1 poxedge = 1 pigcd = 1 ntox = 1 ++xrcrg1 = 12 xrcrg2 = 5 ++cgso = 6.238e-010 cgdo = 6.238e-010 cgbo = 2.56e-011 cgdl = 2.495e-10 ++cgsl = 2.495e-10 ckappas = 0.02 ckappad = 0.02 acde = 1 ++moin = 15 noff = 0.9 voffcv = 0.02 ++kt1 = -0.21 kt1l = 0.0 kt2 = -0.042 ute = -1.5 ++ua1 = 1e-009 ub1 = -3.5e-019 uc1 = 0 prt = 0 ++at = 53000 ++fnoimod = 1 tnoimod = 0 ++jss = 0.0001 jsws = 1e-011 jswgs = 1e-010 njs = 1 ++ijthsfwd= 0.01 ijthsrev= 0.001 bvs = 10 xjbvs = 1 ++jsd = 0.0001 jswd = 1e-011 jswgd = 1e-010 njd = 1 ++ijthdfwd= 0.01 ijthdrev= 0.001 bvd = 10 xjbvd = 1 ++pbs = 1 cjs = 0.0005 mjs = 0.5 pbsws = 1 ++cjsws = 5e-010 mjsws = 0.33 pbswgs = 1 cjswgs = 5e-010 ++mjswgs = 0.33 pbd = 1 cjd = 0.0005 mjd = 0.5 ++pbswd = 1 cjswd = 5e-010 mjswd = 0.33 pbswgd = 1 ++cjswgd = 5e-010 mjswgd = 0.33 tpb = 0.005 tcj = 0.001 ++tpbsw = 0.005 tcjsw = 0.001 tpbswg = 0.005 tcjswg = 0.001 ++xtis = 3 xtid = 3 ++dmcg = 0e-006 dmci = 0e-006 dmdg = 0e-006 dmcgt = 0e-007 ++dwj = 0e-008 xgw = 0e-007 xgl = 0e-008 ++rshg = 0.4 gbmin = 1e-010 rbpb = 5 rbpd = 15 ++rbps = 15 rbdb = 15 rbsb = 15 ngcon = 1 +* +.model P1 pmos level = 54 version = 4.5.0 ++binunit = 1 paramchk= 1 mobmod = 0 ++capmod = 2 igcmod = 1 igbmod = 1 geomod = 0 ++diomod = 1 rdsmod = 0 rbodymod= 1 rgatemod= 1 ++permod = 1 acnqsmod= 0 trnqsmod= 0 ++tnom = 27 toxe = 1.4e-009 toxp = 7e-010 toxm = 1.4e-009 ++epsrox = 3.9 wint = 5e-009 lint = 1.2e-008 ++ll = 0 wl = 0 lln = 1 wln = 1 ++lw = 0 ww = 0 lwn = 1 wwn = 1 ++lwl = 0 wwl = 0 xpart = 0 toxref = 1.4e-009 ++vth0 = -0.22 k1 = 0.39 k2 = 0.05 k3 = 0 ++k3b = 0 w0 = 2.5e-006 dvt0 = 3.9 dvt1 = 0.635 ++dvt2 = -0.032 dvt0w = 0 dvt1w = 0 dvt2w = 0 ++dsub = 0.7 minv = 0.05 voffl = 0 dvtp0 = 0.5e-008 ++dvtp1 = 0.05 lpe0 = 5.75e-008 lpeb = 2.3e-010 xj = 2e-008 ++ngate = 5e+020 ndep = 2.8e+018 nsd = 1e+020 phin = 0 ++cdsc = 0.000258 cdscb = 0 cdscd = 6.1e-008 cit = 0 ++voff = -0.15 nfactor = 2 eta0 = 0.15 etab = 0 ++vfb = 0.55 u0 = 0.0095 ua = 1.6e-009 ub = 8e-018 ++uc = 4.6e-013 vsat = 90000 a0 = 1.2 ags = 1e-020 ++a1 = 0 a2 = 1 b0 = -1e-020 b1 = 0 ++keta = -0.047 dwg = 0 dwb = 0 pclm = 0.55 ++pdiblc1 = 0.03 pdiblc2 = 0.0055 pdiblcb = 3.4e-008 drout = 0.56 ++pvag = 1e-020 delta = 0.014 pscbe1 = 8.14e+008 pscbe2 = 9.58e-007 ++fprout = 0.2 pdits = 0.2 pditsd = 0.23 pditsl = 2.3e+006 ++rsh = 3 rdsw = 250 rsw = 160 rdw = 160 ++rdswmin = 0 rdwmin = 0 rswmin = 0 prwg = 3.22e-008 ++prwb = 6.8e-011 wr = 1 alpha0 = 0.074 alpha1 = 0.005 ++beta0 = 30 agidl = 0.0002 bgidl = 2.1e+009 cgidl = 0.0002 ++egidl = 0.8 ++aigbacc = 0.012 bigbacc = 0.0028 cigbacc = 0.002 ++nigbacc = 1 aigbinv = 0.014 bigbinv = 0.004 cigbinv = 0.004 ++eigbinv = 1.1 nigbinv = 3 aigc = 0.69 bigc = 0.0012 ++cigc = 0.0008 aigsd = 0.0087 bigsd = 0.0012 cigsd = 0.0008 ++nigc = 1 poxedge = 1 pigcd = 1 ntox = 1 ++xrcrg1 = 12 xrcrg2 = 5 ++cgso = 7.43e-010 cgdo = 7.43e-010 cgbo = 2.56e-011 cgdl = 1e-014 ++cgsl = 1e-014 ckappas = 0.5 ckappad = 0.5 acde = 1 ++moin = 15 noff = 0.9 voffcv = 0.02 ++kt1 = -0.19 kt1l = 0 kt2 = -0.052 ute = -1.5 ++ua1 = -1e-009 ub1 = 2e-018 uc1 = 0 prt = 0 ++at = 33000 ++fnoimod = 1 tnoimod = 0 ++jss = 0.0001 jsws = 1e-011 jswgs = 1e-010 njs = 1 ++ijthsfwd= 0.01 ijthsrev= 0.001 bvs = 10 xjbvs = 1 ++jsd = 0.0001 jswd = 1e-011 jswgd = 1e-010 njd = 1 ++ijthdfwd= 0.01 ijthdrev= 0.001 bvd = 10 xjbvd = 1 ++pbs = 1 cjs = 0.0005 mjs = 0.5 pbsws = 1 ++cjsws = 5e-010 mjsws = 0.33 pbswgs = 1 cjswgs = 5e-010 ++mjswgs = 0.33 pbd = 1 cjd = 0.0005 mjd = 0.5 ++pbswd = 1 cjswd = 5e-010 mjswd = 0.33 pbswgd = 1 ++cjswgd = 5e-010 mjswgd = 0.33 tpb = 0.005 tcj = 0.001 ++tpbsw = 0.005 tcjsw = 0.001 tpbswg = 0.005 tcjswg = 0.001 ++xtis = 3 xtid = 3 ++dmcg = 0e-006 dmci = 0e-006 dmdg = 0e-006 dmcgt = 0e-007 ++dwj = 0e-008 xgw = 0e-007 xgl = 0e-008 ++rshg = 0.4 gbmin = 1e-010 rbpb = 5 rbpd = 15 ++rbps = 15 rbdb = 15 rbsb = 15 ngcon = 1 + +.end diff --git a/Windows/spice/examples/various/tmp-noise-2.cir b/Windows/spice/examples/various/tmp-noise-2.cir new file mode 100644 index 00000000..8dbb8910 --- /dev/null +++ b/Windows/spice/examples/various/tmp-noise-2.cir @@ -0,0 +1,24 @@ +* (exec-spice "ngspice %s" t) +* actually not noise but temp coeff + +v1 1 0 dc 100 ac=1 + +b2 2 0 i=v(1) tc1=0.001 +v2 0 2 0 + +b3 3 0 v=v(1) tc1=0.001 + +.temp 127.0 + +.control +op +let idc2=i(v2) +let vdc3=v(3) +print idc2 vdc3 + +ac dec 1 1kHz 1kHz +let iac2=i(v2) +let vac3=v(3) +print iac2 vac3 + +.endc diff --git a/Windows/spice/examples/various/tmp-noise.cir b/Windows/spice/examples/various/tmp-noise.cir new file mode 100644 index 00000000..b43e5694 --- /dev/null +++ b/Windows/spice/examples/various/tmp-noise.cir @@ -0,0 +1,33 @@ +* (exec-spice "ngspice %s" t) + +v1 1 0 dc 2 ac 1 +v2 200 0 dc=1 + +R1 1 2 1k +R2 2 0 1k tc1=0.001 $ tc2=1e-5 + +R10 1 20 1k +R20 20 0 '1k*v(200)' tc1=0.001 $ tc2=1e-5 + +.temp 127.0 + +.control +listing e + +op +let gold = 2/(1+1000/1100) +print v(2) v(20) gold + +noise v(2) v1 dec 1 1kHz 1kHz +let r = 1/(1/1000 + 1/1100) +let gold = sqrt(4*boltz*(273.15+127.0)*r) +print all gold + +noise v(20) v1 dec 1 1kHz 1kHz +print all + +ac dec 1 1kHz 1kHz +let gold = 1/(1+1000/1100) +print v(2) v(20) gold + +.endc diff --git a/Windows/spice/examples/various/todo-temper-3.cir b/Windows/spice/examples/various/todo-temper-3.cir new file mode 100644 index 00000000..e62c89e3 --- /dev/null +++ b/Windows/spice/examples/various/todo-temper-3.cir @@ -0,0 +1,23 @@ +* try temper + +* (exec-spice "ngspice %s" t) + +.model dplain d is={temper >= 25 ? 1e-10 : (temper+1)*1e-11} +.model dref d is=1e-10 + + +Iin 1 0 dc = -1mA +Dref 1 0 dref +e2 2 0 1 0 1 +D2 2 0 dplain +e3 3 0 1 0 1 +D3 3 0 dref area={temper >= 25 ? (temper+100)/100 : 2 } + +.control +dc temp 0 125 1.0 +plot e2#branch/@iin[dc] +plot e3#branch/@iin[dc] +*quit 0 +.endc + +.end |