|
|
|
@ -224,22 +224,45 @@ INPgetModBin(CKTcircuit *ckt, char *name, INPmodel **model, INPtables *tab, char |
|
|
|
double l, w, lmin, lmax, wmin, wmax; |
|
|
|
double parse_values[4]; |
|
|
|
bool parse_found[4]; |
|
|
|
static char *instance_tokens[] = { "l", "w", "nf" }; |
|
|
|
static char *instance_tokens[] = { "l", "w", "nf", "wnflag" }; |
|
|
|
static char *model_tokens[] = { "lmin", "lmax", "wmin", "wmax" }; |
|
|
|
double scale; |
|
|
|
int wnflag; |
|
|
|
|
|
|
|
if (!cp_getvar("scale", CP_REAL, &scale, 0)) |
|
|
|
scale = 1; |
|
|
|
|
|
|
|
if (!cp_getvar("wnflag", CP_NUM, &wnflag, 0)) |
|
|
|
if (newcompat.spe || newcompat.hs) |
|
|
|
wnflag = 1; |
|
|
|
else |
|
|
|
wnflag = 0; |
|
|
|
|
|
|
|
*model = NULL; |
|
|
|
|
|
|
|
/* read W and L. If not on the instance line, leave */ |
|
|
|
if (!parse_line(line, instance_tokens, 2, parse_values, parse_found)) |
|
|
|
return NULL; |
|
|
|
|
|
|
|
/* This is for reading nf. If not available, set to 1. Only in Spectre compatibility mode */ |
|
|
|
if (!newcompat.spe || !parse_line(line, instance_tokens, 3, parse_values, parse_found)) |
|
|
|
parse_values[2] = 1.; |
|
|
|
/* This is for reading nf. If nf is not available, set to 1 if in HSPICE or Spectre compatibility mode */ |
|
|
|
if (!parse_line(line, instance_tokens, 3, parse_values, parse_found)) { |
|
|
|
parse_values[2] = 1.; /* divisor */ |
|
|
|
} |
|
|
|
/* This is for reading wnflag from instance. If it is not available, no change. |
|
|
|
If instance wnflag == 0, set divisor to 1, else use instance nf */ |
|
|
|
else if (parse_line(line, instance_tokens, 4, parse_values, parse_found)) { |
|
|
|
/* wnflag from instance overrules: no use of nf */ |
|
|
|
if (parse_values[3] == 0) { |
|
|
|
parse_values[2] = 1.; /* divisor */ |
|
|
|
} |
|
|
|
} |
|
|
|
/* We do have nf, but no wnflag on the instance. Now it depends on the default |
|
|
|
wnflag or on the .options wnflag */ |
|
|
|
else { |
|
|
|
if (wnflag == 0) |
|
|
|
parse_values[2] = 1.; /* divisor */ |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
l = parse_values[0] * scale; |
|
|
|
w = parse_values[1] / parse_values[2] * scale; |
|
|
|
|