From 7d601628e4e05fd17fcb80c3552dacb64e9f6e7b Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Thu, 17 Feb 2022 17:06:25 -0500 Subject: [PATCH] This commit adds an additional function to the substrate generation, effectively forcing the substrate type (e.g., "pwell") to be defined as delineating isolated substrate areas only (e.g., pwell in deep nwell or isosub a.k.a. subcut). It does so by erasing all of the substrate type out of a cell prior to extraction before redrawing it in the isolated areas. This avoids issues caused by pwell drawn in separate unconnected areas of a cell, as these are removed and the area treated as the default substrate everywhere. Has worked on all layouts tested so far. --- database/DBcellcopy.c | 53 ++++++++++++++++++++++++++++++++++++++++++- extract/ExtBasic.c | 5 +--- 2 files changed, 53 insertions(+), 5 deletions(-) diff --git a/database/DBcellcopy.c b/database/DBcellcopy.c index 8cfeb28f..0e90fefd 100644 --- a/database/DBcellcopy.c +++ b/database/DBcellcopy.c @@ -396,6 +396,8 @@ DBCellGenerateSubstrate(scx, subType, notSubMask, subShieldMask, targetDef) Plane *tempPlane; int plane; Rect rect; + TileTypeBitMask subMask; + int dbEraseSubFunc(); int dbPaintSubFunc(); int dbEraseNonSub(); int dbCopySubFunc(); @@ -415,7 +417,14 @@ DBCellGenerateSubstrate(scx, subType, notSubMask, subShieldMask, targetDef) csd.csd_pNum = plane; csd.csd_modified = FALSE; - /* First paint the substrate type in the temporary plane over the */ + /* First erase the default substrate type everywhere. The substrate */ + /* type is, effectively, only a marker or visual reference. It has */ + /* no use and makes it harder to determine what is the global */ + /* substrate area. */ + TTMaskSetOnlyType(&subMask, subType); + DBTreeSrTiles(scx, &subMask, 0, dbEraseSubFunc, (ClientData)&csd); + + /* Now paint the substrate type in the temporary plane over the */ /* area of all substrate shield types. */ /* Note: xMask is always zero, as this is only called from extract routines */ DBTreeSrTiles(scx, subShieldMask, 0, dbPaintSubFunc, (ClientData)&csd); @@ -431,6 +440,48 @@ DBCellGenerateSubstrate(scx, subType, notSubMask, subShieldMask, targetDef) return tempPlane; } +/* + * Callback function for DBCellGenerateSubstrate() + * Finds tiles in the source def that belong to the type that represents + * the substrate, and erases them. + */ + +int +dbEraseSubFunc(tile, cxp) + Tile *tile; /* Pointer to source tile with shield type */ + TreeContext *cxp; /* Context from DBTreeSrTiles */ +{ + SearchContext *scx; + Rect sourceRect, targetRect; + int pNum; + TileType type, loctype, subType; + Plane *plane; + struct dbCopySubData *csd; /* Client data */ + + scx = cxp->tc_scx; + csd = (struct dbCopySubData *)cxp->tc_filter->tf_arg; + plane = csd->csd_plane; + pNum = csd->csd_pNum; + subType = csd->csd_subtype; + type = TiGetTypeExact(tile); + if (IsSplit(tile)) + { + loctype = (SplitSide(tile)) ? SplitRightType(tile) : SplitLeftType(tile); + if (loctype == TT_SPACE) return 0; + } + + /* Construct the rect for the tile */ + TITORECT(tile, &sourceRect); + + /* Transform to target coordinates */ + GEOTRANSRECT(&scx->scx_trans, &sourceRect, &targetRect); + + csd->csd_modified = TRUE; + + return DBNMPaintPlane(plane, type, &targetRect, DBStdEraseTbl(subType, pNum), + (PaintUndoInfo *)NULL); +} + /* * Callback function for DBCellGenerateSubstrate() * Finds tiles in the source def that belong to the list of types that diff --git a/extract/ExtBasic.c b/extract/ExtBasic.c index 3b3e2481..115a7ee9 100644 --- a/extract/ExtBasic.c +++ b/extract/ExtBasic.c @@ -3693,10 +3693,7 @@ extFindNodes(def, clipArea, subonly) temp_subsnode = (NodeRegion *)NULL; // Reset for new search isabstract = FALSE; - // NOTE: Commented out 12/17/2022. This does not produce the intended - // result when an abstract view contains well and substrate types. - // Not sure if commenting it out produces the intended result when an - // abstract view does NOT contain will and substrate types, though. + // Do not treat abstract cells differently per the substrate. /* DBPropGet(def, "LEFview", &isabstract); */ if (!isabstract)