Add a flag compmod to struct card.
Set compmod to 1 if netlist line is included by command 'incpslt' Guard special newcompat.hs sections by compmod
This commit is contained in:
parent
b04d42270b
commit
66adca25c5
|
|
@ -448,6 +448,7 @@ struct card *insert_new_line(
|
||||||
x->linenum_orig = linenum_orig;
|
x->linenum_orig = linenum_orig;
|
||||||
x->level = card ? card->level : NULL;
|
x->level = card ? card->level : NULL;
|
||||||
x->linesource = lineinfo;
|
x->linesource = lineinfo;
|
||||||
|
x->compmod = 0;
|
||||||
|
|
||||||
if (card)
|
if (card)
|
||||||
card->nextcard = x;
|
card->nextcard = x;
|
||||||
|
|
@ -949,7 +950,7 @@ void inp_get_w_l_x(struct card* card) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* only subcircuit invocations */
|
/* only subcircuit invocations */
|
||||||
if (*curr_line != 'x' || (!newcompat.hs && !newcompat.spe)) {
|
if (*curr_line != 'x' || (!newcompat.hs && !newcompat.spe) || card->compmod > 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1429,6 +1430,47 @@ static struct inp_read_t inp_read(FILE* fp, int call_depth, const char* dir_name
|
||||||
|
|
||||||
struct card* newcard;
|
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);
|
inp_stripcomments_line(buffer, FALSE, TRUE);
|
||||||
|
|
||||||
s = skip_non_ws(buffer); /* advance past non-space chars */
|
s = skip_non_ws(buffer); /* advance past non-space chars */
|
||||||
|
|
@ -1506,10 +1548,15 @@ static struct inp_read_t inp_read(FILE* fp, int call_depth, const char* dir_name
|
||||||
char* tmpstr = copy(nexttok(buffer));
|
char* tmpstr = copy(nexttok(buffer));
|
||||||
wl_append_word(&sourceinfo, &sourceinfo, tmpstr);
|
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) {
|
for (tmpcard = newcard; tmpcard; tmpcard = tmpcard->nextcard) {
|
||||||
/* skip *include */
|
/* skip *include */
|
||||||
tmpcard->linesource = tmpstr;
|
tmpcard->linesource = tmpstr;
|
||||||
|
if (compset)
|
||||||
|
tmpcard->compmod = 1;
|
||||||
|
else
|
||||||
|
tmpcard->compmod = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newcard) {
|
if (newcard) {
|
||||||
|
|
@ -1532,6 +1579,23 @@ static struct inp_read_t inp_read(FILE* fp, int call_depth, const char* dir_name
|
||||||
|
|
||||||
/* Fix the buffer up a bit. */
|
/* Fix the buffer up a bit. */
|
||||||
(void)memcpy(buffer + 1, "end of: ", 8);
|
(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 */
|
} /* end of .include handling */
|
||||||
|
|
||||||
/* loop through 'buffer' until end is reached. Make all letters lower
|
/* 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);
|
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)) {
|
if (ciprefix(".subckt", c->line) || ciprefix("x", c->line)) {
|
||||||
/* remove params: */
|
/* remove params: */
|
||||||
char *str_ptr = strstr(c->line, "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 */
|
/* no 'm' for model cards */
|
||||||
if (ciprefix(".model", curr_line))
|
if (ciprefix(".model", curr_line))
|
||||||
continue;
|
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 */
|
/* if there is already an m=xx in the instance line, multiply it with the new m */
|
||||||
char* mult = strstr(curr_line, " m=");
|
char* mult = strstr(curr_line, " m=");
|
||||||
if (mult) {
|
if (mult) {
|
||||||
|
|
|
||||||
|
|
@ -256,6 +256,7 @@ inp_getoptsc(char *line, struct card *options)
|
||||||
next->linenum = 0;
|
next->linenum = 0;
|
||||||
next->error = NULL;
|
next->error = NULL;
|
||||||
next->actualLine = NULL;
|
next->actualLine = NULL;
|
||||||
|
next->compmod = 0;
|
||||||
|
|
||||||
/* put new line in front */
|
/* put new line in front */
|
||||||
next->nextcard = options;
|
next->nextcard = options;
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ if_sens_run(CKTcircuit *ckt, wordlist *args, INPtables *tab)
|
||||||
deck.error = NULL;
|
deck.error = NULL;
|
||||||
deck.linenum = 0;
|
deck.linenum = 0;
|
||||||
deck.linenum_orig = 0;
|
deck.linenum_orig = 0;
|
||||||
|
deck.compmod = 0;
|
||||||
deck.line = buf;
|
deck.line = buf;
|
||||||
|
|
||||||
current = &deck;
|
current = &deck;
|
||||||
|
|
|
||||||
|
|
@ -248,6 +248,7 @@ if_run(CKTcircuit *ckt, char *what, wordlist *args, INPtables *tab)
|
||||||
deck.nextcard = deck.actualLine = NULL;
|
deck.nextcard = deck.actualLine = NULL;
|
||||||
deck.error = NULL;
|
deck.error = NULL;
|
||||||
deck.linenum = 0;
|
deck.linenum = 0;
|
||||||
|
deck.compmod = 0;
|
||||||
deck.line = buf;
|
deck.line = buf;
|
||||||
|
|
||||||
/*CDHW Delete any previous special task CDHW*/
|
/*CDHW Delete any previous special task CDHW*/
|
||||||
|
|
|
||||||
|
|
@ -847,6 +847,7 @@ struct card * inp_deckcopy(struct card *deck) {
|
||||||
}
|
}
|
||||||
d->linenum = deck->linenum;
|
d->linenum = deck->linenum;
|
||||||
d->linenum_orig = deck->linenum_orig;
|
d->linenum_orig = deck->linenum_orig;
|
||||||
|
d->compmod = deck->compmod;
|
||||||
d->linesource = deck->linesource;
|
d->linesource = deck->linesource;
|
||||||
d->w = deck->w;
|
d->w = deck->w;
|
||||||
d->l = deck->l;
|
d->l = deck->l;
|
||||||
|
|
@ -897,6 +898,7 @@ struct card *inp_deckcopy_oc(struct card * deck)
|
||||||
d->l = deck->l;
|
d->l = deck->l;
|
||||||
d->nf = deck->nf;
|
d->nf = deck->nf;
|
||||||
d->linenum_orig = deck->linenum_orig;
|
d->linenum_orig = deck->linenum_orig;
|
||||||
|
d->compmod = deck->compmod;
|
||||||
d->linesource = deck->linesource;
|
d->linesource = deck->linesource;
|
||||||
d->linenum = i++;
|
d->linenum = i++;
|
||||||
d->line = copy(deck->line);
|
d->line = copy(deck->line);
|
||||||
|
|
@ -957,6 +959,7 @@ struct card* inp_deckcopy_ln(struct card* deck)
|
||||||
d->linenum_orig = deck->linenum_orig;
|
d->linenum_orig = deck->linenum_orig;
|
||||||
d->linesource = deck->linesource;
|
d->linesource = deck->linesource;
|
||||||
d->linenum = deck->linenum;
|
d->linenum = deck->linenum;
|
||||||
|
d->compmod = deck->compmod;
|
||||||
d->line = copy(deck->line);
|
d->line = copy(deck->line);
|
||||||
if (deck->error) {
|
if (deck->error) {
|
||||||
d->error = copy(deck->error);
|
d->error = copy(deck->error);
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,7 @@ struct card {
|
||||||
float w;
|
float w;
|
||||||
float l;
|
float l;
|
||||||
float nf;
|
float nf;
|
||||||
|
int compmod;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* structure used to save models in after they are read during pass 1 */
|
/* structure used to save models in after they are read during pass 1 */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue