📄 mos2sacl.c
字号:
cspr = gspr0 * vspr ; icspr = gspr0 * ivspr ; cdpr = gdpr0 * vdpr ; icdpr = gdpr0 * ivdpr ; cgs = ( - xcgs0 * ivgs ); icgs = xcgs0 * vgs ; cgd = ( - xcgd0 * ivgd ); icgd = xcgd0 * vgd ; cgb = ( - xcgb0 * ivgb ); icgb = xcgb0 * vgb ; cbs = ( gbs0 * vbs - xbs0 * ivbs ); icbs = ( xbs0 * vbs + gbs0 * ivbs ); cbd = ( gbd0 * vbd - xbd0 * ivbd ); icbd = ( xbd0 * vbd + gbd0 * ivbd ); cds = ( gds0 * vds + xnrm * (gm0 * vgs + gmbs0 * vbs) - xrev * (gm0 * vgd + gmbs0 * vbd) ); icds = ( gds0 * ivds + xnrm * (gm0 * ivgs + gmbs0 * ivbs) - xrev * (gm0 * ivgd + gmbs0 * ivbd) ); cs0 = cspr; ics0 = icspr; csprm0 = ( -cspr - cgs - cbs - cds ) ; icsprm0 = ( -icspr - icgs - icbs - icds ) ; cd0 = cdpr; icd0 = icdpr; cdprm0 = ( -cdpr - cgd - cbd + cds ) ; icdprm0 = ( -icdpr - icgd - icbd + icds ) ; cg0 = cgs + cgd + cgb ; icg0 = icgs + icgd + icgb ; cb0 = cbs + cbd - cgb ; icb0 = icbs + icbd - icgb ;#ifdef SENSDEBUG printf("gspr0 = %.7e , gdpr0 = %.7e , gds0 = %.7e, gbs0 = %.7e\n", gspr0,gdpr0,gds0,gbs0); printf("gbd0 = %.7e , gm0 = %.7e , gmbs0 = %.7e\n",gbd0,gm0,gmbs0); printf("xcgs0 = %.7e , xcgd0 = %.7e , xcgb0 = %.7e,", xcgs0,xcgd0,xcgb0); printf("xbd0 = %.7e,xbs0 = %.7e\n", xbd0,xbs0); printf("vbs = %.7e , vbd = %.7e , vgb = %.7e\n",vbs,vbd,vgb); printf("ivbs = %.7e , ivbd = %.7e , ivgb = %.7e\n",ivbs,ivbd,ivgb); printf("cbs0 = %.7e , cbd0 = %.7e , cgb0 = %.7e\n",cbs,cbd,cgb); printf("cb0 = %.7e , cg0 = %.7e , cs0 = %.7e\n",cb0,cg0,cs0); printf("csprm0 = %.7e, cd0 = %.7e, cdprm0 = %.7e\n", csprm0,cd0,cdprm0); printf("icb0 = %.7e , icg0 = %.7e , ics0 = %.7e\n",icb0,icg0,ics0); printf("icsprm0 = %.7e, icd0 = %.7e, icdprm0 = %.7e\n", icsprm0,icd0,icdprm0); printf("\nPerturbation of vbs\n");#endif /* SENSDEBUG */ /* Perturbation of vbs */ flag = 1; A0 = vbsOp; DELA = info->SENpertfac * CONSTvt0 ; DELAinv = 1.0/DELA; if(info->SENacpertflag == 1){ /* store the values of small signal parameters * corresponding to perturbed vbs */ Apert = A0 + DELA; *(ckt->CKTstate0 + here->MOS2vbs) = Apert; *(ckt->CKTstate0 + here->MOS2vbd) = vbdOp; if((error = MOS2load((GENmodel*)model,ckt))) return(error); *(here->MOS2senCgs + 1) = here->MOS2cgs; *(here->MOS2senCgd + 1) = here->MOS2cgd; *(here->MOS2senCgb + 1) = here->MOS2cgb; *(here->MOS2senCbd + 1) = here->MOS2capbd; *(here->MOS2senCbs + 1) = here->MOS2capbs; *(here->MOS2senGds + 1) = here->MOS2gds; *(here->MOS2senGbs + 1) = here->MOS2gbs; *(here->MOS2senGbd + 1) = here->MOS2gbd; *(here->MOS2senGm + 1) = here->MOS2gm; *(here->MOS2senGmbs + 1) = here->MOS2gmbs; *(ckt->CKTstate0 + here->MOS2vbs) = A0; } goto load;pertvbd: /* Perturbation of vbd */#ifdef SENSDEBUG printf("\nPerturbation of vbd\n");#endif /* SENSDEBUG */ flag = 2; A0 = vbdOp; DELA = info->SENpertfac * CONSTvt0 + 1e-8; DELAinv = 1.0/DELA; if(info->SENacpertflag == 1){ /* store the values of small signal parameters * corresponding to perturbed vbd */ Apert = A0 + DELA; *(ckt->CKTstate0 + here->MOS2vbs) = vbsOp; *(ckt->CKTstate0 + here->MOS2vbd) = Apert; if((error = MOS2load((GENmodel*)model,ckt))) return(error); *(here->MOS2senCgs + 2) = here->MOS2cgs; *(here->MOS2senCgd + 2) = here->MOS2cgd; *(here->MOS2senCgb + 2) = here->MOS2cgb; *(here->MOS2senCbd + 2) = here->MOS2capbd; *(here->MOS2senCbs + 2) = here->MOS2capbs; *(here->MOS2senGds + 2) = here->MOS2gds; *(here->MOS2senGbs + 2) = here->MOS2gbs; *(here->MOS2senGbd + 2) = here->MOS2gbd; *(here->MOS2senGm + 2) = here->MOS2gm; *(here->MOS2senGmbs + 2) = here->MOS2gmbs; *(ckt->CKTstate0 + here->MOS2vbd) = A0; } goto load;pertvgb: /* Perturbation of vgb */#ifdef SENSDEBUG printf("\nPerturbation of vgb\n");#endif /* SENSDEBUG */ flag = 3; A0 = model->MOS2type * (*(ckt->CKTrhsOp + here->MOS2gNode) - *(ckt->CKTrhsOp + here->MOS2bNode)); DELA = info->SENpertfac * A0 + 1e-8; DELAinv = model->MOS2type * 1.0/DELA; if(info->SENacpertflag == 1){ /* store the values of small signal parameters * corresponding to perturbed vgb */ *(ckt->CKTstate0 + here->MOS2vbs) = vbsOp; *(ckt->CKTstate0 + here->MOS2vbd) = vbdOp; *(ckt->CKTrhsOp + here->MOS2bNode) -= DELA; if((error = MOS2load((GENmodel*)model,ckt))) return(error); *(here->MOS2senCgs + 3) = here->MOS2cgs; *(here->MOS2senCgd + 3) = here->MOS2cgd; *(here->MOS2senCgb + 3) = here->MOS2cgb; *(here->MOS2senCbd + 3) = here->MOS2capbd; *(here->MOS2senCbs + 3) = here->MOS2capbs; *(here->MOS2senGds + 3) = here->MOS2gds; *(here->MOS2senGbs + 3) = here->MOS2gbs; *(here->MOS2senGbd + 3) = here->MOS2gbd; *(here->MOS2senGm + 3) = here->MOS2gm; *(here->MOS2senGmbs + 3) = here->MOS2gmbs; *(ckt->CKTrhsOp + here->MOS2bNode) += DELA; } goto load;pertl: /* Perturbation of length */ if(here->MOS2sens_l == 0){ goto pertw; }#ifdef SENSDEBUG printf("\nPerturbation of length\n");#endif /* SENSDEBUG */ flag = 4; A0 = here->MOS2l; DELA = info->SENpertfac * A0; DELAinv = 1.0/DELA; if(info->SENacpertflag == 1){ /* store the values of small signal parameters * corresponding to perturbed length */ Apert = A0 + DELA; here->MOS2l = Apert; *(ckt->CKTstate0 + here->MOS2vbs) = vbsOp; *(ckt->CKTstate0 + here->MOS2vbd) = vbdOp; if((error = MOS2load((GENmodel*)model,ckt))) return(error); *(here->MOS2senCgs + 4) = here->MOS2cgs; *(here->MOS2senCgd + 4) = here->MOS2cgd; *(here->MOS2senCgb + 4) = here->MOS2cgb; *(here->MOS2senCbd + 4) = here->MOS2capbd; *(here->MOS2senCbs + 4) = here->MOS2capbs; *(here->MOS2senGds + 4) = here->MOS2gds; *(here->MOS2senGbs + 4) = here->MOS2gbs; *(here->MOS2senGbd + 4) = here->MOS2gbd; *(here->MOS2senGm + 4) = here->MOS2gm; *(here->MOS2senGmbs + 4) = here->MOS2gmbs; here->MOS2l = A0; } goto load;pertw: /* Perturbation of width */ if(here->MOS2sens_w == 0) goto next;#ifdef SENSDEBUG printf("\nPerturbation of width\n");#endif /* SENSDEBUG */ flag = 5; A0 = here->MOS2w; DELA = info->SENpertfac * A0; DELAinv = 1.0/DELA; Apert = A0 + DELA; if(info->SENacpertflag == 1){ /* store the values of small signal parameters * corresponding to perturbed width */ here->MOS2w = Apert; here->MOS2drainArea *= (1 + info->SENpertfac); here->MOS2sourceArea *= (1 + info->SENpertfac); here->MOS2Cbd *= (1 + info->SENpertfac); here->MOS2Cbs *= (1 + info->SENpertfac); if(here->MOS2drainPerimiter){ here->MOS2Cbdsw += here->MOS2Cbdsw * DELA/here->MOS2drainPerimiter; } if(here->MOS2sourcePerimiter){ here->MOS2Cbssw += here->MOS2Cbssw * DELA/here->MOS2sourcePerimiter; } if(vbdOp >= here->MOS2tDepCap){ arg = 1-model->MOS2fwdCapDepCoeff; sarg = exp( (-model->MOS2bulkJctBotGradingCoeff) * log(arg) ); sargsw = exp( (-model->MOS2bulkJctSideGradingCoeff) * log(arg) ); here->MOS2f2d = here->MOS2Cbd*(1-model->MOS2fwdCapDepCoeff* (1+model->MOS2bulkJctBotGradingCoeff))* sarg/arg + here->MOS2Cbdsw*(1-model->MOS2fwdCapDepCoeff* (1+model->MOS2bulkJctSideGradingCoeff))* sargsw/arg; here->MOS2f3d = here->MOS2Cbd * model->MOS2bulkJctBotGradingCoeff * sarg/arg/ here->MOS2tBulkPot + here->MOS2Cbdsw * model->MOS2bulkJctSideGradingCoeff * sargsw/arg / here->MOS2tBulkPot; here->MOS2f4d = here->MOS2Cbd*here->MOS2tBulkPot* (1-arg*sarg)/(1-model->MOS2bulkJctBotGradingCoeff) + here->MOS2Cbdsw*here->MOS2tBulkPot*(1-arg*sargsw)/ (1-model->MOS2bulkJctSideGradingCoeff) -here->MOS2f3d/2* (here->MOS2tDepCap*here->MOS2tDepCap) -here->MOS2tDepCap * here->MOS2f2d; } if(vbsOp >= here->MOS2tDepCap){ arg = 1-model->MOS2fwdCapDepCoeff; sarg = exp( (-model->MOS2bulkJctBotGradingCoeff) * log(arg) ); sargsw = exp( (-model->MOS2bulkJctSideGradingCoeff) * log(arg) );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -