From 173278a00aa438ec8c6db2263b5950fda61435d0 Mon Sep 17 00:00:00 2001 From: Francesco Lannutti Date: Sun, 5 Jul 2015 08:14:44 +0200 Subject: [PATCH] Added Conditional Compilation for Reliability Analysis --- configure.ac | 10 ++++++++++ src/frontend/commands.c | 8 ++++---- src/frontend/runcoms.c | 4 ++-- src/frontend/runcoms.h | 4 ++-- src/frontend/shyu.c | 4 ++-- src/frontend/spiceif.c | 8 ++++---- src/frontend/typesdef.c | 6 +++--- src/include/ngspice/Makefile.am | 8 +++++++- src/include/ngspice/cktdefs.h | 6 +++--- src/include/ngspice/devdefs.h | 2 ++ src/spicelib/analysis/Makefile.am | 16 ++++++++++------ src/spicelib/analysis/analysis.c | 8 ++++++++ src/spicelib/analysis/cktdojob.c | 2 ++ src/spicelib/devices/bsim4/Makefile.am | 8 ++++++-- src/spicelib/devices/bsim4/b4set.c | 3 +++ src/spicelib/devices/bsim4/b4temp.c | 6 +++++- src/spicelib/devices/bsim4/bsim4def.h | 4 ++++ src/spicelib/devices/bsim4/bsim4ext.h | 2 ++ src/spicelib/devices/bsim4/bsim4init.c | 2 ++ src/spicelib/devices/cap/capinit.c | 5 +---- src/spicelib/devices/mos1/Makefile.am | 8 ++++++-- src/spicelib/devices/mos1/mos1defs.h | 4 ++++ src/spicelib/devices/mos1/mos1ext.h | 2 ++ src/spicelib/devices/mos1/mos1init.c | 2 ++ src/spicelib/devices/mos1/mos1set.c | 3 +++ src/spicelib/devices/vsrc/vsrcinit.c | 5 +---- src/spicelib/parser/inp2dot.c | 8 ++++---- 27 files changed, 104 insertions(+), 44 deletions(-) diff --git a/configure.ac b/configure.ac index 40dfcf25a..47c7d93f2 100644 --- a/configure.ac +++ b/configure.ac @@ -154,6 +154,10 @@ AC_ARG_ENABLE([adms], AC_ARG_ENABLE([pss], [AS_HELP_STRING([--enable-pss], [Enable PSS Analysis, (experimental)])]) +# --enable-relan: Enable Reliability Analysis +AC_ARG_ENABLE([relan], + [AS_HELP_STRING([--enable-relan], [Enable Reliability Analysis, (experimental)])]) + # --enable-ndev: define NDEV in the code. An interface for external device i.e. numerical device AC_ARG_ENABLE([ndev], [AS_HELP_STRING([--enable-ndev], [Enable NDEV interface, (experimental)])]) @@ -847,6 +851,10 @@ if test "x$enable_pss" = xyes; then AC_DEFINE([WITH_PSS], [], [Define if you want PSS analysis]) AC_MSG_RESULT([WARNING: PSS analysis enabled]) fi +if test "x$enable_relan" = xyes; then + AC_DEFINE([RELAN], [], [Define if you want Reliability Analysis]) + AC_MSG_RESULT([WARNING: Reliability Analysis enabled]) +fi if test "x$enable_blktmsdebug" = xyes; then AC_DEFINE([D_DBG_BLOCKTIMES], [], [Define if we want debug distortion analysis (BLOCKTIMES)]) AC_MSG_RESULT([WARNING: Distortion analysis debug *D_DBG_BLOCKTIMES* is enabled]) @@ -927,6 +935,8 @@ AM_CONDITIONAL([NUMDEV_WANTED], [test "x$enable_cider" = xyes]) AM_CONDITIONAL([PSS_WANTED], [test "x$enable_pss" = xyes]) +AM_CONDITIONAL([RELAN_WANTED], [test "x$enable_relan" = xyes]) + AM_CONDITIONAL([SENSE2_WANTED], [test "x$enable_sense2" = xyes]) # adms option diff --git a/src/frontend/commands.c b/src/frontend/commands.c index cbc7c1f5a..bd1347b27 100644 --- a/src/frontend/commands.c +++ b/src/frontend/commands.c @@ -294,12 +294,12 @@ struct comm spcp_coms[] = { /* SP */ #endif -//#ifdef RELAN +#ifdef RELAN { "relan", com_relan, TRUE, TRUE, { 0, 0, 0, 0 }, E_DEFHMASK, 0, LOTS, NULL, "[.relan line args] : Do a Reliability Analysis." } , -//#endif +#endif { "ac", com_ac, TRUE, TRUE, { 0, 0, 0, 0 }, E_DEFHMASK, 0, LOTS, @@ -733,12 +733,12 @@ struct comm nutcp_coms[] = { /* SP */ #endif -//#ifdef RELAN +#ifdef RELAN { "relan", NULL, TRUE, TRUE, { 0, 0, 0, 0 }, E_DEFHMASK, 0, LOTS, NULL, "[.relan line args] : Do a Reliability Analysis." } , -//#endif +#endif { "ac", NULL, TRUE, TRUE, { 0, 0, 0, 0 }, E_DEFHMASK, 0, LOTS, diff --git a/src/frontend/runcoms.c b/src/frontend/runcoms.c index f9f8bfb74..3911a5592 100644 --- a/src/frontend/runcoms.c +++ b/src/frontend/runcoms.c @@ -185,13 +185,13 @@ com_pss(wordlist *wl) #endif -//#ifdef RELAN +#ifdef RELAN void com_relan (wordlist *wl) { dosim ("relan", wl) ; } -//#endif +#endif static int diff --git a/src/frontend/runcoms.h b/src/frontend/runcoms.h index 364a66fd8..d4b7ebd68 100644 --- a/src/frontend/runcoms.h +++ b/src/frontend/runcoms.h @@ -17,9 +17,9 @@ void com_tran(wordlist *wl); void com_pss(wordlist *wl); /* SP */ -//#ifdef RELAN +#ifdef RELAN void com_relan (wordlist *wl) ; -//#endif +#endif void com_sens(wordlist *wl); void com_disto(wordlist *wl); diff --git a/src/frontend/shyu.c b/src/frontend/shyu.c index 1c5bc02f2..8bc77cbb6 100644 --- a/src/frontend/shyu.c +++ b/src/frontend/shyu.c @@ -314,7 +314,7 @@ if_sens_run(CKTcircuit *ckt, wordlist *args, INPtables *tab) } #endif -//#ifdef RELAN +#ifdef RELAN if (strcmp (token, "relan") == 0) { JOB *relanJob ; @@ -376,7 +376,7 @@ if_sens_run(CKTcircuit *ckt, wordlist *args, INPtables *tab) } } } -//#endif +#endif next: while (*line) { /* read the entire line */ diff --git a/src/frontend/spiceif.c b/src/frontend/spiceif.c index 74616d884..86b061d98 100644 --- a/src/frontend/spiceif.c +++ b/src/frontend/spiceif.c @@ -222,9 +222,9 @@ if_run(CKTcircuit *ckt, char *what, wordlist *args, INPtables *tab) /* SP */ #endif -//#ifdef RELAN +#ifdef RELAN || eq (what, "relan") -//#endif +#endif ) { @@ -342,9 +342,9 @@ if_run(CKTcircuit *ckt, char *what, wordlist *args, INPtables *tab) /* SP */ #endif -//#ifdef RELAN +#ifdef RELAN (eq (what, "relan")) || -//#endif +#endif (eq(what, "run"))) { diff --git a/src/frontend/typesdef.c b/src/frontend/typesdef.c index 9263d230b..0b08aa58a 100644 --- a/src/frontend/typesdef.c +++ b/src/frontend/typesdef.c @@ -83,9 +83,9 @@ static struct plotab plotabs[NUMPLOTTYPES] = { { "spect", "spect" }, { "pss", "periodic" }, -//#ifdef RELAN - { "relan", "reliability" }, -//#endif +#ifdef RELAN + { "relan", "reliability" } +#endif }; diff --git a/src/include/ngspice/Makefile.am b/src/include/ngspice/Makefile.am index 6eb592a4d..545dc9b13 100644 --- a/src/include/ngspice/Makefile.am +++ b/src/include/ngspice/Makefile.am @@ -125,7 +125,13 @@ pkginclude_HEADERS = \ FastNorm3.h \ fftext.h \ wallace.h \ - wstdio.h \ + wstdio.h + + +if RELAN_WANTED +include_HEADERS += \ relandefs.h +endif + MAINTAINERCLEANFILES = Makefile.in diff --git a/src/include/ngspice/cktdefs.h b/src/include/ngspice/cktdefs.h index afdc5d430..f7a97f4fb 100644 --- a/src/include/ngspice/cktdefs.h +++ b/src/include/ngspice/cktdefs.h @@ -423,13 +423,13 @@ extern int DCpss(CKTcircuit *, int); /* SP */ #endif -//#ifdef RELAN +#ifdef RELAN +extern int CKTreliability (CKTcircuit *, unsigned int) ; extern int RELANaskQuest (CKTcircuit *, JOB *, int, IFvalue *) ; extern int RELANsetParm (CKTcircuit *, JOB *, int, IFvalue *) ; extern int RELANinit (CKTcircuit *, JOB *) ; extern int RELANanalysis (CKTcircuit *, int) ; -extern int CKTreliability (CKTcircuit *, unsigned int) ; -//#endif +#endif extern int NaskQuest(CKTcircuit *, JOB *, int, IFvalue *); extern int NsetParm(CKTcircuit *, JOB *, int, IFvalue *); diff --git a/src/include/ngspice/devdefs.h b/src/include/ngspice/devdefs.h index c1d0d5937..206a43958 100644 --- a/src/include/ngspice/devdefs.h +++ b/src/include/ngspice/devdefs.h @@ -114,7 +114,9 @@ typedef struct SPICEdev { int *DEVinstSize; /* size of an instance */ int *DEVmodSize; /* size of a model */ +#ifdef RELAN int (*DEVreliability)(GENmodel *, CKTcircuit *, unsigned int) ; +#endif } SPICEdev; /* instance of structure for each possible type of device */ diff --git a/src/spicelib/analysis/Makefile.am b/src/spicelib/analysis/Makefile.am index 6d10c779f..61448a688 100644 --- a/src/spicelib/analysis/Makefile.am +++ b/src/spicelib/analysis/Makefile.am @@ -95,12 +95,7 @@ libckt_la_SOURCES = \ tranaskq.c \ traninit.c \ transetp.c \ - cluster.c \ - cktreliability.c \ - relananalysis.c \ - relanaskq.c \ - relaninit.c \ - relansetp.c + cluster.c if PSS_WANTED @@ -111,6 +106,15 @@ libckt_la_SOURCES += \ psssetp.c endif +if RELAN_WANTED +libckt_la_SOURCES += \ + cktreliability.c \ + relananalysis.c \ + relanaskq.c \ + relaninit.c \ + relansetp.c +endif + AM_CPPFLAGS = @AM_CPPFLAGS@ -I$(top_srcdir)/src/include -I$(top_srcdir)/src/spicelib/devices AM_CFLAGS = $(STATIC) diff --git a/src/spicelib/analysis/analysis.c b/src/spicelib/analysis/analysis.c index fb7f3dfcd..af339b43f 100644 --- a/src/spicelib/analysis/analysis.c +++ b/src/spicelib/analysis/analysis.c @@ -6,7 +6,11 @@ #include "analysis.h" extern SPICEanalysis OPTinfo ; + +#ifdef RELAN extern SPICEanalysis RELANinfo ; +#endif + extern SPICEanalysis ACinfo ; extern SPICEanalysis DCTinfo ; extern SPICEanalysis DCOinfo ; @@ -27,7 +31,11 @@ extern SPICEanalysis SEN2info ; SPICEanalysis *analInfo [] = { &OPTinfo, + +#ifdef RELAN &RELANinfo, +#endif + &ACinfo, &DCTinfo, &DCOinfo, diff --git a/src/spicelib/analysis/cktdojob.c b/src/spicelib/analysis/cktdojob.c index 72e755b02..12493e192 100644 --- a/src/spicelib/analysis/cktdojob.c +++ b/src/spicelib/analysis/cktdojob.c @@ -224,6 +224,7 @@ CKTdoJob(CKTcircuit *ckt, int reset, TSKtask *task) /* txl, cpl addition */ if (error == 1111) break; +#ifdef RELAN if (i == 1) { /* In case of Reliability Analysis, perform the final CKTreliability */ @@ -235,6 +236,7 @@ CKTdoJob(CKTcircuit *ckt, int reset, TSKtask *task) return (error) ; } } +#endif } if (error) diff --git a/src/spicelib/devices/bsim4/Makefile.am b/src/spicelib/devices/bsim4/Makefile.am index 483dccb86..14b01d542 100644 --- a/src/spicelib/devices/bsim4/Makefile.am +++ b/src/spicelib/devices/bsim4/Makefile.am @@ -27,10 +27,14 @@ libbsim4_la_SOURCES = \ bsim4ext.h \ bsim4init.c \ bsim4init.h \ - bsim4itf.h \ - b4reliability.c + bsim4itf.h +if RELAN_WANTED +libbsim4_la_SOURCES += \ + b4reliability.c +endif + AM_CPPFLAGS = @AM_CPPFLAGS@ -I$(top_srcdir)/src/include AM_CFLAGS = $(STATIC) diff --git a/src/spicelib/devices/bsim4/b4set.c b/src/spicelib/devices/bsim4/b4set.c index 1f8349531..bfb9a8a73 100644 --- a/src/spicelib/devices/bsim4/b4set.c +++ b/src/spicelib/devices/bsim4/b4set.c @@ -2654,6 +2654,7 @@ do { if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NUL TSTALLOC(BSIM4SbpPtr, BSIM4sNode, BSIM4bNodePrime); } +#ifdef RELAN if (model->BSIM4type == -1) { here->BSIM4reliability = TMALLOC (BSIM4relStruct, 1) ; @@ -2662,6 +2663,8 @@ do { if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NUL here->BSIM4reliability->t_star = 0 ; here->BSIM4reliability->IsON = -1 ; } +#endif + } } diff --git a/src/spicelib/devices/bsim4/b4temp.c b/src/spicelib/devices/bsim4/b4temp.c index a446e2032..b7186c774 100644 --- a/src/spicelib/devices/bsim4/b4temp.c +++ b/src/spicelib/devices/bsim4/b4temp.c @@ -1714,7 +1714,9 @@ int Size_Not_Found, i; here->BSIM4u0temp *= T3; } - /* adding delvto */ + /* adding delvto */ + +#ifdef RELAN if (model->BSIM4type == -1) { if (here->BSIM4reliability->IsON != -1) @@ -1722,6 +1724,8 @@ int Size_Not_Found, i; here->BSIM4delvto = here->BSIM4reliability->deltaVth ; } } +#endif + here->BSIM4vth0 += here->BSIM4delvto; here->BSIM4vfb = pParam->BSIM4vfb + model->BSIM4type * here->BSIM4delvto; diff --git a/src/spicelib/devices/bsim4/bsim4def.h b/src/spicelib/devices/bsim4/bsim4def.h index 59e2f31d9..2d6b66252 100644 --- a/src/spicelib/devices/bsim4/bsim4def.h +++ b/src/spicelib/devices/bsim4/bsim4def.h @@ -29,12 +29,14 @@ Modified by Pankaj Kumar Thakur, 07/23/2012 #include "ngspice/complex.h" #include "ngspice/noisedef.h" +#ifdef RELAN typedef struct sBSIM4relStruct { double time ; double deltaVth ; double t_star ; int IsON ; } BSIM4relStruct ; +#endif typedef struct sBSIM4instance { @@ -581,7 +583,9 @@ typedef struct sBSIM4instance double **BSIM4nVar; #endif /* NONOISE */ +#ifdef RELAN BSIM4relStruct *BSIM4reliability ; +#endif } BSIM4instance ; diff --git a/src/spicelib/devices/bsim4/bsim4ext.h b/src/spicelib/devices/bsim4/bsim4ext.h index 693778691..a0cae5e27 100644 --- a/src/spicelib/devices/bsim4/bsim4ext.h +++ b/src/spicelib/devices/bsim4/bsim4ext.h @@ -32,4 +32,6 @@ extern int BSIM4noise(int,int,GENmodel*,CKTcircuit*,Ndata*,double*); extern int BSIM4unsetup(GENmodel*,CKTcircuit*); extern int BSIM4soaCheck(CKTcircuit *, GENmodel *); +#ifdef RELAN extern int BSIM4reliability (GENmodel *, CKTcircuit *, unsigned int) ; +#endif diff --git a/src/spicelib/devices/bsim4/bsim4init.c b/src/spicelib/devices/bsim4/bsim4init.c index b355a6641..cead0f7e3 100644 --- a/src/spicelib/devices/bsim4/bsim4init.c +++ b/src/spicelib/devices/bsim4/bsim4init.c @@ -75,7 +75,9 @@ SPICEdev BSIM4info = { &BSIM4iSize, /* DEVinstSize */ &BSIM4mSize, /* DEVmodSize */ +#ifdef RELAN BSIM4reliability +#endif }; diff --git a/src/spicelib/devices/cap/capinit.c b/src/spicelib/devices/cap/capinit.c index 1d0499b6d..1c8bb5126 100644 --- a/src/spicelib/devices/cap/capinit.c +++ b/src/spicelib/devices/cap/capinit.c @@ -72,10 +72,7 @@ SPICEdev CAPinfo = { /* DEVacct */ NULL, #endif /* DEVinstSize */ &CAPiSize, - /* DEVmodSize */ &CAPmSize, - - NULL - + /* DEVmodSize */ &CAPmSize }; diff --git a/src/spicelib/devices/mos1/Makefile.am b/src/spicelib/devices/mos1/Makefile.am index a0f1bc48d..c16190272 100644 --- a/src/spicelib/devices/mos1/Makefile.am +++ b/src/spicelib/devices/mos1/Makefile.am @@ -31,10 +31,14 @@ libmos1_la_SOURCES = \ mos1sset.c \ mos1supd.c \ mos1temp.c \ - mos1trun.c \ - mos1reliability.c + mos1trun.c +if RELAN_WANTED +libmos1_la_SOURCES += \ + mos1reliability.c +endif + AM_CPPFLAGS = @AM_CPPFLAGS@ -I$(top_srcdir)/src/include AM_CFLAGS = $(STATIC) diff --git a/src/spicelib/devices/mos1/mos1defs.h b/src/spicelib/devices/mos1/mos1defs.h index 074ea736f..099006c04 100644 --- a/src/spicelib/devices/mos1/mos1defs.h +++ b/src/spicelib/devices/mos1/mos1defs.h @@ -13,12 +13,14 @@ Modified: 2000 AlansFixes #include "ngspice/complex.h" #include "ngspice/noisedef.h" +#ifdef RELAN typedef struct sMOS1relStruct { double time ; double deltaVth ; double t_star ; int IsON ; } MOS1relStruct ; +#endif /* declarations for level 1 MOSFETs */ @@ -271,7 +273,9 @@ typedef struct sMOS1instance { #define MOS1dphibs_dw MOS1sens + 68 #define MOS1dphibd_dw MOS1sens + 69 +#ifdef RELAN MOS1relStruct *MOS1reliability ; +#endif } MOS1instance ; diff --git a/src/spicelib/devices/mos1/mos1ext.h b/src/spicelib/devices/mos1/mos1ext.h index 064198591..dafe2f3bd 100644 --- a/src/spicelib/devices/mos1/mos1ext.h +++ b/src/spicelib/devices/mos1/mos1ext.h @@ -29,4 +29,6 @@ extern int MOS1disto(int,GENmodel*,CKTcircuit*); extern int MOS1noise(int,int,GENmodel*,CKTcircuit*,Ndata*,double*); extern int MOS1dSetup(GENmodel*,CKTcircuit*); +#ifdef RELAN extern int MOS1reliability (GENmodel *, CKTcircuit *, unsigned int) ; +#endif diff --git a/src/spicelib/devices/mos1/mos1init.c b/src/spicelib/devices/mos1/mos1init.c index 63f25dcf1..6dc3f66db 100644 --- a/src/spicelib/devices/mos1/mos1init.c +++ b/src/spicelib/devices/mos1/mos1init.c @@ -75,7 +75,9 @@ SPICEdev MOS1info = { /* DEVinstSize */ &MOS1iSize, /* DEVmodSize */ &MOS1mSize, +#ifdef RELAN MOS1reliability +#endif }; diff --git a/src/spicelib/devices/mos1/mos1set.c b/src/spicelib/devices/mos1/mos1set.c index 8b60c7aa6..334610cb4 100644 --- a/src/spicelib/devices/mos1/mos1set.c +++ b/src/spicelib/devices/mos1/mos1set.c @@ -206,6 +206,7 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\ TSTALLOC(MOS1SPbPtr,MOS1sNodePrime,MOS1bNode); TSTALLOC(MOS1SPdpPtr,MOS1sNodePrime,MOS1dNodePrime); +#ifdef RELAN if (model->MOS1type == -1) { here->MOS1reliability = TMALLOC (MOS1relStruct, 1) ; @@ -214,6 +215,8 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\ here->MOS1reliability->t_star = 0 ; here->MOS1reliability->IsON = -1 ; } +#endif + } } return(OK); diff --git a/src/spicelib/devices/vsrc/vsrcinit.c b/src/spicelib/devices/vsrc/vsrcinit.c index f699cf81f..3c8285851 100644 --- a/src/spicelib/devices/vsrc/vsrcinit.c +++ b/src/spicelib/devices/vsrc/vsrcinit.c @@ -73,10 +73,7 @@ SPICEdev VSRCinfo = { /* DEVacct */ NULL, #endif /* DEVinstSize */ &VSRCiSize, - /* DEVmodSize */ &VSRCmSize, - - NULL - + /* DEVmodSize */ &VSRCmSize }; diff --git a/src/spicelib/parser/inp2dot.c b/src/spicelib/parser/inp2dot.c index 0f0872e71..b2e7e5a72 100644 --- a/src/spicelib/parser/inp2dot.c +++ b/src/spicelib/parser/inp2dot.c @@ -612,7 +612,7 @@ dot_pss(char *line, void *ckt, INPtables *tab, card *current, /* SP */ #endif -//#ifdef RELAN +#ifdef RELAN static int dot_relan (char *line, void *ckt, INPtables *tab, card *current, void *task, void *gnode, JOB *foo) { @@ -670,7 +670,7 @@ dot_relan (char *line, void *ckt, INPtables *tab, card *current, void *task, voi return (0) ; } -//#endif +#endif static int dot_options(char *line, CKTcircuit *ckt, INPtables *tab, card *current, @@ -759,11 +759,11 @@ INP2dot(CKTcircuit *ckt, INPtables *tab, card *current, TSKtask *task, CKTnode * /* SP */ #endif -//#ifdef RELAN +#ifdef RELAN } else if ((strcmp (token, ".relan") == 0)) { rtn = dot_relan (line, ckt, tab, current, task, gnode, foo) ; goto quit ; -//#endif +#endif } else if ((strcmp(token, ".subckt") == 0) || (strcmp(token, ".ends") == 0)) {