From 08cb75a9b47fd8f7c920b99e835512f184f3ff65 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Thu, 18 Mar 2021 15:16:37 -0400 Subject: [PATCH] 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. --- calma/CalmaRdcl.c | 52 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/calma/CalmaRdcl.c b/calma/CalmaRdcl.c index 7d0734c6..88bdc486 100644 --- a/calma/CalmaRdcl.c +++ b/calma/CalmaRdcl.c @@ -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);