sensitivity, use numStates and numSenStates instead of hardcoded literals
This commit is contained in:
parent
dfbce23cae
commit
b045c945c9
|
|
@ -371,7 +371,7 @@ BJTsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
|
||||||
here->BJTstate = *states;
|
here->BJTstate = *states;
|
||||||
*states += BJTnumStates;
|
*states += BJTnumStates;
|
||||||
if(ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & TRANSEN) ){
|
if(ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & TRANSEN) ){
|
||||||
*states += 8 * (ckt->CKTsenInfo->SENparms);
|
*states += BJTnumSenStates * (ckt->CKTsenInfo->SENparms);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(model->BJTcollectorResist == 0) {
|
if(model->BJTcollectorResist == 0) {
|
||||||
|
|
|
||||||
|
|
@ -75,9 +75,14 @@ typedef struct sCAPinstance {
|
||||||
|
|
||||||
#define CAPqcap CAPstate /* charge on the capacitor */
|
#define CAPqcap CAPstate /* charge on the capacitor */
|
||||||
#define CAPccap CAPstate+1 /* current through the capacitor */
|
#define CAPccap CAPstate+1 /* current through the capacitor */
|
||||||
|
|
||||||
|
#define CAPnumStates 2
|
||||||
|
|
||||||
#define CAPsensxp CAPstate+2 /* charge sensitivities and their derivatives.
|
#define CAPsensxp CAPstate+2 /* charge sensitivities and their derivatives.
|
||||||
+3 for the derivatives - pointer to the
|
* +3 for the derivatives - pointer to the
|
||||||
beginning of the array */
|
* beginning of the array */
|
||||||
|
|
||||||
|
#define CAPnumSenStates 2
|
||||||
|
|
||||||
#ifdef USE_CUSPICE
|
#ifdef USE_CUSPICE
|
||||||
typedef struct sCAPparamCPUstruct {
|
typedef struct sCAPparamCPUstruct {
|
||||||
|
|
|
||||||
|
|
@ -103,9 +103,9 @@ CAPsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
|
||||||
}
|
}
|
||||||
|
|
||||||
here->CAPqcap = *states;
|
here->CAPqcap = *states;
|
||||||
*states += 2;
|
*states += CAPnumStates;
|
||||||
if(ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & TRANSEN) ){
|
if(ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & TRANSEN) ){
|
||||||
*states += 2 * (ckt->CKTsenInfo->SENparms);
|
*states += CAPnumSenStates * (ckt->CKTsenInfo->SENparms);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* macro to make elements with built in test for out of memory */
|
/* macro to make elements with built in test for out of memory */
|
||||||
|
|
|
||||||
|
|
@ -169,10 +169,15 @@ typedef struct sDIOinstance {
|
||||||
#define DIOconduct DIOstate+2
|
#define DIOconduct DIOstate+2
|
||||||
#define DIOcapCharge DIOstate+3
|
#define DIOcapCharge DIOstate+3
|
||||||
#define DIOcapCurrent DIOstate+4
|
#define DIOcapCurrent DIOstate+4
|
||||||
|
|
||||||
|
#define DIOnumStates 5
|
||||||
|
|
||||||
#define DIOsensxp DIOstate+5 /* charge sensitivities and their derivatives.
|
#define DIOsensxp DIOstate+5 /* charge sensitivities and their derivatives.
|
||||||
* +6 for the derivatives - pointer to the
|
* +6 for the derivatives - pointer to the
|
||||||
* beginning of the array */
|
* beginning of the array */
|
||||||
|
|
||||||
|
#define DIOnumSenStates 2
|
||||||
|
|
||||||
|
|
||||||
/* per model data */
|
/* per model data */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -201,9 +201,9 @@ DIOsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
|
||||||
here->DIOjunctionSWCap = model->DIOjunctionSWCap * here->DIOpj;
|
here->DIOjunctionSWCap = model->DIOjunctionSWCap * here->DIOpj;
|
||||||
|
|
||||||
here->DIOstate = *states;
|
here->DIOstate = *states;
|
||||||
*states += 5;
|
*states += DIOnumStates;
|
||||||
if(ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & TRANSEN) ){
|
if(ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & TRANSEN) ){
|
||||||
*states += 2 * (ckt->CKTsenInfo->SENparms);
|
*states += DIOnumSenStates * (ckt->CKTsenInfo->SENparms);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(model->DIOresist == 0) {
|
if(model->DIOresist == 0) {
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,6 @@ Modified: Paolo Nenzi
|
||||||
#include "ngspice/complex.h"
|
#include "ngspice/complex.h"
|
||||||
#include "ngspice/noisedef.h"
|
#include "ngspice/noisedef.h"
|
||||||
|
|
||||||
#define HFETAnumStates 24
|
|
||||||
|
|
||||||
typedef struct sHFETAinstance {
|
typedef struct sHFETAinstance {
|
||||||
|
|
||||||
struct GENinstance gen;
|
struct GENinstance gen;
|
||||||
|
|
@ -97,6 +95,8 @@ typedef struct sHFETAinstance {
|
||||||
#define HFETAgmg HFETAstate+22
|
#define HFETAgmg HFETAstate+22
|
||||||
#define HFETAgmd HFETAstate+23
|
#define HFETAgmd HFETAstate+23
|
||||||
|
|
||||||
|
#define HFETAnumStates 24
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int HFETAoff;
|
int HFETAoff;
|
||||||
|
|
|
||||||
|
|
@ -249,7 +249,6 @@ HFETAsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
|
||||||
}
|
}
|
||||||
|
|
||||||
here->HFETAstate = *states;
|
here->HFETAstate = *states;
|
||||||
/* *states += 24; */
|
|
||||||
*states += HFETAnumStates;
|
*states += HFETAnumStates;
|
||||||
|
|
||||||
if(model->HFETArs != 0) {
|
if(model->HFETArs != 0) {
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,8 @@ typedef struct sHFET2instance {
|
||||||
#define HFET2qgd HFET2state+11
|
#define HFET2qgd HFET2state+11
|
||||||
#define HFET2cqgd HFET2state+12
|
#define HFET2cqgd HFET2state+12
|
||||||
|
|
||||||
|
#define HFET2numStates 13
|
||||||
|
|
||||||
int HFET2mode;
|
int HFET2mode;
|
||||||
int HFET2off;
|
int HFET2off;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ int HFET2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *state
|
||||||
IFuid tmpName;
|
IFuid tmpName;
|
||||||
|
|
||||||
here->HFET2state = *states;
|
here->HFET2state = *states;
|
||||||
*states += 13;
|
*states += HFET2numStates;
|
||||||
|
|
||||||
if(!here->HFET2lengthGiven)
|
if(!here->HFET2lengthGiven)
|
||||||
L = 1e-6;
|
L = 1e-6;
|
||||||
|
|
|
||||||
|
|
@ -89,10 +89,15 @@ struct sINDinstance {
|
||||||
|
|
||||||
#define INDflux INDstate /* flux in the inductor */
|
#define INDflux INDstate /* flux in the inductor */
|
||||||
#define INDvolt INDstate+1 /* voltage - save an entry in table */
|
#define INDvolt INDstate+1 /* voltage - save an entry in table */
|
||||||
|
|
||||||
|
#define INDnumStates 2
|
||||||
|
|
||||||
#define INDsensxp INDstate+2 /* charge sensitivities and their derivatives.
|
#define INDsensxp INDstate+2 /* charge sensitivities and their derivatives.
|
||||||
* +3 for the derivatives - pointer to the
|
* +3 for the derivatives - pointer to the
|
||||||
* beginning of the array */
|
* beginning of the array */
|
||||||
|
|
||||||
|
#define INDnumSenStates 2
|
||||||
|
|
||||||
#ifdef USE_CUSPICE
|
#ifdef USE_CUSPICE
|
||||||
typedef struct sINDparamCPUstruct {
|
typedef struct sINDparamCPUstruct {
|
||||||
double *INDcpuPointersD [4];
|
double *INDcpuPointersD [4];
|
||||||
|
|
|
||||||
|
|
@ -80,9 +80,9 @@ INDsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
|
||||||
here=INDnextInstance(here)) {
|
here=INDnextInstance(here)) {
|
||||||
|
|
||||||
here->INDflux = *states;
|
here->INDflux = *states;
|
||||||
*states += 2 ;
|
*states += INDnumStates ;
|
||||||
if(ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & TRANSEN) ){
|
if(ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & TRANSEN) ){
|
||||||
*states += 2 * (ckt->CKTsenInfo->SENparms);
|
*states += INDnumSenStates * (ckt->CKTsenInfo->SENparms);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(here->INDbrEq == 0) {
|
if(here->INDbrEq == 0) {
|
||||||
|
|
|
||||||
|
|
@ -186,6 +186,8 @@ typedef struct sJFETinstance {
|
||||||
#define JFETqgd JFETstate+11
|
#define JFETqgd JFETstate+11
|
||||||
#define JFETcqgd JFETstate+12
|
#define JFETcqgd JFETstate+12
|
||||||
|
|
||||||
|
#define JFETnumStates 13
|
||||||
|
|
||||||
/* per model data */
|
/* per model data */
|
||||||
|
|
||||||
typedef struct sJFETmodel { /* model structure for a jfet */
|
typedef struct sJFETmodel { /* model structure for a jfet */
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ JFETsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
|
||||||
here->JFETm = 1;
|
here->JFETm = 1;
|
||||||
}
|
}
|
||||||
here->JFETstate = *states;
|
here->JFETstate = *states;
|
||||||
*states += 13;
|
*states += JFETnumStates;
|
||||||
|
|
||||||
if(model->JFETsourceResist != 0) {
|
if(model->JFETsourceResist != 0) {
|
||||||
if(here->JFETsourcePrimeNode == 0) {
|
if(here->JFETsourcePrimeNode == 0) {
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,9 @@ typedef struct sJFET2instance {
|
||||||
#define JFET2pave JFET2state+15
|
#define JFET2pave JFET2state+15
|
||||||
#define JFET2vtrap JFET2state+16
|
#define JFET2vtrap JFET2state+16
|
||||||
#define JFET2vgstrap JFET2state+17
|
#define JFET2vgstrap JFET2state+17
|
||||||
#define JFET2_STATE_COUNT 18
|
#define JFET2unknown JFET2state+18
|
||||||
|
|
||||||
|
#define JFET2numStates 19
|
||||||
|
|
||||||
/* per model data */
|
/* per model data */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ JFET2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
|
||||||
}
|
}
|
||||||
|
|
||||||
here->JFET2state = *states;
|
here->JFET2state = *states;
|
||||||
*states += JFET2_STATE_COUNT + 1;
|
*states += JFET2numStates;
|
||||||
|
|
||||||
if(model->JFET2rs != 0) {
|
if(model->JFET2rs != 0) {
|
||||||
if(here->JFET2sourcePrimeNode == 0) {
|
if(here->JFET2sourcePrimeNode == 0) {
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,8 @@ typedef struct sMESAinstance {
|
||||||
#define MESAggdpp MESAstate+18
|
#define MESAggdpp MESAstate+18
|
||||||
#define MESAcgdpp MESAstate+19
|
#define MESAcgdpp MESAstate+19
|
||||||
|
|
||||||
|
#define MESAnumStates 20
|
||||||
|
|
||||||
int MESAoff;
|
int MESAoff;
|
||||||
unsigned MESAlengthGiven : 1;
|
unsigned MESAlengthGiven : 1;
|
||||||
unsigned MESAwidthGiven : 1;
|
unsigned MESAwidthGiven : 1;
|
||||||
|
|
|
||||||
|
|
@ -257,7 +257,7 @@ MESAsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
|
||||||
|
|
||||||
|
|
||||||
here->MESAstate = *states;
|
here->MESAstate = *states;
|
||||||
*states += 20;
|
*states += MESAnumStates;
|
||||||
|
|
||||||
if(model->MESAsourceResist != 0) {
|
if(model->MESAsourceResist != 0) {
|
||||||
if(here->MESAsourcePrimeNode == 0) {
|
if(here->MESAsourcePrimeNode == 0) {
|
||||||
|
|
|
||||||
|
|
@ -318,9 +318,9 @@ typedef struct sMOS1instance {
|
||||||
|
|
||||||
#define MOS1numStates 17
|
#define MOS1numStates 17
|
||||||
|
|
||||||
#define MOS1sensxpgs MOS1states+17 /* charge sensitivities and
|
#define MOS1sensxpgs MOS1states+17 /* charge sensitivities and their derivatives.
|
||||||
their derivatives. +18 for the derivatives:
|
* +18 for the derivatives
|
||||||
pointer to the beginning of the array */
|
* pointer to the beginning of the array */
|
||||||
#define MOS1sensxpgd MOS1states+19
|
#define MOS1sensxpgd MOS1states+19
|
||||||
#define MOS1sensxpgb MOS1states+21
|
#define MOS1sensxpgb MOS1states+21
|
||||||
#define MOS1sensxpbs MOS1states+23
|
#define MOS1sensxpbs MOS1states+23
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ MOS1setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt,
|
||||||
*states += MOS1numStates;
|
*states += MOS1numStates;
|
||||||
|
|
||||||
if(ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & TRANSEN) ){
|
if(ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & TRANSEN) ){
|
||||||
*states += 10 * (ckt->CKTsenInfo->SENparms);
|
*states += MOS1numSenStates * (ckt->CKTsenInfo->SENparms);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!here->MOS1drainPerimiterGiven) {
|
if(!here->MOS1drainPerimiterGiven) {
|
||||||
|
|
|
||||||
|
|
@ -325,8 +325,8 @@ typedef struct sMOS2instance {
|
||||||
|
|
||||||
|
|
||||||
#define MOS2sensxpgs MOS2states+17 /* charge sensitivities and their derivatives
|
#define MOS2sensxpgs MOS2states+17 /* charge sensitivities and their derivatives
|
||||||
+18 for the derivatives - pointer to the
|
* +18 for the derivatives
|
||||||
beginning of the array */
|
* pointer to the beginning of the array */
|
||||||
|
|
||||||
#define MOS2sensxpgd MOS2states+19
|
#define MOS2sensxpgd MOS2states+19
|
||||||
#define MOS2sensxpgb MOS2states+21
|
#define MOS2sensxpgb MOS2states+21
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ MOS2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
|
||||||
*states += MOS2numStates;
|
*states += MOS2numStates;
|
||||||
|
|
||||||
if(ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & TRANSEN) ){
|
if(ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & TRANSEN) ){
|
||||||
*states += 10 * (ckt->CKTsenInfo->SENparms);
|
*states += MOS2numSenStates * (ckt->CKTsenInfo->SENparms);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!here->MOS2drainPerimiterGiven) {
|
if(!here->MOS2drainPerimiterGiven) {
|
||||||
|
|
|
||||||
|
|
@ -250,9 +250,9 @@ typedef struct sMOS6instance {
|
||||||
|
|
||||||
#define MOS6numStates 17
|
#define MOS6numStates 17
|
||||||
|
|
||||||
#define MOS6sensxpgs MOS6states+17 /* charge sensitivities and
|
#define MOS6sensxpgs MOS6states+17 /* charge sensitivities and their derivatives.
|
||||||
their derivatives. +18 for the derivatives:
|
* +18 for the derivatives
|
||||||
pointer to the beginning of the array */
|
* pointer to the beginning of the array */
|
||||||
#define MOS6sensxpgd MOS6states+19
|
#define MOS6sensxpgd MOS6states+19
|
||||||
#define MOS6sensxpgb MOS6states+21
|
#define MOS6sensxpgb MOS6states+21
|
||||||
#define MOS6sensxpbs MOS6states+23
|
#define MOS6sensxpbs MOS6states+23
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ MOS6setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt,
|
||||||
here->MOS6states = *states;
|
here->MOS6states = *states;
|
||||||
*states += MOS6numStates;
|
*states += MOS6numStates;
|
||||||
if(ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & TRANSEN) ){
|
if(ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & TRANSEN) ){
|
||||||
*states += 10 * (ckt->CKTsenInfo->SENparms);
|
*states += MOS6numSenStates * (ckt->CKTsenInfo->SENparms);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((model->MOS6drainResistance != 0 ||
|
if((model->MOS6drainResistance != 0 ||
|
||||||
|
|
|
||||||
|
|
@ -334,7 +334,7 @@ SOI3setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
|
||||||
here->SOI3states = *states;
|
here->SOI3states = *states;
|
||||||
*states += SOI3numStates;
|
*states += SOI3numStates;
|
||||||
/* if(ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & TRANSEN) ){
|
/* if(ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & TRANSEN) ){
|
||||||
*states += 10 * (ckt->CKTsenInfo->SENparms);
|
*states += SOI3numSenStates * (ckt->CKTsenInfo->SENparms);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
/****** Part 4 - check resistance values for internal nodes, ******/
|
/****** Part 4 - check resistance values for internal nodes, ******/
|
||||||
|
|
|
||||||
|
|
@ -393,9 +393,9 @@ typedef struct sVBICinstance {
|
||||||
|
|
||||||
#define VBICnumStates 66
|
#define VBICnumStates 66
|
||||||
|
|
||||||
#define VBICsensxpbe VBICstate+66 /* charge sensitivities and their
|
#define VBICsensxpbe VBICstate+66 /* charge sensitivities and their derivatives.
|
||||||
derivatives. +67 for the derivatives -
|
* +67 for the derivatives
|
||||||
pointer to the beginning of the array */
|
* pointer to the beginning of the array */
|
||||||
#define VBICsensxpbex VBICstate+68
|
#define VBICsensxpbex VBICstate+68
|
||||||
#define VBICsensxpbc VBICstate+70
|
#define VBICsensxpbc VBICstate+70
|
||||||
#define VBICsensxpbcx VBICstate+72
|
#define VBICsensxpbcx VBICstate+72
|
||||||
|
|
|
||||||
|
|
@ -403,7 +403,7 @@ VBICsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
|
||||||
here->VBICstate = *states;
|
here->VBICstate = *states;
|
||||||
*states += VBICnumStates;
|
*states += VBICnumStates;
|
||||||
if(ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & TRANSEN) ){
|
if(ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & TRANSEN) ){
|
||||||
*states += 10 * (ckt->CKTsenInfo->SENparms);
|
*states += VBICnumSenStates * (ckt->CKTsenInfo->SENparms);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(model->VBICextCollResist == 0) {
|
if(model->VBICextCollResist == 0) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue