Skip to content

Commit

Permalink
Changed the automatic search for tech files from the "tech" line in
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
RTimothyEdwards committed May 4, 2024
1 parent fe9ca3a commit 3dc5018
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 19 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.3.476
8.3.477
53 changes: 35 additions & 18 deletions database/DBio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit 3dc5018

Please sign in to comment.