Modified the GDS read routine behavior so that if a cell is being

flattened per "gds flatten" or "gds flatglob", and the "gds readonly"
option is not set, then the instances of the flattened cells are
removed from the layout.  They are retained for the "readonly" option
because when writing GDS of such a cell, the full hierarchy needs to
be walked.
This commit is contained in:
Tim Edwards 2021-03-18 15:16:37 -04:00
parent cde90bb4a7
commit 08cb75a9b4
1 changed files with 50 additions and 2 deletions

View File

@ -592,6 +592,25 @@ calmaParseElement(filename, pnsrefs, pnpaths)
return (calmaSkipTo(CALMA_ENDEL));
}
/*
* ----------------------------------------------------------------------------
*
* Callback procedure for enumerating any paint in a cell. Used to find if
* a cell needs to be retained after being flattened into the parent cell.
*
* Returns 1 always. Only called if a non-space tile was encountered.
*
* ----------------------------------------------------------------------------
*/
int
calmaEnumFunc(tile, plane)
Tile *tile;
int *plane;
{
return 1;
}
/*
* ----------------------------------------------------------------------------
*
@ -998,9 +1017,38 @@ calmaElementSref(filename)
}
}
/* If cell has children in addition to paint to be flattened, */
/* then also generate an instance of the cell. */
/* When not reading with VENDORGDS, if a cell has contents */
/* other than the paint to be flattened, then also generate an */
/* instance of the cell. Otherwise (with VENDORGDS), always */
/* generate cell instances. Note that only paint and cells */
/* are counted, not labels (see below). */
else if (!(def->cd_flags & CDVENDORGDS))
{
int plane;
for (plane = PL_TECHDEPBASE; plane < DBNumPlanes; plane++)
if (DBSrPaintArea((Tile *)NULL, def->cd_planes[plane], &TiPlaneRect,
&DBAllButSpaceAndDRCBits, calmaEnumFunc, (ClientData)NULL))
break;
if ((plane < DBNumPlanes) || DBCellEnum(def, gdsHasUses, (ClientData)NULL))
{
use = DBCellNewUse(def, (useid) ? useid : (char *) NULL);
if (isArray)
DBMakeArray(use, &GeoIdentityTransform, xlo, ylo, xhi, yhi, xsep, ysep);
DBSetTrans(use, &trans);
DBPlaceCell(use, cifReadCellDef);
madeinst = TRUE;
}
else
{
/* (To do: Copy labels from flattened cells, with hierarchical */
/* names. Whether to do this or not should be an option.) */
TxPrintf("Removing instances of flattened cell %s in %s\n",
def->cd_name, cifReadCellDef->cd_name);
madeinst = TRUE;
}
}
else
{
use = DBCellNewUse(def, (useid) ? useid : (char *) NULL);