📄 mos1sacl.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 * here->MOS1tVto ; 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->MOS1vbs) = Apert; *(ckt->CKTstate0 + here->MOS1vbd) = vbdOp; if(error = MOS1load((GENmodel*)model,ckt)) return(error); *(here->MOS1senCgs + 1) = here->MOS1cgs; *(here->MOS1senCgd + 1) = here->MOS1cgd; *(here->MOS1senCgb + 1) = here->MOS1cgb; *(here->MOS1senCbd + 1) = here->MOS1capbd; *(here->MOS1senCbs + 1) = here->MOS1capbs; *(here->MOS1senGds + 1) = here->MOS1gds; *(here->MOS1senGbs + 1) = here->MOS1gbs; *(here->MOS1senGbd + 1) = here->MOS1gbd; *(here->MOS1senGm + 1) = here->MOS1gm; *(here->MOS1senGmbs + 1) = here->MOS1gmbs; *(ckt->CKTstate0 + here->MOS1vbs) = A0; } goto load;pertvbd: /* Perturbation of vbd */#ifdef SENSDEBUG printf("\nPerturbation of vbd\n");#endif /* SENSDEBUG */ flag = 2; A0 = vbdOp; DELA = info->SENpertfac * here->MOS1tVto + 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->MOS1vbs) = vbsOp; *(ckt->CKTstate0 + here->MOS1vbd) = Apert; if(error = MOS1load((GENmodel*)model,ckt)) return(error); *(here->MOS1senCgs + 2) = here->MOS1cgs; *(here->MOS1senCgd + 2) = here->MOS1cgd; *(here->MOS1senCgb + 2) = here->MOS1cgb; *(here->MOS1senCbd + 2) = here->MOS1capbd; *(here->MOS1senCbs + 2) = here->MOS1capbs; *(here->MOS1senGds + 2) = here->MOS1gds; *(here->MOS1senGbs + 2) = here->MOS1gbs; *(here->MOS1senGbd + 2) = here->MOS1gbd; *(here->MOS1senGm + 2) = here->MOS1gm; *(here->MOS1senGmbs + 2) = here->MOS1gmbs; *(ckt->CKTstate0 + here->MOS1vbd) = A0; } goto load;pertvgb: /* Perturbation of vgb */#ifdef SENSDEBUG printf("\nPerturbation of vgb\n");#endif /* SENSDEBUG */ flag = 3; A0 = model->MOS1type * (*(ckt->CKTrhsOp + here->MOS1gNode) - *(ckt->CKTrhsOp + here->MOS1bNode)); DELA = info->SENpertfac * A0 + 1e-8; DELAinv = model->MOS1type * 1.0/DELA; if(info->SENacpertflag == 1){ /* store the values of small signal parameters * corresponding to perturbed vgb */ *(ckt->CKTstate0 + here->MOS1vbs) = vbsOp; *(ckt->CKTstate0 + here->MOS1vbd) = vbdOp; *(ckt->CKTrhsOp + here->MOS1bNode) -= DELA; if(error = MOS1load((GENmodel*)model,ckt)) return(error); *(here->MOS1senCgs + 3) = here->MOS1cgs; *(here->MOS1senCgd + 3) = here->MOS1cgd; *(here->MOS1senCgb + 3) = here->MOS1cgb; *(here->MOS1senCbd + 3) = here->MOS1capbd; *(here->MOS1senCbs + 3) = here->MOS1capbs; *(here->MOS1senGds + 3) = here->MOS1gds; *(here->MOS1senGbs + 3) = here->MOS1gbs; *(here->MOS1senGbd + 3) = here->MOS1gbd; *(here->MOS1senGm + 3) = here->MOS1gm; *(here->MOS1senGmbs + 3) = here->MOS1gmbs; *(ckt->CKTrhsOp + here->MOS1bNode) += DELA; } goto load;pertl: /* Perturbation of length */ if(here->MOS1sens_l == 0){ goto pertw; }#ifdef SENSDEBUG printf("\nPerturbation of length\n");#endif /* SENSDEBUG */ flag = 4; A0 = here->MOS1l; 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->MOS1l = Apert; *(ckt->CKTstate0 + here->MOS1vbs) = vbsOp; *(ckt->CKTstate0 + here->MOS1vbd) = vbdOp; if(error = MOS1load((GENmodel*)model,ckt)) return(error); *(here->MOS1senCgs + 4) = here->MOS1cgs; *(here->MOS1senCgd + 4) = here->MOS1cgd; *(here->MOS1senCgb + 4) = here->MOS1cgb; *(here->MOS1senCbd + 4) = here->MOS1capbd; *(here->MOS1senCbs + 4) = here->MOS1capbs; *(here->MOS1senGds + 4) = here->MOS1gds; *(here->MOS1senGbs + 4) = here->MOS1gbs; *(here->MOS1senGbd + 4) = here->MOS1gbd; *(here->MOS1senGm + 4) = here->MOS1gm; *(here->MOS1senGmbs + 4) = here->MOS1gmbs; here->MOS1l = A0; } goto load;pertw: /* Perturbation of width */ if(here->MOS1sens_w == 0) goto next;#ifdef SENSDEBUG printf("\nPerturbation of width\n");#endif /* SENSDEBUG */ flag = 5; A0 = here->MOS1w; 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->MOS1w = Apert; here->MOS1drainArea *= (1 + info->SENpertfac); here->MOS1sourceArea *= (1 + info->SENpertfac); here->MOS1Cbd *= (1 + info->SENpertfac); here->MOS1Cbs *= (1 + info->SENpertfac); if(here->MOS1drainPerimiter){ here->MOS1Cbdsw += here->MOS1Cbdsw * DELA/here->MOS1drainPerimiter; } if(here->MOS1sourcePerimiter){ here->MOS1Cbssw += here->MOS1Cbssw * DELA/here->MOS1sourcePerimiter; } if(vbdOp >= here->MOS1tDepCap){ arg = 1-model->MOS1fwdCapDepCoeff; sarg = exp( (-model->MOS1bulkJctBotGradingCoeff) * log(arg) ); sargsw = exp( (-model->MOS1bulkJctSideGradingCoeff) * log(arg) ); here->MOS1f2d = here->MOS1Cbd*(1-model->MOS1fwdCapDepCoeff* (1+model->MOS1bulkJctBotGradingCoeff))* sarg/arg + here->MOS1Cbdsw*(1-model->MOS1fwdCapDepCoeff* (1+model->MOS1bulkJctSideGradingCoeff))* sargsw/arg; here->MOS1f3d = here->MOS1Cbd * model->MOS1bulkJctBotGradingCoeff * sarg/arg/ here->MOS1tBulkPot + here->MOS1Cbdsw * model->MOS1bulkJctSideGradingCoeff * sargsw/arg / here->MOS1tBulkPot; here->MOS1f4d = here->MOS1Cbd*here->MOS1tBulkPot* (1-arg*sarg)/ (1-model->MOS1bulkJctBotGradingCoeff) + here->MOS1Cbdsw*here->MOS1tBulkPot*(1-arg*sargsw)/ (1-model->MOS1bulkJctSideGradingCoeff) -here->MOS1f3d/2* (here->MOS1tDepCap*here->MOS1tDepCap) -here->MOS1tDepCap * here->MOS1f2d; } if(vbsOp >= here->MOS1tDepCap){ arg = 1-model->MOS1fwdCapDepCoeff; sarg = exp( (-model->MOS1bulkJctBotGradingCoeff) * log(arg) ); sargsw = exp( (-model->MOS1bulkJctSideGradingCoeff) * log(arg) ); here->MOS1f2s = here->MOS1Cbs*(1-model->MOS1fwdCapDepCoeff* (1+model->MOS1bulkJctBotGradingCoeff))* sarg/arg
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -