bsim2 update: added "m" parameter and noise analysis.
This commit is contained in:
parent
263c0ad377
commit
030f5c9f1b
|
|
@ -16,6 +16,7 @@ libbsim2_a_SOURCES = \
|
|||
b2mdel.c \
|
||||
b2moscap.c \
|
||||
b2mpar.c \
|
||||
b2noi.c \
|
||||
b2par.c \
|
||||
b2pzld.c \
|
||||
b2set.c \
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ Author: 1988 Min-Chie Jeng, Hong J. Park, Thomas L. Quarles
|
|||
**********/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "devdefs.h"
|
||||
#include "bsim2def.h"
|
||||
#include "suffix.h"
|
||||
|
|
@ -12,6 +11,7 @@ Author: 1988 Min-Chie Jeng, Hong J. Park, Thomas L. Quarles
|
|||
IFparm B2pTable[] = { /* parameters */
|
||||
IOP( "l", BSIM2_L, IF_REAL , "Length"),
|
||||
IOP( "w", BSIM2_W, IF_REAL , "Width"),
|
||||
IOP( "m", BSIM2_M, IF_REAL , "Parallel Multiplier"),
|
||||
IOP( "ad", BSIM2_AD, IF_REAL , "Drain area"),
|
||||
IOP( "as", BSIM2_AS, IF_REAL , "Source area"),
|
||||
IOP( "pd", BSIM2_PD, IF_REAL , "Drain perimeter"),
|
||||
|
|
@ -192,6 +192,8 @@ IFparm B2mPTable[] = { /* model parameters */
|
|||
"Default width of source drain diffusion in um"),
|
||||
IOP( "dell", BSIM2_MOD_DELLENGTH, IF_REAL,
|
||||
"Length reduction of source drain diffusion"),
|
||||
IOP("kf", BSIM2_MOD_KF, IF_REAL ,"Flicker noise coefficient"),
|
||||
IOP("af", BSIM2_MOD_AF, IF_REAL ,"Flicker noise exponent"),
|
||||
IP( "nmos", BSIM2_MOD_NMOS, IF_FLAG,
|
||||
"Flag to indicate NMOS"),
|
||||
IP( "pmos", BSIM2_MOD_PMOS, IF_FLAG,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ Author: 1985 Hong J. Park, Thomas L. Quarles
|
|||
*/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "cktdefs.h"
|
||||
#include "bsim2def.h"
|
||||
#include "sperror.h"
|
||||
|
|
@ -14,9 +13,7 @@ Author: 1985 Hong J. Park, Thomas L. Quarles
|
|||
|
||||
|
||||
int
|
||||
B2acLoad(inModel,ckt)
|
||||
GENmodel *inModel;
|
||||
CKTcircuit *ckt;
|
||||
B2acLoad(GENmodel *inModel, CKTcircuit *ckt)
|
||||
{
|
||||
B2model *model = (B2model*)inModel;
|
||||
B2instance *here;
|
||||
|
|
@ -54,6 +51,8 @@ B2acLoad(inModel,ckt)
|
|||
double cdsb;
|
||||
double omega; /* angular fequency of the signal */
|
||||
|
||||
double m; /* parallel multiplier */
|
||||
|
||||
omega = ckt->CKTomega;
|
||||
for( ; model != NULL; model = model->B2nextModel) {
|
||||
for(here = model->B2instances; here!= NULL;
|
||||
|
|
@ -109,40 +108,41 @@ B2acLoad(inModel,ckt)
|
|||
xcbdb = (cbdb - capbd ) * omega;
|
||||
xcbsb = (cbsb - capbs ) * omega;
|
||||
|
||||
m = here->B2m;
|
||||
|
||||
*(here->B2GgPtr +1) += xcggb;
|
||||
*(here->B2BbPtr +1) += -xcbgb-xcbdb-xcbsb;
|
||||
*(here->B2DPdpPtr +1) += xcddb;
|
||||
*(here->B2SPspPtr +1) += xcssb;
|
||||
*(here->B2GbPtr +1) += -xcggb-xcgdb-xcgsb;
|
||||
*(here->B2GdpPtr +1) += xcgdb;
|
||||
*(here->B2GspPtr +1) += xcgsb;
|
||||
*(here->B2BgPtr +1) += xcbgb;
|
||||
*(here->B2BdpPtr +1) += xcbdb;
|
||||
*(here->B2BspPtr +1) += xcbsb;
|
||||
*(here->B2DPgPtr +1) += xcdgb;
|
||||
*(here->B2DPbPtr +1) += -xcdgb-xcddb-xcdsb;
|
||||
*(here->B2DPspPtr +1) += xcdsb;
|
||||
*(here->B2SPgPtr +1) += xcsgb;
|
||||
*(here->B2SPbPtr +1) += -xcsgb-xcsdb-xcssb;
|
||||
*(here->B2SPdpPtr +1) += xcsdb;
|
||||
*(here->B2DdPtr) += gdpr;
|
||||
*(here->B2SsPtr) += gspr;
|
||||
*(here->B2BbPtr) += gbd+gbs;
|
||||
*(here->B2DPdpPtr) += gdpr+gds+gbd+xrev*(gm+gmbs);
|
||||
*(here->B2SPspPtr) += gspr+gds+gbs+xnrm*(gm+gmbs);
|
||||
*(here->B2DdpPtr) -= gdpr;
|
||||
*(here->B2SspPtr) -= gspr;
|
||||
*(here->B2BdpPtr) -= gbd;
|
||||
*(here->B2BspPtr) -= gbs;
|
||||
*(here->B2DPdPtr) -= gdpr;
|
||||
*(here->B2DPgPtr) += (xnrm-xrev)*gm;
|
||||
*(here->B2DPbPtr) += -gbd+(xnrm-xrev)*gmbs;
|
||||
*(here->B2DPspPtr) += -gds-xnrm*(gm+gmbs);
|
||||
*(here->B2SPgPtr) += -(xnrm-xrev)*gm;
|
||||
*(here->B2SPsPtr) -= gspr;
|
||||
*(here->B2SPbPtr) += -gbs-(xnrm-xrev)*gmbs;
|
||||
*(here->B2SPdpPtr) += -gds-xrev*(gm+gmbs);
|
||||
*(here->B2GgPtr +1) += m * (xcggb);
|
||||
*(here->B2BbPtr +1) += m * (-xcbgb-xcbdb-xcbsb);
|
||||
*(here->B2DPdpPtr +1) += m * (xcddb);
|
||||
*(here->B2SPspPtr +1) += m * (xcssb);
|
||||
*(here->B2GbPtr +1) += m * (-xcggb-xcgdb-xcgsb);
|
||||
*(here->B2GdpPtr +1) += m * (xcgdb);
|
||||
*(here->B2GspPtr +1) += m * (xcgsb);
|
||||
*(here->B2BgPtr +1) += m * (xcbgb);
|
||||
*(here->B2BdpPtr +1) += m * (xcbdb);
|
||||
*(here->B2BspPtr +1) += m * (xcbsb);
|
||||
*(here->B2DPgPtr +1) += m * (xcdgb);
|
||||
*(here->B2DPbPtr +1) += m * (-xcdgb-xcddb-xcdsb);
|
||||
*(here->B2DPspPtr +1) += m * (xcdsb);
|
||||
*(here->B2SPgPtr +1) += m * (xcsgb);
|
||||
*(here->B2SPbPtr +1) += m * (-xcsgb-xcsdb-xcssb);
|
||||
*(here->B2SPdpPtr +1) += m * (xcsdb);
|
||||
*(here->B2DdPtr) += m * (gdpr);
|
||||
*(here->B2SsPtr) += m * (gspr);
|
||||
*(here->B2BbPtr) += m * (gbd+gbs);
|
||||
*(here->B2DPdpPtr) += m * (gdpr+gds+gbd+xrev*(gm+gmbs));
|
||||
*(here->B2SPspPtr) += m * (gspr+gds+gbs+xnrm*(gm+gmbs));
|
||||
*(here->B2DdpPtr) -= m * (gdpr);
|
||||
*(here->B2SspPtr) -= m * (gspr);
|
||||
*(here->B2BdpPtr) -= m * (gbd);
|
||||
*(here->B2BspPtr) -= m * (gbs);
|
||||
*(here->B2DPdPtr) -= m * (gdpr);
|
||||
*(here->B2DPgPtr) += m * ((xnrm-xrev)*gm);
|
||||
*(here->B2DPbPtr) += m * (-gbd+(xnrm-xrev)*gmbs);
|
||||
*(here->B2DPspPtr) += m * (-gds-xnrm*(gm+gmbs));
|
||||
*(here->B2SPgPtr) += m * (-(xnrm-xrev)*gm);
|
||||
*(here->B2SPsPtr) -= m * (gspr);
|
||||
*(here->B2SPbPtr) += m * (-gbs-(xnrm-xrev)*gmbs);
|
||||
*(here->B2SPdpPtr) += m * (-gds-xrev*(gm+gmbs));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ Author: 1988 Hong J. Park
|
|||
**********/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "ifsim.h"
|
||||
#include "cktdefs.h"
|
||||
#include "devdefs.h"
|
||||
|
|
@ -14,12 +13,8 @@ Author: 1988 Hong J. Park
|
|||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
B2ask(ckt,inst,which,value,select)
|
||||
CKTcircuit *ckt;
|
||||
GENinstance *inst;
|
||||
int which;
|
||||
IFvalue *value;
|
||||
IFvalue *select;
|
||||
B2ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value,
|
||||
IFvalue *select)
|
||||
{
|
||||
B2instance *here = (B2instance*)inst;
|
||||
|
||||
|
|
@ -29,24 +24,34 @@ B2ask(ckt,inst,which,value,select)
|
|||
return(OK);
|
||||
case BSIM2_W:
|
||||
value->rValue = here->B2w;
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_M:
|
||||
value->rValue = here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_AS:
|
||||
value->rValue = here->B2sourceArea;
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_AD:
|
||||
value->rValue = here->B2drainArea;
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_PS:
|
||||
value->rValue = here->B2sourcePerimeter;
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_PD:
|
||||
value->rValue = here->B2drainPerimeter;
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_NRS:
|
||||
value->rValue = here->B2sourceSquares;
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_NRD:
|
||||
value->rValue = here->B2drainSquares;
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_OFF:
|
||||
value->rValue = here->B2off;
|
||||
|
|
@ -80,9 +85,11 @@ B2ask(ckt,inst,which,value,select)
|
|||
return(OK);
|
||||
case BSIM2_SOURCECONDUCT:
|
||||
value->rValue = here->B2sourceConductance;
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_DRAINCONDUCT:
|
||||
value->rValue = here->B2drainConductance;
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_VBD:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2vbd);
|
||||
|
|
@ -98,87 +105,114 @@ B2ask(ckt,inst,which,value,select)
|
|||
return(OK);
|
||||
case BSIM2_CD:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2cd);
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_CBS:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2cbs);
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2cbs);
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_CBD:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2cbd);
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2cbd);
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_GM:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2gm);
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_GDS:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2gds);
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2gds);
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_GMBS:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2gmbs);
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_GBD:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2gbd);
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_GBS:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2gbs);
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_QB:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2qb);
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_CQB:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2cqb);
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_QG:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2qg);
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_CQG:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2cqg);
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_QD:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2qd);
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_CQD:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2cqd);
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_CGG:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2cggb);
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_CGD:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2cgdb);
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_CGS:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2cgsb);
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_CBG:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2cbgb);
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_CAPBD:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2capbd);
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2capbd);
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_CQBD:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2cqbd);
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_CAPBS:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2capbs);
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_CQBS:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2cqbs);
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_CDG:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2cdgb);
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2cdgb);
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_CDD:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2cddb);
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2cddb);
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_CDS:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2cdsb);
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_VON:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2vono);
|
||||
return(OK);
|
||||
case BSIM2_QBS:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2qbs);
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2qbs);
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
case BSIM2_QBD:
|
||||
value->rValue = *(ckt->CKTstate0 + here->B2qbd);
|
||||
value->rValue *= here->B2m;
|
||||
return(OK);
|
||||
default:
|
||||
return(E_BADPARM);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ Author: 1985 Hong J. Park, Thomas L. Quarles
|
|||
**********/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "cktdefs.h"
|
||||
#include "bsim2def.h"
|
||||
#include "trandefs.h"
|
||||
|
|
@ -14,10 +13,7 @@ Author: 1985 Hong J. Park, Thomas L. Quarles
|
|||
#include "suffix.h"
|
||||
|
||||
int
|
||||
B2convTest(inModel,ckt)
|
||||
|
||||
GENmodel *inModel;
|
||||
CKTcircuit *ckt;
|
||||
B2convTest(GENmodel *inModel, CKTcircuit *ckt)
|
||||
|
||||
/* actually load the current value into the
|
||||
* sparse matrix previously provided
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ Author: 1985 Hong J. Park, Thomas L. Quarles
|
|||
*/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "bsim2def.h"
|
||||
#include "sperror.h"
|
||||
#include "gendefs.h"
|
||||
|
|
@ -14,11 +13,7 @@ Author: 1985 Hong J. Park, Thomas L. Quarles
|
|||
|
||||
|
||||
int
|
||||
B2delete(inModel,name,inInst)
|
||||
GENmodel *inModel;
|
||||
IFuid name;
|
||||
GENinstance **inInst;
|
||||
|
||||
B2delete(GENmodel *inModel, IFuid name, GENinstance **inInst)
|
||||
{
|
||||
|
||||
B2instance **fast = (B2instance**)inInst;
|
||||
|
|
|
|||
|
|
@ -6,15 +6,12 @@ Author: 1985 Hong J. Park, Thomas L. Quarles
|
|||
*/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "bsim2def.h"
|
||||
#include "suffix.h"
|
||||
|
||||
|
||||
void
|
||||
B2destroy(inModel)
|
||||
GENmodel **inModel;
|
||||
|
||||
B2destroy(GENmodel **inModel)
|
||||
{
|
||||
|
||||
B2model **model = (B2model**)inModel;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ Author: 1988 Min-Chie Jeng, Hong J. Park, Thomas L. Quarles
|
|||
**********/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "cktdefs.h"
|
||||
#include "bsim2def.h"
|
||||
#include "trandefs.h"
|
||||
|
|
@ -16,15 +15,11 @@ Author: 1988 Min-Chie Jeng, Hong J. Park, Thomas L. Quarles
|
|||
* using the B2 (Berkeley Short-Channel IGFET Model) Equations.
|
||||
*/
|
||||
void
|
||||
B2evaluate(Vds,Vbs,Vgs,here,model,gm,gds,gmb,qg,qb,qd,cgg,cgd,cgs,
|
||||
cbg,cbd,cbs,cdg,cdd,cds,Ids,von,vdsat,ckt)
|
||||
|
||||
CKTcircuit *ckt;
|
||||
B2model *model;
|
||||
B2instance *here;
|
||||
double Vds,Vbs,Vgs;
|
||||
double *gm,*gds,*gmb,*qg,*qb,*qd,*cgg,*cgd,*cgs,*cbg;
|
||||
double *cbd,*cbs,*cdg,*cdd,*cds,*Ids,*von,*vdsat;
|
||||
B2evaluate(double Vds, double Vbs, double Vgs, B2instance *here, B2model *model,
|
||||
double *gm, double *gds, double *gmb, double *qg, double *qb, double *qd,
|
||||
double *cgg,double *cgd,double *cgs, double *cbg, double *cbd, double *cbs,
|
||||
double *cdg, double *cdd, double *cds, double *Ids, double *von,
|
||||
double *vdsat, CKTcircuit *ckt)
|
||||
{
|
||||
double Vth, Vdsat;
|
||||
double Phisb, T1s, Eta, Gg, Aa, Inv_Aa, U1, U1s, Vc, Kk, SqrtKk;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ Author: 1985 Hong J. Park, Thomas L. Quarles
|
|||
*/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "cktdefs.h"
|
||||
#include "bsim2def.h"
|
||||
#include "sperror.h"
|
||||
|
|
@ -14,10 +13,7 @@ Author: 1985 Hong J. Park, Thomas L. Quarles
|
|||
|
||||
|
||||
int
|
||||
B2getic(inModel,ckt)
|
||||
GENmodel *inModel;
|
||||
CKTcircuit *ckt;
|
||||
|
||||
B2getic(GENmodel *inModel, CKTcircuit *ckt)
|
||||
{
|
||||
|
||||
B2model *model = (B2model*)inModel;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ Author: 1985 Hong J. Park, Thomas L. Quarles
|
|||
**********/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "cktdefs.h"
|
||||
#include "bsim2def.h"
|
||||
#include "trandefs.h"
|
||||
|
|
@ -14,10 +13,7 @@ Author: 1985 Hong J. Park, Thomas L. Quarles
|
|||
#include "suffix.h"
|
||||
|
||||
int
|
||||
B2load(inModel,ckt)
|
||||
|
||||
GENmodel *inModel;
|
||||
CKTcircuit *ckt;
|
||||
B2load(GENmodel *inModel, CKTcircuit *ckt)
|
||||
|
||||
/* actually load the current value into the
|
||||
* sparse matrix previously provided
|
||||
|
|
@ -123,9 +119,13 @@ B2load(inModel,ckt)
|
|||
double vt0;
|
||||
double args[7];
|
||||
int ByPass;
|
||||
#ifndef NOBYPASS
|
||||
double tempv;
|
||||
#endif /*NOBYPASS*/
|
||||
int error;
|
||||
|
||||
double m;
|
||||
|
||||
|
||||
/* loop through all the B2 device models */
|
||||
for( ; model != NULL; model = model->B2nextModel ) {
|
||||
|
|
@ -278,6 +278,7 @@ B2load(inModel,ckt)
|
|||
*(ckt->CKTstate0 + here->B2gbd) * delvbd +
|
||||
*(ckt->CKTstate0 + here->B2gbs) * delvbs ;
|
||||
|
||||
#ifndef NOBYPASS
|
||||
/* now lets see if we can bypass (ugh) */
|
||||
|
||||
/* following should be one big if connected by && all over
|
||||
|
|
@ -341,6 +342,7 @@ B2load(inModel,ckt)
|
|||
goto line850;
|
||||
}
|
||||
}
|
||||
#endif /*NOBYPASS*/
|
||||
|
||||
von = model->B2type * here->B2von;
|
||||
if(*(ckt->CKTstate0 + here->B2vds) >=0) {
|
||||
|
|
@ -653,6 +655,8 @@ line860:
|
|||
* load current vector
|
||||
*/
|
||||
line900:
|
||||
|
||||
m = here->B2m;
|
||||
|
||||
ceqbs = model->B2type * (cbs-(gbs-ckt->CKTgmin)*vbs);
|
||||
ceqbd = model->B2type * (cbd-(gbd-ckt->CKTgmin)*vbd);
|
||||
|
|
@ -670,41 +674,41 @@ line900:
|
|||
cdreq = -(model->B2type)*(cdrain+gds*vds-gm*vgd-gmbs*vbd);
|
||||
}
|
||||
|
||||
*(ckt->CKTrhs + here->B2gNode) -= ceqqg;
|
||||
*(ckt->CKTrhs + here->B2bNode) -=(ceqbs+ceqbd+ceqqb);
|
||||
*(ckt->CKTrhs + here->B2gNode) -= m * (ceqqg);
|
||||
*(ckt->CKTrhs + here->B2bNode) -= m * (ceqbs+ceqbd+ceqqb);
|
||||
*(ckt->CKTrhs + here->B2dNodePrime) +=
|
||||
(ceqbd-cdreq-ceqqd);
|
||||
m * (ceqbd-cdreq-ceqqd);
|
||||
*(ckt->CKTrhs + here->B2sNodePrime) +=
|
||||
(cdreq+ceqbs+ceqqg+ceqqb+ceqqd);
|
||||
m * (cdreq+ceqbs+ceqqg+ceqqb+ceqqd);
|
||||
|
||||
/*
|
||||
* load y matrix
|
||||
*/
|
||||
|
||||
*(here->B2DdPtr) += (here->B2drainConductance);
|
||||
*(here->B2GgPtr) += (gcggb);
|
||||
*(here->B2SsPtr) += (here->B2sourceConductance);
|
||||
*(here->B2BbPtr) += (gbd+gbs-gcbgb-gcbdb-gcbsb);
|
||||
*(here->B2DdPtr) += m * (here->B2drainConductance);
|
||||
*(here->B2GgPtr) += m * (gcggb);
|
||||
*(here->B2SsPtr) += m * (here->B2sourceConductance);
|
||||
*(here->B2BbPtr) += m * (gbd+gbs-gcbgb-gcbdb-gcbsb);
|
||||
*(here->B2DPdpPtr) +=
|
||||
(here->B2drainConductance+gds+gbd+xrev*(gm+gmbs)+gcddb);
|
||||
m * (here->B2drainConductance+gds+gbd+xrev*(gm+gmbs)+gcddb);
|
||||
*(here->B2SPspPtr) +=
|
||||
(here->B2sourceConductance+gds+gbs+xnrm*(gm+gmbs)+gcssb);
|
||||
*(here->B2DdpPtr) += (-here->B2drainConductance);
|
||||
*(here->B2GbPtr) += (-gcggb-gcgdb-gcgsb);
|
||||
*(here->B2GdpPtr) += (gcgdb);
|
||||
*(here->B2GspPtr) += (gcgsb);
|
||||
*(here->B2SspPtr) += (-here->B2sourceConductance);
|
||||
*(here->B2BgPtr) += (gcbgb);
|
||||
*(here->B2BdpPtr) += (-gbd+gcbdb);
|
||||
*(here->B2BspPtr) += (-gbs+gcbsb);
|
||||
*(here->B2DPdPtr) += (-here->B2drainConductance);
|
||||
*(here->B2DPgPtr) += ((xnrm-xrev)*gm+gcdgb);
|
||||
*(here->B2DPbPtr) += (-gbd+(xnrm-xrev)*gmbs-gcdgb-gcddb-gcdsb);
|
||||
*(here->B2DPspPtr) += (-gds-xnrm*(gm+gmbs)+gcdsb);
|
||||
*(here->B2SPgPtr) += (-(xnrm-xrev)*gm+gcsgb);
|
||||
*(here->B2SPsPtr) += (-here->B2sourceConductance);
|
||||
*(here->B2SPbPtr) += (-gbs-(xnrm-xrev)*gmbs-gcsgb-gcsdb-gcssb);
|
||||
*(here->B2SPdpPtr) += (-gds-xrev*(gm+gmbs)+gcsdb);
|
||||
m * (here->B2sourceConductance+gds+gbs+xnrm*(gm+gmbs)+gcssb);
|
||||
*(here->B2DdpPtr) += m * (-here->B2drainConductance);
|
||||
*(here->B2GbPtr) += m * (-gcggb-gcgdb-gcgsb);
|
||||
*(here->B2GdpPtr) += m * (gcgdb);
|
||||
*(here->B2GspPtr) += m * (gcgsb);
|
||||
*(here->B2SspPtr) += m * (-here->B2sourceConductance);
|
||||
*(here->B2BgPtr) += m * (gcbgb);
|
||||
*(here->B2BdpPtr) += m * (-gbd+gcbdb);
|
||||
*(here->B2BspPtr) += m * (-gbs+gcbsb);
|
||||
*(here->B2DPdPtr) += m * (-here->B2drainConductance);
|
||||
*(here->B2DPgPtr) += m * ((xnrm-xrev)*gm+gcdgb);
|
||||
*(here->B2DPbPtr) += m * (-gbd+(xnrm-xrev)*gmbs-gcdgb-gcddb-gcdsb);
|
||||
*(here->B2DPspPtr) += m * (-gds-xnrm*(gm+gmbs)+gcdsb);
|
||||
*(here->B2SPgPtr) += m * (-(xnrm-xrev)*gm+gcsgb);
|
||||
*(here->B2SPsPtr) += m * (-here->B2sourceConductance);
|
||||
*(here->B2SPbPtr) += m * (-gbs-(xnrm-xrev)*gmbs-gcsgb-gcsdb-gcssb);
|
||||
*(here->B2SPdpPtr) += m * (-gds-xrev*(gm+gmbs)+gcsdb);
|
||||
|
||||
|
||||
line1000: ;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ Author: 1988 Hong J. Park
|
|||
*/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "ifsim.h"
|
||||
#include "cktdefs.h"
|
||||
#include "devdefs.h"
|
||||
|
|
@ -17,11 +16,7 @@ Author: 1988 Hong J. Park
|
|||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
B2mAsk(ckt,inst,which,value)
|
||||
CKTcircuit *ckt;
|
||||
GENmodel *inst;
|
||||
int which;
|
||||
IFvalue *value;
|
||||
B2mAsk(CKTcircuit *ckt, GENmodel *inst, int which, IFvalue *value)
|
||||
{
|
||||
B2model *model = (B2model *)inst;
|
||||
switch(which) {
|
||||
|
|
@ -424,6 +419,12 @@ B2mAsk(ckt,inst,which,value)
|
|||
case BSIM2_MOD_DELLENGTH:
|
||||
value->rValue = model->B2deltaLength;
|
||||
return(OK);
|
||||
case BSIM2_MOD_AF:
|
||||
value->rValue = model->B2fNexp;
|
||||
return(OK);
|
||||
case BSIM2_MOD_KF:
|
||||
value->rValue = model->B2fNcoef;
|
||||
return(OK);
|
||||
default:
|
||||
return(E_BADPARM);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,18 +6,13 @@ Author: 1985 Hong J. Park, Thomas L. Quarles
|
|||
*/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "bsim2def.h"
|
||||
#include "sperror.h"
|
||||
#include "suffix.h"
|
||||
|
||||
|
||||
int
|
||||
B2mDelete(inModel,modname,kill)
|
||||
GENmodel **inModel;
|
||||
IFuid modname;
|
||||
GENmodel *kill;
|
||||
|
||||
B2mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
|
||||
{
|
||||
B2model **model = (B2model**)inModel;
|
||||
B2model *modfast = (B2model*)kill;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ Author: 1985 Hong J. Park, Thomas L. Quarles
|
|||
**********/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "cktdefs.h"
|
||||
#include "bsim2def.h"
|
||||
#include "suffix.h"
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ Author: 1988 Min-Chie Jeng, Hong J. Park, Thomas L. Quarles
|
|||
*/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "bsim2def.h"
|
||||
#include "ifsim.h"
|
||||
#include "sperror.h"
|
||||
|
|
@ -14,10 +13,7 @@ Author: 1988 Min-Chie Jeng, Hong J. Park, Thomas L. Quarles
|
|||
|
||||
|
||||
int
|
||||
B2mParam(param,value,inMod)
|
||||
int param;
|
||||
IFvalue *value;
|
||||
GENmodel *inMod;
|
||||
B2mParam(int param, IFvalue *value, GENmodel *inMod)
|
||||
{
|
||||
B2model *mod = (B2model*)inMod;
|
||||
switch(param) {
|
||||
|
|
@ -553,6 +549,14 @@ B2mParam(param,value,inMod)
|
|||
mod->B2deltaLength = value->rValue;
|
||||
mod->B2deltaLengthGiven = TRUE;
|
||||
break;
|
||||
case BSIM2_MOD_AF :
|
||||
mod->B2fNexp = value->rValue;
|
||||
mod->B2fNexpGiven = TRUE;
|
||||
break;
|
||||
case BSIM2_MOD_KF :
|
||||
mod->B2fNcoef = value->rValue;
|
||||
mod->B2fNcoefGiven = TRUE;
|
||||
break;
|
||||
case BSIM2_MOD_NMOS :
|
||||
if(value->iValue) {
|
||||
mod->B2type = 1;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,212 @@
|
|||
/**********
|
||||
Copyright 2003 ??. All rights reserved.
|
||||
Author: 2003 Paolo Nenzi
|
||||
**********/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include "bsim2def.h"
|
||||
#include "cktdefs.h"
|
||||
#include "iferrmsg.h"
|
||||
#include "noisedef.h"
|
||||
#include "suffix.h"
|
||||
|
||||
/*
|
||||
* B2noise (mode, operation, firstModel, ckt, data, OnDens)
|
||||
* This routine names and evaluates all of the noise sources
|
||||
* associated with MOSFET's. It starts with the model *firstModel and
|
||||
* traverses all of its insts. It then proceeds to any other models
|
||||
* on the linked list. The total output noise density generated by
|
||||
* all of the MOSFET's is summed with the variable "OnDens".
|
||||
*/
|
||||
|
||||
extern void NevalSrc();
|
||||
extern double Nintegrate();
|
||||
|
||||
int
|
||||
B2noise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt,
|
||||
Ndata *data, double *OnDens)
|
||||
{
|
||||
B2model *firstModel = (B2model *) genmodel;
|
||||
B2model *model;
|
||||
B2instance *inst;
|
||||
char name[N_MXVLNTH];
|
||||
double tempOnoise;
|
||||
double tempInoise;
|
||||
double noizDens[B2NSRCS];
|
||||
double lnNdens[B2NSRCS];
|
||||
int i;
|
||||
|
||||
/* define the names of the noise sources */
|
||||
|
||||
static char *B2nNames[B2NSRCS] = { /* Note that we have to keep the order */
|
||||
"_rd", /* noise due to rd */ /* consistent with thestrchr definitions */
|
||||
"_rs", /* noise due to rs */ /* in bsim1defs.h */
|
||||
"_id", /* noise due to id */
|
||||
"_1overf", /* flicker (1/f) noise */
|
||||
"" /* total transistor noise */
|
||||
};
|
||||
|
||||
for (model=firstModel; model != NULL; model=model->B2nextModel) {
|
||||
for (inst=model->B2instances; inst != NULL; inst=inst->B2nextInstance) {
|
||||
if (inst->B2owner != ARCHme) continue;
|
||||
|
||||
switch (operation) {
|
||||
|
||||
case N_OPEN:
|
||||
|
||||
/* see if we have to to produce a summary report */
|
||||
/* if so, name all the noise generators */
|
||||
|
||||
if (((NOISEAN*)ckt->CKTcurJob)->NStpsSm != 0) {
|
||||
switch (mode) {
|
||||
|
||||
case N_DENS:
|
||||
for (i=0; i < B2NSRCS; i++) {
|
||||
(void)sprintf(name,"onoise_%s%s",inst->B2name,B2nNames[i]);
|
||||
|
||||
|
||||
data->namelist = (IFuid *)trealloc((char *)data->namelist,(data->numPlots + 1)*sizeof(IFuid));
|
||||
if (!data->namelist) return(E_NOMEM);
|
||||
(*(SPfrontEnd->IFnewUid))(ckt,
|
||||
&(data->namelist[data->numPlots++]),
|
||||
(IFuid)NULL,name,UID_OTHER,(void **)NULL);
|
||||
/* we've added one more plot */
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case INT_NOIZ:
|
||||
for (i=0; i < B2NSRCS; i++) {
|
||||
(void)sprintf(name,"onoise_total_%s%s",inst->B2name,B2nNames[i]);
|
||||
|
||||
|
||||
data->namelist = (IFuid *)trealloc((char *)data->namelist,(data->numPlots + 1)*sizeof(IFuid));
|
||||
if (!data->namelist) return(E_NOMEM);
|
||||
(*(SPfrontEnd->IFnewUid))(ckt,
|
||||
&(data->namelist[data->numPlots++]),
|
||||
(IFuid)NULL,name,UID_OTHER,(void **)NULL);
|
||||
/* we've added one more plot */
|
||||
|
||||
|
||||
(void)sprintf(name,"inoise_total_%s%s",inst->B2name,B2nNames[i]);
|
||||
|
||||
|
||||
data->namelist = (IFuid *)trealloc((char *)data->namelist,(data->numPlots + 1)*sizeof(IFuid));
|
||||
if (!data->namelist) return(E_NOMEM);
|
||||
(*(SPfrontEnd->IFnewUid))(ckt,
|
||||
&(data->namelist[data->numPlots++]),
|
||||
(IFuid)NULL,name,UID_OTHER,(void **)NULL);
|
||||
/* we've added one more plot */
|
||||
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case N_CALC:
|
||||
switch (mode) {
|
||||
|
||||
case N_DENS:
|
||||
NevalSrc(&noizDens[B2RDNOIZ],&lnNdens[B2RDNOIZ],
|
||||
ckt,THERMNOISE,inst->B2dNodePrime,inst->B2dNode,
|
||||
inst->B2drainConductance * inst->B2m);
|
||||
|
||||
NevalSrc(&noizDens[B2RSNOIZ],&lnNdens[B2RSNOIZ],
|
||||
ckt,THERMNOISE,inst->B2sNodePrime,inst->B2sNode,
|
||||
inst->B2sourceConductance * inst->B2m);
|
||||
|
||||
NevalSrc(&noizDens[B2IDNOIZ],&lnNdens[B2IDNOIZ],
|
||||
ckt,THERMNOISE,inst->B2dNodePrime,inst->B2sNodePrime,
|
||||
(2.0/3.0 * fabs(inst->B2gm * inst->B2m)));
|
||||
|
||||
NevalSrc(&noizDens[B2FLNOIZ],(double*)NULL,ckt,
|
||||
N_GAIN,inst->B2dNodePrime, inst->B2sNodePrime,
|
||||
(double)0.0);
|
||||
noizDens[B2FLNOIZ] *= model->B2fNcoef * inst->B2m *
|
||||
exp(model->B2fNexp *
|
||||
log(MAX(fabs(inst->B2cd),N_MINLOG))) /
|
||||
(data->freq *
|
||||
(inst->B2w - model->B2deltaW * 1e-6) *
|
||||
(inst->B2l - model->B2deltaL * 1e-6) *
|
||||
model->B2Cox * model->B2Cox);
|
||||
lnNdens[B2FLNOIZ] =
|
||||
log(MAX(noizDens[B2FLNOIZ],N_MINLOG));
|
||||
|
||||
noizDens[B2TOTNOIZ] = noizDens[B2RDNOIZ] +
|
||||
noizDens[B2RSNOIZ] +
|
||||
noizDens[B2IDNOIZ] +
|
||||
noizDens[B2FLNOIZ];
|
||||
lnNdens[B2TOTNOIZ] =
|
||||
log(MAX(noizDens[B2TOTNOIZ], N_MINLOG));
|
||||
|
||||
*OnDens += noizDens[B2TOTNOIZ];
|
||||
|
||||
if (data->delFreq == 0.0) {
|
||||
|
||||
/* if we haven't done any previous integration, we need to */
|
||||
/* initialize our "history" variables */
|
||||
|
||||
for (i=0; i < B2NSRCS; i++) {
|
||||
inst->B2nVar[LNLSTDENS][i] = lnNdens[i];
|
||||
}
|
||||
|
||||
/* clear out our integration variables if it's the first pass */
|
||||
|
||||
if (data->freq == ((NOISEAN*)ckt->CKTcurJob)->NstartFreq) {
|
||||
for (i=0; i < B2NSRCS; i++) {
|
||||
inst->B2nVar[OUTNOIZ][i] = 0.0;
|
||||
inst->B2nVar[INNOIZ][i] = 0.0;
|
||||
}
|
||||
}
|
||||
} else { /* data->delFreq != 0.0 (we have to integrate) */
|
||||
for (i=0; i < B2NSRCS; i++) {
|
||||
if (i != B2TOTNOIZ) {
|
||||
tempOnoise = Nintegrate(noizDens[i], lnNdens[i],
|
||||
inst->B2nVar[LNLSTDENS][i], data);
|
||||
tempInoise = Nintegrate(noizDens[i] * data->GainSqInv ,
|
||||
lnNdens[i] + data->lnGainInv,
|
||||
inst->B2nVar[LNLSTDENS][i] + data->lnGainInv,
|
||||
data);
|
||||
inst->B2nVar[LNLSTDENS][i] = lnNdens[i];
|
||||
data->outNoiz += tempOnoise;
|
||||
data->inNoise += tempInoise;
|
||||
if (((NOISEAN*)ckt->CKTcurJob)->NStpsSm != 0) {
|
||||
inst->B2nVar[OUTNOIZ][i] += tempOnoise;
|
||||
inst->B2nVar[OUTNOIZ][B2TOTNOIZ] += tempOnoise;
|
||||
inst->B2nVar[INNOIZ][i] += tempInoise;
|
||||
inst->B2nVar[INNOIZ][B2TOTNOIZ] += tempInoise;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (data->prtSummary) {
|
||||
for (i=0; i < B2NSRCS; i++) { /* print a summary report */
|
||||
data->outpVector[data->outNumber++] = noizDens[i];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case INT_NOIZ: /* already calculated, just output */
|
||||
if (((NOISEAN*)ckt->CKTcurJob)->NStpsSm != 0) {
|
||||
for (i=0; i < B2NSRCS; i++) {
|
||||
data->outpVector[data->outNumber++] = inst->B2nVar[OUTNOIZ][i];
|
||||
data->outpVector[data->outNumber++] = inst->B2nVar[INNOIZ][i];
|
||||
}
|
||||
} /* if */
|
||||
break;
|
||||
} /* switch (mode) */
|
||||
break;
|
||||
|
||||
case N_CLOSE:
|
||||
return (OK); /* do nothing, the main calling routine will close */
|
||||
break; /* the plots */
|
||||
} /* switch (operation) */
|
||||
} /* for inst */
|
||||
} /* for model */
|
||||
|
||||
return(OK);
|
||||
}
|
||||
|
|
@ -6,7 +6,6 @@ Author: 1985 Hong J. Park, Thomas L. Quarles
|
|||
*/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "ifsim.h"
|
||||
#include "bsim2def.h"
|
||||
#include "sperror.h"
|
||||
|
|
@ -15,11 +14,7 @@ Author: 1985 Hong J. Park, Thomas L. Quarles
|
|||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
B2param(param,value,inst,select)
|
||||
int param;
|
||||
IFvalue *value;
|
||||
GENinstance *inst;
|
||||
IFvalue *select;
|
||||
B2param(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
|
||||
{
|
||||
B2instance *here = (B2instance*)inst;
|
||||
switch(param) {
|
||||
|
|
@ -31,6 +26,10 @@ B2param(param,value,inst,select)
|
|||
here->B2l = value->rValue;
|
||||
here->B2lGiven = TRUE;
|
||||
break;
|
||||
case BSIM2_M:
|
||||
here->B2m = value->rValue;
|
||||
here->B2mGiven = TRUE;
|
||||
break;
|
||||
case BSIM2_AS:
|
||||
here->B2sourceArea = value->rValue;
|
||||
here->B2sourceAreaGiven = TRUE;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ Author: 1985 Thomas L. Quarles
|
|||
*/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "cktdefs.h"
|
||||
#include "complex.h"
|
||||
#include "sperror.h"
|
||||
|
|
@ -15,10 +14,7 @@ Author: 1985 Thomas L. Quarles
|
|||
|
||||
|
||||
int
|
||||
B2pzLoad(inModel,ckt,s)
|
||||
GENmodel *inModel;
|
||||
CKTcircuit *ckt;
|
||||
SPcomplex *s;
|
||||
B2pzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s)
|
||||
{
|
||||
B2model *model = (B2model*)inModel;
|
||||
B2instance *here;
|
||||
|
|
@ -55,6 +51,8 @@ B2pzLoad(inModel,ckt,s)
|
|||
double cdgb;
|
||||
double cdsb;
|
||||
|
||||
double m;
|
||||
|
||||
for( ; model != NULL; model = model->B2nextModel) {
|
||||
for(here = model->B2instances; here!= NULL;
|
||||
here = here->B2nextInstance) {
|
||||
|
|
@ -108,55 +106,57 @@ B2pzLoad(inModel,ckt,s)
|
|||
xcbsb = (cbsb - capbs ) ;
|
||||
|
||||
|
||||
*(here->B2GgPtr ) += xcggb * s->real;
|
||||
*(here->B2GgPtr +1) += xcggb * s->imag;
|
||||
*(here->B2BbPtr ) += (-xcbgb-xcbdb-xcbsb) * s->real;
|
||||
*(here->B2BbPtr +1) += (-xcbgb-xcbdb-xcbsb) * s->imag;
|
||||
*(here->B2DPdpPtr ) += xcddb * s->real;
|
||||
*(here->B2DPdpPtr +1) += xcddb * s->imag;
|
||||
*(here->B2SPspPtr ) += xcssb * s->real;
|
||||
*(here->B2SPspPtr +1) += xcssb * s->imag;
|
||||
*(here->B2GbPtr ) += (-xcggb-xcgdb-xcgsb) * s->real;
|
||||
*(here->B2GbPtr +1) += (-xcggb-xcgdb-xcgsb) * s->imag;
|
||||
*(here->B2GdpPtr ) += xcgdb * s->real;
|
||||
*(here->B2GdpPtr +1) += xcgdb * s->imag;
|
||||
*(here->B2GspPtr ) += xcgsb * s->real;
|
||||
*(here->B2GspPtr +1) += xcgsb * s->imag;
|
||||
*(here->B2BgPtr ) += xcbgb * s->real;
|
||||
*(here->B2BgPtr +1) += xcbgb * s->imag;
|
||||
*(here->B2BdpPtr ) += xcbdb * s->real;
|
||||
*(here->B2BdpPtr +1) += xcbdb * s->imag;
|
||||
*(here->B2BspPtr ) += xcbsb * s->real;
|
||||
*(here->B2BspPtr +1) += xcbsb * s->imag;
|
||||
*(here->B2DPgPtr ) += xcdgb * s->real;
|
||||
*(here->B2DPgPtr +1) += xcdgb * s->imag;
|
||||
*(here->B2DPbPtr ) += (-xcdgb-xcddb-xcdsb) * s->real;
|
||||
*(here->B2DPbPtr +1) += (-xcdgb-xcddb-xcdsb) * s->imag;
|
||||
*(here->B2DPspPtr ) += xcdsb * s->real;
|
||||
*(here->B2DPspPtr +1) += xcdsb * s->imag;
|
||||
*(here->B2SPgPtr ) += xcsgb * s->real;
|
||||
*(here->B2SPgPtr +1) += xcsgb * s->imag;
|
||||
*(here->B2SPbPtr ) += (-xcsgb-xcsdb-xcssb) * s->real;
|
||||
*(here->B2SPbPtr +1) += (-xcsgb-xcsdb-xcssb) * s->imag;
|
||||
*(here->B2SPdpPtr ) += xcsdb * s->real;
|
||||
*(here->B2SPdpPtr +1) += xcsdb * s->imag;
|
||||
*(here->B2DdPtr) += gdpr;
|
||||
*(here->B2SsPtr) += gspr;
|
||||
*(here->B2BbPtr) += gbd+gbs;
|
||||
*(here->B2DPdpPtr) += gdpr+gds+gbd+xrev*(gm+gmbs);
|
||||
*(here->B2SPspPtr) += gspr+gds+gbs+xnrm*(gm+gmbs);
|
||||
*(here->B2DdpPtr) -= gdpr;
|
||||
*(here->B2SspPtr) -= gspr;
|
||||
*(here->B2BdpPtr) -= gbd;
|
||||
*(here->B2BspPtr) -= gbs;
|
||||
*(here->B2DPdPtr) -= gdpr;
|
||||
*(here->B2DPgPtr) += (xnrm-xrev)*gm;
|
||||
*(here->B2DPbPtr) += -gbd+(xnrm-xrev)*gmbs;
|
||||
*(here->B2DPspPtr) += -gds-xnrm*(gm+gmbs);
|
||||
*(here->B2SPgPtr) += -(xnrm-xrev)*gm;
|
||||
*(here->B2SPsPtr) -= gspr;
|
||||
*(here->B2SPbPtr) += -gbs-(xnrm-xrev)*gmbs;
|
||||
*(here->B2SPdpPtr) += -gds-xrev*(gm+gmbs);
|
||||
m = here->B2m;
|
||||
|
||||
*(here->B2GgPtr ) += m * (xcggb * s->real);
|
||||
*(here->B2GgPtr +1) += m * (xcggb * s->imag);
|
||||
*(here->B2BbPtr ) += m * ((-xcbgb-xcbdb-xcbsb) * s->real);
|
||||
*(here->B2BbPtr +1) += m * ((-xcbgb-xcbdb-xcbsb) * s->imag);
|
||||
*(here->B2DPdpPtr ) += m * (xcddb * s->real);
|
||||
*(here->B2DPdpPtr +1) += m * (xcddb * s->imag);
|
||||
*(here->B2SPspPtr ) += m * (xcssb * s->real);
|
||||
*(here->B2SPspPtr +1) += m * (xcssb * s->imag);
|
||||
*(here->B2GbPtr ) += m * ((-xcggb-xcgdb-xcgsb) * s->real);
|
||||
*(here->B2GbPtr +1) += m * ((-xcggb-xcgdb-xcgsb) * s->imag);
|
||||
*(here->B2GdpPtr ) += m * (xcgdb * s->real);
|
||||
*(here->B2GdpPtr +1) += m * (xcgdb * s->imag);
|
||||
*(here->B2GspPtr ) += m * (xcgsb * s->real);
|
||||
*(here->B2GspPtr +1) += m * (xcgsb * s->imag);
|
||||
*(here->B2BgPtr ) += m * (xcbgb * s->real);
|
||||
*(here->B2BgPtr +1) += m * (xcbgb * s->imag);
|
||||
*(here->B2BdpPtr ) += m * (xcbdb * s->real);
|
||||
*(here->B2BdpPtr +1) += m * (xcbdb * s->imag);
|
||||
*(here->B2BspPtr ) += m * (xcbsb * s->real);
|
||||
*(here->B2BspPtr +1) += m * (xcbsb * s->imag);
|
||||
*(here->B2DPgPtr ) += m * (xcdgb * s->real);
|
||||
*(here->B2DPgPtr +1) += m * (xcdgb * s->imag);
|
||||
*(here->B2DPbPtr ) += m * ((-xcdgb-xcddb-xcdsb) * s->real);
|
||||
*(here->B2DPbPtr +1) += m * ((-xcdgb-xcddb-xcdsb) * s->imag);
|
||||
*(here->B2DPspPtr ) += m * (xcdsb * s->real);
|
||||
*(here->B2DPspPtr +1) += m * (xcdsb * s->imag);
|
||||
*(here->B2SPgPtr ) += m * (xcsgb * s->real);
|
||||
*(here->B2SPgPtr +1) += m * (xcsgb * s->imag);
|
||||
*(here->B2SPbPtr ) += m * ((-xcsgb-xcsdb-xcssb) * s->real);
|
||||
*(here->B2SPbPtr +1) += m * ((-xcsgb-xcsdb-xcssb) * s->imag);
|
||||
*(here->B2SPdpPtr ) += m * (xcsdb * s->real);
|
||||
*(here->B2SPdpPtr +1) += m * (xcsdb * s->imag);
|
||||
*(here->B2DdPtr) += m * (gdpr);
|
||||
*(here->B2SsPtr) += m * (gspr);
|
||||
*(here->B2BbPtr) += m * (gbd+gbs);
|
||||
*(here->B2DPdpPtr) += m * (gdpr+gds+gbd+xrev*(gm+gmbs));
|
||||
*(here->B2SPspPtr) += m * (gspr+gds+gbs+xnrm*(gm+gmbs));
|
||||
*(here->B2DdpPtr) -= m * (gdpr);
|
||||
*(here->B2SspPtr) -= m * (gspr);
|
||||
*(here->B2BdpPtr) -= m * (gbd);
|
||||
*(here->B2BspPtr) -= m * (gbs);
|
||||
*(here->B2DPdPtr) -= m * (gdpr);
|
||||
*(here->B2DPgPtr) += m * ((xnrm-xrev)*gm);
|
||||
*(here->B2DPbPtr) += m * (-gbd+(xnrm-xrev)*gmbs);
|
||||
*(here->B2DPspPtr) += m * (-gds-xnrm*(gm+gmbs));
|
||||
*(here->B2SPgPtr) += m * (-(xnrm-xrev)*gm);
|
||||
*(here->B2SPsPtr) -= m * (gspr);
|
||||
*(here->B2SPbPtr) += m * (-gbs-(xnrm-xrev)*gmbs);
|
||||
*(here->B2SPdpPtr) += m * (-gds-xrev*(gm+gmbs));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ Author: 1988 Min-Chie Jeng, Hong J. Park, Thomas L. Quarles
|
|||
**********/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "smpdefs.h"
|
||||
#include "cktdefs.h"
|
||||
#include "bsim2def.h"
|
||||
|
|
@ -13,11 +12,7 @@ Author: 1988 Min-Chie Jeng, Hong J. Park, Thomas L. Quarles
|
|||
#include "suffix.h"
|
||||
|
||||
int
|
||||
B2setup(matrix,inModel,ckt,states)
|
||||
SMPmatrix *matrix;
|
||||
GENmodel *inModel;
|
||||
CKTcircuit *ckt;
|
||||
int *states;
|
||||
B2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
|
||||
/* load the B2 device structure with those pointers needed later
|
||||
* for fast matrix loading
|
||||
*/
|
||||
|
|
@ -486,7 +481,10 @@ B2setup(matrix,inModel,ckt,states)
|
|||
if(!here->B2wGiven) {
|
||||
here->B2w = 5e-6;
|
||||
}
|
||||
|
||||
if(!here->B2mGiven) {
|
||||
here->B2m = 1.0;
|
||||
}
|
||||
|
||||
/* process drain series resistance */
|
||||
if( (model->B2sheetResistance != 0) &&
|
||||
(here->B2drainSquares != 0.0 ) &&
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ Author: 1985 Hong J. Park, Thomas L. Quarles
|
|||
**********/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "smpdefs.h"
|
||||
#include "cktdefs.h"
|
||||
#include "bsim2def.h"
|
||||
|
|
@ -14,9 +13,7 @@ Author: 1985 Hong J. Park, Thomas L. Quarles
|
|||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
B2temp(inModel,ckt)
|
||||
GENmodel *inModel;
|
||||
CKTcircuit *ckt;
|
||||
B2temp(GENmodel *inModel, CKTcircuit *ckt)
|
||||
/* load the B2 device structure with those pointers needed later
|
||||
* for fast matrix loading
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -4,18 +4,13 @@ Author: 1985 Hong J. Park, Thomas L. Quarles
|
|||
**********/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "cktdefs.h"
|
||||
#include "bsim2def.h"
|
||||
#include "sperror.h"
|
||||
#include "suffix.h"
|
||||
|
||||
int
|
||||
B2trunc(inModel,ckt,timeStep)
|
||||
GENmodel *inModel;
|
||||
CKTcircuit *ckt;
|
||||
double *timeStep;
|
||||
|
||||
B2trunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep)
|
||||
{
|
||||
B2model *model = (B2model*)inModel;
|
||||
B2instance *here;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ typedef struct sBSIM2instance {
|
|||
|
||||
double B2l; /* the length of the channel region */
|
||||
double B2w; /* the width of the channel region */
|
||||
double B2m; /* the parallel multiplier */
|
||||
double B2drainArea; /* the area of the drain diffusion */
|
||||
double B2sourceArea; /* the area of the source diffusion */
|
||||
double B2drainSquares; /* the length of the drain in squares */
|
||||
|
|
@ -54,6 +55,7 @@ typedef struct sBSIM2instance {
|
|||
|
||||
unsigned B2lGiven :1;
|
||||
unsigned B2wGiven :1;
|
||||
unsigned B2mGiven :1;
|
||||
unsigned B2drainAreaGiven :1;
|
||||
unsigned B2sourceAreaGiven :1;
|
||||
unsigned B2drainSquaresGiven :1;
|
||||
|
|
@ -115,6 +117,20 @@ typedef struct sBSIM2instance {
|
|||
double *B2SPdpPtr; /* pointer to sparse matrix element at
|
||||
* (source prime node,drain prime node) */
|
||||
|
||||
#define B2RDNOIZ 0
|
||||
#define B2RSNOIZ 1
|
||||
#define B2IDNOIZ 2
|
||||
#define B2FLNOIZ 3
|
||||
#define B2TOTNOIZ 4
|
||||
|
||||
#define B2NSRCS 5 /* the number of BSIM2 noise sources */
|
||||
|
||||
#ifndef NONOISE
|
||||
double B2nVar[NSTATVARS][B2NSRCS];
|
||||
#else /* NONOISE */
|
||||
double **B2nVar;
|
||||
#endif /* NONOISE */
|
||||
|
||||
#define B2vbd B2states+ 0
|
||||
#define B2vbs B2states+ 1
|
||||
#define B2vgs B2states+ 2
|
||||
|
|
@ -368,7 +384,10 @@ typedef struct sBSIM2model { /* model structure for a resistor */
|
|||
double B2unitAreaJctCap;
|
||||
double B2unitLengthSidewallJctCap;
|
||||
double B2defaultWidth;
|
||||
double B2deltaLength;
|
||||
double B2deltaLength;
|
||||
double B2fNcoef;
|
||||
double B2fNexp;
|
||||
|
||||
|
||||
struct bsim2SizeDependParam *pSizeDependParamKnot;
|
||||
|
||||
|
|
@ -507,6 +526,8 @@ typedef struct sBSIM2model { /* model structure for a resistor */
|
|||
unsigned B2unitLengthSidewallJctCapGiven :1;
|
||||
unsigned B2defaultWidthGiven :1;
|
||||
unsigned B2deltaLengthGiven :1;
|
||||
unsigned B2fNcoefGiven :1;
|
||||
unsigned B2fNexpGiven :1;
|
||||
unsigned B2typeGiven :1;
|
||||
|
||||
} B2model;
|
||||
|
|
@ -532,6 +553,7 @@ typedef struct sBSIM2model { /* model structure for a resistor */
|
|||
#define BSIM2_IC_VDS 11
|
||||
#define BSIM2_IC_VGS 12
|
||||
#define BSIM2_IC 13
|
||||
#define BSIM2_M 14
|
||||
|
||||
/* model parameters */
|
||||
#define BSIM2_MOD_VFB0 101
|
||||
|
|
@ -670,6 +692,9 @@ typedef struct sBSIM2model { /* model structure for a resistor */
|
|||
#define BSIM2_MOD_NMOS 234
|
||||
#define BSIM2_MOD_PMOS 235
|
||||
|
||||
#define BSIM2_MOD_KF 236
|
||||
#define BSIM2_MOD_AF 237
|
||||
|
||||
/* device questions */
|
||||
#define BSIM2_DNODE 241
|
||||
#define BSIM2_GNODE 242
|
||||
|
|
@ -716,14 +741,11 @@ typedef struct sBSIM2model { /* model structure for a resistor */
|
|||
|
||||
#include "bsim2ext.h"
|
||||
|
||||
#ifdef __STDC__
|
||||
extern void B2evaluate(double,double,double,B2instance*,B2model*,
|
||||
double*,double*,double*, double*, double*, double*, double*,
|
||||
double*, double*, double*, double*, double*, double*, double*,
|
||||
double*, double*, double*, double*, CKTcircuit*);
|
||||
#else /* stdc */
|
||||
extern void B2evaluate();
|
||||
#endif /* stdc */
|
||||
|
||||
|
||||
#endif /*B2*/
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ Copyright 1990 Regents of the University of California. All rights reserved.
|
|||
Author: 1988 Min-Chie Jeng, Hong June Park, Thomas L. Quarles
|
||||
**********/
|
||||
|
||||
#ifdef __STDC__
|
||||
extern int B2acLoad(GENmodel *,CKTcircuit*);
|
||||
extern int B2ask(CKTcircuit *,GENinstance*,int,IFvalue*,IFvalue*);
|
||||
extern int B2convTest(GENmodel *,CKTcircuit*);
|
||||
|
|
@ -19,29 +18,10 @@ extern void B2mosCap(CKTcircuit*, double, double, double, double*,
|
|||
double*, double*, double*, double*, double*, double*, double*, double*,
|
||||
double*, double*, double*, double*, double*, double*, double*,
|
||||
double*);
|
||||
extern int B2noise (int, int, GENmodel *, CKTcircuit *, Ndata *, double *);
|
||||
extern int B2param(int,IFvalue*,GENinstance*,IFvalue*);
|
||||
extern int B2pzLoad(GENmodel*,CKTcircuit*,SPcomplex*);
|
||||
extern int B2setup(SMPmatrix*,GENmodel*,CKTcircuit*,int*);
|
||||
extern int B2unsetup(GENmodel*,CKTcircuit*);
|
||||
extern int B2temp(GENmodel*,CKTcircuit*);
|
||||
extern int B2trunc(GENmodel*,CKTcircuit*,double*);
|
||||
#else /* stdc */
|
||||
extern int B2acLoad();
|
||||
extern int B2delete();
|
||||
extern void B2destroy();
|
||||
extern int B2getic();
|
||||
extern int B2load();
|
||||
extern int B2mDelete();
|
||||
extern int B2ask();
|
||||
extern int B2mAsk();
|
||||
extern int B2convTest();
|
||||
extern int B2temp();
|
||||
extern int B2mParam();
|
||||
extern void B2mosCap();
|
||||
extern int B2param();
|
||||
extern int B2pzLoad();
|
||||
extern int B2setup();
|
||||
extern int B2unsetup();
|
||||
extern int B2trunc();
|
||||
|
||||
#endif /* stdc */
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ SPICEdev B2info = {
|
|||
DEVsenPrint : NULL,
|
||||
DEVsenTrunc : NULL,
|
||||
DEVdisto : NULL,
|
||||
DEVnoise : NULL,
|
||||
DEVnoise : B2noise,
|
||||
#ifdef CIDER
|
||||
DEVdump : NULL,
|
||||
DEVacct : NULL,
|
||||
|
|
|
|||
Loading…
Reference in New Issue