diff --git a/src/netlist.c b/src/netlist.c index dbb07a98..c4ece686 100644 --- a/src/netlist.c +++ b/src/netlist.c @@ -643,7 +643,7 @@ static void name_pass_through_nets() pt_symbol = my_calloc(973, xctx->symbols, sizeof(int)); for(i = 0; i < xctx->symbols; i++) { - str_hash_init(&table, 17); + str_hash_init(&table, 37); for(j = 0; j < xctx->sym[i].rects[PINLAYER]; j++) { const char *pin_name = get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr, "name", 0); entry = str_hash_lookup(&table, pin_name, "1", XINSERT_NOREPLACE); @@ -665,7 +665,7 @@ static void name_pass_through_nets() dbg(1, "instance %d: %s\n", i, inst[i].instname); if(inst[i].ptr<0) continue; if(!pt_symbol[ inst[i].ptr ]) continue; - str_hash_init(&table, 17); + str_hash_init(&table, 37); my_strdup(1565, &type, (inst[i].ptr + xctx->sym)->type); if (type && !IS_LABEL_OR_PIN(type) ) { if ((rects = (inst[i].ptr+ xctx->sym)->rects[PINLAYER]) > 0) { diff --git a/src/token.c b/src/token.c index 8afba380..73f36767 100644 --- a/src/token.c +++ b/src/token.c @@ -1636,14 +1636,19 @@ void print_spice_subckt_nodes(FILE *fd, int symbol) break ; } else if(strcmp(token, "@pinlist")==0) { + Int_hashtable table = {NULL, 0}; + int_hash_init(&table, 37); for(i=0;isym[symbol].rect[PINLAYER][i].prop_ptr,"spice_ignore",0), "true")) { - str_ptr= - expandlabel(get_tok_value(xctx->sym[symbol].rect[PINLAYER][i].prop_ptr,"name",0), &multip); - fprintf(fd, "%s ", str_ptr); + const char *name = get_tok_value(xctx->sym[symbol].rect[PINLAYER][i].prop_ptr,"name",0); + if(!int_hash_lookup(&table, name, 1, XINSERT_NOREPLACE)) { + str_ptr= expandlabel(name, &multip); + fprintf(fd, "%s ", str_ptr); + } } } + int_hash_free(&table); } else if(token[0]=='@' && token[1]=='@') { /* recognize single pins 15112003 */ char *prop=NULL; @@ -1875,18 +1880,25 @@ int print_spice_element(FILE *fd, int inst) else if(strcmp(token,"@pinlist")==0) /* of course pinlist must not be present in attributes */ /* print multiplicity */ { /* and node number: m1 n1 m2 n2 .... */ + Int_hashtable table = {NULL, 0}; + int_hash_init(&table, 37); for(i=0;iinst[inst].ptr + xctx->sym)->rect[PINLAYER][i].prop_ptr; - if(strcmp(get_tok_value(prop, "spice_ignore", 0), "true")) { - str_ptr = net_name(inst,i, &multip, 0, 1); + int spice_ignore = !strcmp(get_tok_value(prop, "spice_ignore", 0), "true"); + const char *name = get_tok_value(prop, "name", 0); + if(!spice_ignore) { + if(!int_hash_lookup(&table, name, 1, XINSERT_NOREPLACE)) { + str_ptr = net_name(inst, i, &multip, 0, 1); - tmp = strlen(str_ptr) +100 ; /* always make room for some extra chars - * so 1-char writes to result do not need reallocs */ - STR_ALLOC(&result, tmp + result_pos, &size); - result_pos += my_snprintf(result + result_pos, tmp, "?%d %s ", multip, str_ptr); + tmp = strlen(str_ptr) +100 ; /* always make room for some extra chars + * so 1-char writes to result do not need reallocs */ + STR_ALLOC(&result, tmp + result_pos, &size); + result_pos += my_snprintf(result + result_pos, tmp, "?%d %s ", multip, str_ptr); + } } } + int_hash_free(&table); } else if(token[0]=='@' && token[1]=='@') { /* recognize single pins 15112003 */ for(i=0;i