inpgmod.c, INPgetModBin(), use model_name_match()
This commit is contained in:
parent
b663731379
commit
f5d05af51d
|
|
@ -26,7 +26,7 @@ char * stripWhiteSpacesInsideParens(char *str);
|
|||
char * gettok(char **s);
|
||||
char * gettok_instance(char **);
|
||||
char * gettok_char(char **s, char p, bool inc_p, bool nested);
|
||||
bool model_name_match(const char *token, const char *model_name);
|
||||
int model_name_match(const char *token, const char *model_name);
|
||||
|
||||
extern char *tvprintf(const char *fmt, va_list args);
|
||||
|
||||
|
|
|
|||
|
|
@ -685,37 +685,39 @@ get_comma_separated_values( char *values[], char *str ) {
|
|||
/*
|
||||
check if the given token matches a model name
|
||||
either exact
|
||||
then return 1
|
||||
or
|
||||
modulo a trailing model binning extension '\.[0-9]+'
|
||||
then return 2
|
||||
*/
|
||||
|
||||
bool
|
||||
int
|
||||
model_name_match(const char *token, const char *model_name)
|
||||
{
|
||||
const char *p;
|
||||
size_t token_len = strlen(token);
|
||||
|
||||
if (strncmp(token, model_name, token_len) != 0)
|
||||
return FALSE;
|
||||
return 0;
|
||||
|
||||
p = model_name + token_len;
|
||||
|
||||
// exact match
|
||||
if (*p == '\0')
|
||||
return TRUE;
|
||||
return 1;
|
||||
|
||||
// check for .
|
||||
if (*p++ != '.')
|
||||
return FALSE;
|
||||
return 0;
|
||||
|
||||
// minimum one trailing char
|
||||
if (*p == '\0')
|
||||
return FALSE;
|
||||
return 0;
|
||||
|
||||
// all of them digits
|
||||
for (; *p; p++)
|
||||
if (!isdigit(*p))
|
||||
return FALSE;
|
||||
return 0;
|
||||
|
||||
return TRUE;
|
||||
return 2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -212,6 +212,10 @@ INPgetModBin( CKTcircuit* ckt, char* name, INPmodel** model, INPtables* tab, cha
|
|||
w = parse_values[1]*scale;
|
||||
|
||||
for ( modtmp = modtab; modtmp != NULL; modtmp = modtmp->INPnextModel ) {
|
||||
|
||||
if ( model_name_match(name, modtmp->INPmodName) < 2 )
|
||||
continue;
|
||||
|
||||
if ( /* This is the list of binable models */
|
||||
modtmp->INPmodType != INPtypelook ("BSIM3")
|
||||
&& modtmp->INPmodType != INPtypelook ("BSIM3v32")
|
||||
|
|
@ -238,8 +242,7 @@ INPgetModBin( CKTcircuit* ckt, char* name, INPmodel** model, INPtables* tab, cha
|
|||
lmin = parse_values[0]; lmax = parse_values[1];
|
||||
wmin = parse_values[2]; wmax = parse_values[3];
|
||||
|
||||
if ( strncmp( modtmp->INPmodName, name, strlen( name ) ) == 0 &&
|
||||
in_range( l, lmin, lmax ) && in_range( w, wmin, wmax ) ) {
|
||||
if ( in_range( l, lmin, lmax ) && in_range( w, wmin, wmax ) ) {
|
||||
if ( !modtmp->INPmodfast ) {
|
||||
error = create_model( ckt, modtmp, tab );
|
||||
if ( error ) return NULL;
|
||||
|
|
|
|||
Loading…
Reference in New Issue