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

📄 mos3sld.c

📁 linux平台下类似著名的电路板作图软件 Spice的源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
                    if(gspr0) DcsprDp = cspr0 * (gspr - gspr0)/gspr0 * DELAinv;                DcdprmDp = ( - DcdprDp + DcdDp);                DcsprmDp = ( - DcbsDp - DcdDp - DcbdDp  - DcsprDp);                if(flag == 0){                    EffectiveLength = here->MOS3l                         - 2*model->MOS3latDiff;                    if(EffectiveLength == 0){                         DqgsDp = 0;                        DqgdDp = 0;                        DqgbDp = 0;                    }                    else{                        DqgsDp = model->MOS3type * qgs0 / EffectiveLength;                        DqgdDp = model->MOS3type * qgd0 / EffectiveLength;                        DqgbDp = model->MOS3type * qgb0 / EffectiveLength;                    }                }                else{                    DqgsDp = model->MOS3type * qgs0 / here->MOS3w;                    DqgdDp = model->MOS3type * qgd0 / here->MOS3w;                    DqgbDp = model->MOS3type * qgb0 / here->MOS3w;                }                qbd = *(ckt->CKTstate0 + here->MOS3qbd);                qbs = *(ckt->CKTstate0 + here->MOS3qbs);                DqbsDp = model->MOS3type * (qbs - qbs0)*DELAinv;                DqbdDp = model->MOS3type * (qbd - qbd0)*DELAinv;                if(flag == 0){                    *(here->MOS3dphigs_dl) = DqgsDp;                    *(here->MOS3dphigd_dl) = DqgdDp;                    *(here->MOS3dphibs_dl) = DqbsDp;                    *(here->MOS3dphibd_dl) = DqbdDp;                    *(here->MOS3dphigb_dl) = DqgbDp;                }                else{                    *(here->MOS3dphigs_dw) = DqgsDp;                    *(here->MOS3dphigd_dw) = DqgdDp;                    *(here->MOS3dphibs_dw) = DqbsDp;                    *(here->MOS3dphibd_dw) = DqbdDp;                    *(here->MOS3dphigb_dw) = DqgbDp;                }#ifdef SENSDEBUG                printf("CKTag[0]=%.7e,CKTag[1]=%.7e,flag= %d\n",                        ckt->CKTag[0],ckt->CKTag[1],flag);                printf("cd0 = %.7e ,cd = %.7e,\n",cd0,cd);                 printf("cbs0 = %.7e ,cbs = %.7e,\n",cbs0,cbs);                 printf("cbd0 = %.7e ,cbd = %.7e,\n",cbd0,cbd);                 printf("DcdprmDp = %.7e,\n",DcdprmDp);                 printf("DcsprmDp = %.7e,\n",DcsprmDp);                 printf("DcdprDp = %.7e,\n",DcdprDp);                 printf("DcsprDp = %.7e,\n",DcsprDp);                 printf("qgs0 = %.7e \n",qgs0);                 printf("qgd0 = %.7e \n",qgd0);                 printf("qgb0 = %.7e \n",qgb0);                 printf("qbs0 = %.7e ,qbs = %.7e,\n",qbs0,qbs);                 printf("qbd0 = %.7e ,qbd = %.7e,\n",qbd0,qbd);                 printf("DqgsDp = %.7e \n",DqgsDp);                 printf("DqgdDp = %.7e \n",DqgdDp);                 printf("DqgbDp = %.7e \n",DqgbDp);                 printf("DqbsDp = %.7e \n",DqbsDp);                 printf("DqbdDp = %.7e \n",DqbdDp);                 printf("EffectiveLength = %.7e \n",EffectiveLength);                 printf("tdepCap = %.7e \n",here->MOS3tDepCap);                 printf("\n");#endif /* SENSDEBUG*/                if((info->SENmode == TRANSEN) &&                    (ckt->CKTmode & MODEINITTRAN))                    goto next2;                /*                                 *   load RHS matrix                                 */                if(flag == 0){                    *(info->SEN_RHS[here->MOS3bNode] + here->MOS3senParmNo)                             -= model->MOS3type * DcbDp;                    *(info->SEN_RHS[here->MOS3dNode] + here->MOS3senParmNo)                             -= model->MOS3type * DcdprDp;                    *(info->SEN_RHS[here->MOS3dNodePrime] + here->MOS3senParmNo)                            -= model->MOS3type * DcdprmDp;                    *(info->SEN_RHS[here->MOS3sNode] + here->MOS3senParmNo)                             -= model->MOS3type * DcsprDp;                    *(info->SEN_RHS[here->MOS3sNodePrime] + here->MOS3senParmNo)                            -= model->MOS3type * DcsprmDp;                }                else{                      offset = here->MOS3sens_l;                    *(info->SEN_RHS[here->MOS3bNode] + here->MOS3senParmNo +                             offset) -= model->MOS3type * DcbDp;                    *(info->SEN_RHS[here->MOS3dNode] + here->MOS3senParmNo +                             offset) -= model->MOS3type * DcdprDp;                    *(info->SEN_RHS[here->MOS3dNodePrime] + here->MOS3senParmNo                            + offset) -= model->MOS3type * DcdprmDp;                    *(info->SEN_RHS[here->MOS3sNode] + here->MOS3senParmNo +                            offset) -= model->MOS3type * DcsprDp;                    *(info->SEN_RHS[here->MOS3sNodePrime] + here->MOS3senParmNo                            + offset) -= model->MOS3type * DcsprmDp;                }#ifdef SENSDEBUG                printf("after loading\n");                if(flag == 0){                    printf("DcbDp=%.7e\n",                            *(info->SEN_RHS[here->MOS3bNode] +                            here->MOS3senParmNo));                    printf("DcdprDp=%.7e\n",                            *(info->SEN_RHS[here->MOS3dNode] +                            here->MOS3senParmNo));                    printf("DcsprDp=%.7e\n",                            *(info->SEN_RHS[here->MOS3sNode] +                            here->MOS3senParmNo));                    printf("DcdprmDp=%.7e\n",                            *(info->SEN_RHS[here->MOS3dNodePrime] +                            here->MOS3senParmNo));                    printf("DcsprmDp=%.7e\n",                            *(info->SEN_RHS[here->MOS3sNodePrime] +                            here->MOS3senParmNo));                    printf("\n");                }                else{                    printf("DcbDp=%.7e\n",                            *(info->SEN_RHS[here->MOS3bNode] +                            here->MOS3senParmNo + here->MOS3sens_l));                    printf("DcdprDp=%.7e\n",                            *(info->SEN_RHS[here->MOS3dNode] +                            here->MOS3senParmNo + here->MOS3sens_l));                    printf("DcsprDp=%.7e\n",                            *(info->SEN_RHS[here->MOS3sNode] +                            here->MOS3senParmNo + here->MOS3sens_l));                    printf("DcdprmDp=%.7e\n",                            *(info->SEN_RHS[here->MOS3dNodePrime] +                            here->MOS3senParmNo + here->MOS3sens_l));                    printf("DcsprmDp=%.7e\n",                            *(info->SEN_RHS[here->MOS3sNodePrime] +                            here->MOS3senParmNo + here->MOS3sens_l));                }#endif /* SENSDEBUG*/next2:                                   ;            }next1:            if((info->SENmode == DCSEN) ||                (ckt->CKTmode&MODETRANOP) ) goto restore;            if((info->SENmode == TRANSEN) &&                (ckt->CKTmode & MODEINITTRAN)) goto restore;            for(iparmno = 1;iparmno<=info->SENparms;iparmno++){#ifdef SENSDEBUG                printf("after conductive currents\n");                printf("iparmno = %d\n",iparmno);                printf("DcbDp=%.7e\n",                        *(info->SEN_RHS[here->MOS3bNode] + iparmno));                printf("DcdprDp=%.7e\n",                        *(info->SEN_RHS[here->MOS3dNode] + iparmno));                printf("DcdprmDp=%.7e\n",                        *(info->SEN_RHS[here->MOS3dNodePrime] + iparmno));                printf("DcsprDp=%.7e\n",                        *(info->SEN_RHS[here->MOS3sNode] + iparmno));                printf("DcsprmDp=%.7e\n",                        *(info->SEN_RHS[here->MOS3sNodePrime] + iparmno));                printf("\n");#endif /* SENSDEBUG */                Osxpgs = tag0 * *(ckt->CKTstate1 + here->MOS3sensxpgs +                        10*(iparmno - 1))                        + tag1 * *(ckt->CKTstate1 + here->MOS3sensxpgs +                        10*(iparmno - 1) + 1);                Osxpgd = tag0 * *(ckt->CKTstate1 + here->MOS3sensxpgd +                        10*(iparmno - 1))                        + tag1 * *(ckt->CKTstate1 + here->MOS3sensxpgd +                        10*(iparmno - 1) + 1);                Osxpbs = tag0 * *(ckt->CKTstate1 + here->MOS3sensxpbs +                        10*(iparmno - 1))                        + tag1 * *(ckt->CKTstate1 + here->MOS3sensxpbs +                        10*(iparmno - 1) + 1);                Osxpbd =tag0 * *(ckt->CKTstate1 + here->MOS3sensxpbd +                        10*(iparmno - 1))                        + tag1 * *(ckt->CKTstate1 + here->MOS3sensxpbd +                        10*(iparmno - 1) + 1);                Osxpgb = tag0 * *(ckt->CKTstate1 + here->MOS3sensxpgb +                        10*(iparmno - 1))                        + tag1 * *(ckt->CKTstate1 + here->MOS3sensxpgb +                        10*(iparmno - 1) + 1);#ifdef SENSDEBUG                printf("iparmno=%d\n",iparmno);                printf("sxpgs=%.7e,sdgs=%.7e\n",                        *(ckt->CKTstate1 + here->MOS3sensxpgs +                         10*(iparmno - 1)), *(ckt->CKTstate1 +                         here->MOS3sensxpgs + 10*(iparmno - 1) + 1));                printf("sxpgd=%.7e,sdgd=%.7e\n",                        *(ckt->CKTstate1 + here->MOS3sensxpgd +                         10*(iparmno - 1)), *(ckt->CKTstate1 +                         here->MOS3sensxpgd + 10*(iparmno - 1) + 1));                printf("sxpbs=%.7e,sdbs=%.7e\n",                        *(ckt->CKTstate1 + here->MOS3sensxpbs +                         10*(iparmno - 1)), *(ckt->CKTstate1 +                         here->MOS3sensxpbs + 10*(iparmno - 1) + 1));                printf("sxpbd=%.7e,sdbd=%.7e\n",                        *(ckt->CKTstate1 + here->MOS3sensxpbd +                         10*(iparmno - 1)), *(ckt->CKTstate1 +                         here->MOS3sensxpbd + 10*(iparmno - 1) + 1));                printf("sxpgb=%.7e,sdgb=%.7e\n",                        *(ckt->CKTstate1 + here->MOS3sensxpgb +                         10*(iparmno - 1)), *(ckt->CKTstate1 +                         here->MOS3sensxpgb + 10*(iparmno - 1) + 1));                printf("before loading DqDp\n");                printf("Osxpgs=%.7e,Osxpgd=%.7e\n",Osxpgs,Osxpgd);                printf("Osxpbs=%.7e,Osxpbd=%.7e,Osxpgb=%.7e\n",                        Osxpbs,Osxpbd,Osxpgb);                printf("\n");#endif /* SENSDEBUG */                if(here->MOS3sens_l && (iparmno == here->MOS3senParmNo)){                    Osxpgs -= tag0 * *(here->MOS3dphigs_dl);                    Osxpgd -= tag0 * *(here->MOS3dphigd_dl);                    Osxpbs -= tag0 * *(here->MOS3dphibs_dl);                    Osxpbd -= tag0 * *(here->MOS3dphibd_dl);                    Osxpgb -= tag0 * *(here->MOS3dphigb_dl);                }                if(here->MOS3sens_w &&                         (iparmno == (here->MOS3senParmNo + here->MOS3sens_l))){                    Osxpgs -= tag0 * *(here->MOS3dphigs_dw);                    Osxpgd -= tag0 * *(here->MOS3dphigd_dw);                    Osxpbs -= tag0 * *(here->MOS3dphibs_dw);                    Osxpbd -= tag0 * *(here->MOS3dphibd_dw);                    Osxpgb -= tag0 * *(here->MOS3dphigb_dw);                }#ifdef SENSDEBUG                printf("after loading DqDp\n");                printf("DqgsDp=%.7e",DqgsDp);                printf("Osxpgs=%.7e,Osxpgd=%.7e\n",Osxpgs,Osxpgd);                printf("Osxpbs=%.7e,Osxpbd=%.7e,Osxpgb=%.7e\n",                        Osxpbs,Osxpbd,Osxpgb);#endif /* SENSDEBUG */                *(info->SEN_RHS[here->MOS3bNode] + iparmno) +=                         Osxpbs + Osxpbd -Osxpgb;                *(info->SEN_RHS[here->MOS3gNode] + iparmno) +=                        Osxpgs + Osxpgd + Osxpgb;                *(info->SEN_RHS[here->MOS3dNodePrime] + iparmno) -=                        Osxpgd + Osxpbd ;                *(info->SEN_RHS[here->MOS3sNodePrime] + iparmno) -=                        Osxpgs + Osxpbs;#ifdef SENSDEBUG                printf("after capacitive currents\n");                printf("DcbDp=%.7e\n",                        *(info->SEN_RHS[here->MOS3bNode] + iparmno));                printf("DcdprDp=%.7e\n",                        *(info->SEN_RHS[here->MOS3dNode] + iparmno));                printf("DcdprmDp=%.7e\n",                        *(info->SEN_RHS[here->MOS3dNodePrime] + iparmno));                printf("DcsprDp=%.7e\n",                        *(info->SEN_RHS[here->MOS3sNode] + iparmno));                printf("DcsprmDp=%.7e\n",                        *(info->SEN_RHS[here->MOS3sNodePrime] + iparmno));#endif /* SENSDEBUG */            }restore:    /* put the unperturbed values back into the state vector */            for(i=0; i <= 16; i++)                *(ckt->CKTstate0 + here->MOS3states + i) = *(SaveState + i);            here->MOS3sourceConductance = *(SaveState + 17) ;               here->MOS3drainConductance = *(SaveState + 18) ;             here->MOS3cd =  *(SaveState + 19) ;              here->MOS3cbs =  *(SaveState + 20) ;              here->MOS3cbd =  *(SaveState + 21) ;              here->MOS3gmbs =  *(SaveState + 22) ;              here->MOS3gm =  *(SaveState + 23) ;              here->MOS3gds =  *(SaveState + 24) ;              here->MOS3gbd =  *(SaveState + 25) ;              here->MOS3gbs =  *(SaveState + 26) ;              here->MOS3capbd =  *(SaveState + 27) ;              here->MOS3capbs =  *(SaveState + 28) ;              here->MOS3Cbd =  *(SaveState + 29) ;              here->MOS3Cbdsw =  *(SaveState + 30) ;              here->MOS3Cbs =  *(SaveState + 31) ;              here->MOS3Cbssw =  *(SaveState + 32) ;              here->MOS3f2d =  *(SaveState + 33) ;              here->MOS3f3d =  *(SaveState + 34) ;              here->MOS3f4d =  *(SaveState + 35) ;              here->MOS3f2s =  *(SaveState + 36) ;              here->MOS3f3s =  *(SaveState + 37) ;              here->MOS3f4s =  *(SaveState + 38) ;              here->MOS3cgs = *(SaveState + 39) ;              here->MOS3cgd = *(SaveState + 40) ;              here->MOS3cgb = *(SaveState + 41) ;              here->MOS3vdsat = *(SaveState + 42) ;              here->MOS3von = *(SaveState + 43) ;               here->MOS3mode = save_mode ;              here->MOS3senPertFlag = OFF;        }    }    info->SENstatus = NORMAL;#ifdef SENSDEBUG    printf("MOS3senload end\n");#endif /* SENSDEBUG */    return(OK);}

⌨️ 快捷键说明

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