|
|
|
@ -449,6 +449,7 @@ struct card *insert_new_line( |
|
|
|
x->linenum_orig = linenum_orig; |
|
|
|
x->level = card ? card->level : NULL; |
|
|
|
x->linesource = lineinfo; |
|
|
|
x->compmod = 0; |
|
|
|
|
|
|
|
if (card) |
|
|
|
card->nextcard = x; |
|
|
|
@ -950,7 +951,7 @@ void inp_get_w_l_x(struct card* card) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
/* only subcircuit invocations */ |
|
|
|
if (*curr_line != 'x' || (!newcompat.hs && !newcompat.spe)) { |
|
|
|
if (*curr_line != 'x' || (!newcompat.hs && !newcompat.spe) || card->compmod > 0) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
@ -1430,6 +1431,47 @@ static struct inp_read_t inp_read(FILE* fp, int call_depth, const char* dir_name |
|
|
|
|
|
|
|
struct card* newcard; |
|
|
|
|
|
|
|
struct compat tmpcomp; |
|
|
|
bool compset = FALSE; |
|
|
|
|
|
|
|
/* special treatment of special .inc commands */ |
|
|
|
if (ciprefix(".incpslt", buffer)) { |
|
|
|
compset = TRUE; |
|
|
|
/* save the current compatibility status */ |
|
|
|
tmpcomp.isset = newcompat.isset; /* at least one mode is set */ |
|
|
|
tmpcomp.hs = newcompat.hs; /* HSPICE */ |
|
|
|
tmpcomp.s3 = newcompat.s3; /* spice3 */ |
|
|
|
tmpcomp.ll = newcompat.ll; /* all */ |
|
|
|
tmpcomp.ps = newcompat.ps; /* PSPICE */ |
|
|
|
tmpcomp.lt = newcompat.lt; /* LTSPICE */ |
|
|
|
tmpcomp.ki = newcompat.ki; /* KiCad */ |
|
|
|
tmpcomp.a = newcompat.a; /* whole netlist */ |
|
|
|
tmpcomp.spe = newcompat.spe; /* spectre */ |
|
|
|
tmpcomp.eg = newcompat.eg; /* EAGLE */ |
|
|
|
tmpcomp.mc = newcompat.mc; /* to be set for 'make check' */ |
|
|
|
tmpcomp.xs = newcompat.xs; /* XSPICE */ |
|
|
|
/* save the new comptmode */ |
|
|
|
newcompat.isset = TRUE; /* at least one mode is set */ |
|
|
|
if (ciprefix(".incpslt", buffer)) { |
|
|
|
newcompat.hs = FALSE; |
|
|
|
newcompat.ps = TRUE; |
|
|
|
newcompat.lt = TRUE; |
|
|
|
} |
|
|
|
else { |
|
|
|
newcompat.hs = TRUE; |
|
|
|
newcompat.ps = FALSE; |
|
|
|
newcompat.lt = FALSE; |
|
|
|
} |
|
|
|
newcompat.s3 = FALSE; |
|
|
|
newcompat.ll = FALSE; |
|
|
|
newcompat.ki = FALSE; |
|
|
|
newcompat.a = FALSE; |
|
|
|
newcompat.spe = FALSE; |
|
|
|
newcompat.eg = FALSE; |
|
|
|
newcompat.mc = FALSE; |
|
|
|
newcompat.xs = FALSE; |
|
|
|
} |
|
|
|
|
|
|
|
inp_stripcomments_line(buffer, FALSE, TRUE); |
|
|
|
|
|
|
|
s = skip_non_ws(buffer); /* advance past non-space chars */ |
|
|
|
@ -1507,10 +1549,15 @@ static struct inp_read_t inp_read(FILE* fp, int call_depth, const char* dir_name |
|
|
|
char* tmpstr = copy(nexttok(buffer)); |
|
|
|
wl_append_word(&sourceinfo, &sourceinfo, tmpstr); |
|
|
|
|
|
|
|
/* Add source of netlist data, for use in verbose error messages */ |
|
|
|
/* Add source of netlist data, for use in verbose error messages. |
|
|
|
Set the compatibility mode flag to 1, if pslt is read. */ |
|
|
|
for (tmpcard = newcard; tmpcard; tmpcard = tmpcard->nextcard) { |
|
|
|
/* skip *include */ |
|
|
|
tmpcard->linesource = tmpstr; |
|
|
|
if (compset) |
|
|
|
tmpcard->compmod = 1; |
|
|
|
else |
|
|
|
tmpcard->compmod = 0; |
|
|
|
} |
|
|
|
|
|
|
|
if (newcard) { |
|
|
|
@ -1533,6 +1580,23 @@ static struct inp_read_t inp_read(FILE* fp, int call_depth, const char* dir_name |
|
|
|
|
|
|
|
/* Fix the buffer up a bit. */ |
|
|
|
(void)memcpy(buffer + 1, "end of: ", 8); |
|
|
|
|
|
|
|
if (compset) { |
|
|
|
/* restore the previous compatibility status */ |
|
|
|
newcompat.isset = tmpcomp.isset; /* at least one mode is set */ |
|
|
|
newcompat.hs = tmpcomp.hs; /* HSPICE */ |
|
|
|
newcompat.s3 = tmpcomp.s3; /* spice3 */ |
|
|
|
newcompat.ll = tmpcomp.ll; /* all */ |
|
|
|
newcompat.ps = tmpcomp.ps; /* PSPICE */ |
|
|
|
newcompat.lt = tmpcomp.lt; /* LTSPICE */ |
|
|
|
newcompat.ki = tmpcomp.ki; /* KiCad */ |
|
|
|
newcompat.a = tmpcomp.a; /* whole netlist */ |
|
|
|
newcompat.spe = tmpcomp.spe; /* spectre */ |
|
|
|
newcompat.eg = tmpcomp.eg; /* EAGLE */ |
|
|
|
newcompat.mc = tmpcomp.mc; /* to be set for 'make check' */ |
|
|
|
newcompat.xs = tmpcomp.xs; /* XSPICE */ |
|
|
|
} |
|
|
|
|
|
|
|
} /* end of .include handling */ |
|
|
|
|
|
|
|
/* loop through 'buffer' until end is reached. Make all letters lower |
|
|
|
@ -3704,7 +3768,7 @@ static void inp_fix_for_numparam( |
|
|
|
|
|
|
|
inp_change_quotes(c->line); |
|
|
|
|
|
|
|
if (!newcompat.hs && !newcompat.s3) |
|
|
|
if ((!newcompat.hs && !newcompat.s3) || c->compmod > 0) |
|
|
|
if (ciprefix(".subckt", c->line) || ciprefix("x", c->line)) { |
|
|
|
/* remove params: */ |
|
|
|
char *str_ptr = strstr(c->line, "params:"); |
|
|
|
@ -4038,7 +4102,7 @@ static int inp_fix_subckt_multiplier(struct names *subckt_w_params, |
|
|
|
/* no 'm' for model cards */ |
|
|
|
if (ciprefix(".model", curr_line)) |
|
|
|
continue; |
|
|
|
if (newcompat.hs) { |
|
|
|
if (newcompat.hs && card->compmod == 0) { |
|
|
|
/* if there is already an m=xx in the instance line, multiply it with the new m */ |
|
|
|
char* mult = strstr(curr_line, " m="); |
|
|
|
if (mult) { |
|
|
|
|