summaryrefslogtreecommitdiff
path: root/Windows/spice/examples/Monte_Carlo
diff options
context:
space:
mode:
authorRahul Paknikar2021-01-08 12:47:23 +0530
committerGitHub2021-01-08 12:47:23 +0530
commite6f48f5b1bf22a1d048b44ed4416b4315a461306 (patch)
treefd357549a236cdc652f0b6d2919beee0cee7faa5 /Windows/spice/examples/Monte_Carlo
parentac223c4a69c701ad0a247401acdc48b8b6b6dba6 (diff)
parent6b512cbf954273b0f21d3800d10a7ad42a759425 (diff)
downloadeSim-e6f48f5b1bf22a1d048b44ed4416b4315a461306.tar.gz
eSim-e6f48f5b1bf22a1d048b44ed4416b4315a461306.tar.bz2
eSim-e6f48f5b1bf22a1d048b44ed4416b4315a461306.zip
Merge pull request #161 from rahulp13/installersi2.1
fixed key issue for ubuntu 20+; updated installers for windows os
Diffstat (limited to 'Windows/spice/examples/Monte_Carlo')
-rw-r--r--Windows/spice/examples/Monte_Carlo/MC_2_circ.sp109
-rw-r--r--Windows/spice/examples/Monte_Carlo/MC_2_control.sp47
-rw-r--r--Windows/spice/examples/Monte_Carlo/MC_ring.sp286
-rw-r--r--Windows/spice/examples/Monte_Carlo/MC_ring_ts.sp180
-rw-r--r--Windows/spice/examples/Monte_Carlo/MonteCarlo.sp68
-rw-r--r--Windows/spice/examples/Monte_Carlo/OpWien.sp87
-rw-r--r--Windows/spice/examples/Monte_Carlo/mc_ring_circ.net56
-rw-r--r--Windows/spice/examples/Monte_Carlo/mc_ring_lib_complete_actual.cir212
-rw-r--r--Windows/spice/examples/Monte_Carlo/rand_numb_test.cir40
9 files changed, 0 insertions, 1085 deletions
diff --git a/Windows/spice/examples/Monte_Carlo/MC_2_circ.sp b/Windows/spice/examples/Monte_Carlo/MC_2_circ.sp
deleted file mode 100644
index bacd07b9..00000000
--- a/Windows/spice/examples/Monte_Carlo/MC_2_circ.sp
+++ /dev/null
@@ -1,109 +0,0 @@
-Circuit to perform Monte Carlo simulation in ngspice
-* 25 stage Ring-Osc. using inverters with BSIM3
-
-vin in out dc 0.5 pulse 0.5 0 0.1n 5n 1 1 1
-vdd dd 0 dc 3.3
-vss ss 0 dc 0
-ve sub 0 dc 0
-vpe well 0 dc 3.3
-
-.subckt inv1 dd ss sub well in out
-mn1 out in ss sub n1 w=2u l=0.35u as=3p ad=3p ps=4u pd=4u
-mp1 out in dd well p1 w=4u l=0.35u as=7p ad=7p ps=6u pd=6u
-.ends inv1
-
-.subckt inv5 dd ss sub well in out
-xinv1 dd ss sub well in 1 inv1
-xinv2 dd ss sub well 1 2 inv1
-xinv3 dd ss sub well 2 3 inv1
-xinv4 dd ss sub well 3 4 inv1
-xinv5 dd ss sub well 4 out inv1
-.ends inv5
-
-xinv1 dd ss sub well in out5 inv5
-xinv2 dd ss sub well out5 out10 inv5
-xinv3 dd ss sub well out10 out15 inv5
-xinv4 dd ss sub well out15 out20 inv5
-xinv5 dd ss sub well out20 out inv5
-xinv11 dd 0 sub well out buf inv1
-* output is buf
-cout buf ss 0.2pF
-*
-.options noacct
-
-* The following model parameters are varying statistically:
-* vth0, u0, tox
-* see the AGAUSS function used to define the parameter
-* the deviation is 10%, just for example, not measured
-
-********************************************************************************
-.model n1 nmos
-+level=8
-+version=3.3.0
-+tnom=27.0
-+nch=2.498e+17 tox=AGAUSS(9e-09, 9e-09, 10) xj=1.00000e-07
-+lint=9.36e-8 wint=1.47e-7
-+vth0=AGAUSS(.6322,.6322,10) 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=AGAUSS(388.3203,388.3203,10) 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
-+noimod=2
-+af=1.075e+00 kf=9.670e-28 ef=1.056e+00
-+noia=1.130e+20 noib=7.530e+04 noic=-8.950e-13
-**** PMOS ***
-.model p1 pmos
-+level=8
-+version=3.3.0
-+tnom=27.0
-+nch=3.533024e+17 tox=AGAUSS(9e-09,9e-09,10) xj=1.00000e-07
-+lint=6.23e-8 wint=1.22e-7
-+vth0=AGAUSS(-.6732829,-.6732829,10) 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=AGAUSS(138.7609,138.7609,10)
-+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
-+noimod=2
-+af=9.970e-01 kf=2.080e-29 ef=1.015e+00
-+noia=1.480e+18 noib=3.320e+03 noic=1.770e-13
-.end
-
-.end
diff --git a/Windows/spice/examples/Monte_Carlo/MC_2_control.sp b/Windows/spice/examples/Monte_Carlo/MC_2_control.sp
deleted file mode 100644
index d155c877..00000000
--- a/Windows/spice/examples/Monte_Carlo/MC_2_control.sp
+++ /dev/null
@@ -1,47 +0,0 @@
-*ng_script
-* Perform Monte Carlo simulation in ngspice
-* script for use with 25 stage Ring-Osc. BSIM3
-* circuit is in MC_2_circ.sp
-* edit 'setcs sourcepath' for your path to circuit file
-* start script by 'ngspice -o MC_2_control.log MC_2_control.sp'
-*
-.control
- let mc_runs = 10 $ number of runs for monte carlo
- let run = 1 $ number of the actual run
-
-* Where to find the circuit netlist file MC_2_circ.sp
- setcs sourcepath = ( D:\Spice_general\ngspice\examples\Monte_Carlo )
-
-* create file for frequency information
- echo Monte Carlo, frequency of R.O. > MC_frequ.log
-
-* run the simulation loop
- dowhile run <= mc_runs
- * without the reset switch there is some strange drift
- * towards lower and lower frequencies
- set run = $&run $ create a variable from the vector
- setseed $run $ set the rnd seed value to the loop index
- if run = 1
- source MC_2_circ.sp $ load the circuit once from file, including model data
- else
- mc_source $ re-load the circuit from internal storage
- end
- save buf $ we just need output vector buf, save memory by more than 10x
- tran 15p 200n 0
- write mc_ring{$run}.out buf $ write each sim output to its own rawfile
- linearize buf $ lienarize buf to allow fft
- fft buf $ run fft on vector buf
- let buf2=db(mag(buf))
- * find the frequency where buf has its maximum of the fft signal
- meas sp fft_max MAX_AT buf2 from=0.1G to=0.7G
- print fft_max >> MC_frequ.log $ print frequency to file
- destroy all $ delete all output vectors
- remcirc $ delete circuit
- let run = run + 1 $ increase loop counter
- end
-
- quit
-
-.endc
-
-.end
diff --git a/Windows/spice/examples/Monte_Carlo/MC_ring.sp b/Windows/spice/examples/Monte_Carlo/MC_ring.sp
deleted file mode 100644
index 3ffab2a3..00000000
--- a/Windows/spice/examples/Monte_Carlo/MC_ring.sp
+++ /dev/null
@@ -1,286 +0,0 @@
-Perform Monte Carlo simulation in ngspice
-* 25 stage Ring-Osc. BSIM3 with statistical variation of various model parameters
-* cd into ngspice/examples/Monte_Carlo
-* start in interactive mode 'ngspice MC_ring.sp' with several plots for output
-* or start in batch mode, controlled by .control section (Control mode)
-* with 'ngspice -b -r MC_ring.raw -o MC_ring.log MC_ring.sp'.
-
-vin in out dc 0.5 pulse 0.5 0 0.1n 5n 1 1 1
-vdd dd 0 dc 3.3
-vss ss 0 dc 0
-ve sub 0 dc 0
-vpe well 0 dc 3.3
-
-.subckt inv1 dd ss sub well in out
-mn1 out in ss sub n1 w=2u l=0.35u as=3p ad=3p ps=4u pd=4u
-mp1 out in dd well p1 w=4u l=0.35u as=7p ad=7p ps=6u pd=6u
-.ends inv1
-
-.subckt inv5 dd ss sub well in out
-xinv1 dd ss sub well in 1 inv1
-xinv2 dd ss sub well 1 2 inv1
-xinv3 dd ss sub well 2 3 inv1
-xinv4 dd ss sub well 3 4 inv1
-xinv5 dd ss sub well 4 out inv1
-.ends inv5
-
-xinv1 dd ss sub well in out5 inv5
-xinv2 dd ss sub well out5 out10 inv5
-xinv3 dd ss sub well out10 out15 inv5
-xinv4 dd ss sub well out15 out20 inv5
-xinv5 dd ss sub well out20 out inv5
-xinv11 dd 0 sub well out buf inv1
-cout buf ss 0.2pF
-*
-.options noacct
-.control
- save buf $ we just need buf, save memory by more than 10x
- let mc_runs = 30 $ number of runs for monte carlo
- let run = 0 $ number of actual run
- set curplot = new $ create a new plot
- set curplottitle = "Transient outputs"
- set plot_out = $curplot $ store its name to 'plot_out'
- set curplot = new $ create a new plot
- set curplottitle = "FFT outputs"
- set plot_fft = $curplot $ store its name to 'plot_fft'
- set curplot = new $ create a new plot
- set curplottitle = "Oscillation frequency"
- set max_fft = $curplot $ store its name to 'max_fft'
- let mc_runsp = mc_runs + 1
- let maxffts = unitvec(mc_runsp) $ vector for storing max measure results
- let halfffts = unitvec(mc_runsp)$ vector for storing measure results at -40dB rising
-*
-* define distributions for random numbers:
-* unif: uniform distribution, deviation relativ to nominal value
-* aunif: uniform distribution, deviation absolut
-* gauss: Gaussian distribution, deviation relativ to nominal value
-* agauss: Gaussian distribution, deviation absolut
- define unif(nom, var) (nom + (nom*var) * sunif(0))
- define aunif(nom, avar) (nom + avar * sunif(0))
- define gauss(nom, var, sig) (nom + (nom*var)/sig * sgauss(0))
- define agauss(nom, avar, sig) (nom + avar/sig * sgauss(0))
-*
-* We want to vary the model parameters vth0, u0, tox, lint, and wint
-* of the BSIM3 model for the NMOS and PMOS transistors.
-* We may obtain the nominal values (nom) by manually extracting them from
-* the parameter set. Here we get them automatically and store them into
-* vectors. This has the advantage that you may change the parameter set
-* without having to look up the values again.
- let n1vth0=@n1[vth0]
- let n1u0=@n1[u0]
- let n1tox=@n1[tox]
- let n1lint=@n1[lint]
- let n1wint=@n1[wint]
- let p1vth0=@p1[vth0]
- let p1u0=@p1[u0]
- let p1tox=@p1[tox]
- let p1lint=@p1[lint]
- let p1wint=@p1[wint]
-
-*
-* run the simulation loop
- dowhile run <= mc_runs
- * run=0 simulates with nominal parameters
- if run > 0
- setplot $max_fft
- altermod @n1[vth0] = gauss(n1vth0, 0.1, 3)
- altermod @n1[u0] = gauss(n1u0, 0.05, 3)
- altermod @n1[tox] = gauss(n1tox, 0.1, 3)
- altermod @n1[lint] = gauss(n1lint, 0.1, 3)
- altermod @n1[wint] = gauss(n1wint, 0.1, 3)
- altermod @p1[vth0] = gauss(p1vth0, 0.1, 3)
- altermod @p1[u0] = gauss(p1u0, 0.1, 3)
- altermod @p1[tox] = gauss(p1tox, 0.1, 3 )
- altermod @p1[lint] = gauss(p1lint, 0.1, 3)
- altermod @p1[wint] = gauss(p1wint, 0.1, 3)
- end
- tran 15p 100n 0
-* select stop and step so that number of data points after linearization is not too
-* close to 8192, which would yield varying number of line length and thus scale for fft.
-*
-* We have to figure out what to do if a single simulation will not converge.
-* There is the variable 'sim_status' which is set to 1 if the simulation
-* fails with ’xx simulation(s) aborted’, e.g. because of non-convergence.
-* Then we might skip this run and continue with a new run.
-*
- echo Simulation status $sim_status
- let simstat = $sim_status
- if simstat = 1
- if run = mc_runs
- echo go to end
- else
- echo go to next run
- end
- destroy $curplot
- goto next
- end
-
- set run ="$&run" $ create a variable from the vector
- set mc_runs ="$&mc_runs" $ create a variable from the vector
- echo simulation run no. $run of $mc_runs
- set dt = $curplot
- * save the linearized data for having equal time scales for all runs
- linearize buf $ linearize only buf, no other vectors needed
- destroy $dt $ delete the tran i plot
- set dt = $curplot $ store the current plot to dt (tran i+1)
- setplot $plot_out $ make 'plt_out' the active plot
- * firstly save the time scale once to become the default scale
- if run=0
- let time={$dt}.time
- end
- let vout{$run}={$dt}.buf $ store the output vector to plot 'plot_out'
- setplot $dt $ go back to the previous plot (tran i+1)
- fft buf $ run fft on vector buf
- destroy $dt $ delete the tran i+1 plot
- let buf2=db(mag(buf))
- * find the frequency where buf has its maximum of the fft signal
- meas sp fft_max MAX_AT buf2 from=0.1G to=0.7G
- * find the frequency where buf is -40dB at rising fft signal
- meas sp fft_40 WHEN buf2=-40 RISE=1 from=0.1G to=0.7G
- echo
- echo
- * store the fft vector
- set dt = $curplot $ store the current plot to dt (spec i)
- setplot $plot_fft $ make 'plot_fft' the active plot
- if run=0
- let frequency={$dt}.frequency
- end
- let fft{$run}={$dt}.buf $ store the output vector to plot 'plot_fft'
- * store the measured value
- setplot $max_fft $ make 'max_fft' the active plot
- let maxffts[{$run}]={$dt}.fft_max
- let halfffts[{$run}]={$dt}.fft_40
- let run = run + 1
- label next
- reset
- end
-***** plotting **********************************************************
-if $?batchmode
- echo
- echo Plotting not available in batch mode
- echo Write linearized vout0 to vout{$mc_runs} to rawfile $rawfile
- echo
- write $rawfile {$plot_out}.allv
- rusage
- quit
-else
- setplot $plot_out
- plot vout0 ylabel 'RO output, original parameters' $ just plot the tran output with nominal parameters
- setplot $plot_fft
- settype decibel ally
- plot db(mag(ally)) xlimit .1G 1G ylimit -80 10 ylabel 'fft output'
-*
-* create a histogram from vector maxffts
- setplot $max_fft $ make 'max_fft' the active plot
- set startfreq=400MEG
- set bin_size=5MEG
- set bin_count=20
- compose xvec start=$startfreq step=$bin_size lin=$bin_count $ requires variables as parameters
- settype frequency xvec
- let bin_count=$bin_count $ create a vector from the variable
- let yvec=unitvec(bin_count) $ requires vector as parameter
- let startfreq=$startfreq
- let bin_size=$bin_size
- * put data into the correct bins
- let run = 0
- dowhile run < mc_runs
- set run = $&run $ create a variable from the vector
- let val = maxffts[{$run}]
- let part = 0
- * Check if val fits into a bin. If yes, raise bin by 1
- dowhile part < bin_count
- if ((val < (startfreq + (part+1)*bin_size)) & (val > (startfreq + part*bin_size)))
- let yvec[part] = yvec[part] + 1
- break
- end
- let part = part + 1
- end
- let run = run + 1
- end
-
- * plot the histogram
- set plotstyle=combplot
- plot yvec-1 vs xvec xlabel 'oscillation frequency' ylabel 'bin count' $ subtract 1 because we started with unitvec containing ones
-
- * plot simulation series
- set plotstyle=linplot
- let xx = vector(mc_runsp)
- settype frequency maxffts
- plot maxffts vs xx xlabel 'iteration no.' ylabel 'RO frequency'
-
-* calculate jitter
- let diff40 = (vecmax(halfffts) - vecmin(halfffts))*1e-6
- echo
- echo Max. jitter is "$&diff40" MHz
-end
- rusage
-.endc
-********************************************************************************
-.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
-+noimod=2
-+af=1.075e+00 kf=9.670e-28 ef=1.056e+00
-+noia=1.130e+20 noib=7.530e+04 noic=-8.950e-13
-**** PMOS ***
-.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
-+noimod=2
-+af=9.970e-01 kf=2.080e-29 ef=1.015e+00
-+noia=1.480e+18 noib=3.320e+03 noic=1.770e-13
-.end
diff --git a/Windows/spice/examples/Monte_Carlo/MC_ring_ts.sp b/Windows/spice/examples/Monte_Carlo/MC_ring_ts.sp
deleted file mode 100644
index ee88c329..00000000
--- a/Windows/spice/examples/Monte_Carlo/MC_ring_ts.sp
+++ /dev/null
@@ -1,180 +0,0 @@
-*ng_script
-* Example script for Monte Carlo with commercial HSPICE-compatible libraries
-* The circuit in mc_ring_circ.net is a 25-stage inverter ring oscillator.
-* Add your library to mc_ring_circ.net and choose transistors accordingly.
-* Add the source file and the library path.
-* A simple BSIM3 inverter R.O. serves as an MC example wtihout need for a library.
-.control
-begin
- let mc_runs = 30 $ number of runs for monte carlo
- let run = 0 $ number of actual run
- set curplot = new $ create a new plot
- set curplottitle = "Transient outputs"
- set plot_out = $curplot $ store its name to 'plot_out'
- set curplot = new $ create a new plot
- set curplottitle = "FFT outputs"
- set plot_fft = $curplot $ store its name to 'plot_fft'
- set curplot = new $ create a new plot
- set curplottitle = "Oscillation frequency"
- set max_fft = $curplot $ store its name to 'max_fft'
- let mc_runsp = mc_runs + 1
- let maxffts = unitvec(mc_runsp) $ vector for storing max measure results
- let halfffts = unitvec(mc_runsp)$ vector for storing measure results at -40dB rising
- unlet mc_runsp
-
- set mc_runs = $&mc_runs $ create a variable from the vector
- let seeds = mc_runs + 2
- setseed $&seeds
- unlet seeds
-
- echo source the input file
-* Path of your circuit file and library file here
-* Will be added to the already existing sourcepath
- setcs sourcepath = ( $inputdir $sourcepath ./ngspice/examples/Monte_Carlo )
-* source with file name of your circuit file
- source mc_ring_circ.net
-
- save buf $ we just need buf, save memory by more than 10x
-
-* Output path (directory has already to be there)
-* set outputpath = 'D:\Spice_general\ngspice\examples\Monte_Carlo\out'
-* If your current directory is the 'ngspice' directory
-* set outputpath = './examples/Monte_Carlo/out' $ LINUX alternative
-* run the simulation loop
-
-* We have to figure out what to do if a single simulation will not converge.
-* There is now the variable sim_status, that is 0 if simulation ended regularly,
-* and 1 if the simulation has been aborted with error message '...simulation(s) aborted'.
-* Then we skip the rest of the run and continue with a new run.
-
- dowhile run <= mc_runs
-
- set run = $&run $ create a variable from the vector
-
- * run=0 simulates with nominal parameters
- if run > 0
- echo
- echo * * * * * *
- echo Source the circuit again internally for run no. $run
- echo * * * * * *
- setseed $run
- mc_source $ re-source the input file
- else
- echo run no. $run
- end
- echo simulation run no. $run of $mc_runs
- tran 100p 1000n 0
- echo Simulation status $sim_status
- let simstat = $sim_status
- if simstat = 1
- if run = mc_runs
- echo go to end
- else
- echo go to next run
- end
- destroy $curplot
- goto next
- end
-
-* select stop and step so that number of data points after linearization is not too
-* close to 8192, which would yield varying number of line length and thus scale for fft.
-*
- set dt0 = $curplot
- * save the linearized data for having equal time scales for all runs
- linearize buf $ linearize only buf, no other vectors needed
- set dt1 = $curplot $ store the current plot to dt (tran i+1)
- setplot $plot_out $ make 'plt_out' the active plot
- * firstly save the time scale once to become the default scale
- if run=0
- let time={$dt1}.time
- end
- let vout{$run}={$dt1}.buf $ store the output vector to plot 'plot_out'
- setplot $dt1 $ go back to the previous plot (tran i+1)
- fft buf $ run fft on vector buf
- let buf2=db(mag(buf))
- * find the frequency where buf has its maximum of the fft signal
- meas sp fft_max MAX_AT buf2 from=0.05G to=0.7G
- * find the frequency where buf is -40dB at rising fft signal
- meas sp fft_40 WHEN buf2=-40 RISE=1 from=0.05G to=0.7G
- * store the fft vector
- set dt2 = $curplot $ store the current plot to dt (spec i)
- setplot $plot_fft $ make 'plot_fft' the active plot
- if run=0
- let frequency={$dt2}.frequency
- end
- let fft{$run}={$dt2}.buf $ store the output vector to plot 'plot_fft'
- settype decibel fft{$run}
- * store the measured value
- setplot $max_fft $ make 'max_fft' the active plot
- let maxffts[{$run}]={$dt2}.fft_max
- let halfffts[{$run}]={$dt2}.fft_40
- destroy $dt0 $dt1 $dt2 $ save memory, we don't need this plot (spec) any more
-
- label next
- remcirc
- let run = run + 1
- end
-***** plotting **********************************************************
-if $?batchmode
- echo
- echo Plotting not available in batch mode
- echo Write linearized vout0 to vout{$mc_runs} to rawfile $rawfile
- echo
- write $rawfile {$plot_out}.allv
- rusage
- quit
-else
- if $?sharedmode or $?win_console
- gnuplot xnp_pl1 {$plot_out}.vout0 $ just plot the tran output with nominal parameters
- else
- plot {$plot_out}.vout0 $ just plot the tran output with nominal parameters
- end
- setplot $plot_fft
- if $?sharedmode or $?win_console
- gnuplot xnp_pl2 db(mag(ally)) xlimit 0 1G ylimit -80 10
- else
- plot db(mag(ally)) xlimit 0 1G ylimit -80 10
- end
-*
-* create a histogram from vector maxffts
- setplot $max_fft $ make 'max_fft' the active plot
- set startfreq=50MEG
- set bin_size=1MEG
- set bin_count=100
- compose osc_frequ start=$startfreq step=$bin_size lin=$bin_count $ requires variables as parameters
- settype frequency osc_frequ
- let bin_count=$bin_count $ create a vector from the variable
- let yvec=unitvec(bin_count) $ requires vector as parameter
- let startfreq=$startfreq
- let bin_size=$bin_size
- * put data into the correct bins
- let run = 0
- dowhile run < mc_runs
- set run = $&run $ create a variable from the vector
- let val = maxffts[{$run}]
- let part = 0
- * Check if val fits into a bin. If yes, raise bin by 1
- dowhile part < bin_count
- if ((val < (startfreq + (part+1)*bin_size)) & (val >= (startfreq + part*bin_size)))
- let yvec[part] = yvec[part] + 1
- break
- end
- let part = part + 1
- end
- let run = run + 1
- end
- * plot the histogram
- let count = yvec - 1 $ subtract 1 because we started with unitvec containing ones
- if $?sharedmode or $?win_console
- gnuplot np_pl3 count vs osc_frequ combplot
- else
- plot count vs osc_frequ combplot
- end
-* calculate jitter
- let diff40 = (vecmax(halfffts) - vecmin(halfffts))*1e-6
- echo
- echo Max. jitter is "$&diff40" MHz
-end
- rusage
-* quit
-end
diff --git a/Windows/spice/examples/Monte_Carlo/MonteCarlo.sp b/Windows/spice/examples/Monte_Carlo/MonteCarlo.sp
deleted file mode 100644
index e079893f..00000000
--- a/Windows/spice/examples/Monte_Carlo/MonteCarlo.sp
+++ /dev/null
@@ -1,68 +0,0 @@
-* Effecting a Monte Carlo calculation in ngspice
-V1 N001 0 AC 1 DC 0
-R1 N002 N001 141
-*
-C1 OUT 0 1e-09
-L1 OUT 0 10e-06
-C2 N002 0 1e-09
-L2 N002 0 10e-06
-L3 N003 N002 40e-06
-C3 OUT N003 250e-12
-*
-R2 0 OUT 141
-.control
- let mc_runs = 5
- let run = 0
- set curplot=new $ create a new plot
- set scratch=$curplot $ store its name to 'scratch'
- setplot $scratch $ make 'scratch' the active plot
- let bwh=unitvec(mc_runs) $ create a vector in plot 'scratch' to store bandwidth data
-
-* define distributions for random numbers:
-* unif: uniform distribution, deviation relativ to nominal value
-* aunif: uniform distribution, deviation absolut
-* gauss: Gaussian distribution, deviation relativ to nominal value
-* agauss: Gaussian distribution, deviation absolut
-* limit: if unif. distributed value >=0 then add +avar to nom, else -avar
- define unif(nom, rvar) (nom + (nom*rvar) * sunif(0))
- define aunif(nom, avar) (nom + avar * sunif(0))
- define gauss(nom, rvar, sig) (nom + (nom*rvar)/sig * sgauss(0))
- define agauss(nom, avar, sig) (nom + avar/sig * sgauss(0))
-* define limit(nom, avar) (nom + ((sgauss(0) ge 0) ? avar : -avar))
- define limit(nom, avar) (nom + ((sgauss(0) >= 0) ? avar : -avar))
-*
-*
- dowhile run < mc_runs $ loop starts here
-*
-* alter c1 = unif(1e-09, 0.1)
-* alter c1 = aunif(1e-09, 100e-12)
-* alter c1 = gauss(1e-09, 0.1, 3)
-* alter c1 = agauss(1e-09, 100e-12, 3)
-*
- alter c1 = unif(1e-09, 0.1)
- alter l1 = unif(10e-06, 0.1)
- alter c2 = unif(1e-09, 0.1)
- alter l2 = unif(10e-06, 0.1)
- alter l3 = unif(40e-06, 0.1)
- alter c3 = limit(250e-12, 25e-12)
-*
- ac oct 100 250K 10Meg
-*
-* measure bandwidth at -10 dB
- meas ac bw trig vdb(out) val=-10 rise=1 targ vdb(out) val=-10 fall=1
-*
- set run = $&run $ create a variable from the vector
- set dt = $curplot $ store the current plot to dt
- setplot $scratch $ make 'scratch' the active plot
- let vout{$run}={$dt}.v(out) $ store the output vector to plot 'scratch'
- let bwh[run]={$dt}.bw $ store bw to vector bwh in plot 'scratch'
- setplot $dt $ go back to the previous plot
- let run = run + 1
- end $ loop ends here
-*
- plot db({$scratch}.allv)
- echo
- print {$scratch}.bwh
-.endc
-
-.end
diff --git a/Windows/spice/examples/Monte_Carlo/OpWien.sp b/Windows/spice/examples/Monte_Carlo/OpWien.sp
deleted file mode 100644
index b6ada544..00000000
--- a/Windows/spice/examples/Monte_Carlo/OpWien.sp
+++ /dev/null
@@ -1,87 +0,0 @@
-OPWIEN.CIR - OPAMP WIEN-BRIDGE OSCILLATOR
-* http://www.ecircuitcenter.com/circuits/opwien/opwien.htm
-* single simulation run
-* 2 resistors and 2 capacitors of Wien bridge a varied statistically
-* number of variations: varia
-
-* Simulation time
-.param ttime=12000m
-.param varia=100
-.param ttime10 = 'ttime/varia'
-
-* nominal resistor and capacitor values
-.param res = 10k
-.param cn = 16NF
-
-* CURRENT PULSE TO START OSCILLATIONS
-IS 0 3 dc 0 PWL(0US 0MA 10US 0.1MA 40US 0.1MA 50US 0MA 10MS 0MA)
-*
-* RC TUNING
-VR2 r2 0 dc 0 trrandom (2 'ttime10' 0 1) ; Gauss controlling voltage
-*
-*VR2 r2 0 dc 0 trrandom (1 'ttime10' 0 3) ; Uniform within -3 3
-*
-* If Gauss, factor 0.033 is 10% equivalent to 3 sigma
-* if uniform, uniform between +/- 10%
-R2 4 6 R = 'res + 0.033 * res*V(r2)' ; behavioral resistor
-*R2 4 6 'res' $ constant R
-
-VC2 c2 0 dc 0 trrandom (2 'ttime10' 0 1)
-*C2 6 3'cn' $ constant C
-C2 6 3 C = 'cn + 0.033 * cn*V(c2)' ; behavioral capacitor
-
-VR1 r1 0 dc 0 trrandom (2 'ttime10' 0 1)
-*VR1 r1 0 dc 0 trrandom (1 'ttime10' 0 3)
-R1 3 0 R = 'res + 0.033 * res*V(r1)'
-*R1 3 0 'res'
-
-VC1 c1 0 dc 0 trrandom (2 'ttime10' 0 1)
-C1 3 0 C = 'cn + 0.033 * cn*V(c2)'
-*C1 3 0 'cn'
-
-* NON-INVERTING OPAMP
-R10 0 2 10K
-R11 2 5 18K
-XOP 3 2 4 OPAMP1
-* AMPLITUDE STABILIZATION
-R12 5 4 5K
-D1 5 4 D1N914
-D2 4 5 D1N914
-*
-.model D1N914 D(Is=0.1p Rs=16 CJO=2p Tt=12n Bv=100 Ibv=0.4n)
-*
-* OPAMP MACRO MODEL, SINGLE-POLE
-* connections: non-inverting input
-* | inverting input
-* | | output
-* | | |
-.SUBCKT OPAMP1 1 2 6
-* INPUT IMPEDANCE
-RIN 1 2 10MEG
-* DC GAIN (100K) AND POLE 1 (100HZ)
-EGAIN 3 0 1 2 100K
-RP1 3 4 1K
-CP1 4 0 1.5915UF
-* OUTPUT BUFFER AND RESISTANCE
-EBUFFER 5 0 4 0 1
-ROUT 5 6 10
-.ENDS
-*
-* ANALYSIS
-.TRAN 0.05MS 'ttime'
-*
-* VIEW RESULTS
-.control
-option noinit
-run
-plot V(4) 5*V(r1) 5*V(r2) 5*V(c1) 5*V(c2)
-linearize v(4)
-fft v(4)
-let v4mag = mag(v(4))
-plot v4mag
-plot v4mag xlimit 500 1500
-*wrdata histo v4mag
-rusage
-.endc
-
-.END
diff --git a/Windows/spice/examples/Monte_Carlo/mc_ring_circ.net b/Windows/spice/examples/Monte_Carlo/mc_ring_circ.net
deleted file mode 100644
index cd058a5e..00000000
--- a/Windows/spice/examples/Monte_Carlo/mc_ring_circ.net
+++ /dev/null
@@ -1,56 +0,0 @@
-Perform Monte Carlo simulation in ngspice
-* 25 stage Ring-Osc. BSIM3 or 4 with statistical variation of model parameters
-* Model parameters are varied according to the PDK selection.
-* Tested with 3 different commercial HSPICE libraries from 2 vendors.
-* To be started with script MC_ring_ts.sp
-
-.options noacct seedinfo
-
-vin in out dc 0.5 pulse 0.5 0 0.1n 5n 1 1 1
-vdd dd 0 dc 3.3
-vss ss 0 dc 0
-ve sub 0 dc 0
-vpe well 0 dc 3.3
-
-* transistors to be selected according to the library (here: p33ll and n33ll or pch_5_mac and nch_5_mac
-* or pe3 and ne3 or p1 and n1 (these models see below))
-.subckt inv1 dd ss sub well in out
-*XMP1 out in dd well p33ll w=5u l=800n m=3 nf=1 ad=1.35p as=1.35p pd=9.6u ps=9.6u mosmis_mod=1
-*XMN1 out in ss sub n33ll w=5u l=800n m=1 nf=3 ad=0.9p as=0.9p pd=6.6u ps=6.6u mosmis_mod=1
-*XMP1 out in dd well pch_5_mac w=5u l=800n m=3 nf=1 ad=1.35p as=1.35p pd=9.6u ps=9.6u mosmis_mod=1
-*XMN1 out in ss sub nch_5_mac w=5u l=800n m=1 nf=3 ad=0.9p as=0.9p pd=6.6u ps=6.6u mosmis_mod=1
-*XMP1 out in dd well pe3 w=5u l=800n m=3 nf=1 ad=1.35p as=1.35p pd=9.6u ps=9.6u mosmis_mod=1
-*XMN1 out in ss sub ne3 w=5u l=800n m=1 nf=3 ad=0.9p as=0.9p pd=6.6u ps=6.6u mosmis_mod=1
-MP1 out in dd well p1 w=5u l=800n m=3 ad=1.35p as=1.35p pd=9.6u ps=9.6u
-MN1 out in ss sub n1 w=5u l=800n m=1 ad=0.9p as=0.9p pd=6.6u ps=6.6u
-.ends inv1
-
-.subckt inv5 dd ss sub well in out
-xinv1 dd ss sub well in 1 inv1
-xinv2 dd ss sub well 1 2 inv1
-xinv3 dd ss sub well 2 3 inv1
-xinv4 dd ss sub well 3 4 inv1
-xinv5 dd ss sub well 4 out inv1
-.ends inv5
-
-xinv1 dd ss sub well in out5 inv5
-xinv2 dd ss sub well out5 out10 inv5
-xinv3 dd ss sub well out10 out15 inv5
-xinv4 dd ss sub well out15 out20 inv5
-xinv5 dd ss sub well out20 out inv5
-xinv11 dd 0 sub well out buf inv1
-cout buf ss 0.2pF
-
- *** Model library files.
-* Add your library here
-* Chose the transistors for XMP1 and XMN1 accordingly
-*.lib "jc_usage.l" MC_LIB
-*.lib "my_ts_usage.l" MC_LIB
-*.lib "x_usage.l" MC_LIB
-
-* or use the BSIM3 model with internal parameters except Vth0
-* that varies the threshold voltage +-3 sigma around a mean of +-0.6V
-.model p1 PMOS version=3.3.0 Level=8 Vth0=agauss(-0.6, 0.1, 3)
-.model n1 NMOS version=3.3.0 Level=8 Vth0=agauss(0.6, 0.1, 3)
-
-.end
diff --git a/Windows/spice/examples/Monte_Carlo/mc_ring_lib_complete_actual.cir b/Windows/spice/examples/Monte_Carlo/mc_ring_lib_complete_actual.cir
deleted file mode 100644
index 9fd239e4..00000000
--- a/Windows/spice/examples/Monte_Carlo/mc_ring_lib_complete_actual.cir
+++ /dev/null
@@ -1,212 +0,0 @@
-Perform Monte Carlo simulation in ngspice
-* 25 stage Ring-Osc. BSIM3 or 4 with statistical variation of model parameters
-* Model parameters are varied according to the PDK selection.
-* Tested with 3 different commercial HSPICE libraries from 2 vendors.
-* Add your library to mc_ring_circ.net and choose transistors accordingly.
-* Add the library path to the .LIB statement.
-* A simple BSIM3 inverter R.O. serves as an MC example.
-
-.options noacct
-
-vin in out dc 0.5 pulse 0.5 0 0.1n 5n 1 1 1
-vdd dd 0 dc 3.3
-vss ss 0 dc 0
-ve sub 0 dc 0
-vpe well 0 dc 3.3
-
-* transistors to be selected according to the library (here: p33ll and n33ll or pch_5_mac and nch_5_mac
-* or pe3 and ne3 or p1 and n1 (these models see below))
-.subckt inv1 dd ss sub well in out
-*XMP1 out in dd well p33ll w=5u l=800n m=3 nf=1 ad=1.35p as=1.35p pd=9.6u ps=9.6u mosmis_mod=1
-*XMN1 out in ss sub n33ll w=5u l=800n m=1 nf=3 ad=0.9p as=0.9p pd=6.6u ps=6.6u mosmis_mod=1
-XMP1 out in dd well pch_5_mac w=5u l=800n m=3 nf=1 ad=1.35p as=1.35p pd=9.6u ps=9.6u mosmis_mod=1
-XMN1 out in ss sub nch_5_mac w=5u l=800n m=1 nf=3 ad=0.9p as=0.9p pd=6.6u ps=6.6u mosmis_mod=1
-*XMP1 out in dd well pe3 w=5u l=800n m=3 nf=1 ad=1.35p as=1.35p pd=9.6u ps=9.6u mosmis_mod=1
-*XMN1 out in ss sub ne3 w=5u l=800n m=1 nf=3 ad=0.9p as=0.9p pd=6.6u ps=6.6u mosmis_mod=1
-*MP1 out in dd well p1 w=5u l=800n m=3 ad=1.35p as=1.35p pd=9.6u ps=9.6u
-*MN1 out in ss sub n1 w=5u l=800n m=1 ad=0.9p as=0.9p pd=6.6u ps=6.6u
-.ends inv1
-
-.subckt inv5 dd ss sub well in out
-xinv1 dd ss sub well in 1 inv1
-xinv2 dd ss sub well 1 2 inv1
-xinv3 dd ss sub well 2 3 inv1
-xinv4 dd ss sub well 3 4 inv1
-xinv5 dd ss sub well 4 out inv1
-.ends inv5
-
-xinv1 dd ss sub well in out5 inv5
-xinv2 dd ss sub well out5 out10 inv5
-xinv3 dd ss sub well out10 out15 inv5
-xinv4 dd ss sub well out15 out20 inv5
-xinv5 dd ss sub well out20 out inv5
-xinv11 dd 0 sub well out buf inv1
-cout buf ss 0.2pF
-
- *** Model library files.
-* Add your library here (full path required, or path relative to path
-* of ngspice executable (interactive mode), or relative to path of
-* input file (batch mode))
-* Chose the transistors for XMP1 and XMN1 according to the library
-*.lib "jc_usage.l" MC_LIB
-*.lib "../../../various/lib-test/my_usage.l" MC_LIB
-.lib "D:\Spice_general\tests\lib-test\ts14\my_ts_usage.l" MC_LIB
-*.lib "x_usage.l" MC_LIB
-
-* or use the BSIM3 model with internal parameters except Vth0
-* that varies the threshold voltage +-3 sigma around a mean of +-0.6V
-*.model p1 PMOS version=3.3.0 Level=8 Vth0=agauss(-0.6, 0.1, 3)
-*.model n1 NMOS version=3.3.0 Level=8 Vth0=agauss(0.6, 0.1, 3)
-
-.control
- let mc_runs = 10 $ number of runs for monte carlo
- let run = 0 $ number of actual run
- set curplot = new $ create a new plot
- set curplottitle = "Transient outputs"
- set plot_out = $curplot $ store its name to 'plot_out'
- set curplot = new $ create a new plot
- set curplottitle = "FFT outputs"
- set plot_fft = $curplot $ store its name to 'plot_fft'
- set curplot = new $ create a new plot
- set curplottitle = "Oscillation frequency"
- set max_fft = $curplot $ store its name to 'max_fft'
- let mc_runsp = mc_runs + 1
- let maxffts = unitvec(mc_runsp) $ vector for storing max measure results
- let halfffts = unitvec(mc_runsp)$ vector for storing measure results at -40dB rising
- unlet mc_runsp
-
- set mc_runs = $&mc_runs $ create a variable from the vector
- let seeds = mc_runs + 2
- setseed $&seeds
- unlet seeds
-
- save buf $ we just need buf, save memory by more than 10x
-
-* run the simulation loop
-
-* We have to figure out what to do if a single simulation will not converge.
-* There is now the variable sim_status, that is 0 if simulation ended regularly,
-* and 1 if the simulation has been aborted with error message '...simulation(s) aborted'.
-* Then we skip the rest of the run and continue with a new run.
-
- dowhile run <= mc_runs
-
- set run = $&run $ create a variable from the vector
-
- * run=0 simulates with nominal parameters
- if run > 0
- echo
- echo * * * * * *
- echo Source the circuit again internally for run no. $run
- echo * * * * * *
- setseed $run
- mc_source $ re-source the input file
- else
- echo run no. $run
- end
- echo simulation run no. $run of $mc_runs
- tran 100p 1000n 0
- echo Simulation status $sim_status
- let simstat = $sim_status
- if simstat = 1
- if run = mc_runs
- echo go to end
- else
- echo go to next run
- end
- destroy $curplot
- goto next
- end
-
-* select stop and step so that number of data points after linearization is not too
-* close to 8192, which would yield varying number of line length and thus scale for fft.
-*
- set dt0 = $curplot
- * save the linearized data for having equal time scales for all runs
- linearize buf $ linearize only buf, no other vectors needed
- set dt1 = $curplot $ store the current plot to dt (tran i+1)
- setplot $plot_out $ make 'plt_out' the active plot
- * firstly save the time scale once to become the default scale
- if run=0
- let time={$dt1}.time
- end
- let vout{$run}={$dt1}.buf $ store the output vector to plot 'plot_out'
- setplot $dt1 $ go back to the previous plot (tran i+1)
- fft buf $ run fft on vector buf
- let buf2=db(mag(buf))
- * find the frequency where buf has its maximum of the fft signal
- meas sp fft_max MAX_AT buf2 from=0.05G to=0.7G
- * find the frequency where buf is -40dB at rising fft signal
- meas sp fft_40 WHEN buf2=-40 RISE=1 from=0.05G to=0.7G
- * store the fft vector
- set dt2 = $curplot $ store the current plot to dt (spec i)
- setplot $plot_fft $ make 'plot_fft' the active plot
- if run=0
- let frequency={$dt2}.frequency
- end
- let fft{$run}={$dt2}.buf $ store the output vector to plot 'plot_fft'
- * store the measured value
- setplot $max_fft $ make 'max_fft' the active plot
- let maxffts[{$run}]={$dt2}.fft_max
- let halfffts[{$run}]={$dt2}.fft_40
- destroy $dt0 $dt1 $dt2 $ save memory, we don't need this plot (spec) any more
-
- label next
- remcirc
- let run = run + 1
- end
-***** plotting **********************************************************
-if $?batchmode
- echo
- echo Plotting not available in batch mode
- echo Write linearized vout0 to vout{$mc_runs} to rawfile $rawfile
- echo
- write $rawfile {$plot_out}.allv
- rusage
- quit
-else
- plot {$plot_out}.vout0 $ just plot the tran output with run 0 parameters
- setplot $plot_fft
- plot db(mag(ally)) xlimit 0 1G ylimit -80 10
-*
-* create a histogram from vector maxffts
- setplot $max_fft $ make 'max_fft' the active plot
- set startfreq=50MEG
- set bin_size=1MEG
- set bin_count=100
- compose osc_frequ start=$startfreq step=$bin_size lin=$bin_count $ requires variables as parameters
- settype frequency osc_frequ
- let bin_count=$bin_count $ create a vector from the variable
- let yvec=unitvec(bin_count) $ requires vector as parameter
- let startfreq=$startfreq
- let bin_size=$bin_size
- * put data into the correct bins
- let run = 0
- dowhile run < mc_runs
- set run = $&run $ create a variable from the vector
- let val = maxffts[{$run}]
- let part = 0
- * Check if val fits into a bin. If yes, raise bin by 1
- dowhile part < bin_count
- if ((val < (startfreq + (part+1)*bin_size)) & (val > (startfreq + part*bin_size)))
- let yvec[part] = yvec[part] + 1
- break
- end
- let part = part + 1
- end
- let run = run + 1
- end
- * plot the histogram
- set plotstyle=combplot
- let counts = yvec - 1 $ subtract 1 because we started with unitvec containing ones
- plot counts vs osc_frequ
-* calculate jitter
- let diff40 = (vecmax(halfffts) - vecmin(halfffts))*1e-6
- echo
- echo Max. jitter is "$&diff40" MHz
-end
- rusage
-* quit
-.endc
-
-.end
diff --git a/Windows/spice/examples/Monte_Carlo/rand_numb_test.cir b/Windows/spice/examples/Monte_Carlo/rand_numb_test.cir
deleted file mode 100644
index dac4b5b6..00000000
--- a/Windows/spice/examples/Monte_Carlo/rand_numb_test.cir
+++ /dev/null
@@ -1,40 +0,0 @@
-*** random number test for scope-inpcom-8
-
-*** Start value of seed for random number generator: variable 'rndseed' is set to 1
-*** and random number generator is seeded with this value.
-*** You may override this value by adding 'setseed 5' or similar to file .spiceinit.
-
-*** print a message when the random number generator gets a new seed
-.option seedinfo
-
-*** like HSPICE: set rndseed to (number of seconds since 1.1.1970 - 1470000000)
-*** and seed the random number generator with rndseed
-*.option seed = random
-
-*** like HSPICE: set rndseed to 55
-*** and seed the random number generator with rndseed (here 55)
-.option seed = 55
-
-*** the 'circuit'
-.param myval = agauss(0, 1, 1)
-v1 1 0 'myval'
-
-*** the .control script
-.control
-
-*** set variable rndseed to value 11
-*set rndseed = 11
-*** seed the random number generator with value from variable rndseed
-*setseed
-
-*** seed the random number generator with value 12 and set rndseed to 12
-setseed 12
-
-*** reload circuit and re-evaluate all random functions (agauss etc.)
-mc_source
-*** simulate and print result
-op
-print v(1)
-.endc
-
-.end