From 537b1f057d70a685d59ddc899aa54b3788acaae3 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Fri, 8 Oct 2021 10:58:10 -0400 Subject: [PATCH] Modified the generation of "equiv" statements in "extract" some more, to eliminate all redundant names resulting from redundant labels. Changed the behavior of "goto" so that it will find local names with slashes, which are the result of using "flatten". A hierarchical search is done first, as before, but on failure to find a subcell component, the local cell is searched for the verbatim name. --- VERSION | 2 +- commands/CmdE.c | 1 + commands/CmdFI.c | 23 +++++++++++++++-------- extract/ExtBasic.c | 26 ++++++++++++++++++++++---- 4 files changed, 39 insertions(+), 13 deletions(-) diff --git a/VERSION b/VERSION index 72b18b6b..238919a9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.216 +8.3.217 diff --git a/commands/CmdE.c b/commands/CmdE.c index af7ad350..9ddf2450 100644 --- a/commands/CmdE.c +++ b/commands/CmdE.c @@ -925,6 +925,7 @@ CmdExtract(w, cmd) "local put all generated files in the current directory", "resistance estimate resistance", "labelcheck check for connections through sticky labels", + "aliases output all net name aliases", NULL }; static char *cmdExtLength[] = diff --git a/commands/CmdFI.c b/commands/CmdFI.c index 2441c3e7..e1500cb0 100644 --- a/commands/CmdFI.c +++ b/commands/CmdFI.c @@ -1586,7 +1586,7 @@ CmdFindNetProc(nodename, use, rect, warn_not_found) Rect localrect; int pnum, xpos, ypos; char *xstr, *ystr; - bool locvalid; + bool locvalid = FALSE, usefound = TRUE; TileType ttype; scx.scx_use = use; @@ -1600,9 +1600,11 @@ CmdFindNetProc(nodename, use, rect, warn_not_found) use = scx2.scx_use; if (use == NULL) { - if (warn_not_found) - TxError("Couldn't find use %s\n", s); - return TT_SPACE; + /* Assume slash is part of the name and try to find locally */ + *s2 = '/'; + s = nodename; + usefound = FALSE; + goto checklocal; } GeoTransTrans(DBGetArrayTransform(use, scx2.scx_x, scx2.scx_y), &use->cu_transform, &tmp); @@ -1621,7 +1623,6 @@ CmdFindNetProc(nodename, use, rect, warn_not_found) /* see extract/extBasic.c for the format of the node, found */ /* in extMakeNodeNumPrint(). */ - locvalid = FALSE; if ((xstr = strchr(s, '_')) != NULL) { bool isNeg = FALSE; @@ -1674,10 +1675,10 @@ CmdFindNetProc(nodename, use, rect, warn_not_found) /* coordinates that is no longer generated by magic. It is kept */ /* here for backward compatibility. */ - if ((locvalid == FALSE) && (sscanf(s,"%d_%d_%d",&pnum,&xpos,&ypos) == 3)) + if ((locvalid == FALSE) && (sscanf(s, "%d_%d_%d", &pnum, &xpos, &ypos) == 3)) { - xpos = ((xpos & 0x1)?-1:1)*xpos/2; - ypos = ((ypos & 0x1)?-1:1)*ypos/2; + xpos = ((xpos & 0x1) ? -1 : 1) * xpos / 2; + ypos = ((ypos & 0x1) ? -1 : 1) * ypos / 2; localrect.r_xbot = xpos; localrect.r_ybot = ypos; localrect.r_xtop = xpos + 1; @@ -1685,6 +1686,8 @@ CmdFindNetProc(nodename, use, rect, warn_not_found) locvalid = TRUE; } +checklocal: + if (locvalid == TRUE) { int findTile(); @@ -1714,7 +1717,11 @@ CmdFindNetProc(nodename, use, rect, warn_not_found) else { if (warn_not_found) + { TxError("Couldn't find label %s\n", s); + if (!usefound) + TxError("Couldn't find use referenced in hierarchical name\n"); + } return TT_SPACE; } } diff --git a/extract/ExtBasic.c b/extract/ExtBasic.c index 3e738fc3..c1b231f5 100644 --- a/extract/ExtBasic.c +++ b/extract/ExtBasic.c @@ -729,7 +729,11 @@ extOutputNodes(nodeList, outFile) /* Output the alternate names for the node. Avoid generating */ /* unnecessary "equiv A A" entries for labels on disconnected */ - /* nets. */ + /* nets. Also avoid multiple "equiv" statements with the same */ + /* nets (happens when ports with the same name have different */ + /* port numbers, which should probably just be prohibited), and */ + /* raise an error if two ports with different names are being */ + /* marked as equivalent. */ for (ll = reg->nreg_labels; ll; ll = ll->ll_next) { @@ -740,7 +744,11 @@ extOutputNodes(nodeList, outFile) if (ll->ll_label->lab_text == text) { + char *portname = NULL; + char *lastname = NULL; + isPort = (ll->ll_attr == LL_PORTATTR) ? TRUE : FALSE; + if (isPort) portname = text; for (ll = ll->ll_next; ll; ll = ll->ll_next) if (extLabType(ll->ll_label->lab_text, LABTYPE_NAME)) @@ -749,12 +757,22 @@ extOutputNodes(nodeList, outFile) if ((ll->ll_attr == LL_PORTATTR) || (ExtOptions & EXT_DOALIASES)) { - fprintf(outFile, "equiv \"%s\" \"%s\"\n", - text, ll->ll_label->lab_text); - if (isPort && (ll->ll_attr == LL_PORTATTR)) + if ((portname == NULL) || + (strcmp(ll->ll_label->lab_text, portname))) + { + if ((lastname == NULL) || + (strcmp(ll->ll_label->lab_text, lastname))) + fprintf(outFile, "equiv \"%s\" \"%s\"\n", + text, ll->ll_label->lab_text); + lastname = ll->ll_label->lab_text; + } + if ((portname != NULL) && + (strcmp(ll->ll_label->lab_text, portname))) TxError("Warning: Ports \"%s\" and \"%s\" are" " electrically shorted.\n", text, ll->ll_label->lab_text); + if (!isPort && (ll->ll_attr == LL_PORTATTR)) + portname = ll->ll_label->lab_text; } } break;