From 3f7ab36416faf4721a7e26ebe14acfdba505b2ac Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Wed, 4 Apr 2018 10:35:18 -0400 Subject: [PATCH] Correction to cell versioning handling for the "getcell" command. This correction allows a full path to be passed for the cellname and will (correctly) break the path into cell name and path components (previously was naming the cell with the full path). To avoid name conflicts, the cell name gets modified if the path cannot be resolved against an existing cell of the same name. --- .gitignore | 1 + README | 13 ++++++++ commands/CmdCD.c | 77 +++++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 83 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 23285fed..04cd59d6 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ config.log scripts/config.log scripts/config.status scripts/defs.mak +.*.swp *.o *.so *~ diff --git a/README b/README index 7ced316d..e7331ba7 100644 --- a/README +++ b/README @@ -27,6 +27,19 @@ development push over 8.1 is to add a Cairo (2D hardware-accelerated graphics) interface ("magic -d CAIRO" or "magic -d XR"). + October, 2017: DRC changes correctly handle DRC errors in a child + cell that are effectively corrected by geometry in the parent cell. + + March, 2018: Added better version handling of subcells. "Use" + records contain a path (relative or absolute) to the library used + by the subcell, and this path is honored as long as it can be + found. + + April, 2018: Added the "plow" function back to the level of + capability it originally had. This does not include handling of + magic extensions since version 7, including non-manhattan geometry, + stacked contacts, and DRC rule extensions. + 4. Version 8.1 Release Notes: --------------------------------- diff --git a/commands/CmdCD.c b/commands/CmdCD.c index e819b1b9..e4c03a85 100644 --- a/commands/CmdCD.c +++ b/commands/CmdCD.c @@ -3666,6 +3666,7 @@ cmdDumpParseArgs(cmdName, w, cmd, dummy, scx) Rect rootBox; Transform *tx_cell, trans_cell; char **av; + char *cellnameptr, *fullpathname; int ac, clen; if (cmd->tx_argc < 2) @@ -3680,18 +3681,78 @@ cmdDumpParseArgs(cmdName, w, cmd, dummy, scx) return FALSE; } - /* Locate the cell specified by the command */ - if (CmdIllegalChars(cmd->tx_argv[1], "", "Cell name")) - return (FALSE); + /* cellnameptr should not include any path components */ + if ((cellnameptr = strrchr(cmd->tx_argv[1], '/')) != NULL) + { + cellnameptr++; + /* Allocate extra space for cellname in case it needs an extension */ + fullpathname = (char *)mallocMagic(strlen(cmd->tx_argv[1]) + 10); + strcpy(fullpathname, cmd->tx_argv[1]); + } + else + { + cellnameptr = cmd->tx_argv[1]; + fullpathname = NULL; + } /* If the name still has ".mag" attached, then strip it. */ - clen = strlen(cmd->tx_argv[1]); - if ((clen > 4) && !strcmp(cmd->tx_argv[1] + clen - 4, ".mag")) - *(cmd->tx_argv[1] + clen - 4) = '\0'; + clen = strlen(cellnameptr); + if ((clen > 4) && !strcmp(cellnameptr + clen - 4, ".mag")) + *(cellnameptr + clen - 4) = '\0'; - def = DBCellLookDef(cmd->tx_argv[1]); + /* However, if this is a full path, then the full path name must have .mag */ + if (fullpathname != NULL) + { + clen = strlen(fullpathname); + if ((clen <= 4) || strcmp(fullpathname + clen - 4, ".mag")) + strcat(cellnameptr, ".mag"); + } + + /* Check for illegal characters in the cellname */ + if (CmdIllegalChars(cellnameptr, "", "Cell name")) + { + if (fullpathname) freeMagic(fullpathname); + return (FALSE); + } + + def = DBCellLookDef(cellnameptr); if (def == (CellDef *) NULL) - def = DBCellNewDef(cmd->tx_argv[1], (char *) NULL); + def = DBCellNewDef(cellnameptr, (char *) NULL); + + if (fullpathname != NULL) + { + /* Check if def already exists. If it points to a */ + /* different file, then force a rename of the cell and */ + /* flag a warning. */ + + if (def->cd_file != NULL) + { + /* Note: may want processing to see if absolute paths match */ + if (strcmp(def->cd_file, fullpathname)) + { + char uniqchar; + char *newcellname = (char *)mallocMagic(strlen(cellnameptr) + 3); + TxError("Warning: Cell file path mismatch. Existing cell has" + " path \"%s\", while %s path is \"%s\".\n", + def->cd_file, cmdName, fullpathname); + uniqchar = 'a'; + while (def != NULL) + { + sprintf(newcellname, "%s_%c", cellnameptr, uniqchar); + def = DBCellLookDef(newcellname); + uniqchar++; + } + TxError("Renaming cell to \"%s\" to avoid conflict.", newcellname); + def = DBCellNewDef(cellnameptr, (char *)NULL); + def->cd_file = StrDup(&def->cd_file, fullpathname); + freeMagic(newcellname); + } + } + else + def->cd_file = StrDup(&def->cd_file, fullpathname); + freeMagic(fullpathname); + } + editDef = EditCellUse->cu_def; /*