Moved the substrate plane/restore further out so that planes are

not restored until after all cells have been processed through
extraction.  Otherwise, top-down connections can end up with
different generated names for the same node, resulting in a
disconnect in the netlist.
This commit is contained in:
Tim Edwards 2021-04-05 16:03:54 -04:00
parent fca21c8fc0
commit f84de3676a
7 changed files with 51 additions and 14 deletions

View File

@ -32,6 +32,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header$";
#include "utils/malloc.h"
#include "extflat/extflat.h"
#include "extflat/EFint.h"
#include "tiles/tile.h"
#include "extract/extract.h" /* for device class list */
/*

View File

@ -34,6 +34,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
#include "utils/utils.h"
#include "extflat/extflat.h"
#include "extflat/EFint.h"
#include "tiles/tile.h"
#include "extract/extract.h"
/* Root of the tree being flattened */

View File

@ -58,7 +58,7 @@ ClientData extUnInit = (ClientData) CLIENTDEFAULT;
int extOutputUsesFunc();
FILE *extFileOpen();
void extCellFile();
Plane* extCellFile();
void extHeader();
@ -83,7 +83,7 @@ void extHeader();
* ----------------------------------------------------------------------------
*/
void
Plane *
ExtCell(def, outName, doLength)
CellDef *def; /* Cell being extracted */
char *outName; /* Name of output file; if NULL, derive from def name */
@ -95,6 +95,7 @@ ExtCell(def, outName, doLength)
{
char *filename;
FILE *f;
Plane *savePlane;
bool doLocal;
doLocal = (ExtOptions & EXT_DOLOCAL) ? TRUE : FALSE;
@ -115,7 +116,7 @@ ExtCell(def, outName, doLength)
}
extNumFatal = extNumWarnings = 0;
extCellFile(def, f, doLength);
savePlane = extCellFile(def, f, doLength);
(void) fclose(f);
if (extNumFatal > 0 || extNumWarnings > 0)
@ -129,6 +130,7 @@ ExtCell(def, outName, doLength)
extNumWarnings, extNumWarnings != 1 ? "s" : "");
TxPrintf("\n");
}
return savePlane;
}
/*
@ -315,7 +317,7 @@ extPrepSubstrate(def)
/*
* ----------------------------------------------------------------------------
*
* extRevertSubstrate ---
* ExtRevertSubstrate ---
*
* This routine swaps the substrate plane of CellDef "def" with the plane
* structure provided in the argument "savePlane". It should be called at
@ -336,7 +338,7 @@ extPrepSubstrate(def)
void
extRevertSubstrate(def, savePlane)
ExtRevertSubstrate(def, savePlane)
CellDef *def;
Plane *savePlane;
{
@ -371,7 +373,7 @@ extRevertSubstrate(def, savePlane)
* ----------------------------------------------------------------------------
*/
void
Plane *
extCellFile(def, f, doLength)
CellDef *def; /* Def to be extracted */
FILE *f; /* Output to this file */
@ -408,10 +410,8 @@ extCellFile(def, f, doLength)
if (!SigInterruptPending && doLength && (ExtOptions & EXT_DOLENGTH))
extLength(extParentUse, f);
/* Revert the substrate plane, if it was altered */
if (saveSub) extRevertSubstrate(def, saveSub);
UndoEnable();
return saveSub;
}
/*

View File

@ -616,6 +616,16 @@ closeit:
return (ret);
}
/* Linked list structure to use to store the substrate plane from each */
/* extracted CellDef so that they can be returned to the original after */
/* extraction. */
struct saveList {
Plane *sl_plane;
CellDef *sl_def;
struct saveList *sl_next;
};
/*
* ----------------------------------------------------------------------------
*
@ -645,7 +655,9 @@ extExtractStack(stack, doExtract, rootDef)
{
int fatal = 0, warnings = 0;
bool first = TRUE;
Plane *savePlane;
CellDef *def;
struct saveList *newsl, *sl = (struct saveList *)NULL;
while (def = (CellDef *) StackPop(stack))
{
@ -654,7 +666,16 @@ extExtractStack(stack, doExtract, rootDef)
{
if (doExtract)
{
ExtCell(def, (char *) NULL, (def == rootDef));
savePlane = ExtCell(def, (char *) NULL, (def == rootDef));
if (savePlane != NULL)
{
newsl = (struct saveList *)mallocMagic(sizeof(struct saveList));
newsl->sl_plane = savePlane;
newsl->sl_def = def;
newsl->sl_next = sl;
sl = newsl;
}
fatal += extNumFatal;
warnings += extNumWarnings;
}
@ -668,6 +689,13 @@ extExtractStack(stack, doExtract, rootDef)
}
}
/* Replace any modified substrate planes */
for (; sl; sl = sl->sl_next)
{
ExtRevertSubstrate(sl->sl_def, sl->sl_plane);
freeMagic(sl);
}
if (!doExtract)
{
TxPrintf("\n");

View File

@ -148,6 +148,8 @@ ExtractTest(w, cmd)
if (cmd->tx_argc == 1)
{
Plane *savePlane;
selectedCell = CmdGetSelectedCell((Transform *) NULL);
if (selectedCell == NULL)
{
@ -156,7 +158,8 @@ ExtractTest(w, cmd)
}
extDispInit(selectedCell->cu_def, w);
ExtCell(selectedCell->cu_def, selectedCell->cu_def->cd_name, FALSE);
savePlane = ExtCell(selectedCell->cu_def, selectedCell->cu_def->cd_name, FALSE);
ExtRevertSubstrate(selectedCell->cu_def, savePlane);
return;
}

View File

@ -75,7 +75,8 @@ extern void ExtTechInit();
extern void ExtTechFinal();
extern void ExtSetStyle();
extern void ExtPrintStyle();
extern void ExtCell();
extern void ExtRevertSubstrate();
extern Plane *ExtCell();
extern int ExtGetGateTypesMask();
extern int ExtGetDiffTypesMask();

View File

@ -91,6 +91,7 @@ PlowRandomTest(def)
static char *dirnames[] = { "up", "down", "right", "left" };
Rect plowRect;
int dir, plowDir;
Plane *savePlane;
#ifdef notdef
strcpy(goodName, tempgood);
@ -101,7 +102,8 @@ PlowRandomTest(def)
sprintf(tempExt, "%s.ext", tempName);
/* Generate "good" extracted file */
ExtCell(def, goodName, FALSE);
savePlane = ExtCell(def, goodName, FALSE);
ExtRevertSubstrate(def, savePlane);
(void) sprintf(command, "sedplow %s", goodExt);
system(command);
#endif /* notdef */
@ -136,7 +138,8 @@ PlowRandomTest(def)
#ifdef notdef
/* Extract to the temp file */
ExtCell(def, tempName, FALSE);
savePlane = ExtCell(def, tempName, FALSE);
ExtRevertSubstrate(def, savePlane);
(void) sprintf(command, "sedplow %s", tempExt);
system(command);