Added option "notopports" to "extract unique". The option

behaves like "extract unique all" on all cells below the topmost
level of hierarchy, and "extract unique noports" on the top
level.
This commit is contained in:
Tim Edwards 2021-09-09 15:47:48 -04:00
parent d63a102515
commit 96b7c20c17
5 changed files with 33 additions and 12 deletions

View File

@ -1 +1 @@
8.3.204 8.3.205

View File

@ -933,11 +933,15 @@ CmdExtract(w, cmd)
"receiver termName(s) identify a receiving (input) terminal", "receiver termName(s) identify a receiving (input) terminal",
NULL NULL
}; };
/* These must match definitions EXT_UNIQ_* in extract/extract.h: */
static char *cmdExtUniq[] = static char *cmdExtUniq[] =
{ {
"all extract matching labels as unique nodes", "all extract matching labels as unique nodes",
"# extract tagged labels as unique nodes", "# extract tagged labels as unique nodes",
"noports ignore ports when making labels unique", "noports ignore ports when making labels unique",
"notopports ignore top-level ports when making labels unique",
NULL NULL
}; };
static char *cmdExtCmd[] = static char *cmdExtCmd[] =

View File

@ -243,10 +243,11 @@ extDefPushFunc(use)
* If there are, we generate unique names by appending a numeric * If there are, we generate unique names by appending a numeric
* suffix to all but one of the offending labels. * suffix to all but one of the offending labels.
* If "option" is 1 (tagged mode), then only labels ending in the * If "option" is 1 (tagged mode), then only labels ending in the
* character "#" are forced to be unique. If "option" is 2 (noports * character "#" are forced to be unique. If "option" is 2 ("noports"
* mode), then port labels are not forced to be unique. Finally, * mode), then port labels are not forced to be unique. If "option"
* if the label has been changed and doesn't end in a '!', we leave * is 3 ("notopports" mode), then port labels on the top level are
* feedback. * not forced to be unique. Finally, if the label has been changed
* and doesn't end in a '!', we leave feedback.
* *
* Results: * Results:
* None. * None.
@ -266,6 +267,7 @@ ExtUnique(rootUse, option)
{ {
CellDef *def; CellDef *def;
int nwarn; int nwarn;
int locoption;
/* Make sure the entire subtree is read in */ /* Make sure the entire subtree is read in */
if (DBCellReadArea(rootUse, &rootUse->cu_def->cd_bbox, TRUE)) if (DBCellReadArea(rootUse, &rootUse->cu_def->cd_bbox, TRUE))
@ -288,6 +290,12 @@ ExtUnique(rootUse, option)
nwarn = 0; nwarn = 0;
while (def = (CellDef *) StackPop(extDefStack)) while (def = (CellDef *) StackPop(extDefStack))
{ {
/* EXT_UNIQ_NOTOPPORTS: Use EXT_UNIQ_ALL on all cells other than the top */
if ((option == EXT_UNIQ_NOTOPPORTS) && (StackLook(extDefStack) != NULL))
locoption = EXT_UNIQ_ALL;
else
locoption = option;
def->cd_client = (ClientData) 0; def->cd_client = (ClientData) 0;
if (!SigInterruptPending) if (!SigInterruptPending)
nwarn += extUniqueCell(def, option); nwarn += extUniqueCell(def, option);

View File

@ -53,13 +53,13 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
* For the cell 'def', look for the same label appearing in two or more * For the cell 'def', look for the same label appearing in two or more
* distinct nodes. For each such label found: * distinct nodes. For each such label found:
* *
* If option is 0, then generate unique names for all * If option is EXT_UNIQ_ALL, then generate unique names for all
* but one of the nodes by appending a unique numeric * but one of the nodes by appending a unique numeric
* suffix to the offending labels. * suffix to the offending labels.
* If option is 1, then generate unique names only if * If option is EXT_UNIQ_TAGGED, then generate unique names only
* the label ends in '#'. Leave feedback for all other * if the label ends in '#'. Leave feedback for all other
* names that don't end in '!'. * names that don't end in '!'.
* If option is 2, then generate unique names as for * If option is EXT_UNIQ_NOPORTS, then generate unique names as for
* option 0 only if the label is not a port. * option 0 only if the label is not a port.
* *
* Results: * Results:
@ -186,16 +186,19 @@ extMakeUnique(def, ll, lreg, lregList, labelHash, option)
* changes a label to make it unique. * changes a label to make it unique.
*/ */
text = ll->ll_label->lab_text; text = ll->ll_label->lab_text;
if (option == 0) if (option == EXT_UNIQ_ALL)
goto makeUnique; goto makeUnique;
else if ((option == 2) && !(ll->ll_label->lab_flags & PORT_DIR_MASK)) else if ((option == EXT_UNIQ_NOPORTS || option == EXT_UNIQ_NOTOPPORTS) &&
!(ll->ll_label->lab_flags & PORT_DIR_MASK))
goto makeUnique; goto makeUnique;
cpend = strchr(text, '\0'); cpend = strchr(text, '\0');
if (cpend > text) cpend--; if (cpend > text) cpend--;
if (*cpend == '#') goto makeUnique; if (*cpend == '#') goto makeUnique;
if (*cpend == '!') return 0; if (*cpend == '!') return 0;
if ((option == 2) && (ll->ll_label->lab_flags & PORT_DIR_MASK)) return 0; if (((option == EXT_UNIQ_NOPORTS) || (option == EXT_UNIQ_NOTOPPORTS))
&& (ll->ll_label->lab_flags & PORT_DIR_MASK))
return 0;
/* Generate a warning for each occurrence of this label */ /* Generate a warning for each occurrence of this label */
nwarn = 0; nwarn = 0;

View File

@ -73,6 +73,12 @@ extern char *extDevTable[];
extern int ExtOptions; /* Bitmask of above */ extern int ExtOptions; /* Bitmask of above */
/* Options for "extract unique" */
#define EXT_UNIQ_ALL 0
#define EXT_UNIQ_TAGGED 1
#define EXT_UNIQ_NOPORTS 2
#define EXT_UNIQ_NOTOPPORTS 3
extern bool ExtTechLine(); extern bool ExtTechLine();
extern void ExtTechInit(); extern void ExtTechInit();
extern void ExtTechFinal(); extern void ExtTechFinal();