Modified "lef writeall" to only generate output for the set of subcells

that are direct children of the top level cell.  The "-all" option was
added to enable the previous behavior, although its usefulness is
doubtful.
This commit is contained in:
Tim Edwards 2019-12-19 10:33:22 -05:00
parent d0f3aaeb59
commit f15ea2a135
3 changed files with 23 additions and 9 deletions

View File

@ -1024,7 +1024,7 @@ calmaOutFunc(def, f, cliprect)
((lab->lab_flags & PORT_NUM_MASK) == i))
{
calmaWriteLabelFunc(lab, type, f);
break;
/* break; */ /* Do not limit to unique labels! */
}
}
}

View File

@ -87,6 +87,11 @@ CmdLef(w, cmd)
* the macro other than pin area
* immediately surrounding labels.
*/
bool recurse = FALSE; /* If TRUE, recurse on all subcells
* during "writeall". By default,
* only the immediate children of the
* top level cell are output.
*/
static char *cmdLefOption[] =
{
@ -95,7 +100,8 @@ CmdLef(w, cmd)
"write [filename] [-tech] write LEF for current cell\n"
" write [filename] -hide hide all details other than ports",
"writeall write all cells including the top-level cell\n"
" writeall -notop write all subcells of the top-level cell",
" writeall -notop write all children of the top-level cell\n"
" writeall -all recurse on all subcells of the top-level cell",
"help print this help information",
NULL
};
@ -184,11 +190,13 @@ CmdLef(w, cmd)
lefTopCell = FALSE;
else if (!strncmp(cmd->tx_argv[i], "-tech", 5))
lefTech = TRUE;
else if (!strncmp(cmd->tx_argv[i], "-all", 4))
recurse = TRUE;
else goto wrongNumArgs;
}
else goto wrongNumArgs;
}
LefWriteAll(selectedUse, lefTopCell, lefTech);
LefWriteAll(selectedUse, lefTopCell, lefTech, recurse);
}
break;
case LEF_WRITE:

View File

@ -1133,10 +1133,11 @@ lefWriteMacro(def, f, scale, hide)
*/
void
LefWriteAll(rootUse, writeTopCell, lefTech)
LefWriteAll(rootUse, writeTopCell, lefTech, recurse)
CellUse *rootUse;
bool writeTopCell;
bool lefTech;
bool recurse;
{
CellDef *def, *rootdef;
FILE *f;
@ -1155,8 +1156,12 @@ LefWriteAll(rootUse, writeTopCell, lefTech)
(void) DBCellSrDefs(0, lefDefInitFunc, (ClientData) 0);
/* Recursively visit all defs in the tree and push on stack */
/* If "recurse" is false, then only the children of the root use */
/* are pushed (this is the default behavior). */
lefDefStack = StackNew(100);
(void) lefDefPushFunc(rootUse);
if (writeTopCell)
lefDefPushFunc(rootUse, (bool *)NULL);
DBCellEnum(rootUse->cu_def, lefDefPushFunc, (ClientData)&recurse);
/* Open the file for output */
@ -1185,8 +1190,7 @@ LefWriteAll(rootUse, writeTopCell, lefTech)
{
def->cd_client = (ClientData) 0;
if (!SigInterruptPending)
if ((writeTopCell == TRUE) || (def != rootdef))
lefWriteMacro(def, f, scale);
lefWriteMacro(def, f, scale);
}
/* End the LEF file */
@ -1217,8 +1221,9 @@ lefDefInitFunc(def)
*/
int
lefDefPushFunc(use)
lefDefPushFunc(use, recurse)
CellUse *use;
bool *recurse;
{
CellDef *def = use->cu_def;
@ -1227,7 +1232,8 @@ lefDefPushFunc(use)
def->cd_client = (ClientData) 1;
StackPush((ClientData) def, lefDefStack);
(void) DBCellEnum(def, lefDefPushFunc, (ClientData) 0);
if (recurse && (*recurse))
(void) DBCellEnum(def, lefDefPushFunc, (ClientData)recurse);
return (0);
}