diff --git a/examples/digital/adder32b_mos.cir b/examples/digital/adder32b_mos.cir index cf9d4a4bb..28421b520 100644 --- a/examples/digital/adder32b_mos.cir +++ b/examples/digital/adder32b_mos.cir @@ -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) * use BSIM3 model with default parameters -.model n1 nmos level=49 version=3.2.4simd -.model p1 pmos level=49 version=3.2.4simd +.model n1 nmos level=49 version=3.2.4 +.model p1 pmos level=49 version=3.2.4 *.include ./Modelcards/modelcard32.nmos *.include ./Modelcards/modelcard32.pmos diff --git a/src/spicelib/devices/bsim3v32simd/b3v32check.c b/src/spicelib/devices/bsim3v32simd/b3v32check.c index 18eca0401..9cb35d35d 100644 --- a/src/spicelib/devices/bsim3v32simd/b3v32check.c +++ b/src/spicelib/devices/bsim3v32simd/b3v32check.c @@ -19,6 +19,17 @@ #include "ngspice/devdefs.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 BSIM3v32checkModel (BSIM3v32model *model, BSIM3v32instance *here, CKTcircuit *ckt) { @@ -38,9 +49,9 @@ FILE *fplog; fprintf (fplog, "W = %g, L = %g, M = %g\n", here->BSIM3v32w, here->BSIM3v32l, here->BSIM3v32m); - if ((strcmp(model->BSIM3v32version, "3.2.4")) && (strncmp(model->BSIM3v32version, "3.24", 4)) - && (strcmp(model->BSIM3v32version, "3.2.3")) && (strncmp(model->BSIM3v32version, "3.23", 4)) - && (strcmp(model->BSIM3v32version, "3.2.2")) && (strncmp(model->BSIM3v32version, "3.22", 4)) + if ((vesion_check(model->BSIM3v32version, "3.2.4")) && (strncmp(model->BSIM3v32version, "3.24", 4)) + && (vesion_check(model->BSIM3v32version, "3.2.3")) && (strncmp(model->BSIM3v32version, "3.23", 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))) { fprintf (fplog, diff --git a/src/spicelib/devices/bsim3v32simd/b3v32set.c b/src/spicelib/devices/bsim3v32simd/b3v32set.c index ee76d188f..62ffc92da 100644 --- a/src/spicelib/devices/bsim3v32simd/b3v32set.c +++ b/src/spicelib/devices/bsim3v32simd/b3v32set.c @@ -31,6 +31,17 @@ extern SPICEdev BSIM3v32simdinfo; #define Charge_q 1.60219e-19 #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 BSIM3v32SIMDsetup (SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) @@ -87,16 +98,17 @@ BSIM3v32instance **InstArray; * is faster than comparing strings. * 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; - 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; - 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; else if ((!strncmp(model->BSIM3v32version, "3.2", 3))||(!strncmp(model->BSIM3v32version, "3.20", 4))) model->BSIM3v32intVersion = BSIM3v32V32; else model->BSIM3v32intVersion = BSIM3v32V3OLD; + printf("bsim3v32simd version set to %d\n", model->BSIM3v32intVersion); /* BSIM3v32V3OLD is a placeholder for pre 3.2 revision * This model should not be used for pre 3.2 models. */ @@ -938,7 +950,6 @@ BSIM3v32instance **InstArray; model->BSIM3v32vbsrMax = 1e99; if (!model->BSIM3v32vbdrMaxGiven) model->BSIM3v32vbdrMax = 1e99; - /* loop through all the instances of the model */ for (here = BSIM3v32instances(model); here != NULL ; here=BSIM3v32nextInstance(here)) diff --git a/src/spicelib/parser/inpdomod.c b/src/spicelib/parser/inpdomod.c index 833ecf5ec..29c0b0145 100644 --- a/src/spicelib/parser/inpdomod.c +++ b/src/spicelib/parser/inpdomod.c @@ -299,12 +299,16 @@ char *INPdomodel(CKTcircuit *ckt, struct card *image, INPtables * tab) type = INPtypelook("BSIM3v1"); } if (prefix("3.2", ver)) { /* version string ver has to start with 3.2 */ - #ifdef BSIM3v32SIMD - if((strlen(ver)>5) && (strcmp(&ver[5],"simd")==0)) + #ifdef BSIM3v32SIMDxxxxx + if((strlen(ver)>5) && (strcmp(&ver[strlen(ver)-4],"simd")==0)) type = INPtypelook("BSIM3v32simd"); else #endif + #if defined(MODSIMD_ALWAYS) + type = INPtypelook("BSIM3v32simd"); + #else type = INPtypelook("BSIM3v32"); + #endif } if ( (strstr(ver, "default")) || (prefix("3.3", ver)) ) { type = INPtypelook("BSIM3");