From f4470dc8a018587de0d40e5ad51c535a413e4277 Mon Sep 17 00:00:00 2001 From: rlar Date: Thu, 1 Dec 2016 19:09:40 +0100 Subject: [PATCH] experimental, drop IF_REDUNDANT Use the .id fields of neighbouring entries to recognise REDUNDANT'cy Thus IOPR and OPR are no longer needed. --- src/frontend/device.c | 4 ++-- src/frontend/spiceif.c | 16 +++++++++------- src/include/ngspice/ifsim.h | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/frontend/device.c b/src/frontend/device.c index b091b7f24..907d676c1 100644 --- a/src/frontend/device.c +++ b/src/frontend/device.c @@ -638,7 +638,7 @@ param_forall(dgen *dg, int flags) for (i = 0; i < xcount; i++) if ((plist[i].dataType & IF_ASK) - && !(plist[i].dataType & IF_REDUNDANT) + && !(i > 0 && plist[i - 1].id == plist[i].id) && ((plist[i].dataType & IF_SET) || dg->ckt->CKTrhsOld) && (!(plist[i].dataType & IF_UNINTERESTING) || (flags == DGEN_ALLPARAMS))) { @@ -672,7 +672,7 @@ param_forall_old(dgen *dg, int flags) for (i = 0; i < xcount; i++) if ((plist[i].dataType & IF_ASK) - && !(plist[i].dataType & IF_REDUNDANT) + && !(i > 0 && plist[i - 1].id == plist[i].id) && ((plist[i].dataType & IF_SET) || dg->ckt->CKTrhsOld) && (!(plist[i].dataType & IF_UNINTERESTING) || (flags == DGEN_ALLPARAMS))) { diff --git a/src/frontend/spiceif.c b/src/frontend/spiceif.c index b1ddbc3d7..01b462b9f 100644 --- a/src/frontend/spiceif.c +++ b/src/frontend/spiceif.c @@ -647,9 +647,9 @@ spif_getparam_special(CKTcircuit *ckt, char **name, char *param, int ind, int do /* It is a device */ for (i = 0; i < *(device->numInstanceParms); i++) { opt = &device->instanceParms[i]; - if (opt->dataType & IF_REDUNDANT || !opt->description) + if (i > 0 && device->instanceParms[i - 1].id == device->instanceParms[i].id) continue; - if (!(opt->dataType & IF_ASK)) + if (!opt->description || !(opt->dataType & IF_ASK)) continue; pv = doask(ckt, typecode, dev, mod, opt, ind); if (pv) { @@ -675,7 +675,9 @@ spif_getparam_special(CKTcircuit *ckt, char **name, char *param, int ind, int do /* It is a model */ for (i = 0; i < *(device->numModelParms); i++) { opt = &device->modelParms[i]; - if (opt->dataType & IF_REDUNDANT || !opt->description) + if (i > 0 && device->modelParms[i - 1].id == device->modelParms[i].id) + continue; + if (!opt->description) continue; /* We check that the parameter is interesting and therefore is @@ -779,9 +781,9 @@ spif_getparam(CKTcircuit *ckt, char **name, char *param, int ind, int do_model) device = ft_sim->devices[typecode]; for (i = 0; i < *(device->numInstanceParms); i++) { opt = &device->instanceParms[i]; - if (opt->dataType & IF_REDUNDANT || !opt->description) + if (i > 0 && device->instanceParms[i - 1].id == device->instanceParms[i].id) continue; - if (!(opt->dataType & IF_ASK)) + if (!opt->description || !(opt->dataType & IF_ASK)) continue; pv = doask(ckt, typecode, dev, mod, opt, ind); if (pv) { @@ -1038,7 +1040,7 @@ parmlookup(IFdevice *dev, GENinstance **inptr, char *param, int do_model, int in ((dev->instanceParms[i].dataType & IF_ASK) && inout == 0)) && cieq(dev->instanceParms[i].keyword, param)) { - while ((dev->instanceParms[i].dataType & IF_REDUNDANT) && (i > 0)) + while (i > 0 && dev->instanceParms[i - 1].id == dev->instanceParms[i].id) i--; return (&dev->instanceParms[i]); } @@ -1052,7 +1054,7 @@ parmlookup(IFdevice *dev, GENinstance **inptr, char *param, int do_model, int in ((dev->modelParms[i].dataType & IF_ASK) && inout == 0)) && eq(dev->modelParms[i].keyword, param)) { - while ((dev->modelParms[i].dataType & IF_REDUNDANT) && (i > 0)) + while (i > 0 && dev->modelParms[i - 1].id == dev->modelParms[i].id) i--; return (&dev->modelParms[i]); } diff --git a/src/include/ngspice/ifsim.h b/src/include/ngspice/ifsim.h index 4d62605b8..df61eb6fb 100644 --- a/src/include/ngspice/ifsim.h +++ b/src/include/ngspice/ifsim.h @@ -135,7 +135,7 @@ struct IFparm { #define IF_UNIMP_MASK (~0xfff) /* Used by sensetivity to check if a parameter is or is not useful */ -#define IF_REDUNDANT 0x0010000 +#define IF_REDUNDANT 0x0000000 #define IF_PRINCIPAL 0x0020000 #define IF_AC 0x0040000 #define IF_AC_ONLY 0x0080000