update to Monte Carlo examples

This commit is contained in:
h_vogt 2016-08-07 09:48:44 +02:00 committed by rlar
parent 932665124f
commit 975745fa3c
5 changed files with 6 additions and 6 deletions

View File

@ -1,3 +1,4 @@
*ng_script
* Perform Monte Carlo simulation in ngspice * Perform Monte Carlo simulation in ngspice
* script for use with 25 stage Ring-Osc. BSIM3 * script for use with 25 stage Ring-Osc. BSIM3
* circuit is in MC_2_circ.sp * circuit is in MC_2_circ.sp
@ -5,7 +6,6 @@
* start script by 'ngspice -o MC_2_control.log MC_2_control.sp' * start script by 'ngspice -o MC_2_control.log MC_2_control.sp'
* *
.control .control
save buf $ we just need output vector buf, save memory by more than 10x
let mc_runs = 100 $ number of runs for monte carlo let mc_runs = 100 $ number of runs for monte carlo
let run = 1 $ number of the actual run let run = 1 $ number of the actual run
@ -19,10 +19,10 @@
dowhile run <= mc_runs dowhile run <= mc_runs
* without the reset switch there is some strange drift * without the reset switch there is some strange drift
* towards lower and lower frequencies * towards lower and lower frequencies
reset
set run = $&run $ create a variable from the vector set run = $&run $ create a variable from the vector
setseed $run $ set the rnd seed value to the loop index setseed $run $ set the rnd seed value to the loop index
source MC_2_circ.sp $ load the circuit, including model data source MC_2_circ.sp $ load the circuit, including model data
save buf $ we just need output vector buf, save memory by more than 10x
tran 15p 200n 0 tran 15p 200n 0
write mc_ring{$run}.out buf $ write each sim output to its own rawfile write mc_ring{$run}.out buf $ write each sim output to its own rawfile
linearize buf $ lienarize buf to allow fft linearize buf $ lienarize buf to allow fft

View File

@ -171,7 +171,7 @@ else
* put data into the correct bins * put data into the correct bins
let run = 0 let run = 0
dowhile run < mc_runs dowhile run < mc_runs
set run = "$&run" $ create a variable from the vector set run = $&run $ create a variable from the vector
let val = maxffts[{$run}] let val = maxffts[{$run}]
let part = 0 let part = 0
* Check if val fits into a bin. If yes, raise bin by 1 * Check if val fits into a bin. If yes, raise bin by 1

View File

@ -4,7 +4,7 @@ Perform Monte Carlo simulation in ngspice
* Tested with 3 different commercial HSPICE libraries from 2 vendors. * Tested with 3 different commercial HSPICE libraries from 2 vendors.
* To be started with script MC_ring_ts.sp * To be started with script MC_ring_ts.sp
.options noacct .options noacct seedinfo
vin in out dc 0.5 pulse 0.5 0 0.1n 5n 1 1 1 vin in out dc 0.5 pulse 0.5 0 0.1n 5n 1 1 1
vdd dd 0 dc 3.3 vdd dd 0 dc 3.3

View File

@ -140,7 +140,7 @@ Test sequences for ngspice control structures
label starthe label starthe
echo start $loop echo start $loop
let loop = $loop + 1 $ expression needs vector at lhs let loop = $loop + 1 $ expression needs vector at lhs
set loop = "$&loop" $ convert vector contents to variable set loop = $&loop $ convert vector contents to variable
if $loop < 3 if $loop < 3
goto starthe goto starthe
end end

View File

@ -38,7 +38,7 @@
let part = 0 let part = 0
dowhile part < no_buck dowhile part < no_buck
let value = bucket[part] - 1 let value = bucket[part] - 1
set value = "$&value" set value = $&value
* print the buckets' contents * print the buckets' contents
echo $value echo $value
let part = part + 1 let part = part + 1