From 51be270f069585df68d5c90a9a882cabf545ff5c Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sun, 26 Jan 2020 12:11:31 +0100 Subject: [PATCH] enable local or global statistical values for B source pre_set statlocal (or set statlocal in spinit or .spiceinit) will be setting a different random number for evaluating the value of fcn agauss etc. in each B line, e.g. if this line appears in a subcircuit, all expanded B lines will have different values. If not set, each B line will use the same random number for agauss evaluation. --- src/frontend/inp.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/frontend/inp.c b/src/frontend/inp.c index ee0ae6cbf..b84623b6d 100644 --- a/src/frontend/inp.c +++ b/src/frontend/inp.c @@ -727,12 +727,15 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) #ifdef HAS_PROGREP SetAnalyse("Prepare Deck", 0); #endif - /*FIXME This is for the globel param setting only */ - /* replace agauss(x,y,z) in each b-line by suitable value */ - static char *statfcn[] = { "agauss", "gauss", "aunif", "unif", "limit" }; - int ii; - for (ii = 0; ii < 5; ii++) - eval_agauss(deck, statfcn[ii]); + /*This is for the globel param setting only */ + /* replace agauss(x,y,z) in each b-line by suitable value, one for all */ + bool statlocal = cp_getvar("statlocal", CP_BOOL, NULL, 0); + if (!statlocal) { + static char *statfcn[] = {"agauss", "gauss", "aunif", "unif", "limit"}; + int ii; + for (ii = 0; ii < 5; ii++) + eval_agauss(deck, statfcn[ii]); + } /* Now expand subcircuit macros and substitute numparams.*/ if (!cp_getvar("nosubckt", CP_BOOL, NULL, 0)) if ((deck->nextcard = inp_subcktexpand(deck->nextcard)) == NULL) { @@ -815,11 +818,13 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) /* replace agauss(x,y,z) in each b-line by suitable value */ /* FIXME: This is for the local param setting (not yet implemented in - inp_fix_agauss_in_param() for model parameters according to HSPICE manual) - static char *statfcn[] = { "agauss", "gauss", "aunif", "unif", "limit" }; - int ii; - for (ii = 0; ii < 5; ii++) - eval_agauss(deck, statfcn[ii]); */ + inp_fix_agauss_in_param() for model parameters according to HSPICE manual)*/ + if (statlocal) { + static char *statfcn[] = {"agauss", "gauss", "aunif", "unif", "limit"}; + int ii; + for (ii = 0; ii < 5; ii++) + eval_agauss(deck, statfcn[ii]); + } /* If user wants all currents saved (.options savecurrents), add .save to wl_first with all terminal currents available on selected devices */ wl_first = inp_savecurrents(deck, options, wl_first, controls);