ngspice/src/spicelib/devices/bsim4/b4mdel.c

99 lines
5.5 KiB
C

/* ******************************************************************************
* BSIM4 4.8.1 released by Chetan Kumar Dabhi 2/15/2017 *
* BSIM4 Model Equations *
******************************************************************************
******************************************************************************
* Copyright 2017 Regents of the University of California. *
* All rights reserved. *
* *
* Project Director: Prof. Chenming Hu. *
* Authors: Gary W. Ng, Weidong Liu, Xuemei Xi, Mohan Dunga, Wenwei Yang *
* Ali Niknejad, Shivendra Singh Parihar, Chetan Kumar Dabhi *
* Yogesh Singh Chauhan, Sayeef Salahuddin, Chenming Hu *
******************************************************************************
******************************************************************************
* CMC In-Code Statement *
* *
* The Developer agrees that the following statement will appear in the *
* model code that has been adopted as a CMC Standard. *
* *
* Software is distributed as is, completely without warranty or service *
* support. The University of California and its employees are not liable *
* for the condition or performance of the software. *
* *
* The University of California owns the copyright and grants users a *
* perpetual, irrevocable, worldwide, non-exclusive, royalty-free license *
* with respect to the software as set forth below. *
* *
* The University of California hereby disclaims all implied warranties. *
* *
* The University of California grants the users the right to modify, *
* copy, and redistribute the software and documentation, both within *
* the user's organization and externally, subject to the following *
* restrictions: *
* *
* 1. The users agree not to charge for the University of California code *
* itself but may charge for additions, extensions, or support. *
* *
* 2. In any product based on the software, the users agree to *
* acknowledge the University of California that developed the *
* software. This acknowledgment shall appear in the product *
* documentation. *
* *
* 3. Redistributions to others of source code and documentation must *
* retain the copyright notice, disclaimer, and list of conditions. *
* *
* 4. Redistributions to others in binary form must reproduce the *
* copyright notice, disclaimer, and list of conditions in the *
* documentation and/or other materials provided with the *
* distribution. *
* *
* Agreed to on ______Feb. 15, 2017______________ *
* *
* By: ____University of California, Berkeley___ *
* ____Chenming Hu__________________________ *
* ____Professor in Graduate School ________ *
* *
****************************************************************************** */
#include "ngspice/ngspice.h"
#include "bsim4def.h"
#include "ngspice/sperror.h"
#include "ngspice/suffix.h"
int
BSIM4mDelete(
GENmodel **inModel,
IFuid modname,
GENmodel *kill)
{
BSIM4model **model = (BSIM4model **) inModel;
BSIM4model *modfast = (BSIM4model *) kill;
BSIM4instance *here;
BSIM4instance *prev = NULL;
BSIM4model **oldmod;
oldmod = model;
for (; *model; model = &((*model)->BSIM4nextModel)) {
if ((*model)->BSIM4modName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
}
return E_NOMOD;
delgot:
*oldmod = (*model)->BSIM4nextModel; /* cut deleted device out of list */
for (here = (*model)->BSIM4instances; here; here = here->BSIM4nextInstance) {
if (prev) FREE(prev);
prev = here;
}
if (prev) FREE(prev);
FREE(*model);
return OK;
}