remove handling of simd suffix after version

This commit is contained in:
Florian Ballenegger 2020-07-25 23:44:10 +02:00
parent bcc2675308
commit 3755d63cf1
4 changed files with 37 additions and 11 deletions

View File

@ -71,8 +71,8 @@ Xadd a1 a2 a3 a4 a1 a2 a3 a4 a1 a2 a3 a4 a1 a2 a3 a4 a1 a2 a3 a4 a1 a2 a3 a4 a1
.save V(a1) V(a2) V(a3) V(a4) V(b1) V(b2) V(b3) V(b4) .save V(a1) V(a2) V(a3) V(a4) V(b1) V(b2) V(b3) V(b4)
* use BSIM3 model with default parameters * use BSIM3 model with default parameters
.model n1 nmos level=49 version=3.2.4simd .model n1 nmos level=49 version=3.2.4
.model p1 pmos level=49 version=3.2.4simd .model p1 pmos level=49 version=3.2.4
*.include ./Modelcards/modelcard32.nmos *.include ./Modelcards/modelcard32.nmos
*.include ./Modelcards/modelcard32.pmos *.include ./Modelcards/modelcard32.pmos

View File

@ -19,6 +19,17 @@
#include "ngspice/devdefs.h" #include "ngspice/devdefs.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
static int vesion_check(const char* modver, const char *ver)
{
int len = strlen(modver);
if(len>5)
if(strcmp(&modver[len-4],"simd")==0)
if(strlen(ver)<=len-4)
if(strncmp(modver,ver,len-4)==0)
return 0;
return strcmp(modver,ver);
}
int int
BSIM3v32checkModel (BSIM3v32model *model, BSIM3v32instance *here, CKTcircuit *ckt) BSIM3v32checkModel (BSIM3v32model *model, BSIM3v32instance *here, CKTcircuit *ckt)
{ {
@ -38,9 +49,9 @@ FILE *fplog;
fprintf (fplog, "W = %g, L = %g, M = %g\n", here->BSIM3v32w, fprintf (fplog, "W = %g, L = %g, M = %g\n", here->BSIM3v32w,
here->BSIM3v32l, here->BSIM3v32m); here->BSIM3v32l, here->BSIM3v32m);
if ((strcmp(model->BSIM3v32version, "3.2.4")) && (strncmp(model->BSIM3v32version, "3.24", 4)) if ((vesion_check(model->BSIM3v32version, "3.2.4")) && (strncmp(model->BSIM3v32version, "3.24", 4))
&& (strcmp(model->BSIM3v32version, "3.2.3")) && (strncmp(model->BSIM3v32version, "3.23", 4)) && (vesion_check(model->BSIM3v32version, "3.2.3")) && (strncmp(model->BSIM3v32version, "3.23", 4))
&& (strcmp(model->BSIM3v32version, "3.2.2")) && (strncmp(model->BSIM3v32version, "3.22", 4)) && (vesion_check(model->BSIM3v32version, "3.2.2")) && (strncmp(model->BSIM3v32version, "3.22", 4))
&& (strncmp(model->BSIM3v32version, "3.2", 3)) && (strncmp(model->BSIM3v32version, "3.20", 4))) && (strncmp(model->BSIM3v32version, "3.2", 3)) && (strncmp(model->BSIM3v32version, "3.20", 4)))
{ {
fprintf (fplog, fprintf (fplog,

View File

@ -31,6 +31,17 @@ extern SPICEdev BSIM3v32simdinfo;
#define Charge_q 1.60219e-19 #define Charge_q 1.60219e-19
#define Meter2Micron 1.0e6 #define Meter2Micron 1.0e6
static int vesion_check(const char* modver, const char *ver)
{
int len = strlen(modver);
if(len>5)
if(strcmp(&modver[len-4],"simd")==0)
if(strlen(ver)<=len-4)
if(strncmp(modver,ver,len-4)==0)
return 0;
return strcmp(modver,ver);
}
int int
BSIM3v32SIMDsetup (SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, BSIM3v32SIMDsetup (SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt,
int *states) int *states)
@ -87,16 +98,17 @@ BSIM3v32instance **InstArray;
* is faster than comparing strings. * is faster than comparing strings.
* Paolo Nenzi 2002 * Paolo Nenzi 2002
*/ */
if ((!strcmp(model->BSIM3v32version, "3.2.4"))||(!strncmp(model->BSIM3v32version, "3.24", 4))) if ((!vesion_check(model->BSIM3v32version, "3.2.4"))||(!strncmp(model->BSIM3v32version, "3.24", 4)))
model->BSIM3v32intVersion = BSIM3v32V324; model->BSIM3v32intVersion = BSIM3v32V324;
else if ((!strcmp(model->BSIM3v32version, "3.2.3"))||(!strncmp(model->BSIM3v32version, "3.23", 4))) else if ((!vesion_check(model->BSIM3v32version, "3.2.3"))||(!strncmp(model->BSIM3v32version, "3.23", 4)))
model->BSIM3v32intVersion = BSIM3v32V323; model->BSIM3v32intVersion = BSIM3v32V323;
else if ((!strcmp(model->BSIM3v32version, "3.2.2"))||(!strncmp(model->BSIM3v32version, "3.22", 4))) else if ((!vesion_check(model->BSIM3v32version, "3.2.2"))||(!strncmp(model->BSIM3v32version, "3.22", 4)))
model->BSIM3v32intVersion = BSIM3v32V322; model->BSIM3v32intVersion = BSIM3v32V322;
else if ((!strncmp(model->BSIM3v32version, "3.2", 3))||(!strncmp(model->BSIM3v32version, "3.20", 4))) else if ((!strncmp(model->BSIM3v32version, "3.2", 3))||(!strncmp(model->BSIM3v32version, "3.20", 4)))
model->BSIM3v32intVersion = BSIM3v32V32; model->BSIM3v32intVersion = BSIM3v32V32;
else else
model->BSIM3v32intVersion = BSIM3v32V3OLD; model->BSIM3v32intVersion = BSIM3v32V3OLD;
printf("bsim3v32simd version set to %d\n", model->BSIM3v32intVersion);
/* BSIM3v32V3OLD is a placeholder for pre 3.2 revision /* BSIM3v32V3OLD is a placeholder for pre 3.2 revision
* This model should not be used for pre 3.2 models. * This model should not be used for pre 3.2 models.
*/ */
@ -938,7 +950,6 @@ BSIM3v32instance **InstArray;
model->BSIM3v32vbsrMax = 1e99; model->BSIM3v32vbsrMax = 1e99;
if (!model->BSIM3v32vbdrMaxGiven) if (!model->BSIM3v32vbdrMaxGiven)
model->BSIM3v32vbdrMax = 1e99; model->BSIM3v32vbdrMax = 1e99;
/* loop through all the instances of the model */ /* loop through all the instances of the model */
for (here = BSIM3v32instances(model); here != NULL ; for (here = BSIM3v32instances(model); here != NULL ;
here=BSIM3v32nextInstance(here)) here=BSIM3v32nextInstance(here))

View File

@ -299,12 +299,16 @@ char *INPdomodel(CKTcircuit *ckt, struct card *image, INPtables * tab)
type = INPtypelook("BSIM3v1"); type = INPtypelook("BSIM3v1");
} }
if (prefix("3.2", ver)) { /* version string ver has to start with 3.2 */ if (prefix("3.2", ver)) { /* version string ver has to start with 3.2 */
#ifdef BSIM3v32SIMD #ifdef BSIM3v32SIMDxxxxx
if((strlen(ver)>5) && (strcmp(&ver[5],"simd")==0)) if((strlen(ver)>5) && (strcmp(&ver[strlen(ver)-4],"simd")==0))
type = INPtypelook("BSIM3v32simd"); type = INPtypelook("BSIM3v32simd");
else else
#endif #endif
#if defined(MODSIMD_ALWAYS)
type = INPtypelook("BSIM3v32simd");
#else
type = INPtypelook("BSIM3v32"); type = INPtypelook("BSIM3v32");
#endif
} }
if ( (strstr(ver, "default")) || (prefix("3.3", ver)) ) { if ( (strstr(ver, "default")) || (prefix("3.3", ver)) ) {
type = INPtypelook("BSIM3"); type = INPtypelook("BSIM3");