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

📄 mos3sacl.c

📁 linux平台下类似著名的电路板作图软件 Spice的源代码
💻 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->MOS3vbs) = Apert;                *(ckt->CKTstate0 + here->MOS3vbd) = vbdOp;                if(error = MOS3load((GENmodel*)model,ckt)) return(error);                *(here->MOS3senCgs + 1) = here->MOS3cgs;                *(here->MOS3senCgd + 1) = here->MOS3cgd;                *(here->MOS3senCgb + 1) = here->MOS3cgb;                *(here->MOS3senCbd + 1) = here->MOS3capbd;                *(here->MOS3senCbs + 1) = here->MOS3capbs;                *(here->MOS3senGds + 1) = here->MOS3gds;                *(here->MOS3senGbs + 1) = here->MOS3gbs;                *(here->MOS3senGbd + 1) = here->MOS3gbd;                *(here->MOS3senGm + 1) = here->MOS3gm;                *(here->MOS3senGmbs + 1) = here->MOS3gmbs;                *(ckt->CKTstate0 + here->MOS3vbs) = 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->MOS3vbs) = vbsOp;                *(ckt->CKTstate0 + here->MOS3vbd) = Apert;                if(error = MOS3load((GENmodel*)model,ckt)) return(error);                *(here->MOS3senCgs + 2) = here->MOS3cgs;                *(here->MOS3senCgd + 2) = here->MOS3cgd;                *(here->MOS3senCgb + 2) = here->MOS3cgb;                *(here->MOS3senCbd + 2) = here->MOS3capbd;                *(here->MOS3senCbs + 2) = here->MOS3capbs;                *(here->MOS3senGds + 2) = here->MOS3gds;                *(here->MOS3senGbs + 2) = here->MOS3gbs;                *(here->MOS3senGbd + 2) = here->MOS3gbd;                *(here->MOS3senGm + 2) = here->MOS3gm;                *(here->MOS3senGmbs + 2) = here->MOS3gmbs;                *(ckt->CKTstate0 + here->MOS3vbd) = A0;            }            goto load;pertvgb:  /* Perturbation of vgb */#ifdef SENSDEBUG            printf("\nPerturbation of vgb\n");#endif /* SENSDEBUG */            flag = 3;            A0 = model->MOS3type * (*(ckt->CKTrhsOp + here->MOS3gNode)                 -  *(ckt->CKTrhsOp + here->MOS3bNode));             DELA =  info->SENpertfac * A0 + 1e-8;            DELAinv = model->MOS3type * 1.0/DELA;            if(info->SENacpertflag == 1){                /* store the  values of small signal parameters                  * corresponding to perturbed vgb */                *(ckt->CKTstate0 + here->MOS3vbs) = vbsOp;                *(ckt->CKTstate0 + here->MOS3vbd) = vbdOp;                *(ckt->CKTrhsOp + here->MOS3bNode) -= DELA;                 if(error = MOS3load((GENmodel*)model,ckt)) return(error);                *(here->MOS3senCgs + 3) = here->MOS3cgs;                *(here->MOS3senCgd + 3) = here->MOS3cgd;                *(here->MOS3senCgb + 3) = here->MOS3cgb;                *(here->MOS3senCbd + 3) = here->MOS3capbd;                *(here->MOS3senCbs + 3) = here->MOS3capbs;                *(here->MOS3senGds + 3) = here->MOS3gds;                *(here->MOS3senGbs + 3) = here->MOS3gbs;                *(here->MOS3senGbd + 3) = here->MOS3gbd;                *(here->MOS3senGm + 3) = here->MOS3gm;                *(here->MOS3senGmbs + 3) = here->MOS3gmbs;                *(ckt->CKTrhsOp + here->MOS3bNode) += DELA;             }            goto load;pertl:    /* Perturbation of length */            if(here->MOS3sens_l == 0){                goto pertw;            }#ifdef SENSDEBUG            printf("\nPerturbation of length\n");#endif /* SENSDEBUG */            flag = 4;            A0 = here->MOS3l;            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->MOS3l = Apert;                *(ckt->CKTstate0 + here->MOS3vbs) = vbsOp;                *(ckt->CKTstate0 + here->MOS3vbd) = vbdOp;                if(error = MOS3load((GENmodel*)model,ckt)) return(error);                *(here->MOS3senCgs + 4) = here->MOS3cgs;                *(here->MOS3senCgd + 4) = here->MOS3cgd;                *(here->MOS3senCgb + 4) = here->MOS3cgb;                *(here->MOS3senCbd + 4) = here->MOS3capbd;                *(here->MOS3senCbs + 4) = here->MOS3capbs;                *(here->MOS3senGds + 4) = here->MOS3gds;                *(here->MOS3senGbs + 4) = here->MOS3gbs;                *(here->MOS3senGbd + 4) = here->MOS3gbd;                *(here->MOS3senGm + 4) = here->MOS3gm;                *(here->MOS3senGmbs + 4) = here->MOS3gmbs;                here->MOS3l = A0;            }            goto load;pertw:    /* Perturbation of width */            if(here->MOS3sens_w == 0)                goto next;#ifdef SENSDEBUG            printf("\nPerturbation of width\n");#endif /* SENSDEBUG */            flag = 5;            A0 = here->MOS3w;            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->MOS3w = Apert;                here->MOS3drainArea *= (1 + info->SENpertfac);                here->MOS3sourceArea *= (1 + info->SENpertfac);                here->MOS3Cbd *= (1 + info->SENpertfac);                here->MOS3Cbs *= (1 + info->SENpertfac);                if(here->MOS3drainPerimiter){                    here->MOS3Cbdsw += here->MOS3Cbdsw *                        DELA/here->MOS3drainPerimiter;                }                if(here->MOS3sourcePerimiter){                    here->MOS3Cbssw += here->MOS3Cbssw *                        DELA/here->MOS3sourcePerimiter;                }                if(vbdOp >= here->MOS3tDepCap){                    arg = 1-model->MOS3fwdCapDepCoeff;                    sarg = exp( (-model->MOS3bulkJctBotGradingCoeff) *                             log(arg) );                    sargsw = exp( (-model->MOS3bulkJctSideGradingCoeff) *                             log(arg) );                    here->MOS3f2d = here->MOS3Cbd*(1-model->MOS3fwdCapDepCoeff*                            (1+model->MOS3bulkJctBotGradingCoeff))* sarg/arg                            +  here->MOS3Cbdsw*(1-model->MOS3fwdCapDepCoeff*                            (1+model->MOS3bulkJctSideGradingCoeff))*                            sargsw/arg;                    here->MOS3f3d = here->MOS3Cbd *                             model->MOS3bulkJctBotGradingCoeff * sarg/arg/                            model->MOS3bulkJctPotential                            + here->MOS3Cbdsw *                             model->MOS3bulkJctSideGradingCoeff * sargsw/arg /                            model->MOS3bulkJctPotential;                    here->MOS3f4d = here->MOS3Cbd*model->MOS3bulkJctPotential*                            (1-arg*sarg)/ (1-model->MOS3bulkJctBotGradingCoeff)                            + here->MOS3Cbdsw*model->MOS3bulkJctPotential*                            (1-arg*sargsw)/                            (1-model->MOS3bulkJctSideGradingCoeff)                            -here->MOS3f3d/2*                            (here->MOS3tDepCap*here->MOS3tDepCap)                            -here->MOS3tDepCap * here->MOS3f2d;                }                if(vbsOp >= here->MOS3tDepCap){                    arg = 1-model->MOS3fwdCapDepCoeff;                    sarg = exp( (-model->MOS3bulkJctBotGradingCoeff) *                             log(arg) );                    sargsw = exp( (-model->MOS3bulkJctSideGradingCoeff) *                             log(arg) );                    here->MOS3f2s = here->MOS3Cbs*(1-model->MOS3fwdCapDepCoeff*                        (1+model->MOS3bulkJctBotGradingCoeff))* sarg/arg

⌨️ 快捷键说明

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