diff --git a/ChangeLog b/ChangeLog index f1dd7c229..0963ceb0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ 2003-12-30 Paolo Nenzi - * src/spicelib/devices/jfet/jfetpzld.c: gspr and gdpr were initialized + * src/spicelibe/devices/hfet2/*: Added parallel multipler and "dtemp" + parameters. Added pole-zero analysis and parallel code switches. + + * src/spicelib/devices/jfet/jfetpzld.c: gspr and gdpr were initialized with Resist and not Conduct, corrected! * src/spicelib/devices/hfet1/*: Added parallel multiplier and "dtemp" to diff --git a/DEVICES b/DEVICES index 0f65d4f27..29287717b 100644 --- a/DEVICES +++ b/DEVICES @@ -222,9 +222,19 @@ HFET - HFET Level 1 (Ytterdal) - Added pole-zero analysis -HFET2 - HFET Level 2 - Initial release. - +HFET2 - HFET Level 2 (Ytterdal) + Initial Release. + Ver: N/A + Class: Z + Level: 6 + Status: + + + Enhancements over the original model: + + - Parallel multiplier + - Instance temperature as difference for circuit temperature + - Added pole-zero analysis *************************************************************************** *************************** MES devices *************************** diff --git a/src/spicelib/devices/hfet2/Makefile.am b/src/spicelib/devices/hfet2/Makefile.am index e013a1a53..eb9878d10 100644 --- a/src/spicelib/devices/hfet2/Makefile.am +++ b/src/spicelib/devices/hfet2/Makefile.am @@ -19,6 +19,7 @@ libhfet2_a_SOURCES = \ hfet2mdel.c \ hfet2mpar.c \ hfet2param.c \ + hfet2pzl.c \ hfet2setup.c \ hfet2temp.c \ hfet2trunc.c diff --git a/src/spicelib/devices/hfet2/hfet2.c b/src/spicelib/devices/hfet2/hfet2.c index fdaf30222..3f35a1c12 100644 --- a/src/spicelib/devices/hfet2/hfet2.c +++ b/src/spicelib/devices/hfet2/hfet2.c @@ -1,6 +1,9 @@ +/********** +Imported from MacSpice3f4 - Antony Wilson +Modified: Paolo Nenzi +**********/ #include "ngspice.h" -#include #include "ifsim.h" #include "devdefs.h" #include "hfet2defs.h" @@ -8,32 +11,34 @@ IFparm HFET2pTable[] = { /* parameters */ - OP("off", HFET2_OFF, IF_FLAG ,""), - IOP("l", HFET2_LENGTH, IF_REAL ,""), - IOP("w", HFET2_WIDTH, IF_REAL ,""), - IOP("icvds", HFET2_IC_VDS, IF_REAL ,""), - IOP("icvgs", HFET2_IC_VGS, IF_REAL ,""), - IOP("temp", HFET2_TEMP, IF_REAL ,""), - OP("dnode", HFET2_DRAINNODE, IF_INTEGER ,""), - OP("gnode", HFET2_GATENODE, IF_INTEGER ,""), - OP("snode", HFET2_SOURCENODE, IF_INTEGER ,""), - OP("dprimenode",HFET2_DRAINPRIMENODE, IF_INTEGER ,""), - OP("sprimenode",HFET2_SOURCEPRIMENODE,IF_INTEGER ,""), - OP("vgs", HFET2_VGS, IF_REAL ,""), - OP("vgd", HFET2_VGD, IF_REAL ,""), - OP("cg", HFET2_CG, IF_REAL ,""), - OP("cd", HFET2_CD, IF_REAL ,""), - OP("cgd", HFET2_CGD, IF_REAL ,""), - OP("gm", HFET2_GM, IF_REAL ,""), - OP("gds", HFET2_GDS, IF_REAL ,""), - OP("ggs", HFET2_GGS, IF_REAL ,""), - OP("ggd", HFET2_GGD, IF_REAL ,""), - OP("qgs", HFET2_QGS, IF_REAL ,""), - OP("cqgs", HFET2_CQGS, IF_REAL ,""), - OP("qgd", HFET2_QGD, IF_REAL ,""), - OP("cqgd", HFET2_CQGD, IF_REAL ,""), - OP("cs", HFET2_CS, IF_REAL ,""), - OP("p", HFET2_POWER, IF_REAL ,"") + OP("off", HFET2_OFF, IF_FLAG ,"Device initialli OFF"), + IOP("l", HFET2_LENGTH, IF_REAL ,"Length of device"), + IOP("w", HFET2_WIDTH, IF_REAL ,"Width of device"), + IOP("m", HFET2_M, IF_REAL ,"Parallel Multiplier"), + IOP("icvds", HFET2_IC_VDS, IF_REAL ,"Initial D-S voltage"), + IOP("icvgs", HFET2_IC_VGS, IF_REAL ,"Initial G-S voltage"), + IOP("temp", HFET2_TEMP, IF_REAL ,"Instance temperature"), + IOP("dtemp", HFET2_DTEMP, IF_REAL ,"Instance temperature difference"), + OP("dnode", HFET2_DRAINNODE, IF_INTEGER ,"Number of drain node"), + OP("gnode", HFET2_GATENODE, IF_INTEGER ,"Number of gate node"), + OP("snode", HFET2_SOURCENODE, IF_INTEGER ,"Number of source node"), + OP("dprimenode",HFET2_DRAINPRIMENODE, IF_INTEGER ,"Number of internal drain node"), + OP("sprimenode",HFET2_SOURCEPRIMENODE,IF_INTEGER ,"Number of internal source node"), + OP("vgs", HFET2_VGS, IF_REAL ,"Gate-Source voltage"), + OP("vgd", HFET2_VGD, IF_REAL ,"Gate-Drain voltage"), + OP("cg", HFET2_CG, IF_REAL ,"Gate capacitance"), + OP("cd", HFET2_CD, IF_REAL ,"Drain capacitance"), + OP("cgd", HFET2_CGD, IF_REAL ,"Gate_Drain capacitance"), + OP("gm", HFET2_GM, IF_REAL ,"Transconductance"), + OP("gds", HFET2_GDS, IF_REAL ,"Drain-Source conductance"), + OP("ggs", HFET2_GGS, IF_REAL ,"Gate-Source conductance"), + OP("ggd", HFET2_GGD, IF_REAL ,"Gate-Drain conductance"), + OP("qgs", HFET2_QGS, IF_REAL ,"Gate-Source charge storage"), + OP("cqgs", HFET2_CQGS, IF_REAL ,"Capacitance due to gate-source charge storage"), + OP("qgd", HFET2_QGD, IF_REAL ,"Gate-Drain charge storage"), + OP("cqgd", HFET2_CQGD, IF_REAL ,"Capacitance due to gate-drain charge storage"), + OP("cs", HFET2_CS, IF_REAL ,"Source current"), + OP("p", HFET2_POWER, IF_REAL ,"Power dissipated by the mesfet") }; @@ -74,10 +79,10 @@ IFparm HFET2mPTable[] = { /* model parameters */ IOP( "vs", HFET2_MOD_VS, IF_REAL,"Saturation velocity"), IOP( "vsigma", HFET2_MOD_VSIGMA, IF_REAL,""), IOP( "vsigmat", HFET2_MOD_VSIGMAT, IF_REAL,""), - IOP( "vt0", HFET2_MOD_VTO, IF_REAL,""), + IOP( "vt0", HFET2_MOD_VTO, IF_REAL,"Pinch-off voltage"), IOP( "vt1", HFET2_MOD_VT1, IF_REAL,""), IOP( "vt2", HFET2_MOD_VT2, IF_REAL,""), - IOP( "vto", HFET2_MOD_VTO, IF_REAL,"") + IOP( "vto", HFET2_MOD_VTO, IF_REAL,"Pinch-off voltage") }; diff --git a/src/spicelib/devices/hfet2/hfet2acl.c b/src/spicelib/devices/hfet2/hfet2acl.c index aedd25391..85b496df8 100644 --- a/src/spicelib/devices/hfet2/hfet2acl.c +++ b/src/spicelib/devices/hfet2/hfet2acl.c @@ -1,15 +1,16 @@ +/********** +Imported from MacSpice3f4 - Antony Wilson +Modified: Paolo Nenzi +**********/ #include "ngspice.h" -#include #include "cktdefs.h" #include "hfet2defs.h" #include "sperror.h" #include "suffix.h" -int HFET2acLoad(inModel, ckt) -GENmodel *inModel; -CKTcircuit *ckt; +int HFET2acLoad(GENmodel *inModel, CKTcircuit *ckt) { HFET2model *model = (HFET2model*)inModel; @@ -23,10 +24,17 @@ CKTcircuit *ckt; double ggd; double xgd; + double m; + for( ; model != NULL; model = model->HFET2nextModel ) { - for( here = model->HFET2instances; here != NULL; here = here->HFET2nextInstance) - { + for( here = model->HFET2instances; here != NULL; + here = here->HFET2nextInstance) { + + if (here->HFET2owner != ARCHme) continue; + + m = here->HFET2m; + gdpr=model->HFET2drainConduct; gspr=model->HFET2sourceConduct; gm= *(ckt->CKTstate0 + here->HFET2gm) ; @@ -35,28 +43,29 @@ CKTcircuit *ckt; xgs= *(ckt->CKTstate0 + here->HFET2qgs) * ckt->CKTomega ; ggd= *(ckt->CKTstate0 + here->HFET2ggd) ; xgd= *(ckt->CKTstate0 + here->HFET2qgd) * ckt->CKTomega ; - *(here->HFET2drainDrainPtr ) += gdpr; - *(here->HFET2gateGatePtr ) += ggd+ggs; - *(here->HFET2gateGatePtr +1) += xgd+xgs; - *(here->HFET2sourceSourcePtr ) += gspr; - *(here->HFET2drainPrimeDrainPrimePtr ) += gdpr+gds+ggd; - *(here->HFET2drainPrimeDrainPrimePtr +1) += xgd; - *(here->HFET2sourcePriHFET2ourcePrimePtr ) += gspr+gds+gm+ggs; - *(here->HFET2sourcePriHFET2ourcePrimePtr +1) += xgs; - *(here->HFET2drainDrainPrimePtr ) -= gdpr; - *(here->HFET2gateDrainPrimePtr ) -= ggd; - *(here->HFET2gateDrainPrimePtr +1) -= xgd; - *(here->HFET2gateSourcePrimePtr ) -= ggs; - *(here->HFET2gateSourcePrimePtr +1) -= xgs; - *(here->HFET2sourceSourcePrimePtr ) -= gspr; - *(here->HFET2drainPrimeDrainPtr ) -= gdpr; - *(here->HFET2drainPrimeGatePtr ) += (-ggd+gm); - *(here->HFET2drainPrimeGatePtr +1) -= xgd; - *(here->HFET2drainPriHFET2ourcePrimePtr ) += (-gds-gm); - *(here->HFET2sourcePrimeGatePtr ) += (-ggs-gm); - *(here->HFET2sourcePrimeGatePtr +1) -= xgs; - *(here->HFET2sourcePriHFET2ourcePtr ) -= gspr; - *(here->HFET2sourcePrimeDrainPrimePtr ) -= gds; + + *(here->HFET2drainDrainPtr ) += m * (gdpr); + *(here->HFET2gateGatePtr ) += m * (ggd+ggs); + *(here->HFET2gateGatePtr +1) += m * (xgd+xgs); + *(here->HFET2sourceSourcePtr ) += m * (gspr); + *(here->HFET2drainPrimeDrainPrimePtr ) += m * (gdpr+gds+ggd); + *(here->HFET2drainPrimeDrainPrimePtr +1) += m * (xgd); + *(here->HFET2sourcePriHFET2ourcePrimePtr ) += m * (gspr+gds+gm+ggs); + *(here->HFET2sourcePriHFET2ourcePrimePtr +1) += m * (xgs); + *(here->HFET2drainDrainPrimePtr ) -= m * (gdpr); + *(here->HFET2gateDrainPrimePtr ) -= m * (ggd); + *(here->HFET2gateDrainPrimePtr +1) -= m * (xgd); + *(here->HFET2gateSourcePrimePtr ) -= m * (ggs); + *(here->HFET2gateSourcePrimePtr +1) -= m * (xgs); + *(here->HFET2sourceSourcePrimePtr ) -= m * (gspr); + *(here->HFET2drainPrimeDrainPtr ) -= m * (gdpr); + *(here->HFET2drainPrimeGatePtr ) += m * (-ggd+gm); + *(here->HFET2drainPrimeGatePtr +1) -= m * (xgd); + *(here->HFET2drainPriHFET2ourcePrimePtr ) += m * (-gds-gm); + *(here->HFET2sourcePrimeGatePtr ) += m * (-ggs-gm); + *(here->HFET2sourcePrimeGatePtr +1) -= m * (xgs); + *(here->HFET2sourcePriHFET2ourcePtr ) -= m * (gspr); + *(here->HFET2sourcePrimeDrainPrimePtr ) -= m * (gds); } } return(OK); diff --git a/src/spicelib/devices/hfet2/hfet2ask.c b/src/spicelib/devices/hfet2/hfet2ask.c index d40d41982..32310d56a 100644 --- a/src/spicelib/devices/hfet2/hfet2ask.c +++ b/src/spicelib/devices/hfet2/hfet2ask.c @@ -7,7 +7,6 @@ Imported into HFET2 source: Paolo Nenzi 2001 */ #include "ngspice.h" -#include #include "cktdefs.h" #include "devdefs.h" #include "ifsim.h" @@ -18,12 +17,8 @@ Imported into HFET2 source: Paolo Nenzi 2001 /* ARGSUSED */ int -HFET2ask(ckt,inst,which,value,select) - CKTcircuit *ckt; - GENinstance *inst; - int which; - IFvalue *value; - IFvalue *select; +HFET2ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, + IFvalue *select) { HFET2instance *here = (HFET2instance*)inst; static char *msg = "Current and power not available in ac analysis"; @@ -32,7 +27,8 @@ HFET2ask(ckt,inst,which,value,select) value->rValue = here->HFET2length; return (OK); case HFET2_WIDTH: - value->rValue = here->HFET2width; + value->rValue = here->HFET2width; + value->rValue *= here->HFET2m; case HFET2_IC_VDS: value->rValue = here->HFET2icVDS; return (OK); @@ -58,7 +54,9 @@ HFET2ask(ckt,inst,which,value,select) value->iValue = here->HFET2sourcePrimeNode; return (OK); case HFET2_TEMP: - value->rValue = here->HFET2temp; + value->rValue = here->HFET2temp - CONSTCtoK; + case HFET2_DTEMP: + value->rValue = here->HFET2dtemp; case HFET2_VGS: value->rValue = *(ckt->CKTstate0 + here->HFET2vgs); return (OK); @@ -67,36 +65,47 @@ HFET2ask(ckt,inst,which,value,select) return (OK); case HFET2_CG: value->rValue = *(ckt->CKTstate0 + here->HFET2cg); + value->rValue *= here->HFET2m; return (OK); case HFET2_CD: value->rValue = *(ckt->CKTstate0 + here->HFET2cd); + value->rValue *= here->HFET2m; return (OK); case HFET2_CGD: value->rValue = *(ckt->CKTstate0 + here->HFET2cgd); + value->rValue *= here->HFET2m; return (OK); case HFET2_GM: value->rValue = *(ckt->CKTstate0 + here->HFET2gm); + value->rValue *= here->HFET2m; return (OK); case HFET2_GDS: value->rValue = *(ckt->CKTstate0 + here->HFET2gds); + value->rValue *= here->HFET2m; return (OK); case HFET2_GGS: value->rValue = *(ckt->CKTstate0 + here->HFET2ggs); + value->rValue *= here->HFET2m; return (OK); case HFET2_GGD: value->rValue = *(ckt->CKTstate0 + here->HFET2ggd); + value->rValue *= here->HFET2m; return (OK); case HFET2_QGS: value->rValue = *(ckt->CKTstate0 + here->HFET2qgs); + value->rValue *= here->HFET2m; return (OK); case HFET2_CQGS: value->rValue = *(ckt->CKTstate0 + here->HFET2cqgs); + value->rValue *= here->HFET2m; return (OK); case HFET2_QGD: value->rValue = *(ckt->CKTstate0 + here->HFET2qgd); + value->rValue *= here->HFET2m; return (OK); case HFET2_CQGD: value->rValue = *(ckt->CKTstate0 + here->HFET2cqgd); + value->rValue *= here->HFET2m; return (OK); case HFET2_CS : if (ckt->CKTcurrentAnalysis & DOING_AC) { @@ -107,6 +116,7 @@ HFET2ask(ckt,inst,which,value,select) } else { value->rValue = -*(ckt->CKTstate0 + here->HFET2cd); value->rValue -= *(ckt->CKTstate0 + here->HFET2cg); + value->rValue *= here->HFET2m; } return(OK); case HFET2_POWER : @@ -123,6 +133,7 @@ HFET2ask(ckt,inst,which,value,select) value->rValue -= (*(ckt->CKTstate0+here->HFET2cd) + *(ckt->CKTstate0 + here->HFET2cg)) * *(ckt->CKTrhsOld + here->HFET2sourceNode); + value->rValue *= here->HFET2m; } return(OK); default: diff --git a/src/spicelib/devices/hfet2/hfet2defs.h b/src/spicelib/devices/hfet2/hfet2defs.h index 842bf1362..aae5bb59e 100644 --- a/src/spicelib/devices/hfet2/hfet2defs.h +++ b/src/spicelib/devices/hfet2/hfet2defs.h @@ -23,7 +23,9 @@ typedef struct sHFET2instance { int HFET2sourcePrimeNode; double HFET2length; double HFET2width; + double HFET2m; double HFET2temp; + double HFET2dtemp; double HFET2tLambda; double HFET2tMu; double HFET2tNmax; @@ -64,11 +66,13 @@ typedef struct sHFET2instance { int HFET2mode; int HFET2off; - unsigned HFET2icVDSGiven : 1; - unsigned HFET2icVGSGiven : 1; + unsigned HFET2icVDSGiven : 1; + unsigned HFET2icVGSGiven : 1; unsigned HFET2lengthGiven : 1; - unsigned HFET2widthGiven : 1; - unsigned HFET2tempGiven : 1; + unsigned HFET2widthGiven : 1; + unsigned HFET2mGiven : 1; + unsigned HFET2tempGiven : 1; + unsigned HFET2dtempGiven : 1; double HFET2n0; double HFET2n01; @@ -186,6 +190,8 @@ typedef struct sHFET2model { #define HFET2_CS 7 #define HFET2_POWER 8 #define HFET2_TEMP 9 +#define HFET2_DTEMP 10 +#define HFET2_M 11 /* model parameters */ #define HFET2_MOD_NHFET 101 diff --git a/src/spicelib/devices/hfet2/hfet2del.c b/src/spicelib/devices/hfet2/hfet2del.c index 0eac5dabf..61bb659a8 100644 --- a/src/spicelib/devices/hfet2/hfet2del.c +++ b/src/spicelib/devices/hfet2/hfet2del.c @@ -7,17 +7,13 @@ Imported into hfet2 model: Paolo Nenzi 2001 */ #include "ngspice.h" -#include #include "hfet2defs.h" #include "sperror.h" #include "suffix.h" int -HFET2delete(inModel,name,inst) - GENmodel *inModel; - IFuid name; - GENinstance **inst; +HFET2delete(GENmodel *inModel, IFuid name, GENinstance **inst) { HFET2model *model = (HFET2model*)inModel; HFET2instance **fast = (HFET2instance**)inst; diff --git a/src/spicelib/devices/hfet2/hfet2dest.c b/src/spicelib/devices/hfet2/hfet2dest.c index 1af55e904..1932d007a 100644 --- a/src/spicelib/devices/hfet2/hfet2dest.c +++ b/src/spicelib/devices/hfet2/hfet2dest.c @@ -1,12 +1,14 @@ +/********** +Imported from MacSpice3f4 - Antony Wilson +Modified: Paolo Nenzi +**********/ #include "ngspice.h" -#include #include "hfet2defs.h" #include "suffix.h" -void HFET2destroy(inModel) -GENmodel **inModel; +void HFET2destroy(GENmodel **inModel) { HFET2model **model = (HFET2model**)inModel; diff --git a/src/spicelib/devices/hfet2/hfet2ext.h b/src/spicelib/devices/hfet2/hfet2ext.h index 9604af910..243861744 100644 --- a/src/spicelib/devices/hfet2/hfet2ext.h +++ b/src/spicelib/devices/hfet2/hfet2ext.h @@ -3,7 +3,6 @@ Copyright 1993: T. Ytterdal, K. Lee, M. Shur and T. A. Fjeldly. All rights reser Author: Trond Ytterdal **********/ -#ifdef __STDC__ extern int HFET2acLoad(GENmodel*,CKTcircuit*); extern int HFET2ask(CKTcircuit*,GENinstance*,int,IFvalue*,IFvalue*); extern int HFET2delete(GENmodel*,IFuid,GENinstance**); @@ -14,25 +13,8 @@ extern int HFET2mAsk(CKTcircuit*,GENmodel*,int,IFvalue*); extern int HFET2mDelete(GENmodel**,IFuid,GENmodel*); extern int HFET2mParam(int,IFvalue*,GENmodel*); extern int HFET2param(int,IFvalue*,GENinstance*,IFvalue*); +extern int HFET2pzLoad(GENmodel*, CKTcircuit*, SPcomplex*); extern int HFET2setup(SMPmatrix*,GENmodel*,CKTcircuit*,int*); extern int HFET2temp(GENmodel*,CKTcircuit*); extern int HFET2trunc(GENmodel*,CKTcircuit*,double*); extern int HFET2unsetup( GENmodel*,CKTcircuit*); - -#else /* stdc */ -extern int HFET2acLoad(); -extern int HFET2ask(); -extern int HFET2delete(); -extern void HFET2destroy(); -extern int HFET2getic(); -extern int HFET2load(); -extern int HFETAmAsk(); -extern int HFETAmDelete(); -extern int HFET2mParam(); -extern int HFET2param(); -extern int HFET2setup(); -extern int HFET2temp(); -extern int HFET2trunc(); -extern int HFET2unsetup(); -#endif - diff --git a/src/spicelib/devices/hfet2/hfet2getic.c b/src/spicelib/devices/hfet2/hfet2getic.c index e3e0ab7b8..5477949a3 100644 --- a/src/spicelib/devices/hfet2/hfet2getic.c +++ b/src/spicelib/devices/hfet2/hfet2getic.c @@ -1,15 +1,16 @@ +/********** +Imported from MacSpice3f4 - Antony Wilson +Modified: Paolo Nenzi +**********/ #include "ngspice.h" -#include #include "cktdefs.h" #include "hfet2defs.h" #include "sperror.h" #include "suffix.h" -int HFET2getic(inModel, ckt) -GENmodel *inModel; -CKTcircuit *ckt; +int HFET2getic(GENmodel *inModel, CKTcircuit *ckt) { HFET2model *model = (HFET2model*)inModel; @@ -17,6 +18,8 @@ CKTcircuit *ckt; for( ; model ; model = model->HFET2nextModel) { for(here = model->HFET2instances; here ; here = here->HFET2nextInstance) { + if (here->HFET2owner != ARCHme) continue; + if(!here->HFET2icVDSGiven) { here->HFET2icVDS = *(ckt->CKTrhs + here->HFET2drainNode) - *(ckt->CKTrhs + here->HFET2sourceNode); diff --git a/src/spicelib/devices/hfet2/hfet2init.c b/src/spicelib/devices/hfet2/hfet2init.c index 0e6a5ae14..892b785f5 100644 --- a/src/spicelib/devices/hfet2/hfet2init.c +++ b/src/spicelib/devices/hfet2/hfet2init.c @@ -57,7 +57,7 @@ SPICEdev HFET2info = { DEVsetic : HFET2getic, DEVask : HFET2ask, DEVmodAsk : HFET2mAsk, - DEVpzLoad : NULL, + DEVpzLoad : HFET2pzLoad, DEVconvTest : NULL, DEVsenSetup : NULL, DEVsenLoad : NULL, diff --git a/src/spicelib/devices/hfet2/hfet2load.c b/src/spicelib/devices/hfet2/hfet2load.c index 609cc2973..c2c9ee709 100644 --- a/src/spicelib/devices/hfet2/hfet2load.c +++ b/src/spicelib/devices/hfet2/hfet2load.c @@ -1,6 +1,9 @@ +/********** +Imported from MacSpice3f4 - Antony Wilson +Modified: Paolo Nenzi +**********/ #include "ngspice.h" -#include #include "devdefs.h" #include "cktdefs.h" #include "hfet2defs.h" @@ -16,13 +19,11 @@ static void hfeta2(HFET2model *model, HFET2instance *here, CKTcircuit *ckt, double *gds, double *capgs, double *capgd); -int HFET2load(inModel, ckt) -GENmodel *inModel; -register CKTcircuit *ckt; +int HFET2load(GENmodel *inModel, CKTcircuit *ckt) { - register HFET2model *model = (HFET2model*)inModel; - register HFET2instance *here; + HFET2model *model = (HFET2model*)inModel; + HFET2instance *here; double capgd; double capgs; double cd; @@ -59,8 +60,14 @@ register CKTcircuit *ckt; int error; int inverse; + double m; + for( ; model != NULL; model = model->HFET2nextModel ) { - for(here = model->HFET2instances; here != NULL; here=here->HFET2nextInstance) { + for(here = model->HFET2instances; here != NULL; + here=here->HFET2nextInstance) { + + if (here->HFET2owner != ARCHme) continue; + gdpr = model->HFET2drainConduct; gspr = model->HFET2sourceConduct; vcrit = VCRIT; @@ -283,30 +290,33 @@ register CKTcircuit *ckt; // load current vector load: + + m = here->HFET2m; + ceqgd=model->HFET2type*(cgd-ggd*vgd); ceqgs=model->HFET2type*((cg-cgd)-ggs*vgs); cdreq=model->HFET2type*((cd+cgd)-gds*vds-gm*vgs); - *(ckt->CKTrhs + here->HFET2gateNode) += (-ceqgs-ceqgd); - *(ckt->CKTrhs + here->HFET2drainPrimeNode) += (-cdreq+ceqgd); - *(ckt->CKTrhs + here->HFET2sourcePrimeNode) += (cdreq+ceqgs); + *(ckt->CKTrhs + here->HFET2gateNode) += m * (-ceqgs-ceqgd); + *(ckt->CKTrhs + here->HFET2drainPrimeNode) += m * (-cdreq+ceqgd); + *(ckt->CKTrhs + here->HFET2sourcePrimeNode) += m * (cdreq+ceqgs); // load y matrix - *(here->HFET2drainDrainPrimePtr) += (-gdpr); - *(here->HFET2gateDrainPrimePtr) += (-ggd); - *(here->HFET2gateSourcePrimePtr) += (-ggs); - *(here->HFET2sourceSourcePrimePtr) += (-gspr); - *(here->HFET2drainPrimeDrainPtr) += (-gdpr); - *(here->HFET2drainPrimeGatePtr) += (gm-ggd); - *(here->HFET2drainPriHFET2ourcePrimePtr) += (-gds-gm); - *(here->HFET2sourcePrimeGatePtr) += (-ggs-gm); - *(here->HFET2sourcePriHFET2ourcePtr) += (-gspr); - *(here->HFET2sourcePrimeDrainPrimePtr) += (-gds); - *(here->HFET2drainDrainPtr) += (gdpr); - *(here->HFET2gateGatePtr) += (ggd+ggs); - *(here->HFET2sourceSourcePtr) += (gspr); - *(here->HFET2drainPrimeDrainPrimePtr) += (gdpr+gds+ggd); - *(here->HFET2sourcePriHFET2ourcePrimePtr) += (gspr+gds+gm+ggs); + *(here->HFET2drainDrainPrimePtr) += m * (-gdpr); + *(here->HFET2gateDrainPrimePtr) += m * (-ggd); + *(here->HFET2gateSourcePrimePtr) += m * (-ggs); + *(here->HFET2sourceSourcePrimePtr) += m * (-gspr); + *(here->HFET2drainPrimeDrainPtr) += m * (-gdpr); + *(here->HFET2drainPrimeGatePtr) += m * (gm-ggd); + *(here->HFET2drainPriHFET2ourcePrimePtr) += m * (-gds-gm); + *(here->HFET2sourcePrimeGatePtr) += m * (-ggs-gm); + *(here->HFET2sourcePriHFET2ourcePtr) += m * (-gspr); + *(here->HFET2sourcePrimeDrainPrimePtr) += m * (-gds); + *(here->HFET2drainDrainPtr) += m * (gdpr); + *(here->HFET2gateGatePtr) += m * (ggd+ggs); + *(here->HFET2sourceSourcePtr) += m * (gspr); + *(here->HFET2drainPrimeDrainPrimePtr) += m * (gdpr+gds+ggd); + *(here->HFET2sourcePriHFET2ourcePrimePtr) += m * (gspr+gds+gm+ggs); } } return(OK); diff --git a/src/spicelib/devices/hfet2/hfet2mask.c b/src/spicelib/devices/hfet2/hfet2mask.c index 0b1e54a31..b38d572d2 100644 --- a/src/spicelib/devices/hfet2/hfet2mask.c +++ b/src/spicelib/devices/hfet2/hfet2mask.c @@ -7,7 +7,6 @@ Imported into HFET2 model: Paolo Nenzi 2001 */ #include "ngspice.h" -#include #include "cktdefs.h" #include "devdefs.h" #include "ifsim.h" @@ -18,11 +17,7 @@ Imported into HFET2 model: Paolo Nenzi 2001 /* ARGSUSED */ int -HFET2mAsk(ckt,inst,which,value) - CKTcircuit *ckt; - GENmodel *inst; - int which; - IFvalue *value; +HFET2mAsk(CKTcircuit *ckt, GENmodel *inst, int which, IFvalue *value) { HFET2model *here = (HFET2model*)inst; switch(which) { diff --git a/src/spicelib/devices/hfet2/hfet2mdel.c b/src/spicelib/devices/hfet2/hfet2mdel.c index 661bd59ad..dda5f5c68 100644 --- a/src/spicelib/devices/hfet2/hfet2mdel.c +++ b/src/spicelib/devices/hfet2/hfet2mdel.c @@ -7,17 +7,13 @@ Imported into hfet2 model: Paolo Nenzi 2001 */ #include "ngspice.h" -#include #include "hfet2defs.h" #include "sperror.h" #include "suffix.h" int -HFET2mDelete(inModel,modname,kill) - GENmodel **inModel; - IFuid modname; - GENmodel *kill; +HFET2mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) { HFET2model **model = (HFET2model**)inModel; HFET2model *modfast = (HFET2model*)kill; diff --git a/src/spicelib/devices/hfet2/hfet2mpar.c b/src/spicelib/devices/hfet2/hfet2mpar.c index f372c3a5c..1d21206ef 100644 --- a/src/spicelib/devices/hfet2/hfet2mpar.c +++ b/src/spicelib/devices/hfet2/hfet2mpar.c @@ -1,16 +1,16 @@ +/********** +Imported from MacSpice3f4 - Antony Wilson +Modified: Paolo Nenzi +**********/ #include "ngspice.h" -#include #include "ifsim.h" #include "hfet2defs.h" #include "sperror.h" #include "suffix.h" -int HFET2mParam(param, value, inModel) -int param; -IFvalue *value; -GENmodel *inModel; +int HFET2mParam(int param, IFvalue *value, GENmodel *inModel) { HFET2model *model = (HFET2model*)inModel; diff --git a/src/spicelib/devices/hfet2/hfet2param.c b/src/spicelib/devices/hfet2/hfet2param.c index b23a2bbd0..88399e280 100644 --- a/src/spicelib/devices/hfet2/hfet2param.c +++ b/src/spicelib/devices/hfet2/hfet2param.c @@ -1,17 +1,16 @@ +/********** +Imported from MacSpice3f4 - Antony Wilson +Modified: Paolo Nenzi +**********/ #include "ngspice.h" -#include #include "ifsim.h" #include "hfet2defs.h" #include "sperror.h" #include "suffix.h" -int HFET2param(param, value, inst, select) -int param; -IFvalue *value; -GENinstance *inst; -IFvalue *select; +int HFET2param(int param, IFvalue *value, GENinstance *inst, IFvalue *select) { HFET2instance *here = (HFET2instance*)inst; @@ -45,13 +44,21 @@ IFvalue *select; } break; case HFET2_TEMP: - TEMP = value->rValue+CONSTCtoK; + TEMP = value->rValue + CONSTCtoK; here->HFET2tempGiven = TRUE; break; + case HFET2_DTEMP: + here->HFET2dtemp = value->rValue; + here->HFET2dtempGiven = TRUE; + break; case HFET2_WIDTH: W = value->rValue; here->HFET2widthGiven = TRUE; break; + case HFET2_M: + here->HFET2m = value->rValue; + here->HFET2mGiven = TRUE; + break; default: return(E_BADPARM); } diff --git a/src/spicelib/devices/hfet2/hfet2pzl.c b/src/spicelib/devices/hfet2/hfet2pzl.c new file mode 100644 index 000000000..6168f2122 --- /dev/null +++ b/src/spicelib/devices/hfet2/hfet2pzl.c @@ -0,0 +1,82 @@ +/********** +Author: 2003 Paolo Nenzi +**********/ +/* + */ + + +#include "ngspice.h" +#include "cktdefs.h" +#include "hfet2defs.h" +#include "sperror.h" +#include "suffix.h" + + +int HFET2pzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) +{ + + HFET2model *model = (HFET2model*)inModel; + HFET2instance *here; + double gdpr; + double gspr; + double gm; + double gds; + double ggs; + double xgs; + double ggd; + double xgd; + + double m; + + for( ; model != NULL; model = model->HFET2nextModel ) + { + for( here = model->HFET2instances; here != NULL; + here = here->HFET2nextInstance) { + + if (here->HFET2owner != ARCHme) continue; + + m = here->HFET2m; + + gdpr=model->HFET2drainConduct; + gspr=model->HFET2sourceConduct; + gm= *(ckt->CKTstate0 + here->HFET2gm) ; + gds= *(ckt->CKTstate0 + here->HFET2gds) ; + ggs= *(ckt->CKTstate0 + here->HFET2ggs) ; + xgs= *(ckt->CKTstate0 + here->HFET2qgs) ; + ggd= *(ckt->CKTstate0 + here->HFET2ggd) ; + xgd= *(ckt->CKTstate0 + here->HFET2qgd) ; + + *(here->HFET2drainDrainPtr ) += m * (gdpr); + *(here->HFET2gateGatePtr ) += m * (ggd+ggs); + *(here->HFET2gateGatePtr) += m * ((xgd+xgs) * s->real); + *(here->HFET2gateGatePtr +1) += m * ((xgd+xgs) * s->imag); + *(here->HFET2sourceSourcePtr ) += m * (gspr); + *(here->HFET2drainPrimeDrainPrimePtr ) += m * (gdpr+gds+ggd); + *(here->HFET2drainPrimeDrainPrimePtr) += m * (xgd * s->real); + *(here->HFET2drainPrimeDrainPrimePtr +1) += m * (xgd * s->imag); + *(here->HFET2sourcePriHFET2ourcePrimePtr ) += m * (gspr+gds+gm+ggs); + *(here->HFET2sourcePriHFET2ourcePrimePtr) += m * (xgs * s->real); + *(here->HFET2sourcePriHFET2ourcePrimePtr +1) += m * (xgs * s->imag); + *(here->HFET2drainDrainPrimePtr ) -= m * (gdpr); + *(here->HFET2gateDrainPrimePtr ) -= m * (ggd); + *(here->HFET2gateDrainPrimePtr) -= m * (xgd * s->real); + *(here->HFET2gateDrainPrimePtr +1) -= m * (xgd * s->imag); + *(here->HFET2gateSourcePrimePtr ) -= m * (ggs); + *(here->HFET2gateSourcePrimePtr) -= m * (xgs * s->real); + *(here->HFET2gateSourcePrimePtr +1) -= m * (xgs * s->imag); + *(here->HFET2sourceSourcePrimePtr ) -= m * (gspr); + *(here->HFET2drainPrimeDrainPtr ) -= m * (gdpr); + *(here->HFET2drainPrimeGatePtr ) += m * (-ggd+gm); + *(here->HFET2drainPrimeGatePtr) -= m * (xgd * s->real); + *(here->HFET2drainPrimeGatePtr +1) -= m * (xgd * s->imag); + *(here->HFET2drainPriHFET2ourcePrimePtr ) += m * (-gds-gm); + *(here->HFET2sourcePrimeGatePtr ) += m * (-ggs-gm); + *(here->HFET2sourcePrimeGatePtr) -= m * (xgs * s->real); + *(here->HFET2sourcePrimeGatePtr +1) -= m * (xgs * s->imag); + *(here->HFET2sourcePriHFET2ourcePtr ) -= m * (gspr); + *(here->HFET2sourcePrimeDrainPrimePtr ) -= m * (gds); + } + } + return(OK); + +} diff --git a/src/spicelib/devices/hfet2/hfet2setup.c b/src/spicelib/devices/hfet2/hfet2setup.c index 67d306231..8a0c0127c 100644 --- a/src/spicelib/devices/hfet2/hfet2setup.c +++ b/src/spicelib/devices/hfet2/hfet2setup.c @@ -1,6 +1,9 @@ +/********** +Imported from MacSpice3f4 - Antony Wilson +Modified: Paolo Nenzi +**********/ #include "ngspice.h" -#include #include "smpdefs.h" #include "cktdefs.h" #include "hfet2defs.h" @@ -9,11 +12,7 @@ #include "suffix.h" -int HFET2setup(matrix, inModel, ckt, states) -SMPmatrix *matrix; -GENmodel *inModel; -CKTcircuit *ckt; -int *states; +int HFET2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) { HFET2model *model = (HFET2model*)inModel; @@ -115,21 +114,25 @@ int *states; /* loop through all the instances of the model */ - for (here = model->HFET2instances; here != NULL; here=here->HFET2nextInstance) { + for (here = model->HFET2instances; here != NULL; + here=here->HFET2nextInstance) { CKTnode *tmpNode; IFuid tmpName; - + + if (here->HFET2owner != ARCHme) goto matrixpointers; + here->HFET2state = *states; *states += 13; if(!here->HFET2lengthGiven) - L = 1e-6; - if(!here->HFET2tempGiven) - TEMP = ckt->CKTtemp; + L = 1e-6; if(!here->HFET2widthGiven) W = 20e-6; - + if(!here->HFET2mGiven) + here->HFET2m = 1.0; + +matrixpointers: if(model->HFET2rs != 0 && here->HFET2sourcePrimeNode==0) { error = CKTmkVolt(ckt,&tmp,here->HFET2name,"source"); if(error) return(error); @@ -195,9 +198,7 @@ if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NULL){\ int -HFET2unsetup(inModel,ckt) - GENmodel *inModel; - CKTcircuit *ckt; +HFET2unsetup(GENmodel *inModel, CKTcircuit *ckt) { HFET2model *model; HFET2instance *here; @@ -220,14 +221,8 @@ HFET2unsetup(inModel,ckt) CKTdltNNum(ckt, here->HFET2sourcePrimeNode); here->HFET2sourcePrimeNode = 0; } - /*if (here->HFET2gateNode - && here->HFET2gateNode != here->HFET2gateNode) - { - CKTdltNNum(ckt, here->HFET2gateNode); - here->HFET2gateNode = 0; - }*/ } } return OK; -} \ No newline at end of file +} diff --git a/src/spicelib/devices/hfet2/hfet2temp.c b/src/spicelib/devices/hfet2/hfet2temp.c index e512a5713..5adabd463 100644 --- a/src/spicelib/devices/hfet2/hfet2temp.c +++ b/src/spicelib/devices/hfet2/hfet2temp.c @@ -1,6 +1,9 @@ +/********** +Imported from MacSpice3f4 - Antony Wilson +Modified: Paolo Nenzi +**********/ #include "ngspice.h" -#include #include "smpdefs.h" #include "cktdefs.h" #include "hfet2defs.h" @@ -16,6 +19,8 @@ CKTcircuit *ckt; HFET2instance *here; HFET2model *model = (HFET2model*)inModel; + double vt; + double tdiff; for( ; model != NULL; model = model->HFET2nextModel ) { if(model->HFET2rd != 0) @@ -31,9 +36,19 @@ CKTcircuit *ckt; if(!model->HFET2vt2Given) VT2 = VTO; DELTA2 = DELTA*DELTA; - for (here = model->HFET2instances; here != NULL; here=here->HFET2nextInstance) { - double vt = CONSTKoverQ*TEMP; - double tdiff = TEMP - ckt->CKTnomTemp; + for (here = model->HFET2instances; here != NULL; + here=here->HFET2nextInstance) { + + if (here->HFET2owner != ARCHme) continue; + + if(!here->HFET2dtempGiven) + here->HFET2dtemp = 0.0; + if(!here->HFET2tempGiven) + TEMP = ckt->CKTtemp + here->HFET2dtemp; + + vt = CONSTKoverQ*TEMP; + tdiff = TEMP - ckt->CKTnomTemp; + TLAMBDA = LAMBDA + KLAMBDA*tdiff; TMU = MU - KMU*tdiff; TNMAX = NMAX - KNMAX*tdiff; diff --git a/src/spicelib/devices/hfet2/hfet2trunc.c b/src/spicelib/devices/hfet2/hfet2trunc.c index ce74da535..c063ad175 100644 --- a/src/spicelib/devices/hfet2/hfet2trunc.c +++ b/src/spicelib/devices/hfet2/hfet2trunc.c @@ -17,7 +17,11 @@ double *tiHFET2tep; HFET2instance *here; for( ; model != NULL; model = model->HFET2nextModel) { - for(here=model->HFET2instances;here!=NULL;here = here->HFET2nextInstance){ + for(here=model->HFET2instances;here!=NULL; + here = here->HFET2nextInstance){ + + if (here->HFET2owner != ARCHme) continue; + CKTterr(here->HFET2qgs,ckt,tiHFET2tep); CKTterr(here->HFET2qgd,ckt,tiHFET2tep); }