diff options
Diffstat (limited to 'antenna.c')
-rw-r--r-- | antenna.c | 73 |
1 files changed, 67 insertions, 6 deletions
@@ -20,6 +20,7 @@ #include <unistd.h> #include <sys/types.h> #include <regex.h> +#include <assert.h> /* This entire file is dependent on the Tcl/Tk version */ #ifdef TCL_QROUTER @@ -55,6 +56,42 @@ struct antennainfo_ { ANTENNAINFO AntennaList; +typedef struct annotateinfo_ *ANNOTATEINFO; + +struct annotateinfo_ { + ANNOTATEINFO next; + NET net; + char *instance; + char *pin; + int flag; /* Flag for checking output status */ +}; + +ANNOTATEINFO AnnotateList = NULL; + +#define ANNO_INIT 0 +#define ANNO_OUTPUT 1 + +/*----------------------------------------------------------------------*/ +/* Report connection of a fixed antenna violation, given the net. */ +/*----------------------------------------------------------------------*/ + +char *get_annotate_info(NET net, char **pinptr) +{ + ANNOTATEINFO annotate; + + for (annotate = AnnotateList; annotate; annotate = annotate->next) { + if (annotate->net->netnum == net->netnum) { + if (annotate->flag == ANNO_INIT) { + annotate->flag = ANNO_OUTPUT; /* Mark as having been output */ + *pinptr = annotate->pin; + return annotate->instance; + } + } + } + *pinptr = NULL; + return NULL; +} + /*--------------------------------------------------------------*/ /* Regular expression matching of the given string in */ /* "antennacell" to the string "strtest". If the regular */ @@ -561,7 +598,7 @@ get_route_area_forward_fromseg(NET net, ROUTE rt, SEG nseg, int layer, /* antenna area forward and reverse from that segment. */ rt2 = rt->end.route; - if (rt2 == NULL) return; /* This should not happen */ + assert( rt2 != NULL ) ; for (rseg = rt2->segments; rseg; rseg = rseg->next) { if (rseg->segtype & ST_WIRE) { @@ -612,7 +649,7 @@ get_route_area_forward_fromseg(NET net, ROUTE rt, SEG nseg, int layer, } } } - if (rseg == NULL) return; /* This should not happen */ + assert( rseg != NULL ) ; if (rseg->next != NULL) area += get_route_area_forward_fromseg(net, rt2, rseg->next, @@ -1252,8 +1289,20 @@ resolve_antenna(char *antennacell, u_char do_fix) if ((FixedList != NULL) || (BadList != NULL)) fout = fopen("antenna.out", "w"); + /* Clear any existing list of instance connections (annotations) */ + + if (AnnotateList) { + ANNOTATEINFO nextannotate; + while (AnnotateList != NULL) { + nextannotate = AnnotateList->next; + free(AnnotateList); + AnnotateList = nextannotate; + } + } + if (FixedList != NULL) { ROUTE rt; + ANNOTATEINFO newannotate; fprintf(fout, "Revised netlist: New antenna anchor connections\n"); for (nextviolation = FixedList; nextviolation; @@ -1265,6 +1314,16 @@ resolve_antenna(char *antennacell, u_char do_fix) fprintf(fout, "Net=%s Instance=%s Cell=%s Pin=%s\n", nextviolation->net->netname, g->gatename, g->gatetype->gatename, g->gatetype->node[i]); + + // Create an annotation entry for this fixed violation + + newannotate = (ANNOTATEINFO)malloc(sizeof(struct annotateinfo_)); + newannotate->net = nextviolation->net; + newannotate->instance = g->gatename; + newannotate->pin = g->gatetype->node[i]; + newannotate->flag = ANNO_INIT; + newannotate->next = AnnotateList; + AnnotateList = newannotate; } fprintf(fout, "\n"); } @@ -1291,10 +1350,12 @@ resolve_antenna(char *antennacell, u_char do_fix) /* Free up the violation lists */ - while (FixedList != NULL) { - nextviolation = FixedList->next; - free(FixedList); - FixedList = nextviolation; + if (FixedList != NULL) { + while (FixedList != NULL) { + nextviolation = FixedList->next; + free(FixedList); + FixedList = nextviolation; + } } while (BadList != NULL) { nextviolation = BadList->next; |