in case of vector instance names and spiceprefix attr set apply spiceprefix to all members, not only on first one

This commit is contained in:
Stefan Frederik 2020-12-02 17:33:01 +01:00
parent e279262f00
commit fe46725c0c
3 changed files with 26 additions and 1 deletions

View File

@ -126,6 +126,14 @@ function sign(x)
function process( i, iprefix)
{
if($0 ~/\*\*\*\* end_element/){
spiceprefix=""
return
}
if($0 ~/\*\*\*\* spice_prefix/){
spiceprefix=$3
return
}
if($0 ~/\*\*\*\* begin user architecture code/){ #20180129
user_code=1
print
@ -212,6 +220,7 @@ function process( i, iprefix)
# .probe tran v( ?1 DL[3],DL[2],DL[1],DL[0] , ?1 WL[3],WL{2],WL[1],WL[0] )
# ............ .......... --> matches ?n and ?-n
if($1 ==".probe" && $4 ~/^\?-?[0-9]+$/ && $7 ~/^\?-?[0-9]+$/ && NF==9) {
num1=split($5,name,",")
num2=split($8,name2,",")
@ -222,6 +231,7 @@ function process( i, iprefix)
}
# .save v( ?1 DL[3],DL[2],DL[1],DL[0] , ?1 WL[3],WL{2],WL[1],WL[0] )
# ............ .......... --> matches ?n and ?-n
} else if($1 ==".save" && $3 ~/^\?-?[0-9]+$/ && $6 ~/^\?-?[0-9]+$/ && NF==8) {
num1=split($4,name,",")
num2=split($7,name2,",")
@ -233,12 +243,14 @@ function process( i, iprefix)
# .probe tran v( ?1 LDY1_B[1],LDY1_B[0] )
# ............ --> matches ?n and ?-n
} else if($1 ==".probe" && $4 ~/^\?-?[0-9]+$/ && NF==6) {
num=split($5,name,",")
for(i=1;i<=num;i++) {
print $1 " " $2 " " $3 " " name[i] " " $6
}
# .save v( ?1 LDY1_B[1],LDY1_B[0] )
# ............ --> matches ?n and ?-n
} else if($1 ==".save" && $3 ~/^\?-?[0-9]+$/ && NF==5) {
num=split($4,name,",")
for(i=1;i<=num;i++) {
@ -277,6 +289,7 @@ function process( i, iprefix)
for(j=2;j<=NF;j+=1) # start from 2 not from 3 20070221
{
# ............ --> matches ?n and ?-n
if($j ~/^\?-?[0-9]+$/) continue # handle the case that $2 not pinlist 20070221
arg_num[j]=split($j,tmp,",")
for(k=1;k<=arg_num[j]; k++) {
@ -285,10 +298,11 @@ function process( i, iprefix)
}
for(i=1;i<=num;i++)
{
printf "%s ", name[i]
printf "%s ", spiceprefix name[i]
for(j=2;j<=NF;j++)
{
# ............ --> matches ?n and ?-n
if($j !~ /^\?-?[0-9]+$/)
{
printf "%s ", $j # if not a node just print it

View File

@ -409,6 +409,7 @@ void spice_netlist(FILE *fd, int spice_stop )
} else {
const char *m;
print_spice_element(fd, i) ; /* this is the element line */
fprintf(fd, "**** end_element\n");
/* hash device_model attribute if any */
m = get_tok_value(xctx->inst[i].prop_ptr, "device_model", 0);
if(m[0]) str_hash_lookup(model_table, model_name(m), m, XINSERT);

View File

@ -1563,6 +1563,7 @@ void print_spice_element(FILE *fd, int inst)
char *result = NULL;
int result_pos = 0;
int size = 0;
char *spiceprefixtag = NULL;
size = CADCHUNKALLOC;
my_realloc(1211, &result, size);
@ -1621,11 +1622,17 @@ void print_spice_element(FILE *fd, int inst)
token[token_pos]='\0';
token_pos=0;
/* if spiceprefix==0 and token == @spiceprefix then set empty value */
if (!spiceprefix && !strcmp(token, "@spiceprefix")) {
value=NULL;
} else {
dbg(1, "print_spice_element(): token: |%s|\n", token);
value = get_tok_value(xctx->inst[inst].prop_ptr, token+1, 0);
if(!strcmp(token, "@spiceprefix")) {
spiceprefixtag = my_malloc(301, get_tok_value_size+22);
my_snprintf(spiceprefixtag, get_tok_value_size+22, "**** spice_prefix %s\n", value);
value = spiceprefixtag;
}
/* get_tok_size==0 indicates that token(+1) does not exist in instance attributes */
if (!get_tok_size) value=get_tok_value(template, token+1, 0);
token_exists = get_tok_size;
@ -1821,6 +1828,7 @@ void print_spice_element(FILE *fd, int inst)
my_free(1021, &name);
my_free(1022, &token);
my_free(1194, &result);
my_free(298, &spiceprefixtag);
my_free(455, &translatedvalue);
}
@ -2772,6 +2780,7 @@ const char *translate(int inst, const char* s)
token[token_pos]='\0';
dbg(2, "translate(): token=%s\n", token);
/* if spiceprefix==0 and token == @spiceprefix then set empty value */
if(!spiceprefix && !strcmp(token, "@spiceprefix")) {
value = NULL;
get_tok_size = 0;
@ -3048,6 +3057,7 @@ const char *translate2(struct Lcc *lcc, int level, char* s)
token[token_pos] = '\0';
token_pos = 0;
/* if spiceprefix==0 and token == @spiceprefix then set empty value */
if(!spiceprefix && !strcmp(token, "@spiceprefix")) {
my_free(1069, &value1);
get_tok_size = 0;