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

📄 inpdomod.c

📁 ngspice又一个电子CAD仿真软件代码.功能更全
💻 C
📖 第 1 页 / 共 2 页
字号:
/**********Copyright 1990 Regents of the University of California.  All rights reserved.Author: 1985 Thomas L. Quarles**********/#include "ngspice.h"#include "iferrmsg.h"#include "inpdefs.h"#include "inp.h"/*-------------------------------------------------------------- * This fcn takes the model card & examines it.  Depending upon * model type, it parses the model line, and then calls * INPmakeMod to stick the model name into the model list. * Note that multi-line models are handled in the calling fcn * (INPpas1). *-------------------------------------------------------------*/char *INPdomodel(void *ckt, card * image, INPtables * tab){    char *modname;    int type = -1;    int lev;    char *typename;    char *err = (char *) NULL;    char *line;    line = image->line;    #ifdef TRACE    /* SDB debug statement */    printf("In INPdomodel, examining line %s . . . \n", line); #endif            INPgetTok(&line, &modname, 1);	/* throw away '.model' */    tfree(modname);    INPgetTok(&line, &modname, 1);      /* get model name */    INPinsert(&modname, tab);           /* stick model name into table */    INPgetTok(&line, &typename, 1);     /* get model type */        /*  -----  Check if model is a BJT --------- */    if ((strcmp(typename, "npn") == 0) || (strcmp(typename, "pnp") == 0)) {	err = INPfindLev(line,&lev);	switch(lev) {		case 0:		case 1:			type = INPtypelook("BJT");			if (type < 0) {	  		  err = INPmkTemp(	  		          "Device type BJT not available in this binary\n");			}		break;		case 2:			 type = INPtypelook("BJT2");                if(type < 0) {                    err = INPmkTemp(                            "Device type BJT2 not available in this binary\n");                }                break;		case 4:			 type = INPtypelook("VBIC");                if(type < 0) {                    err = INPmkTemp(                            "Device type VBIC not available in this binary\n");                }                break;		default: /* placeholder; use level 4 for the next model */		err = INPmkTemp(		  "Only BJT levels 1-2, 4 are supported in this binary\n");                break;	}		INPmakeMod(modname, type, image);    } /* end if ((strcmp(typename, "npn") == 0) || (strcmp(typename, "pnp") == 0)) */    /*  --------  Check if model is a diode --------- */        else if (strcmp(typename, "d") == 0) {	type = INPtypelook("Diode");	if (type < 0) {	    err =		INPmkTemp		("Device type Diode not available in this binary\n");	}	INPmakeMod(modname, type, image);    } /*   else if (strcmp(typename, "d") == 0) {  */        /*  --------  Check if model is a jfet --------- */    else if ((strcmp(typename, "njf") == 0)	       || (strcmp(typename, "pjf") == 0)) {	err = INPfindLev(line, &lev);	switch (lev) {	case 0:	case 1:	    type = INPtypelook("JFET");	    if (type < 0) {		err =		    INPmkTemp		    ("Device type JFET not available in this binary\n");	    }	    break;	case 2:	    type = INPtypelook("JFET2");	    if (type < 0) {		err =		    INPmkTemp		    ("Device type JFET2 not available in this binary\n");	    }	    break;	default:		/* placeholder; use level 3 for the next model */	    err =		INPmkTemp		("Only JFET device levels 1-2 are supported in this binary\n");	    break;	}	INPmakeMod(modname, type, image);    }  /*   end  else if ((strcmp(typename, "njf") == 0) */        /*  --------  Check if model is a MES or an HFET --------- */    else if ((strcmp(typename, "nmf")   == 0)	       || (strcmp(typename, "pmf")   == 0)	       || (strcmp(typename, "nhfet") == 0)	       || (strcmp(typename, "phfet") == 0)) {	  err = INPfindLev( line, &lev );	  switch ( lev ) 	  {			case 0:        	case 1:        		type = INPtypelook("MES");        		if (type < 0)        		{        			err = INPmkTemp("Device type MES not available\n");        		}        		break;        	case 2:        		type = INPtypelook("MESA");        		if (type < 0)        		{        			err = INPmkTemp("Device type MESA not availabe\n");        		}        		break;			case 3:        		type = INPtypelook("MESA");        		if (type < 0)        		{        			err = INPmkTemp("Device type MESA not availabe\n");        		}        		break;        	case 4:        		type = INPtypelook("MESA");        		if ( type < 0)        		{        			err = INPmkTemp(" Device type MESA not available\n");        		}        		break;        	case 5:        		type = INPtypelook("HFET1");        		if ( type < 0)        		{        			err = INPmkTemp(" Device type HFET1 not available\n");        		}        		break;        	case 6:        		type = INPtypelook("HFET2");        		if ( type < 0)        		{        			err = INPmkTemp(" Device type HFET2 not available in this binary\n");        		}        		break;        	default:        		err = INPmkTemp("only mesfet device level 1-4 and hfet level 5-6 supported\n");        		break;        }	INPmakeMod(modname, type, image);    }         /*  --------  Check if model is a Uniform Distrib. RC line --------- */    else if (strcmp(typename, "urc") == 0) {	type = INPtypelook("URC");	if (type < 0) {	    err =		INPmkTemp		("Device type URC not available in this binary\n");	}	INPmakeMod(modname, type, image);    }         /*  --------  Check if model is a MOSFET --------- */    else if ((strcmp(typename, "nmos") == 0)	       || (strcmp(typename, "pmos") == 0)	       || (strcmp(typename, "nsoi") == 0)	       || (strcmp(typename, "psoi") == 0)) {	err = INPfindLev(line, &lev);	switch (lev) {	case 0:	case 1:	    type = INPtypelook("Mos1");	    if (type < 0) {		err =		    INPmkTemp		    ("Device type MOS1 not available in this binary\n");	    }	    break;	case 2:	    type = INPtypelook("Mos2");	    if (type < 0) {		err =		    INPmkTemp		    ("Device type MOS2 not available in this binary\n");	    }	    break;	case 3:	    type = INPtypelook("Mos3");	    if (type < 0) {		err =		    INPmkTemp		    ("Device type MOS3 not available in this binary\n");	    }	    break;	case 4:	    type = INPtypelook("BSIM1");	    if (type < 0) {		err =		    INPmkTemp		    ("Device type BSIM1 not available in this binary\n");	    }	    break;	case 5:	    type = INPtypelook("BSIM2");	    if (type < 0) {		err =		    INPmkTemp		    ("Device type BSIM2 not available in this binary\n");	    }	    break;	case 6:	    type = INPtypelook("Mos6");	    if (type < 0) {		err =		    INPmkTemp		    ("Device type MOS6 not available in this binary\n");	    }	    break;	case 7:	    type = INPtypelook("MOS7");	    if (type < 0) {		err =		    INPmkTemp		    ("Device type MOS7 not available in this binary\n");	    }	    break;	case 8:	    type = INPtypelook("BSIM3");	    if (type < 0) {		err =		    INPmkTemp		    ("Device type BSIM3 not available in this binary\n");	    }	    break;	    	case  9:	    type = INPtypelook("Mos9");         if(type < 0) {          err = INPmkTemp                ("Device type MOS9 not available in this binary\n");        }        break;		case 14:	    type = INPtypelook("BSIM4");	    if (type < 0) {		err =		    INPmkTemp		    ("Device type BSIM4 not available in this binary\n");	    }	    break;	case 15:	    type = INPtypelook("BSIM5");	    if (type < 0) {		err =		    INPmkTemp		    ("Device type BSIM5 not available in this binary\n");	    }	    break;        	case 16:	    type = INPtypelook("BSIM6");	    if (type < 0) {		err =		    INPmkTemp		    ("Device type BSIM6 not available in this binary\n");}	    break;	case 44:		type = INPtypelook("EKV");		if (type < 0) {		err =		    INPmkTemp		    ("Placeholder for EKV model: look at http://legwww.epfl.ch for info on EKV\n");	    }	    break;    	case 49:	    type = INPtypelook("BSIM3v1S");	    if (type < 0) {		err =		    INPmkTemp		    ("Device type BSIM3v1S not available in this binary\n");	    }	    break;	case 50:	    type = INPtypelook("BSIM3v1");	    if (type < 0) {		err =		    INPmkTemp		    ("Device type BSIM3v1 not available in this binary\n");	    }	    break;	case 51:	    type = INPtypelook("BSIM3v1A");	    if (type < 0) {

⌨️ 快捷键说明

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