Add parameter m (multiplier), while translating from G or F source

to code model spice2poly
This commit is contained in:
Holger Vogt 2025-05-11 17:24:37 +02:00
parent bc18768ff6
commit 89d3fc4144
1 changed files with 13 additions and 4 deletions

View File

@ -298,7 +298,7 @@ static char *two2three_translate(
char **out_conn; char **out_conn;
char **in_conn; char **in_conn;
char **coef; char **coef;
char* multibeg, *multiend, *val; char* multibeg, *multiend, *multi = NULL;
char *card; char *card;
@ -315,14 +315,15 @@ static char *two2three_translate(
Remove it here, add it later */ Remove it here, add it later */
multibeg = strstr(orig_card, " m="); multibeg = strstr(orig_card, " m=");
if (multibeg) { if (multibeg) {
*multibeg = '\0'; // *multibeg = '\0';
/*
multiend = multibeg + 3; multiend = multibeg + 3;
while (*multiend == ' ') while (*multiend == ' ')
multiend++; multiend++;
while (*multiend && *multiend != ' ') while (*multiend && *multiend != ' ')
multiend++; multiend++;
*/ multi = copy_substring(multibeg, multiend);
while (multibeg < multiend)
*(multibeg++) = ' ';
} }
/* Count the number of tokens for use in parsing */ /* Count the number of tokens for use in parsing */
@ -426,6 +427,9 @@ static char *two2three_translate(
for(i = 0; i < num_coefs; i++) for(i = 0; i < num_coefs; i++)
mod_card_len += strlen(coef[i]) + 1; mod_card_len += strlen(coef[i]) + 1;
if (multi && (type == 'g' || type == 'G' || type == 'f'|| type == 'F'))
mod_card_len += strlen(multi) + 1;
/* Allocate space for the cards and write them into the strings */ /* Allocate space for the cards and write them into the strings */
*inst_card = TMALLOC(char, inst_card_len); *inst_card = TMALLOC(char, inst_card_len);
@ -472,6 +476,11 @@ static char *two2three_translate(
sprintf(*mod_card + strlen(*mod_card), "%s ", coef[i]); sprintf(*mod_card + strlen(*mod_card), "%s ", coef[i]);
sprintf(*mod_card + strlen(*mod_card), "]"); sprintf(*mod_card + strlen(*mod_card), "]");
if (multi && (type == 'g' || type == 'G' || type == 'f' || type == 'F')) {
sprintf(*mod_card + strlen(*mod_card), " %s", multi);
tfree(multi);
}
#ifdef TRACE #ifdef TRACE
/* SDB debug statement */ /* SDB debug statement */
printf("In two2three_translate, translated statements:\n%s \n%s \n", *inst_card, *mod_card); printf("In two2three_translate, translated statements:\n%s \n%s \n", *inst_card, *mod_card);