1 /********** 2 Copyright 1990 Regents of the University of California. All rights reserved. 3 Author: 1985 Thomas L. Quarles 4 Modified: Alan Gillespie 5 **********/ 6 /* 7 */ 8 9 #include "ngspice/ngspice.h" 10 #include "ngspice/cktdefs.h" 11 #include "mos9defs.h" 12 #include "ngspice/sperror.h" 13 #include "ngspice/suffix.h" 14 15 16 int MOS9acLoad(GENmodel * inModel,CKTcircuit * ckt)17MOS9acLoad(GENmodel *inModel, CKTcircuit *ckt) 18 { 19 MOS9model *model = (MOS9model *)inModel; 20 MOS9instance *here; 21 int xnrm; 22 int xrev; 23 double EffectiveLength; 24 double EffectiveWidth; 25 double xgs; 26 double xgd; 27 double xgb; 28 double xbd; 29 double xbs; 30 double capgs; 31 double capgd; 32 double capgb; 33 double GateBulkOverlapCap; 34 double GateDrainOverlapCap; 35 double GateSourceOverlapCap; 36 37 for( ; model != NULL; model = MOS9nextModel(model)) { 38 for(here = MOS9instances(model); here!= NULL; 39 here = MOS9nextInstance(here)) { 40 41 if (here->MOS9mode < 0) { 42 xnrm=0; 43 xrev=1; 44 } else { 45 xnrm=1; 46 xrev=0; 47 } 48 /* 49 * charge oriented model parameters 50 */ 51 EffectiveWidth=here->MOS9w-2*model->MOS9widthNarrow+ 52 model->MOS9widthAdjust; 53 EffectiveLength=here->MOS9l - 2*model->MOS9latDiff+ 54 model->MOS9lengthAdjust; 55 GateSourceOverlapCap = model->MOS9gateSourceOverlapCapFactor * 56 here->MOS9m * EffectiveWidth; 57 GateDrainOverlapCap = model->MOS9gateDrainOverlapCapFactor * 58 here->MOS9m * EffectiveWidth; 59 GateBulkOverlapCap = model->MOS9gateBulkOverlapCapFactor * 60 here->MOS9m * EffectiveLength; 61 62 63 /* 64 * meyer"s model parameters 65 */ 66 capgs = ( *(ckt->CKTstate0+here->MOS9capgs)+ 67 *(ckt->CKTstate0+here->MOS9capgs) + 68 GateSourceOverlapCap ); 69 capgd = ( *(ckt->CKTstate0+here->MOS9capgd)+ 70 *(ckt->CKTstate0+here->MOS9capgd) + 71 GateDrainOverlapCap ); 72 capgb = ( *(ckt->CKTstate0+here->MOS9capgb)+ 73 *(ckt->CKTstate0+here->MOS9capgb) + 74 GateBulkOverlapCap ); 75 xgs = capgs * ckt->CKTomega; 76 xgd = capgd * ckt->CKTomega; 77 xgb = capgb * ckt->CKTomega; 78 xbd = here->MOS9capbd * ckt->CKTomega; 79 xbs = here->MOS9capbs * ckt->CKTomega; 80 81 /* 82 * load matrix 83 */ 84 85 *(here->MOS9GgPtr +1) += xgd+xgs+xgb; 86 *(here->MOS9BbPtr +1) += xgb+xbd+xbs; 87 *(here->MOS9DPdpPtr +1) += xgd+xbd; 88 *(here->MOS9SPspPtr +1) += xgs+xbs; 89 *(here->MOS9GbPtr +1) -= xgb; 90 *(here->MOS9GdpPtr +1) -= xgd; 91 *(here->MOS9GspPtr +1) -= xgs; 92 *(here->MOS9BgPtr +1) -= xgb; 93 *(here->MOS9BdpPtr +1) -= xbd; 94 *(here->MOS9BspPtr +1) -= xbs; 95 *(here->MOS9DPgPtr +1) -= xgd; 96 *(here->MOS9DPbPtr +1) -= xbd; 97 *(here->MOS9SPgPtr +1) -= xgs; 98 *(here->MOS9SPbPtr +1) -= xbs; 99 *(here->MOS9DdPtr) += here->MOS9drainConductance; 100 *(here->MOS9SsPtr) += here->MOS9sourceConductance; 101 *(here->MOS9BbPtr) += here->MOS9gbd+here->MOS9gbs; 102 *(here->MOS9DPdpPtr) += here->MOS9drainConductance+ 103 here->MOS9gds+here->MOS9gbd+ 104 xrev*(here->MOS9gm+here->MOS9gmbs); 105 *(here->MOS9SPspPtr) += here->MOS9sourceConductance+ 106 here->MOS9gds+here->MOS9gbs+ 107 xnrm*(here->MOS9gm+here->MOS9gmbs); 108 *(here->MOS9DdpPtr) -= here->MOS9drainConductance; 109 *(here->MOS9SspPtr) -= here->MOS9sourceConductance; 110 *(here->MOS9BdpPtr) -= here->MOS9gbd; 111 *(here->MOS9BspPtr) -= here->MOS9gbs; 112 *(here->MOS9DPdPtr) -= here->MOS9drainConductance; 113 *(here->MOS9DPgPtr) += (xnrm-xrev)*here->MOS9gm; 114 *(here->MOS9DPbPtr) += -here->MOS9gbd+(xnrm-xrev)*here->MOS9gmbs; 115 *(here->MOS9DPspPtr) -= here->MOS9gds+ 116 xnrm*(here->MOS9gm+here->MOS9gmbs); 117 *(here->MOS9SPgPtr) -= (xnrm-xrev)*here->MOS9gm; 118 *(here->MOS9SPsPtr) -= here->MOS9sourceConductance; 119 *(here->MOS9SPbPtr) -= here->MOS9gbs+(xnrm-xrev)*here->MOS9gmbs; 120 *(here->MOS9SPdpPtr) -= here->MOS9gds+ 121 xrev*(here->MOS9gm+here->MOS9gmbs); 122 } 123 } 124 return(OK); 125 } 126