Added "m" to mes device. Updated Documentation and added mes test file.

This commit is contained in:
pnenzi 2003-12-31 07:56:39 +00:00
parent 42edf017c8
commit 3329216be0
23 changed files with 176 additions and 200 deletions

View File

@ -1,6 +1,12 @@
2003-12-31 Paolo Nenzi <p.nenzi@ieee.org>
* src/spicelib/devices/mes/*: Added parallel multiplier.
* tests/mes, tests/mes/subth.cir: added test netlist for mes devices.
2003-12-30 Paolo Nenzi <p.nenzi@ieee.org>
* src/spicelibe/devices/hfet2/*: Added parallel multipler and "dtemp"
* src/spicelibe/devices/hfet2/*: Added parallel multiplier and "dtemp"
parameters. Added pole-zero analysis and parallel code switches.
* src/spicelib/devices/jfet/jfetpzld.c: gspr and gdpr were initialized

12
DEVICES
View File

@ -241,7 +241,17 @@ HFET2 - HFET Level 2 (Ytterdal)
***************************************************************************
MES - MESfet model
Initial release
Initial Release.
Ver: N/A
Class: Z
Level: 1
Status:
Enhancements over the original model:
- Parallel multiplier
- Alan Gillespie junction diodes implementation
MESA - MESA model
Initial release. TO BE TESTED

View File

@ -4,7 +4,6 @@ Author: 1987 Thomas L. Quarles
**********/
#include "ngspice.h"
#include <stdio.h>
#include "ifsim.h"
#include "devdefs.h"
#include "mesdefs.h"
@ -13,6 +12,7 @@ Author: 1987 Thomas L. Quarles
IFparm MESpTable[] = { /* parameters */
OPU("off", MES_OFF, IF_FLAG ,"Device initially off"),
IOPU("area", MES_AREA, IF_REAL ,"Area factor"),
IOPU("m", MES_AREA, IF_REAL ,"Parallel Multiplier"),
IOPAU("icvds", MES_IC_VDS, IF_REAL ,"Initial D-S voltage"),
IOPAU("icvgs", MES_IC_VGS, IF_REAL ,"Initial G-S voltage"),
OPU("dnode", MES_DRAINNODE, IF_INTEGER,"Number of drain node"),

View File

@ -6,7 +6,6 @@ Author: 1985 S. Hwang
*/
#include "ngspice.h"
#include <stdio.h>
#include "cktdefs.h"
#include "mesdefs.h"
#include "sperror.h"
@ -14,9 +13,7 @@ Author: 1985 S. Hwang
int
MESacLoad(inModel,ckt)
GENmodel *inModel;
CKTcircuit *ckt;
MESacLoad(GENmodel *inModel, CKTcircuit *ckt)
{
MESmodel *model = (MESmodel*)inModel;
MESinstance *here;
@ -29,12 +26,16 @@ MESacLoad(inModel,ckt)
double ggd;
double xgd;
double m;
for( ; model != NULL; model = model->MESnextModel ) {
for( here = model->MESinstances; here != NULL;
here = here->MESnextInstance) {
if (here->MESowner != ARCHme) continue;
m = here->MESm;
gdpr=model->MESdrainConduct * here->MESarea;
gspr=model->MESsourceConduct * here->MESarea;
gm= *(ckt->CKTstate0 + here->MESgm) ;
@ -43,28 +44,28 @@ MESacLoad(inModel,ckt)
xgs= *(ckt->CKTstate0 + here->MESqgs) * ckt->CKTomega ;
ggd= *(ckt->CKTstate0 + here->MESggd) ;
xgd= *(ckt->CKTstate0 + here->MESqgd) * ckt->CKTomega ;
*(here->MESdrainDrainPtr ) += gdpr;
*(here->MESgateGatePtr ) += ggd+ggs;
*(here->MESgateGatePtr +1) += xgd+xgs;
*(here->MESsourceSourcePtr ) += gspr;
*(here->MESdrainPrimeDrainPrimePtr ) += gdpr+gds+ggd;
*(here->MESdrainPrimeDrainPrimePtr +1) += xgd;
*(here->MESsourcePrimeSourcePrimePtr ) += gspr+gds+gm+ggs;
*(here->MESsourcePrimeSourcePrimePtr +1) += xgs;
*(here->MESdrainDrainPrimePtr ) -= gdpr;
*(here->MESgateDrainPrimePtr ) -= ggd;
*(here->MESgateDrainPrimePtr +1) -= xgd;
*(here->MESgateSourcePrimePtr ) -= ggs;
*(here->MESgateSourcePrimePtr +1) -= xgs;
*(here->MESsourceSourcePrimePtr ) -= gspr;
*(here->MESdrainPrimeDrainPtr ) -= gdpr;
*(here->MESdrainPrimeGatePtr ) += (-ggd+gm);
*(here->MESdrainPrimeGatePtr +1) -= xgd;
*(here->MESdrainPrimeSourcePrimePtr ) += (-gds-gm);
*(here->MESsourcePrimeGatePtr ) += (-ggs-gm);
*(here->MESsourcePrimeGatePtr +1) -= xgs;
*(here->MESsourcePrimeSourcePtr ) -= gspr;
*(here->MESsourcePrimeDrainPrimePtr ) -= gds;
*(here->MESdrainDrainPtr ) += m * (gdpr);
*(here->MESgateGatePtr ) += m * (ggd+ggs);
*(here->MESgateGatePtr +1) += m * (xgd+xgs);
*(here->MESsourceSourcePtr ) += m * (gspr);
*(here->MESdrainPrimeDrainPrimePtr ) += m * (gdpr+gds+ggd);
*(here->MESdrainPrimeDrainPrimePtr +1) += m * (xgd);
*(here->MESsourcePrimeSourcePrimePtr ) += m * (gspr+gds+gm+ggs);
*(here->MESsourcePrimeSourcePrimePtr +1) += m * (xgs);
*(here->MESdrainDrainPrimePtr ) -= m * (gdpr);
*(here->MESgateDrainPrimePtr ) -= m * (ggd);
*(here->MESgateDrainPrimePtr +1) -= m * (xgd);
*(here->MESgateSourcePrimePtr ) -= m * (ggs);
*(here->MESgateSourcePrimePtr +1) -= m * (xgs);
*(here->MESsourceSourcePrimePtr ) -= m * (gspr);
*(here->MESdrainPrimeDrainPtr ) -= m * (gdpr);
*(here->MESdrainPrimeGatePtr ) += m * (-ggd+gm);
*(here->MESdrainPrimeGatePtr +1) -= m * (xgd);
*(here->MESdrainPrimeSourcePrimePtr ) += m * (-gds-gm);
*(here->MESsourcePrimeGatePtr ) += m * (-ggs-gm);
*(here->MESsourcePrimeGatePtr +1) -= m * (xgs);
*(here->MESsourcePrimeSourcePtr ) -= m * (gspr);
*(here->MESsourcePrimeDrainPrimePtr ) -= m * (gds);
}
}

View File

@ -6,7 +6,6 @@ Author: 1987 Thomas L. Quarles
*/
#include "ngspice.h"
#include <stdio.h>
#include "cktdefs.h"
#include "devdefs.h"
#include "ifsim.h"
@ -17,18 +16,14 @@ Author: 1987 Thomas L. Quarles
/* ARGSUSED */
int
MESask(ckt,inst,which,value,select)
CKTcircuit *ckt;
GENinstance *inst;
int which;
IFvalue *value;
IFvalue *select;
MESask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue *select)
{
MESinstance *here = (MESinstance*)inst;
static char *msg = "Current and power not available in ac analysis";
switch(which) {
case MES_AREA:
value->rValue = here->MESarea;
value->rValue *= here->MESm;
return (OK);
case MES_IC_VDS:
value->rValue = here->MESicVDS;
@ -59,36 +54,47 @@ MESask(ckt,inst,which,value,select)
return (OK);
case MES_CG:
value->rValue = *(ckt->CKTstate0 + here->MEScg);
value->rValue *= here->MESm;
return (OK);
case MES_CD:
value->rValue = *(ckt->CKTstate0 + here->MEScd);
value->rValue *= here->MESm;
return (OK);
case MES_CGD:
value->rValue = *(ckt->CKTstate0 + here->MEScgd);
value->rValue *= here->MESm;
return (OK);
case MES_GM:
value->rValue = *(ckt->CKTstate0 + here->MESgm);
value->rValue *= here->MESm;
return (OK);
case MES_GDS:
value->rValue = *(ckt->CKTstate0 + here->MESgds);
value->rValue *= here->MESm;
return (OK);
case MES_GGS:
value->rValue = *(ckt->CKTstate0 + here->MESggs);
value->rValue *= here->MESm;
return (OK);
case MES_GGD:
value->rValue = *(ckt->CKTstate0 + here->MESggd);
value->rValue *= here->MESm;
return (OK);
case MES_QGS:
value->rValue = *(ckt->CKTstate0 + here->MESqgs);
value->rValue *= here->MESm;
return (OK);
case MES_CQGS:
value->rValue = *(ckt->CKTstate0 + here->MEScqgs);
value->rValue *= here->MESm;
return (OK);
case MES_QGD:
value->rValue = *(ckt->CKTstate0 + here->MESqgd);
value->rValue *= here->MESm;
return (OK);
case MES_CQGD:
value->rValue = *(ckt->CKTstate0 + here->MEScqgd);
value->rValue *= here->MESm;
return (OK);
case MES_CS :
if (ckt->CKTcurrentAnalysis & DOING_AC) {
@ -99,6 +105,7 @@ MESask(ckt,inst,which,value,select)
} else {
value->rValue = -*(ckt->CKTstate0 + here->MEScd);
value->rValue -= *(ckt->CKTstate0 + here->MEScg);
value->rValue *= here->MESm;
}
return(OK);
case MES_POWER :
@ -115,6 +122,7 @@ MESask(ckt,inst,which,value,select)
value->rValue -= (*(ckt->CKTstate0+here->MEScd) +
*(ckt->CKTstate0 + here->MEScg)) *
*(ckt->CKTrhsOld + here->MESsourceNode);
value->rValue *= here->MESm;
}
return(OK);
default:

View File

@ -33,6 +33,7 @@ typedef struct sMESinstance {
int MESsourcePrimeNode; /* number of internal source node of mesfet */
double MESarea; /* area factor for the mesfet */
double MESm; /* Parallel multiplier */
double MESicVDS; /* initial condition voltage D-S*/
double MESicVGS; /* initial condition voltage G-S*/
double *MESdrainDrainPrimePtr; /* pointer to sparse matrix at
@ -67,7 +68,8 @@ typedef struct sMESinstance {
* (source prime,source prime) */
int MESoff; /* 'off' flag for mesfet */
unsigned MESareaGiven : 1; /* flag to indicate area was specified */
unsigned MESareaGiven : 1; /* flag to indicate area was specified */
unsigned MESmGiven : 1; /* flag to indicate multiplier specified*/
unsigned MESicVDSGiven : 1; /* initial condition given flag for V D-S*/
unsigned MESicVGSGiven : 1; /* initial condition given flag for V G-S*/
@ -224,6 +226,7 @@ typedef struct sMESmodel { /* model structure for a mesfet */
#define MES_OFF 5
#define MES_CS 6
#define MES_POWER 7
#define MES_M 8
/* model parameters */
#define MES_MOD_VTO 101

View File

@ -6,17 +6,13 @@ Author: 1985 S. Hwang
*/
#include "ngspice.h"
#include <stdio.h>
#include "mesdefs.h"
#include "sperror.h"
#include "suffix.h"
int
MESdelete(inModel,name,inst)
GENmodel *inModel;
IFuid name;
GENinstance **inst;
MESdelete(GENmodel *inModel, IFuid name, GENinstance **inst)
{
MESmodel *model = (MESmodel*)inModel;
MESinstance **fast = (MESinstance**)inst;

View File

@ -6,14 +6,12 @@ Author: 1985 S. Hwang
*/
#include "ngspice.h"
#include <stdio.h>
#include "mesdefs.h"
#include "suffix.h"
void
MESdestroy(inModel)
GENmodel **inModel;
MESdestroy(GENmodel **inModel)
{
MESmodel **model = (MESmodel**)inModel;
MESinstance *here;

View File

@ -4,7 +4,6 @@ Author: 1988 Jaijeet S Roychowdhury
**********/
#include "ngspice.h"
#include <stdio.h>
#include "cktdefs.h"
#include "mesdefs.h"
#include "sperror.h"
@ -12,11 +11,7 @@ Author: 1988 Jaijeet S Roychowdhury
#include "suffix.h"
int
MESdisto(mode,genmodel,ckt)
GENmodel *genmodel;
CKTcircuit *ckt;
int mode;
MESdisto(int mode,GENmodel *genmodel, CKTcircuit *ckt)
/* assuming here that ckt->CKTomega has been initialised to
* the correct value
*/

View File

@ -4,7 +4,6 @@ Author: 1988 Jaijeet Roychowdhury
**********/
#include "ngspice.h"
#include <stdio.h>
#include "devdefs.h"
#include "cktdefs.h"
#include "mesdefs.h"
@ -14,9 +13,7 @@ Author: 1988 Jaijeet Roychowdhury
#include "suffix.h"
int
MESdSetup(inModel,ckt)
GENmodel *inModel;
CKTcircuit *ckt;
MESdSetup(GENmodel *inModel, CKTcircuit *ckt)
/* actually load the current resistance value into the
* sparse matrix previously provided
*/
@ -68,10 +65,10 @@ MESdSetup(inModel,ckt)
/*
* dc model parameters
*/
beta = model->MESbeta * here->MESarea;
gdpr = model->MESdrainConduct * here->MESarea;
gspr = model->MESsourceConduct * here->MESarea;
csat = model->MESgateSatCurrent * here->MESarea;
beta = model->MESbeta * here->MESm * here->MESarea;
gdpr = model->MESdrainConduct * here->MESm * here->MESarea;
gspr = model->MESsourceConduct * here->MESm * here->MESarea;
csat = model->MESgateSatCurrent * here->MESm * here->MESarea;
vcrit = model->MESvcrit;
vto = model->MESthreshold;
/*
@ -229,8 +226,8 @@ d_p.d3_pqr = 0.0;
* charge storage elements
*/
{ /* code block */
czgs = model->MEScapGS * here->MESarea;
czgd = model->MEScapGD * here->MESarea;
czgs = model->MEScapGS * here->MESm * here->MESarea;
czgd = model->MEScapGD * here->MESm * here->MESarea;
phib = model->MESgatePotential;
vcap = 1 / model->MESalpha;

View File

@ -4,7 +4,6 @@ Author: 1985 S. Hwang
Modified: 2000 AlansFixes
**********/
#ifdef __STDC__
extern int MESacLoad(GENmodel*,CKTcircuit*);
extern int MESask(CKTcircuit*,GENinstance*,int,IFvalue*,IFvalue*);
extern int MESdelete(GENmodel*,IFuid,GENinstance**);
@ -22,25 +21,5 @@ extern int MEStemp(GENmodel*,CKTcircuit*);
extern int MEStrunc(GENmodel*,CKTcircuit*,double*);
extern int MESdisto(int,GENmodel*,CKTcircuit*);
extern int MESnoise(int,int,GENmodel*,CKTcircuit*,Ndata*,double*);
extern int MESdSetup(GENmodel*,CKTcircuit*);
#else /* stdc */
extern int MESacLoad();
extern int MESask();
extern int MESdelete();
extern void MESdestroy();
extern int MESgetic();
extern int MESload();
extern int MESmAsk();
extern int MESmDelete();
extern int MESmParam();
extern int MESparam();
extern int MESpzLoad();
extern int MESsetup();
extern int MESunsetup();
extern int MEStemp();
extern int MEStrunc();
extern int MESdisto();
extern int MESnoise();
#endif /* stdc */

View File

@ -6,7 +6,6 @@ Author: 1985 S. Hwang
*/
#include "ngspice.h"
#include <stdio.h>
#include "cktdefs.h"
#include "mesdefs.h"
#include "sperror.h"
@ -14,9 +13,7 @@ Author: 1985 S. Hwang
int
MESgetic(inModel,ckt)
GENmodel *inModel;
CKTcircuit *ckt;
MESgetic(GENmodel *inModel, CKTcircuit *ckt)
{
MESmodel *model = (MESmodel*)inModel;
MESinstance *here;

View File

@ -5,7 +5,6 @@ Modified: 2000 AlansFixes
**********/
#include "ngspice.h"
#include <stdio.h>
#include "devdefs.h"
#include "cktdefs.h"
#include "mesdefs.h"
@ -15,17 +14,12 @@ Modified: 2000 AlansFixes
#include "suffix.h"
/* forward declaraction of our helper function */
#ifdef __STDC__
static double qggnew(double,double,double,double,double,double,double,
double*,double*);
#else /* stdc */
static double qggnew();
#endif /* stdc */
int
MESload(inModel,ckt)
GENmodel *inModel;
CKTcircuit *ckt;
MESload(GENmodel *inModel, CKTcircuit *ckt)
/* actually load the current resistance value into the
* sparse matrix previously provided
*/
@ -86,6 +80,8 @@ MESload(inModel,ckt)
int ichk1;
int error;
double m;
/* loop through all the models */
for( ; model != NULL; model = model->MESnextModel ) {
@ -429,32 +425,35 @@ MESload(inModel,ckt)
* load current vector
*/
load:
m = here->MESm;
ceqgd=model->MEStype*(cgd-ggd*vgd);
ceqgs=model->MEStype*((cg-cgd)-ggs*vgs);
cdreq=model->MEStype*((cd+cgd)-gds*vds-gm*vgs);
*(ckt->CKTrhs + here->MESgateNode) += (-ceqgs-ceqgd);
*(ckt->CKTrhs + here->MESgateNode) += m * (-ceqgs-ceqgd);
*(ckt->CKTrhs + here->MESdrainPrimeNode) +=
(-cdreq+ceqgd);
m * (-cdreq+ceqgd);
*(ckt->CKTrhs + here->MESsourcePrimeNode) +=
(cdreq+ceqgs);
m * (cdreq+ceqgs);
/*
* load y matrix
*/
*(here->MESdrainDrainPrimePtr) += (-gdpr);
*(here->MESgateDrainPrimePtr) += (-ggd);
*(here->MESgateSourcePrimePtr) += (-ggs);
*(here->MESsourceSourcePrimePtr) += (-gspr);
*(here->MESdrainPrimeDrainPtr) += (-gdpr);
*(here->MESdrainPrimeGatePtr) += (gm-ggd);
*(here->MESdrainPrimeSourcePrimePtr) += (-gds-gm);
*(here->MESsourcePrimeGatePtr) += (-ggs-gm);
*(here->MESsourcePrimeSourcePtr) += (-gspr);
*(here->MESsourcePrimeDrainPrimePtr) += (-gds);
*(here->MESdrainDrainPtr) += (gdpr);
*(here->MESgateGatePtr) += (ggd+ggs);
*(here->MESsourceSourcePtr) += (gspr);
*(here->MESdrainPrimeDrainPrimePtr) += (gdpr+gds+ggd);
*(here->MESsourcePrimeSourcePrimePtr) += (gspr+gds+gm+ggs);
*(here->MESdrainDrainPrimePtr) += m * (-gdpr);
*(here->MESgateDrainPrimePtr) += m * (-ggd);
*(here->MESgateSourcePrimePtr) += m * (-ggs);
*(here->MESsourceSourcePrimePtr) += m * (-gspr);
*(here->MESdrainPrimeDrainPtr) += m * (-gdpr);
*(here->MESdrainPrimeGatePtr) += m * (gm-ggd);
*(here->MESdrainPrimeSourcePrimePtr) += m * (-gds-gm);
*(here->MESsourcePrimeGatePtr) += m * (-ggs-gm);
*(here->MESsourcePrimeSourcePtr) += m * (-gspr);
*(here->MESsourcePrimeDrainPrimePtr) += m * (-gds);
*(here->MESdrainDrainPtr) += m * (gdpr);
*(here->MESgateGatePtr) += m * (ggd+ggs);
*(here->MESsourceSourcePtr) += m * (gspr);
*(here->MESdrainPrimeDrainPrimePtr) += m * (gdpr+gds+ggd);
*(here->MESsourcePrimeSourcePrimePtr) += m * (gspr+gds+gm+ggs);
}
}
return(OK);

View File

@ -6,7 +6,6 @@ Author: 1987 Thomas L. Quarles
*/
#include "ngspice.h"
#include <stdio.h>
#include "cktdefs.h"
#include "devdefs.h"
#include "ifsim.h"
@ -17,11 +16,7 @@ Author: 1987 Thomas L. Quarles
/* ARGSUSED */
int
MESmAsk(ckt,inst,which,value)
CKTcircuit *ckt;
GENmodel *inst;
int which;
IFvalue *value;
MESmAsk(CKTcircuit *ckt, GENmodel *inst, int which, IFvalue *value)
{
MESmodel *here = (MESmodel*)inst;
switch(which) {

View File

@ -6,17 +6,13 @@ Author: 1985 S. Hwang
*/
#include "ngspice.h"
#include <stdio.h>
#include "mesdefs.h"
#include "sperror.h"
#include "suffix.h"
int
MESmDelete(inModel,modname,kill)
GENmodel **inModel;
IFuid modname;
GENmodel *kill;
MESmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{
MESmodel **model = (MESmodel**)inModel;
MESmodel *modfast = (MESmodel*)kill;

View File

@ -6,7 +6,6 @@ Author: 1985 S. Hwang
*/
#include "ngspice.h"
#include <stdio.h>
#include "ifsim.h"
#include "mesdefs.h"
#include "sperror.h"
@ -14,10 +13,7 @@ Author: 1985 S. Hwang
int
MESmParam(param,value,inModel)
int param;
IFvalue *value;
GENmodel *inModel;
MESmParam(int param, IFvalue *value, GENmodel *inModel)
{
MESmodel *model = (MESmodel*)inModel;
switch(param) {

View File

@ -4,7 +4,6 @@ Author: 1987 Gary W. Ng
**********/
#include "ngspice.h"
#include <stdio.h>
#include "mesdefs.h"
#include "cktdefs.h"
#include "iferrmsg.h"
@ -24,13 +23,8 @@ extern void NevalSrc();
extern double Nintegrate();
int
MESnoise (mode, operation, genmodel, ckt, data, OnDens)
int mode;
int operation;
GENmodel *genmodel;
CKTcircuit *ckt;
Ndata *data;
double *OnDens;
MESnoise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, Ndata *data,
double *OnDens)
{
MESmodel *firstModel = (MESmodel *) genmodel;
MESmodel *model;
@ -122,21 +116,21 @@ if (!data->namelist) return(E_NOMEM);
case N_DENS:
NevalSrc(&noizDens[MESRDNOIZ],&lnNdens[MESRDNOIZ],
ckt,THERMNOISE,inst->MESdrainPrimeNode,inst->MESdrainNode,
model->MESdrainConduct * inst->MESarea);
model->MESdrainConduct * inst->MESarea * inst->MESm);
NevalSrc(&noizDens[MESRSNOIZ],&lnNdens[MESRSNOIZ],
ckt,THERMNOISE,inst->MESsourcePrimeNode,inst->MESsourceNode,
model->MESsourceConduct * inst->MESarea);
model->MESsourceConduct * inst->MESarea * inst->MESm);
NevalSrc(&noizDens[MESIDNOIZ],&lnNdens[MESIDNOIZ],
ckt,THERMNOISE,inst->MESdrainPrimeNode,
inst->MESsourcePrimeNode,
(2.0/3.0 * fabs(*(ckt->CKTstate0 + inst->MESgm))));
(2.0/3.0 * inst->MESm * fabs(*(ckt->CKTstate0 + inst->MESgm))));
NevalSrc(&noizDens[MESFLNOIZ],(double*)NULL,ckt,
N_GAIN,inst->MESdrainPrimeNode, inst->MESsourcePrimeNode,
(double)0.0);
noizDens[MESFLNOIZ] *= model->MESfNcoef *
noizDens[MESFLNOIZ] *= inst->MESm * model->MESfNcoef *
exp(model->MESfNexp *
log(MAX(fabs(*(ckt->CKTstate0 + inst->MEScd)),N_MINLOG))) /
data->freq;

View File

@ -6,7 +6,6 @@ Author: 1985 S. Hwang
*/
#include "ngspice.h"
#include <stdio.h>
#include "ifsim.h"
#include "mesdefs.h"
#include "sperror.h"
@ -15,11 +14,7 @@ Author: 1985 S. Hwang
/* ARGSUSED */
int
MESparam(param,value,inst,select)
int param;
IFvalue *value;
GENinstance *inst;
IFvalue *select;
MESparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
{
MESinstance *here = (MESinstance*)inst;
switch(param) {
@ -27,6 +22,10 @@ MESparam(param,value,inst,select)
here->MESarea = value->rValue;
here->MESareaGiven = TRUE;
break;
case MES_M:
here->MESm = value->rValue;
here->MESmGiven = TRUE;
break;
case MES_IC_VDS:
here->MESicVDS = value->rValue;
here->MESicVDSGiven = TRUE;

View File

@ -6,7 +6,6 @@ Author: 1985 S. Hwang
*/
#include "ngspice.h"
#include <stdio.h>
#include "cktdefs.h"
#include "mesdefs.h"
#include "sperror.h"
@ -15,10 +14,7 @@ Author: 1985 S. Hwang
int
MESpzLoad(inModel,ckt,s)
GENmodel *inModel;
CKTcircuit *ckt;
SPcomplex *s;
MESpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s)
{
MESmodel *model = (MESmodel*)inModel;
MESinstance *here;
@ -31,12 +27,16 @@ MESpzLoad(inModel,ckt,s)
double ggd;
double xgd;
double m;
for( ; model != NULL; model = model->MESnextModel ) {
for( here = model->MESinstances; here != NULL;
here = here->MESnextInstance) {
if (here->MESowner != ARCHme) continue;
m = here->MESm;
gdpr=model->MESdrainConduct * here->MESarea;
gspr=model->MESsourceConduct * here->MESarea;
gm= *(ckt->CKTstate0 + here->MESgm) ;
@ -45,35 +45,36 @@ MESpzLoad(inModel,ckt,s)
xgs= *(ckt->CKTstate0 + here->MESqgs) ;
ggd= *(ckt->CKTstate0 + here->MESggd) ;
xgd= *(ckt->CKTstate0 + here->MESqgd) ;
*(here->MESdrainDrainPtr ) += gdpr;
*(here->MESgateGatePtr ) += ggd+ggs;
*(here->MESgateGatePtr ) += (xgd+xgs)*s->real;
*(here->MESgateGatePtr +1) += (xgd+xgs)*s->imag;
*(here->MESsourceSourcePtr ) += gspr;
*(here->MESdrainPrimeDrainPrimePtr ) += gdpr+gds+ggd;
*(here->MESdrainPrimeDrainPrimePtr ) += xgd*s->real;
*(here->MESdrainPrimeDrainPrimePtr +1) += xgd*s->imag;
*(here->MESsourcePrimeSourcePrimePtr ) += gspr+gds+gm+ggs;
*(here->MESsourcePrimeSourcePrimePtr ) += xgs*s->real;
*(here->MESsourcePrimeSourcePrimePtr +1) += xgs*s->imag;
*(here->MESdrainDrainPrimePtr ) -= gdpr;
*(here->MESgateDrainPrimePtr ) -= ggd;
*(here->MESgateDrainPrimePtr ) -= xgd*s->real;
*(here->MESgateDrainPrimePtr +1) -= xgd*s->imag;
*(here->MESgateSourcePrimePtr ) -= ggs;
*(here->MESgateSourcePrimePtr ) -= xgs*s->real;
*(here->MESgateSourcePrimePtr +1) -= xgs*s->imag;
*(here->MESsourceSourcePrimePtr ) -= gspr;
*(here->MESdrainPrimeDrainPtr ) -= gdpr;
*(here->MESdrainPrimeGatePtr ) += (-ggd+gm);
*(here->MESdrainPrimeGatePtr ) -= xgd*s->real;
*(here->MESdrainPrimeGatePtr +1) -= xgd*s->imag;
*(here->MESdrainPrimeSourcePrimePtr ) += (-gds-gm);
*(here->MESsourcePrimeGatePtr ) += (-ggs-gm);
*(here->MESsourcePrimeGatePtr ) -= xgs*s->real;
*(here->MESsourcePrimeGatePtr +1) -= xgs*s->imag;
*(here->MESsourcePrimeSourcePtr ) -= gspr;
*(here->MESsourcePrimeDrainPrimePtr ) -= gds;
*(here->MESdrainDrainPtr ) += m * gdpr;
*(here->MESgateGatePtr ) += m * ggd+ggs;
*(here->MESgateGatePtr ) += m * (xgd+xgs)*s->real;
*(here->MESgateGatePtr +1) += m * (xgd+xgs)*s->imag;
*(here->MESsourceSourcePtr ) += m * gspr;
*(here->MESdrainPrimeDrainPrimePtr ) += m * gdpr+gds+ggd;
*(here->MESdrainPrimeDrainPrimePtr ) += m * xgd*s->real;
*(here->MESdrainPrimeDrainPrimePtr +1) += m * xgd*s->imag;
*(here->MESsourcePrimeSourcePrimePtr ) += m * gspr+gds+gm+ggs;
*(here->MESsourcePrimeSourcePrimePtr ) += m * xgs*s->real;
*(here->MESsourcePrimeSourcePrimePtr +1) += m * xgs*s->imag;
*(here->MESdrainDrainPrimePtr ) -= m * gdpr;
*(here->MESgateDrainPrimePtr ) -= m * ggd;
*(here->MESgateDrainPrimePtr ) -= m * xgd*s->real;
*(here->MESgateDrainPrimePtr +1) -= m * xgd*s->imag;
*(here->MESgateSourcePrimePtr ) -= m * ggs;
*(here->MESgateSourcePrimePtr ) -= m * xgs*s->real;
*(here->MESgateSourcePrimePtr +1) -= m * xgs*s->imag;
*(here->MESsourceSourcePrimePtr ) -= m * gspr;
*(here->MESdrainPrimeDrainPtr ) -= m * gdpr;
*(here->MESdrainPrimeGatePtr ) += m * (-ggd+gm);
*(here->MESdrainPrimeGatePtr ) -= m * xgd*s->real;
*(here->MESdrainPrimeGatePtr +1) -= m * xgd*s->imag;
*(here->MESdrainPrimeSourcePrimePtr ) += m * (-gds-gm);
*(here->MESsourcePrimeGatePtr ) += m * (-ggs-gm);
*(here->MESsourcePrimeGatePtr ) -= m * xgs*s->real;
*(here->MESsourcePrimeGatePtr +1) -= m * xgs*s->imag;
*(here->MESsourcePrimeSourcePtr ) -= m * gspr;
*(here->MESsourcePrimeDrainPrimePtr ) -= m * gds;
}
}

View File

@ -5,7 +5,6 @@ Modified: 2000 AlansFixes
**********/
#include "ngspice.h"
#include <stdio.h>
#include "smpdefs.h"
#include "cktdefs.h"
#include "mesdefs.h"
@ -14,11 +13,7 @@ Modified: 2000 AlansFixes
#include "suffix.h"
int
MESsetup(matrix,inModel,ckt,states)
SMPmatrix *matrix;
GENmodel *inModel;
CKTcircuit *ckt;
int *states;
MESsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
/* load the diode structure with those pointers needed later
* for fast matrix loading
*/
@ -83,7 +78,10 @@ MESsetup(matrix,inModel,ckt,states)
if (here->MESowner != ARCHme) goto matrixpointers;
if(!here->MESareaGiven) {
here->MESarea = 1;
here->MESarea = 1.0;
}
if(!here->MESmGiven) {
here->MESm = 1.0;
}
here->MESstate = *states;
*states += MESnumStates;
@ -163,9 +161,7 @@ if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NULL){\
}
int
MESunsetup(inModel,ckt)
GENmodel *inModel;
CKTcircuit *ckt;
MESunsetup(GENmodel *inModel, CKTcircuit *ckt)
{
MESmodel *model;
MESinstance *here;

View File

@ -4,7 +4,6 @@ Author: 1985 S. Hwang
**********/
#include "ngspice.h"
#include <stdio.h>
#include "smpdefs.h"
#include "cktdefs.h"
#include "mesdefs.h"
@ -14,10 +13,8 @@ Author: 1985 S. Hwang
/* ARGSUSED */
int
MEStemp(inModel,ckt)
GENmodel *inModel;
CKTcircuit *ckt;
/* load the diode structure with those pointers needed later
MEStemp(GENmodel *inModel, CKTcircuit *ckt)
/* load the mes structure with those pointers needed later
* for fast matrix loading
*/
{

View File

@ -6,7 +6,6 @@ Author: 1985 S. Hwang
*/
#include "ngspice.h"
#include <stdio.h>
#include "cktdefs.h"
#include "mesdefs.h"
#include "sperror.h"
@ -14,10 +13,7 @@ Author: 1985 S. Hwang
int
MEStrunc(inModel,ckt,timeStep)
GENmodel *inModel;
CKTcircuit *ckt;
double *timeStep;
MEStrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep)
{
MESmodel *model = (MESmodel*)inModel;
MESinstance *here;

17
tests/mes/subth.cir Normal file
View File

@ -0,0 +1,17 @@
Mesfet subthreshold characteristics
Vds 1 0
vids 1 2 dc 0
Vgs 3 0 dc 0
z1 2 3 0 mesmod area=1.4
.model mesmod nmf level=1 rd=46 rs=46 vt0=-1.3
+ lambda=0.03 alpha=3 beta=1.4e-3
* z1 2 3 0 lev2 l=1u w=20u
* .model lev2 nmf level=2 d=0.12u mu=0.23 vs=1.8e5
*+ m=3.3 vto=-1.3 eta=1.82 lambda=0.044 sigma0=0.09
*+ vsigma=0.1 vsigmat=0.9 rdi=46 rsi=46 delta=5
*+ nd=2.1e23
.end