From 3dc5018af4994cc23e2c2dbc822927d7897fba93 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Fri, 3 May 2024 21:43:27 -0400 Subject: [PATCH] Changed the automatic search for tech files from the "tech" line in a .mag file to include the original system path. This restores the ability to find the tech file for any cell created using the old SCMOS technologies. This method is as problematic as is the way all SCMOS tech files used the same name "scmos". But at least it preserves backwards-compatible behavior (behavior prior to 8.3.471). This commit corrects github issue #306. --- VERSION | 2 +- database/DBio.c | 53 ++++++++++++++++++++++++++++++++----------------- 2 files changed, 36 insertions(+), 19 deletions(-) diff --git a/VERSION b/VERSION index 58ac8b5c..caedea0e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.476 +8.3.477 diff --git a/database/DBio.c b/database/DBio.c index 108edc68..7cf8085e 100644 --- a/database/DBio.c +++ b/database/DBio.c @@ -497,6 +497,7 @@ dbCellReadDef(f, cellDef, ignoreTech, dereference) int n = 1, d = 1; HashTable dbUseTable; bool needcleanup = FALSE; + bool hasrcfile = FALSE; /* * It's very important to disable interrupts during the body of @@ -556,7 +557,7 @@ dbCellReadDef(f, cellDef, ignoreTech, dereference) * magic/ and look for a compatible techfile there. */ char *found = NULL; - char *string, *techfullname; + char *sptr, *string, *techfullname; techfullname = mallocMagic(strlen(tech) + 6); sprintf(techfullname, "%s.tech", tech); @@ -621,45 +622,61 @@ dbCellReadDef(f, cellDef, ignoreTech, dereference) found = DBSearchForTech(techfullname, tech, string, 0); } - /* Experimental---check for a ".magicrc" file in */ - /* the same directory as ".tech" and source it */ - /* first. */ + /* Check for a ".magicrc" file in the same directory */ + /* as ".tech" and source it first. */ if (found) { char *rcpath; + FILE *tmpf; rcpath = (char *)mallocMagic(strlen(found) + strlen(tech) + 10); sprintf(rcpath, "%s/%s.magicrc", found, tech); - Tcl_EvalFile(magicinterp, rcpath); + if ((tmpf = fopen(rcpath, "r")) != NULL) + { + fclose(tmpf); + Tcl_EvalFile(magicinterp, rcpath); + hasrcfile = TRUE; + } freeMagic(rcpath); } #endif freeMagic(techfullname); if (found) - { - char *sptr; PaAppend(&SysLibPath, found); - TxError("Loading technology %s\n", tech); - if (!TechLoad(tech, 0)) - TxError("Error in loading technology file\n"); - else if ((sptr = strstr(found, "libs.tech")) != NULL) + TxError("Loading technology %s\n", tech); + result = TechLoad(tech, 0); + if (!result) + TxError("Error in loading technology file\n"); + else if (found) + { + if ((sptr = strstr(found, "libs.tech")) != NULL) { int paths = 0; - /* Additional automatic handling of open_pdks- */ - /* style PDKs. Append the libs.ref libraries */ - /* to the cell search path. */ + + if (hasrcfile == FALSE) + { + /* Additional automatic handling of open_pdks- */ + /* style PDKs. Append the libs.ref libraries */ + /* to the cell search path. Do this only if a */ + /* magicrc file was not associated with the PDK */ + /* as the magicrc file is expected to set the */ + /* search path. */ - strcpy(sptr + 5, "ref"); - paths = DBAddStandardCellPaths(found, 0); - if (paths > 0) - TxPrintf("Cell path is now \"%s\"\n", CellLibPath); + strcpy(sptr + 5, "ref"); + paths = DBAddStandardCellPaths(found, 0); + if (paths > 0) + TxPrintf("Cell path is now \"%s\"\n", CellLibPath); + } } freeMagic(found); + } #ifdef MAGIC_WRAPPER + if (result) + { /* Apply tag callbacks for "tech load" command */ { char *argv[2];