void s_hierarchy_post_process (NETLIST * head) { NETLIST *nl_current; CPINLIST *pl_current; char *source_net_name = NULL; int did_work = FALSE; nl_current = head; while (nl_current != NULL) { if (nl_current->composite_component) { #if DEBUG printf("Found composite %s\n", nl_current->component_uref); #endif if (nl_current->cpins) { pl_current = nl_current->cpins; while (pl_current != NULL) { verbose_print("p"); if (pl_current->pin_label == NULL) { fprintf(stderr, _("Found a pin [%1$s] on component [%2$s] which does not have a label!\n"), nl_current->component_uref, pl_current->pin_number); } else { #if DEBUG printf("# L: %s %s\n", pl_current->pin_number, pl_current->pin_label); #endif /* get source net name, all nets are named already */ source_net_name = s_net_name_search (pl_current->nets); #if DEBUG printf("name: %s\n", source_net_name); printf("Now we need to search for: %s/%s\n", nl_current->component_uref, pl_current->pin_label); #endif did_work = s_hierarchy_setup_rename (head, nl_current->component_uref, pl_current->pin_label, source_net_name); if (!did_work) { fprintf(stderr, _("Missing I/O symbol with refdes [%1$s] inside schematic for symbol [%2$s]\n"), pl_current->pin_label, nl_current->component_uref); } } pl_current = pl_current->next; } } } nl_current = nl_current->next; } }
char *s_net_name (TOPLEVEL * pr_current, NETLIST * netlist_head, NET * net_head, char *hierarchy_tag, int type) { char *string = NULL; NET *n_start; NETLIST *nl_current; CPINLIST *pl_current; char *net_name = NULL; int found = 0; char *temp; int *unnamed_counter; char *unnamed_string; net_name = s_net_name_search(pr_current, net_head); if (net_name) { return (net_name); } #if DEBUG printf("didn't find named net\n"); #endif /* didn't find a name */ /* go looking for another net which might have already been named */ /* ie you don't want to create a new unnamed net if the net has */ /* already been named */ nl_current = netlist_head; while (nl_current != NULL) { if (nl_current->cpins) { pl_current = nl_current->cpins; while (pl_current != NULL) { if (pl_current->nets) { n_start = pl_current->nets; if (n_start->next && net_head->next) { found = s_net_find(n_start->next, net_head->next); if (found) { net_name = s_net_name_search(pr_current, n_start); if (net_name) { return (net_name); } } } } pl_current = pl_current->next; } } nl_current = nl_current->next; } #if DEBUG printf("didn't find previously named\n"); #endif /* AND we don't want to assign a dangling pin */ /* which is signified by having only a head node */ /* which is just a place holder */ /* and the head node shows up here */ if (net_head->nid == -1 && net_head->prev == NULL && net_head->next == NULL) { string = g_strdup_printf("unconnected_pin-%d", unnamed_pin_counter++); return (string); } switch (type) { case PIN_TYPE_NET: unnamed_counter = &unnamed_net_counter; unnamed_string = pr_current->unnamed_netname; break; case PIN_TYPE_BUS: unnamed_counter = &unnamed_bus_counter; unnamed_string = pr_current->unnamed_busname; break; default: g_critical ("Incorrect connectivity type %i in s_name_nets()\n", type); return NULL; } /* have we exceeded the number of unnamed nets? */ if (*unnamed_counter < MAX_UNNAMED_NETS) { if (netlist_mode == SPICE) { string = g_strdup_printf("%d", (*unnamed_counter)++); } else { temp = g_strdup_printf ("%s%d", unnamed_string, (*unnamed_counter)++); if (hierarchy_tag) { string = s_hierarchy_create_netname (pr_current, temp, hierarchy_tag); g_free (temp); } else { string = temp; } } } else { fprintf(stderr, "Increase number of unnamed nets (s_net.c)\n"); exit(-1); } return string; }