⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mos9sacl.c

📁 ngspice又一个电子CAD仿真软件代码.功能更全
💻 C
📖 第 1 页 / 共 3 页
字号:
            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 ,", xcgs0,xcgd0);            printf("xcgb0 = %.7e, xbd0 = %.7e,xbs0 = %.7e\n" ,xcgb0,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->MOS9vbs) = Apert;                *(ckt->CKTstate0 + here->MOS9vbd) = vbdOp;                if((error = MOS9load((GENmodel*)model,ckt))) return(error);                *(here->MOS9senCgs + 1) = here->MOS9cgs;                *(here->MOS9senCgd + 1) = here->MOS9cgd;                *(here->MOS9senCgb + 1) = here->MOS9cgb;                *(here->MOS9senCbd + 1) = here->MOS9capbd;                *(here->MOS9senCbs + 1) = here->MOS9capbs;                *(here->MOS9senGds + 1) = here->MOS9gds;                *(here->MOS9senGbs + 1) = here->MOS9gbs;                *(here->MOS9senGbd + 1) = here->MOS9gbd;                *(here->MOS9senGm + 1) = here->MOS9gm;                *(here->MOS9senGmbs + 1) = here->MOS9gmbs;                *(ckt->CKTstate0 + here->MOS9vbs) = 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->MOS9vbs) = vbsOp;                *(ckt->CKTstate0 + here->MOS9vbd) = Apert;                if((error = MOS9load((GENmodel*)model,ckt))) return(error);                *(here->MOS9senCgs + 2) = here->MOS9cgs;                *(here->MOS9senCgd + 2) = here->MOS9cgd;                *(here->MOS9senCgb + 2) = here->MOS9cgb;                *(here->MOS9senCbd + 2) = here->MOS9capbd;                *(here->MOS9senCbs + 2) = here->MOS9capbs;                *(here->MOS9senGds + 2) = here->MOS9gds;                *(here->MOS9senGbs + 2) = here->MOS9gbs;                *(here->MOS9senGbd + 2) = here->MOS9gbd;                *(here->MOS9senGm + 2) = here->MOS9gm;                *(here->MOS9senGmbs + 2) = here->MOS9gmbs;                *(ckt->CKTstate0 + here->MOS9vbd) = A0;            }            goto load;pertvgb:  /* Perturbation of vgb */#ifdef SENSDEBUG            printf("\nPerturbation of vgb\n");#endif /* SENSDEBUG */            flag = 3;            A0 = model->MOS9type * (*(ckt->CKTrhsOp + here->MOS9gNode)                 -  *(ckt->CKTrhsOp + here->MOS9bNode));             DELA =  info->SENpertfac * A0 + 1e-8;            DELAinv = model->MOS9type * 1.0/DELA;            if(info->SENacpertflag == 1){                /* store the  values of small signal parameters                  * corresponding to perturbed vgb */                *(ckt->CKTstate0 + here->MOS9vbs) = vbsOp;                *(ckt->CKTstate0 + here->MOS9vbd) = vbdOp;                *(ckt->CKTrhsOp + here->MOS9bNode) -= DELA;                 if((error = MOS9load((GENmodel*)model,ckt))) return(error);                *(here->MOS9senCgs + 3) = here->MOS9cgs;                *(here->MOS9senCgd + 3) = here->MOS9cgd;                *(here->MOS9senCgb + 3) = here->MOS9cgb;                *(here->MOS9senCbd + 3) = here->MOS9capbd;                *(here->MOS9senCbs + 3) = here->MOS9capbs;                *(here->MOS9senGds + 3) = here->MOS9gds;                *(here->MOS9senGbs + 3) = here->MOS9gbs;                *(here->MOS9senGbd + 3) = here->MOS9gbd;                *(here->MOS9senGm + 3) = here->MOS9gm;                *(here->MOS9senGmbs + 3) = here->MOS9gmbs;                *(ckt->CKTrhsOp + here->MOS9bNode) += DELA;             }            goto load;pertl:    /* Perturbation of length */            if(here->MOS9sens_l == 0){                goto pertw;            }#ifdef SENSDEBUG            printf("\nPerturbation of length\n");#endif /* SENSDEBUG */            flag = 4;            A0 = here->MOS9l;            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->MOS9l = Apert;                *(ckt->CKTstate0 + here->MOS9vbs) = vbsOp;                *(ckt->CKTstate0 + here->MOS9vbd) = vbdOp;                if((error = MOS9load((GENmodel*)model,ckt))) return(error);                *(here->MOS9senCgs + 4) = here->MOS9cgs;                *(here->MOS9senCgd + 4) = here->MOS9cgd;                *(here->MOS9senCgb + 4) = here->MOS9cgb;                *(here->MOS9senCbd + 4) = here->MOS9capbd;                *(here->MOS9senCbs + 4) = here->MOS9capbs;                *(here->MOS9senGds + 4) = here->MOS9gds;                *(here->MOS9senGbs + 4) = here->MOS9gbs;                *(here->MOS9senGbd + 4) = here->MOS9gbd;                *(here->MOS9senGm + 4) = here->MOS9gm;                *(here->MOS9senGmbs + 4) = here->MOS9gmbs;                here->MOS9l = A0;            }            goto load;pertw:    /* Perturbation of width */            if(here->MOS9sens_w == 0)                goto next;#ifdef SENSDEBUG            printf("\nPerturbation of width\n");#endif /* SENSDEBUG */            flag = 5;            A0 = here->MOS9w;            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->MOS9w = Apert;                here->MOS9drainArea *= (1 + info->SENpertfac);                here->MOS9sourceArea *= (1 + info->SENpertfac);                here->MOS9Cbd *= (1 + info->SENpertfac);                here->MOS9Cbs *= (1 + info->SENpertfac);                if(here->MOS9drainPerimiter){                    here->MOS9Cbdsw += here->MOS9Cbdsw *                        DELA/here->MOS9drainPerimiter;                }                if(here->MOS9sourcePerimiter){                    here->MOS9Cbssw += here->MOS9Cbssw *                        DELA/here->MOS9sourcePerimiter;                }                if(vbdOp >= here->MOS9tDepCap){                    arg = 1-model->MOS9fwdCapDepCoeff;                    sarg = exp( (-model->MOS9bulkJctBotGradingCoeff) *                             log(arg) );                    sargsw = exp( (-model->MOS9bulkJctSideGradingCoeff) *                             log(arg) );                    here->MOS9f2d = here->MOS9Cbd*(1-model->MOS9fwdCapDepCoeff*                            (1+model->MOS9bulkJctBotGradingCoeff))* sarg/arg                            +  here->MOS9Cbdsw*(1-model->MOS9fwdCapDepCoeff*                            (1+model->MOS9bulkJctSideGradingCoeff))*                            sargsw/arg;                    here->MOS9f3d = here->MOS9Cbd *                             model->MOS9bulkJctBotGradingCoeff * sarg/arg/                            model->MOS9bulkJctPotential                            + here->MOS9Cbdsw *                             model->MOS9bulkJctSideGradingCoeff * sargsw/arg /                            model->MOS9bulkJctPotential;                    here->MOS9f4d = here->MOS9Cbd*model->MOS9bulkJctPotential*                            (1-arg*sarg)/ (1-model->MOS9bulkJctBotGradingCoeff)                            + here->MOS9Cbdsw*model->MOS9bulkJctPotential*                            (1-arg*sargsw)/                            (1-model->MOS9bulkJctSideGradingCoeff)                            -here->MOS9f3d/2*                            (here->MOS9tDepCap*here->MOS9tDepCap)                            -here->MOS9tDepCap * here->MOS9f2d;                }                if(vbsOp >= here->MOS9tDepCap){                    arg = 1-model->MOS9fwdCapDepCoeff;                    sarg = exp( (-model->MOS9bulkJctBotGradingCoeff) *                             log(arg) );                    sargsw = exp( (-model->MOS9bulkJctSideGradingCoeff) *                             log(arg) );                    here->MOS9f2s = here->MOS9Cbs*(1-model->MOS9fwdCapDepCoeff*                        (1+model->MOS9bulkJctBotGradingCoeff))* sarg/arg

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -