Browse Source

Add DEVmodDelete functions to reduce memoory leaks in Cider models. The model memory was not freed during remcirc or quit. In the future, some of the code duplication could be refactored. The cmosinv.cir is now down to just 1 memory leak.

pre-master-46
Brian Taylor 3 years ago
committed by Holger Vogt
parent
commit
f39f89ea9b
  1. 174
      src/spicelib/devices/nbjt/nbjtdel.c
  2. 1
      src/spicelib/devices/nbjt/nbjtext.h
  3. 2
      src/spicelib/devices/nbjt/nbjtinit.c
  4. 1
      src/spicelib/devices/nbjt2/nbjt2ext.h
  5. 175
      src/spicelib/devices/nbjt2/nbt2del.c
  6. 2
      src/spicelib/devices/nbjt2/nbt2init.c
  7. 175
      src/spicelib/devices/numd/numddel.c
  8. 1
      src/spicelib/devices/numd/numdext.h
  9. 2
      src/spicelib/devices/numd/numdinit.c
  10. 175
      src/spicelib/devices/numd2/nud2del.c
  11. 1
      src/spicelib/devices/numd2/numd2ext.h
  12. 2
      src/spicelib/devices/numd2/numd2init.c
  13. 176
      src/spicelib/devices/numos/nummdel.c
  14. 1
      src/spicelib/devices/numos/numosext.h
  15. 2
      src/spicelib/devices/numos/numosinit.c

174
src/spicelib/devices/nbjt/nbjtdel.c

@ -24,3 +24,177 @@ NBJTdelete(GENinstance *gen_inst)
return OK; return OK;
} }
int NBJTmodDelete(GENmodel *gen_model)
{
NBJTmodel *model = (NBJTmodel *)gen_model;
MESHcard *xmesh = model->NBJTxMeshes; /* list of xmesh cards */
MESHcard *ymesh = model->NBJTyMeshes; /* list of ymesh cards */
DOMNcard *domains = model->NBJTdomains; /* list of domain cards */
BDRYcard *boundaries = model->NBJTboundaries; /* list of boundary cards */
DOPcard *dopings = model->NBJTdopings; /* list of doping cards */
ELCTcard *electrodes = model->NBJTelectrodes; /* list of electrode cards */
CONTcard *contacts = model->NBJTcontacts; /* list of contact cards */
MODLcard *models = model->NBJTmodels; /* list of model cards */
MATLcard *materials = model->NBJTmaterials; /* list of material cards */
MOBcard *mobility = model->NBJTmobility; /* list of mobility cards */
METHcard *methods = model->NBJTmethods; /* list of method cards */
OPTNcard *options = model->NBJToptions; /* list of option cards */
OUTPcard *outputs = model->NBJToutputs; /* list of output cards */
TWOtranInfo *pInfo = model->NBJTpInfo; /* transient analysis information */
DOPprofile *profiles = model->NBJTprofiles; /* expanded list of doping profiles */
DOPtable *dopTables = model->NBJTdopTables; /* list of tables used by profiles */
TWOmaterial *matlInfo = model->NBJTmatlInfo; /* list of material info structures */
{
MESHcard *next = NULL, *this = NULL;
next = xmesh;
while (next) {
this = next;
next = next->MESHnextCard;
FREE(this);
}
}
{
MESHcard *next = NULL, *this = NULL;
next = ymesh;
while (next) {
this = next;
next = next->MESHnextCard;
FREE(this);
}
}
{
DOMNcard *next = NULL, *this = NULL;
next = domains;
while (next) {
this = next;
next = next->DOMNnextCard;
FREE(this);
}
}
{
BDRYcard *next = NULL, *this = NULL;
next = boundaries;
while (next) {
this = next;
next = next->BDRYnextCard;
FREE(this);
}
}
{
DOPcard *next = NULL, *this = NULL;
next = dopings;
while (next) {
this = next;
next = next->DOPnextCard;
if (this->DOPdomains) {
FREE(this->DOPdomains);
}
if (this->DOPinFile) {
FREE(this->DOPinFile);
}
FREE(this);
}
}
{
ELCTcard *next = NULL, *this = NULL;
next = electrodes;
while (next) {
this = next;
next = next->ELCTnextCard;
FREE(this);
}
}
{
CONTcard *next = NULL, *this = NULL;
next = contacts;
while (next) {
this = next;
next = next->CONTnextCard;
FREE(this);
}
}
{
MODLcard *next = NULL, *this = NULL;
next = models;
while (next) {
this = next;
next = next->MODLnextCard;
FREE(this);
}
}
{
MATLcard *next = NULL, *this = NULL;
next = materials;
while (next) {
this = next;
next = next->MATLnextCard;
FREE(this);
}
}
{
MOBcard *next = NULL, *this = NULL;
next = mobility;
while (next) {
this = next;
next = next->MOBnextCard;
FREE(this);
}
}
{
METHcard *next = NULL, *this = NULL;
next = methods;
while (next) {
this = next;
next = next->METHnextCard;
FREE(this);
}
}
{
OPTNcard *next = NULL, *this = NULL;
next = options;
while (next) {
this = next;
next = next->OPTNnextCard;
FREE(this);
}
}
{
OUTPcard *next = NULL, *this = NULL;
next = outputs;
while (next) {
this = next;
next = next->OUTPnextCard;
if (this->OUTProotFile) {
FREE(this->OUTProotFile);
}
FREE(this);
}
}
{
if (pInfo) {
FREE(pInfo);
}
}
{
DOPprofile *next = NULL, *this = NULL;
next = profiles;
while (next) {
this = next;
next = next->next;
FREE(this);
}
}
(void)dopTables;
{
TWOmaterial *next = NULL, *this = NULL;
next = matlInfo;
while (next) {
this = next;
next = next->next;
FREE(this);
}
}
return OK;
}

1
src/spicelib/devices/nbjt/nbjtext.h

@ -9,6 +9,7 @@ Author: 1987 Karti Mayaram
extern int NBJTacLoad(GENmodel *, CKTcircuit *); extern int NBJTacLoad(GENmodel *, CKTcircuit *);
extern int NBJTask(CKTcircuit *, GENinstance *, int, IFvalue *, IFvalue *); extern int NBJTask(CKTcircuit *, GENinstance *, int, IFvalue *, IFvalue *);
extern int NBJTdelete(GENinstance *); extern int NBJTdelete(GENinstance *);
extern int NBJTmodDelete(GENmodel *);
extern int NBJTgetic(GENmodel *, CKTcircuit *); extern int NBJTgetic(GENmodel *, CKTcircuit *);
extern int NBJTload(GENmodel *, CKTcircuit *); extern int NBJTload(GENmodel *, CKTcircuit *);
extern int NBJTmParam(int, IFvalue *, GENmodel *); extern int NBJTmParam(int, IFvalue *, GENmodel *);

2
src/spicelib/devices/nbjt/nbjtinit.c

@ -43,7 +43,7 @@ SPICEdev NBJTinfo = {
.DEVacLoad = NBJTacLoad, .DEVacLoad = NBJTacLoad,
.DEVaccept = NULL, .DEVaccept = NULL,
.DEVdestroy = NULL, .DEVdestroy = NULL,
.DEVmodDelete = NULL,
.DEVmodDelete = NBJTmodDelete,
.DEVdelete = NBJTdelete, .DEVdelete = NBJTdelete,
.DEVsetic = NULL, .DEVsetic = NULL,
.DEVask = NBJTask, .DEVask = NBJTask,

1
src/spicelib/devices/nbjt2/nbjt2ext.h

@ -10,6 +10,7 @@ Author: 1987 Karti Mayaram
extern int NBJT2acLoad(GENmodel *, CKTcircuit *); extern int NBJT2acLoad(GENmodel *, CKTcircuit *);
extern int NBJT2ask(CKTcircuit *, GENinstance *, int, IFvalue *, IFvalue *); extern int NBJT2ask(CKTcircuit *, GENinstance *, int, IFvalue *, IFvalue *);
extern int NBJT2delete(GENinstance *); extern int NBJT2delete(GENinstance *);
extern int NBJT2modDelete(GENmodel *);
extern int NBJT2getic(GENmodel *, CKTcircuit *); extern int NBJT2getic(GENmodel *, CKTcircuit *);
extern int NBJT2load(GENmodel *, CKTcircuit *); extern int NBJT2load(GENmodel *, CKTcircuit *);
extern int NBJT2mParam(int, IFvalue *, GENmodel *); extern int NBJT2mParam(int, IFvalue *, GENmodel *);

175
src/spicelib/devices/nbjt2/nbt2del.c

@ -14,6 +14,7 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "../../../ciderlib/twod/twodext.h" #include "../../../ciderlib/twod/twodext.h"
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
#include "ngspice/carddefs.h"
int int
@ -25,3 +26,177 @@ NBJT2delete(GENinstance *gen_inst)
return OK; return OK;
} }
int NBJT2modDelete(GENmodel *gen_model)
{
NBJT2model *model = (NBJT2model *)gen_model;
MESHcard *xmesh = model->NBJT2xMeshes; /* list of xmesh cards */
MESHcard *ymesh = model->NBJT2yMeshes; /* list of ymesh cards */
DOMNcard *domains = model->NBJT2domains; /* list of domain cards */
BDRYcard *boundaries = model->NBJT2boundaries; /* list of boundary cards */
DOPcard *dopings = model->NBJT2dopings; /* list of doping cards */
ELCTcard *electrodes = model->NBJT2electrodes; /* list of electrode cards */
CONTcard *contacts = model->NBJT2contacts; /* list of contact cards */
MODLcard *models = model->NBJT2models; /* list of model cards */
MATLcard *materials = model->NBJT2materials; /* list of material cards */
MOBcard *mobility = model->NBJT2mobility; /* list of mobility cards */
METHcard *methods = model->NBJT2methods; /* list of method cards */
OPTNcard *options = model->NBJT2options; /* list of option cards */
OUTPcard *outputs = model->NBJT2outputs; /* list of output cards */
TWOtranInfo *pInfo = model->NBJT2pInfo; /* transient analysis information */
DOPprofile *profiles = model->NBJT2profiles; /* expanded list of doping profiles */
DOPtable *dopTables = model->NBJT2dopTables; /* list of tables used by profiles */
TWOmaterial *matlInfo = model->NBJT2matlInfo; /* list of material info structures */
{
MESHcard *next = NULL, *this = NULL;
next = xmesh;
while (next) {
this = next;
next = next->MESHnextCard;
FREE(this);
}
}
{
MESHcard *next = NULL, *this = NULL;
next = ymesh;
while (next) {
this = next;
next = next->MESHnextCard;
FREE(this);
}
}
{
DOMNcard *next = NULL, *this = NULL;
next = domains;
while (next) {
this = next;
next = next->DOMNnextCard;
FREE(this);
}
}
{
BDRYcard *next = NULL, *this = NULL;
next = boundaries;
while (next) {
this = next;
next = next->BDRYnextCard;
FREE(this);
}
}
{
DOPcard *next = NULL, *this = NULL;
next = dopings;
while (next) {
this = next;
next = next->DOPnextCard;
if (this->DOPdomains) {
FREE(this->DOPdomains);
}
if (this->DOPinFile) {
FREE(this->DOPinFile);
}
FREE(this);
}
}
{
ELCTcard *next = NULL, *this = NULL;
next = electrodes;
while (next) {
this = next;
next = next->ELCTnextCard;
FREE(this);
}
}
{
CONTcard *next = NULL, *this = NULL;
next = contacts;
while (next) {
this = next;
next = next->CONTnextCard;
FREE(this);
}
}
{
MODLcard *next = NULL, *this = NULL;
next = models;
while (next) {
this = next;
next = next->MODLnextCard;
FREE(this);
}
}
{
MATLcard *next = NULL, *this = NULL;
next = materials;
while (next) {
this = next;
next = next->MATLnextCard;
FREE(this);
}
}
{
MOBcard *next = NULL, *this = NULL;
next = mobility;
while (next) {
this = next;
next = next->MOBnextCard;
FREE(this);
}
}
{
METHcard *next = NULL, *this = NULL;
next = methods;
while (next) {
this = next;
next = next->METHnextCard;
FREE(this);
}
}
{
OPTNcard *next = NULL, *this = NULL;
next = options;
while (next) {
this = next;
next = next->OPTNnextCard;
FREE(this);
}
}
{
OUTPcard *next = NULL, *this = NULL;
next = outputs;
while (next) {
this = next;
next = next->OUTPnextCard;
if (this->OUTProotFile) {
FREE(this->OUTProotFile);
}
FREE(this);
}
}
{
if (pInfo) {
FREE(pInfo);
}
}
{
DOPprofile *next = NULL, *this = NULL;
next = profiles;
while (next) {
this = next;
next = next->next;
FREE(this);
}
}
(void)dopTables;
{
TWOmaterial *next = NULL, *this = NULL;
next = matlInfo;
while (next) {
this = next;
next = next->next;
FREE(this);
}
}
return OK;
}

2
src/spicelib/devices/nbjt2/nbt2init.c

@ -43,7 +43,7 @@ SPICEdev NBJT2info = {
.DEVacLoad = NBJT2acLoad, .DEVacLoad = NBJT2acLoad,
.DEVaccept = NULL, .DEVaccept = NULL,
.DEVdestroy = NULL, .DEVdestroy = NULL,
.DEVmodDelete = NULL,
.DEVmodDelete = NBJT2modDelete,
.DEVdelete = NBJT2delete, .DEVdelete = NBJT2delete,
.DEVsetic = NULL, .DEVsetic = NULL,
.DEVask = NBJT2ask, .DEVask = NBJT2ask,

175
src/spicelib/devices/numd/numddel.c

@ -8,6 +8,7 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "../../../ciderlib/oned/onedext.h" #include "../../../ciderlib/oned/onedext.h"
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
#include "ngspice/carddefs.h"
int int
@ -19,3 +20,177 @@ NUMDdelete(GENinstance *gen_inst)
return OK; return OK;
} }
int NUMDmodDelete(GENmodel *gen_model)
{
NUMDmodel *model = (NUMDmodel *)gen_model;
MESHcard *xmesh = model->NUMDxMeshes; /* list of xmesh cards */
MESHcard *ymesh = model->NUMDyMeshes; /* list of ymesh cards */
DOMNcard *domains = model->NUMDdomains; /* list of domain cards */
BDRYcard *boundaries = model->NUMDboundaries; /* list of boundary cards */
DOPcard *dopings = model->NUMDdopings; /* list of doping cards */
ELCTcard *electrodes = model->NUMDelectrodes; /* list of electrode cards */
CONTcard *contacts = model->NUMDcontacts; /* list of contact cards */
MODLcard *models = model->NUMDmodels; /* list of model cards */
MATLcard *materials = model->NUMDmaterials; /* list of material cards */
MOBcard *mobility = model->NUMDmobility; /* list of mobility cards */
METHcard *methods = model->NUMDmethods; /* list of method cards */
OPTNcard *options = model->NUMDoptions; /* list of option cards */
OUTPcard *outputs = model->NUMDoutputs; /* list of output cards */
ONEtranInfo *pInfo = model->NUMDpInfo; /* transient analysis information */
DOPprofile *profiles = model->NUMDprofiles; /* expanded list of doping profiles */
DOPtable *dopTables = model->NUMDdopTables; /* list of tables used by profiles */
ONEmaterial *matlInfo = model->NUMDmatlInfo; /* list of material info structures */
{
MESHcard *next = NULL, *this = NULL;
next = xmesh;
while (next) {
this = next;
next = next->MESHnextCard;
FREE(this);
}
}
{
MESHcard *next = NULL, *this = NULL;
next = ymesh;
while (next) {
this = next;
next = next->MESHnextCard;
FREE(this);
}
}
{
DOMNcard *next = NULL, *this = NULL;
next = domains;
while (next) {
this = next;
next = next->DOMNnextCard;
FREE(this);
}
}
{
BDRYcard *next = NULL, *this = NULL;
next = boundaries;
while (next) {
this = next;
next = next->BDRYnextCard;
FREE(this);
}
}
{
DOPcard *next = NULL, *this = NULL;
next = dopings;
while (next) {
this = next;
next = next->DOPnextCard;
if (this->DOPdomains) {
FREE(this->DOPdomains);
}
if (this->DOPinFile) {
FREE(this->DOPinFile);
}
FREE(this);
}
}
{
ELCTcard *next = NULL, *this = NULL;
next = electrodes;
while (next) {
this = next;
next = next->ELCTnextCard;
FREE(this);
}
}
{
CONTcard *next = NULL, *this = NULL;
next = contacts;
while (next) {
this = next;
next = next->CONTnextCard;
FREE(this);
}
}
{
MODLcard *next = NULL, *this = NULL;
next = models;
while (next) {
this = next;
next = next->MODLnextCard;
FREE(this);
}
}
{
MATLcard *next = NULL, *this = NULL;
next = materials;
while (next) {
this = next;
next = next->MATLnextCard;
FREE(this);
}
}
{
MOBcard *next = NULL, *this = NULL;
next = mobility;
while (next) {
this = next;
next = next->MOBnextCard;
FREE(this);
}
}
{
METHcard *next = NULL, *this = NULL;
next = methods;
while (next) {
this = next;
next = next->METHnextCard;
FREE(this);
}
}
{
OPTNcard *next = NULL, *this = NULL;
next = options;
while (next) {
this = next;
next = next->OPTNnextCard;
FREE(this);
}
}
{
OUTPcard *next = NULL, *this = NULL;
next = outputs;
while (next) {
this = next;
next = next->OUTPnextCard;
if (this->OUTProotFile) {
FREE(this->OUTProotFile);
}
FREE(this);
}
}
{
if (pInfo) {
FREE(pInfo);
}
}
{
DOPprofile *next = NULL, *this = NULL;
next = profiles;
while (next) {
this = next;
next = next->next;
FREE(this);
}
}
(void)dopTables;
{
TWOmaterial *next = NULL, *this = NULL;
next = matlInfo;
while (next) {
this = next;
next = next->next;
FREE(this);
}
}
return OK;
}

1
src/spicelib/devices/numd/numdext.h

@ -10,6 +10,7 @@ Author: 1987 Karti Mayaram
extern int NUMDacLoad(GENmodel *, CKTcircuit *); extern int NUMDacLoad(GENmodel *, CKTcircuit *);
extern int NUMDask(CKTcircuit *, GENinstance *, int, IFvalue *, IFvalue *); extern int NUMDask(CKTcircuit *, GENinstance *, int, IFvalue *, IFvalue *);
extern int NUMDdelete(GENinstance *); extern int NUMDdelete(GENinstance *);
extern int NUMDmodDelete(GENmodel *);
extern int NUMDgetic(GENmodel *, CKTcircuit *); extern int NUMDgetic(GENmodel *, CKTcircuit *);
extern int NUMDload(GENmodel *, CKTcircuit *); extern int NUMDload(GENmodel *, CKTcircuit *);
extern int NUMDmParam(int, IFvalue *, GENmodel *); extern int NUMDmParam(int, IFvalue *, GENmodel *);

2
src/spicelib/devices/numd/numdinit.c

@ -43,7 +43,7 @@ SPICEdev NUMDinfo = {
.DEVacLoad = NUMDacLoad, .DEVacLoad = NUMDacLoad,
.DEVaccept = NULL, .DEVaccept = NULL,
.DEVdestroy = NULL, .DEVdestroy = NULL,
.DEVmodDelete = NULL,
.DEVmodDelete = NUMDmodDelete,
.DEVdelete = NUMDdelete, .DEVdelete = NUMDdelete,
.DEVsetic = NULL, .DEVsetic = NULL,
.DEVask = NUMDask, .DEVask = NUMDask,

175
src/spicelib/devices/numd2/nud2del.c

@ -9,6 +9,7 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "../../../ciderlib/twod/twodext.h" #include "../../../ciderlib/twod/twodext.h"
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
#include "ngspice/carddefs.h"
int int
@ -20,3 +21,177 @@ NUMD2delete(GENinstance *gen_inst)
return OK; return OK;
} }
int NUMD2modDelete(GENmodel *gen_model)
{
NUMD2model *model = (NUMD2model *)gen_model;
MESHcard *xmesh = model->NUMD2xMeshes; /* list of xmesh cards */
MESHcard *ymesh = model->NUMD2yMeshes; /* list of ymesh cards */
DOMNcard *domains = model->NUMD2domains; /* list of domain cards */
BDRYcard *boundaries = model->NUMD2boundaries; /* list of boundary cards */
DOPcard *dopings = model->NUMD2dopings; /* list of doping cards */
ELCTcard *electrodes = model->NUMD2electrodes; /* list of electrode cards */
CONTcard *contacts = model->NUMD2contacts; /* list of contact cards */
MODLcard *models = model->NUMD2models; /* list of model cards */
MATLcard *materials = model->NUMD2materials; /* list of material cards */
MOBcard *mobility = model->NUMD2mobility; /* list of mobility cards */
METHcard *methods = model->NUMD2methods; /* list of method cards */
OPTNcard *options = model->NUMD2options; /* list of option cards */
OUTPcard *outputs = model->NUMD2outputs; /* list of output cards */
TWOtranInfo *pInfo = model->NUMD2pInfo; /* transient analysis information */
DOPprofile *profiles = model->NUMD2profiles; /* expanded list of doping profiles */
DOPtable *dopTables = model->NUMD2dopTables; /* list of tables used by profiles */
TWOmaterial *matlInfo = model->NUMD2matlInfo; /* list of material info structures */
{
MESHcard *next = NULL, *this = NULL;
next = xmesh;
while (next) {
this = next;
next = next->MESHnextCard;
FREE(this);
}
}
{
MESHcard *next = NULL, *this = NULL;
next = ymesh;
while (next) {
this = next;
next = next->MESHnextCard;
FREE(this);
}
}
{
DOMNcard *next = NULL, *this = NULL;
next = domains;
while (next) {
this = next;
next = next->DOMNnextCard;
FREE(this);
}
}
{
BDRYcard *next = NULL, *this = NULL;
next = boundaries;
while (next) {
this = next;
next = next->BDRYnextCard;
FREE(this);
}
}
{
DOPcard *next = NULL, *this = NULL;
next = dopings;
while (next) {
this = next;
next = next->DOPnextCard;
if (this->DOPdomains) {
FREE(this->DOPdomains);
}
if (this->DOPinFile) {
FREE(this->DOPinFile);
}
FREE(this);
}
}
{
ELCTcard *next = NULL, *this = NULL;
next = electrodes;
while (next) {
this = next;
next = next->ELCTnextCard;
FREE(this);
}
}
{
CONTcard *next = NULL, *this = NULL;
next = contacts;
while (next) {
this = next;
next = next->CONTnextCard;
FREE(this);
}
}
{
MODLcard *next = NULL, *this = NULL;
next = models;
while (next) {
this = next;
next = next->MODLnextCard;
FREE(this);
}
}
{
MATLcard *next = NULL, *this = NULL;
next = materials;
while (next) {
this = next;
next = next->MATLnextCard;
FREE(this);
}
}
{
MOBcard *next = NULL, *this = NULL;
next = mobility;
while (next) {
this = next;
next = next->MOBnextCard;
FREE(this);
}
}
{
METHcard *next = NULL, *this = NULL;
next = methods;
while (next) {
this = next;
next = next->METHnextCard;
FREE(this);
}
}
{
OPTNcard *next = NULL, *this = NULL;
next = options;
while (next) {
this = next;
next = next->OPTNnextCard;
FREE(this);
}
}
{
OUTPcard *next = NULL, *this = NULL;
next = outputs;
while (next) {
this = next;
next = next->OUTPnextCard;
if (this->OUTProotFile) {
FREE(this->OUTProotFile);
}
FREE(this);
}
}
{
if (pInfo) {
FREE(pInfo);
}
}
{
DOPprofile *next = NULL, *this = NULL;
next = profiles;
while (next) {
this = next;
next = next->next;
FREE(this);
}
}
(void)dopTables;
{
TWOmaterial *next = NULL, *this = NULL;
next = matlInfo;
while (next) {
this = next;
next = next->next;
FREE(this);
}
}
return OK;
}

1
src/spicelib/devices/numd2/numd2ext.h

@ -10,6 +10,7 @@ Author: 1987 Karti Mayaram
extern int NUMD2acLoad(GENmodel *, CKTcircuit *); extern int NUMD2acLoad(GENmodel *, CKTcircuit *);
extern int NUMD2ask(CKTcircuit *, GENinstance *, int, IFvalue *, IFvalue *); extern int NUMD2ask(CKTcircuit *, GENinstance *, int, IFvalue *, IFvalue *);
extern int NUMD2delete(GENinstance *); extern int NUMD2delete(GENinstance *);
extern int NUMD2modDelete(GENmodel *);
extern int NUMD2getic(GENmodel *, CKTcircuit *); extern int NUMD2getic(GENmodel *, CKTcircuit *);
extern int NUMD2load(GENmodel *, CKTcircuit *); extern int NUMD2load(GENmodel *, CKTcircuit *);
extern int NUMD2mParam(int, IFvalue *, GENmodel *); extern int NUMD2mParam(int, IFvalue *, GENmodel *);

2
src/spicelib/devices/numd2/numd2init.c

@ -43,7 +43,7 @@ SPICEdev NUMD2info = {
.DEVacLoad = NUMD2acLoad, .DEVacLoad = NUMD2acLoad,
.DEVaccept = NULL, .DEVaccept = NULL,
.DEVdestroy = NULL, .DEVdestroy = NULL,
.DEVmodDelete = NULL,
.DEVmodDelete = NUMD2modDelete,
.DEVdelete = NUMD2delete, .DEVdelete = NUMD2delete,
.DEVsetic = NULL, .DEVsetic = NULL,
.DEVask = NUMD2ask, .DEVask = NUMD2ask,

176
src/spicelib/devices/numos/nummdel.c

@ -14,6 +14,7 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "../../../ciderlib/twod/twodext.h" #include "../../../ciderlib/twod/twodext.h"
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
#include "ngspice/carddefs.h"
int int
@ -25,3 +26,178 @@ NUMOSdelete(GENinstance *gen_inst)
return OK; return OK;
} }
int NUMOSmodDelete(GENmodel *gen_model)
{
NUMOSmodel *model = (NUMOSmodel *)gen_model;
MESHcard *xmesh = model->NUMOSxMeshes; /* list of xmesh cards */
MESHcard *ymesh = model->NUMOSyMeshes; /* list of ymesh cards */
DOMNcard *domains = model->NUMOSdomains; /* list of domain cards */
BDRYcard *boundaries = model->NUMOSboundaries; /* list of boundary cards */
DOPcard *dopings = model->NUMOSdopings; /* list of doping cards */
ELCTcard *electrodes = model->NUMOSelectrodes; /* list of electrode cards */
CONTcard *contacts = model->NUMOScontacts; /* list of contact cards */
MODLcard *models = model->NUMOSmodels; /* list of model cards */
MATLcard *materials = model->NUMOSmaterials; /* list of material cards */
MOBcard *mobility = model->NUMOSmobility; /* list of mobility cards */
METHcard *methods = model->NUMOSmethods; /* list of method cards */
OPTNcard *options = model->NUMOSoptions; /* list of option cards */
OUTPcard *outputs = model->NUMOSoutputs; /* list of output cards */
TWOtranInfo *pInfo = model->NUMOSpInfo; /* transient analysis information */
DOPprofile *profiles = model->NUMOSprofiles; /* expanded list of doping profiles */
DOPtable *dopTables = model->NUMOSdopTables; /* list of tables used by profiles */
TWOmaterial *matlInfo = model->NUMOSmatlInfo; /* list of material info structures */
{
MESHcard *next = NULL, *this = NULL;
next = xmesh;
while (next) {
this = next;
next = next->MESHnextCard;
FREE(this);
}
}
{
MESHcard *next = NULL, *this = NULL;
next = ymesh;
while (next) {
this = next;
next = next->MESHnextCard;
FREE(this);
}
}
{
DOMNcard *next = NULL, *this = NULL;
next = domains;
while (next) {
this = next;
next = next->DOMNnextCard;
FREE(this);
}
}
{
BDRYcard *next = NULL, *this = NULL;
next = boundaries;
while (next) {
this = next;
next = next->BDRYnextCard;
FREE(this);
}
}
{
DOPcard *next = NULL, *this = NULL;
next = dopings;
while (next) {
this = next;
next = next->DOPnextCard;
if (this->DOPdomains) {
FREE(this->DOPdomains);
}
if (this->DOPinFile) {
FREE(this->DOPinFile);
}
FREE(this);
}
}
{
ELCTcard *next = NULL, *this = NULL;
next = electrodes;
while (next) {
this = next;
next = next->ELCTnextCard;
FREE(this);
}
}
{
CONTcard *next = NULL, *this = NULL;
next = contacts;
while (next) {
this = next;
next = next->CONTnextCard;
FREE(this);
}
}
{
MODLcard *next = NULL, *this = NULL;
next = models;
while (next) {
this = next;
next = next->MODLnextCard;
FREE(this);
}
}
{
MATLcard *next = NULL, *this = NULL;
next = materials;
while (next) {
this = next;
next = next->MATLnextCard;
FREE(this);
}
}
{
MOBcard *next = NULL, *this = NULL;
next = mobility;
while (next) {
this = next;
next = next->MOBnextCard;
FREE(this);
}
}
{
METHcard *next = NULL, *this = NULL;
next = methods;
while (next) {
this = next;
next = next->METHnextCard;
FREE(this);
}
}
{
OPTNcard *next = NULL, *this = NULL;
next = options;
while (next) {
this = next;
next = next->OPTNnextCard;
FREE(this);
}
}
{
OUTPcard *next = NULL, *this = NULL;
next = outputs;
while (next) {
this = next;
next = next->OUTPnextCard;
if (this->OUTProotFile) {
FREE(this->OUTProotFile);
}
FREE(this);
}
}
{
if (pInfo) {
FREE(pInfo);
}
}
{
DOPprofile *next = NULL, *this = NULL;
next = profiles;
while (next) {
this = next;
next = next->next;
FREE(this);
}
}
(void)dopTables;
{
TWOmaterial *next = NULL, *this = NULL;
next = matlInfo;
while (next) {
this = next;
next = next->next;
FREE(this);
}
}
return OK;
}

1
src/spicelib/devices/numos/numosext.h

@ -10,6 +10,7 @@ Author: 1987 Karti Mayaram
extern int NUMOSacLoad(GENmodel *, CKTcircuit *); extern int NUMOSacLoad(GENmodel *, CKTcircuit *);
extern int NUMOSask(CKTcircuit *, GENinstance *, int, IFvalue *, IFvalue *); extern int NUMOSask(CKTcircuit *, GENinstance *, int, IFvalue *, IFvalue *);
extern int NUMOSdelete(GENinstance *); extern int NUMOSdelete(GENinstance *);
extern int NUMOSmodDelete(GENmodel *);
extern int NUMOSgetic(GENmodel *, CKTcircuit *); extern int NUMOSgetic(GENmodel *, CKTcircuit *);
extern int NUMOSload(GENmodel *, CKTcircuit *); extern int NUMOSload(GENmodel *, CKTcircuit *);
extern int NUMOSmParam(int, IFvalue *, GENmodel *); extern int NUMOSmParam(int, IFvalue *, GENmodel *);

2
src/spicelib/devices/numos/numosinit.c

@ -43,7 +43,7 @@ SPICEdev NUMOSinfo = {
.DEVacLoad = NUMOSacLoad, .DEVacLoad = NUMOSacLoad,
.DEVaccept = NULL, .DEVaccept = NULL,
.DEVdestroy = NULL, .DEVdestroy = NULL,
.DEVmodDelete = NULL,
.DEVmodDelete = NUMOSmodDelete,
.DEVdelete = NUMOSdelete, .DEVdelete = NUMOSdelete,
.DEVsetic = NULL, .DEVsetic = NULL,
.DEVask = NUMOSask, .DEVask = NUMOSask,

Loading…
Cancel
Save