Committing final verified method for handling isolated substrate.

This commit is contained in:
Tim Edwards 2021-04-05 10:20:41 -04:00
parent 75e4fbe5ad
commit 7be338b44f
5 changed files with 189 additions and 187 deletions

View File

@ -342,7 +342,7 @@ DBCellCheckCopyAllPaint(scx, mask, xMask, targetUse, func)
DBTreeSrTiles(scx, &locMask, xMask, dbCopyAllPaint, (ClientData) &arg);
}
/* Client data structure used by DBCellCopySubstrate() */
/* Client data structure used by DBCellGenerateSubstrate() */
struct dbCopySubData {
Plane *csd_plane;
@ -354,7 +354,7 @@ struct dbCopySubData {
/*
*-----------------------------------------------------------------------------
*
* DBCellCopySubstrate --
* DBCellGenerateSubstrate --
*
* This function is used by the extraction code in ExtSubtree.c.
* Paint substrate into the target use. Similar to DBCellCopyAllPaint(),
@ -380,61 +380,13 @@ struct dbCopySubData {
* ----------------------------------------------------------------------------
*/
void
DBCellCopySubstrate(scx, subType, notSubMask, targetUse)
SearchContext *scx;
TileType subType; /* Substrate paint type */
TileTypeBitMask *notSubMask; /* Mask of types that are not substrate */
CellUse *targetUse;
{
struct dbCopySubData csd;
Plane *tempPlane;
int plane;
Rect rect;
int dbEraseNonSub();
int dbCopySubFunc();
GEOTRANSRECT(&scx->scx_trans, &scx->scx_area, &rect);
/* Clip to bounding box of the top level cell */
GEOCLIP(&rect, &scx->scx_use->cu_def->cd_bbox);
plane = DBPlane(subType);
tempPlane = DBNewPlane((ClientData) TT_SPACE);
DBClearPaintPlane(tempPlane);
/* First paint the substrate type in the temporary plane over the whole cell area */
DBPaintPlane(tempPlane, &rect, DBStdPaintTbl(subType, plane),
(PaintUndoInfo *)NULL);
csd.csd_subtype = subType;
csd.csd_plane = tempPlane;
csd.csd_pNum = plane;
/* Now erase all areas that are non-substrate types in the source */
/* Note: xMask is always zero, as this is only called from extract routines */
DBTreeSrTiles(scx, notSubMask, 0, dbEraseNonSub, (ClientData)&csd);
/* Finally, copy the temp plane contents into the destination */
csd.csd_plane = targetUse->cu_def->cd_planes[plane];
DBSrPaintArea((Tile *)NULL, tempPlane, &TiPlaneRect,
&DBAllButSpaceBits, dbCopySubFunc, (ClientData)&csd);
/* Clean up by removing the temp plane */
DBFreePaintPlane(tempPlane);
TiFreePlane(tempPlane);
}
/* Create a canonical substrate. Return the modified plane */
Plane *
DBCellCanonicalSubstrate(scx, subType, notSubMask, subShieldMask, targetUse)
DBCellGenerateSubstrate(scx, subType, notSubMask, subShieldMask, targetDef)
SearchContext *scx;
TileType subType; /* Substrate paint type */
TileTypeBitMask *notSubMask; /* Mask of types that are not substrate */
TileTypeBitMask *subShieldMask; /* Mask of types that shield substrate */
CellUse *targetUse;
CellDef *targetDef;
{
struct dbCopySubData csd;
Plane *tempPlane;
@ -469,16 +421,55 @@ DBCellCanonicalSubstrate(scx, subType, notSubMask, subShieldMask, targetUse)
DBTreeSrTiles(scx, notSubMask, 0, dbEraseNonSub, (ClientData)&csd);
/* Finally, copy the destination plane contents onto tempPlane */
DBSrPaintArea((Tile *)NULL, targetUse->cu_def->cd_planes[plane], &TiPlaneRect,
DBSrPaintArea((Tile *)NULL, targetDef->cd_planes[plane], &TiPlaneRect,
&DBAllButSpaceBits, dbCopySubFunc, (ClientData)&csd);
return tempPlane;
}
/*
* Callback function for DBCellCopySubstrate()
* Callback function for DBCellGenerateSubstrate()
* Finds tiles in the source def that belong to the list of types that
* shield the substrate (e.g., deep nwell), and paint the substrate type
* into the target plane over the same area.
*/
int
dbPaintSubFunc(tile, cxp)
Tile *tile; /* Pointer to source tile with shield type */
TreeContext *cxp; /* Context from DBTreeSrTiles */
{
Rect rect;
int pNum;
TileType type, loctype, subType;
Plane *plane;
struct dbCopySubData *csd; /* Client data */
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, &rect);
csd->csd_modified = TRUE;
return DBNMPaintPlane(plane, type, &rect, DBStdPaintTbl(subType, pNum),
(PaintUndoInfo *)NULL);
}
/*
* Callback function for DBCellGenerateSubstrate()
* Finds tiles on the substrate plane in the source def that are not the
* substrate type, and erases those areas from the target.
* substrate type, and erases those areas from the target. This reduces
* the geometry in the target plane to areas that form isolated substrate
* regions. Regions belonging to the common global substrate are ignored.
*/
int
@ -521,9 +512,10 @@ dbEraseNonSub(tile, cxp)
}
/*
* Callback function for DBCellCopySubstrate()
* Simple paint function to copy substrate paint from a temporary plane into
* a target plane.
* Callback function for DBCellGenerateSubstrate()
* Simple paint function to copy all paint from the substrate plane of the
* source def into the target plane containing the isolated substrate
* regions.
*/
int
@ -554,36 +546,6 @@ dbCopySubFunc(tile, csd)
(PaintUndoInfo *)NULL);
}
int
dbPaintSubFunc(tile, cxp)
Tile *tile; /* Pointer to source tile with shield type */
TreeContext *cxp; /* Context from DBTreeSrTiles */
{
Rect rect;
int pNum;
TileType type, loctype, subType;
Plane *plane;
struct dbCopySubData *csd; /* Client data */
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, &rect);
csd->csd_modified = TRUE;
return DBNMPaintPlane(plane, type, &rect, DBStdPaintTbl(subType, pNum),
(PaintUndoInfo *)NULL);
}
/*
*-----------------------------------------------------------------------------
*

View File

@ -819,12 +819,11 @@ extern char *DBPrintUseId();
extern void DBCellCopyPaint();
extern void DBCellCopyAllPaint();
extern void DBCellCheckCopyAllPaint();
extern void DBCellCopySubstrate();
extern Plane *DBCellCanonicalSubstrate();
extern void DBCellCopyLabels();
extern void DBCellCopyAllLabels();
extern void DBCellCopyCells();
extern void DBCellCopyAllCells();
extern Plane *DBCellGenerateSubstrate();
/* Contact image handling */
extern TileType DBPlaneToResidue();

View File

@ -219,6 +219,137 @@ extFileOpen(def, file, mode, doLocal, prealfile)
return (PaOpen(name, mode, ".ext", ".", ".", prealfile));
}
/*
* ----------------------------------------------------------------------------
*
* extPrepSubstrate ---
*
* Prepare a replacement plane for the plane representing the substrate, as
* defined in ExtCurStyle->exts_globSubstratePlane. The target CellDef is
* searched for types that shield (i.e., isolate) a section of the layout
* from the global substrate. The tile type that represents the substrate
* is painted into the isolated regions.
*
* The purpose of this method is to deal with the common methodology in
* which the substrate is not represented by any tile type, because no mask
* is defined for the substrate. Typically, an entire cell such as a digital
* standard cell may be placed on the default substrate or in a deep nwell
* region. It is therefore necessary to be able to detect what is underneath
* a cell on the plane representing the substrate to determine if the area is
* the default substrate or an isolated region. If an isolated region, it
* must be painted with a tile type so that the extraction code can tag the
* tiles with a Region and assign it a node. This code creates the substrate
* paint in the isolated regions for the duration of the extration, then
* reverts back to the original plane afterward.
*
* Results:
* Returns a Plane structure that is the original substrate plane from
* CellDef "def", with isolated substrate regions filled with the
* substrate tile type. If there are no isolated substrate regions,
* or if a substrate plane or substrate type is not defined by the
* technology, then the routine returns NULL.
*
* Side effects:
* All modifications are limited to the returned plane structure.
*
* ----------------------------------------------------------------------------
*/
Plane *
extPrepSubstrate(def)
CellDef *def;
{
SearchContext scx;
CellUse dummy;
TileType subType;
TileTypeBitMask subMask, notSubMask;
Plane *subPlane, *savePlane;
int pNum;
/* Determine if substrate copying is required. */
if (ExtCurStyle->exts_globSubstratePlane == -1) return NULL;
/* Find a type to use for the substrate, and the mask of all types */
/* in the same plane as the substrate that are not connected to the */
/* substrate. If there is not a simple type representing the substrate */
/* then do not attempt to resolve substrate regions. */
TTMaskZero(&subMask);
TTMaskSetMask(&subMask, &ExtCurStyle->exts_globSubstrateTypes);
for (subType = TT_TECHDEPBASE; subType < DBNumUserLayers; subType++)
if (TTMaskHasType(&subMask, subType))
if (DBPlane(subType) == ExtCurStyle->exts_globSubstratePlane)
break;
TTMaskCom2(&notSubMask, &subMask);
TTMaskAndMask(&notSubMask, &DBPlaneTypes[ExtCurStyle->exts_globSubstratePlane]);
if (subType == DBNumUserLayers) return NULL;
/* Generate the full flattened substrate into ha->ha_cumFlat (which */
/* was empty initially). This adds layer geometry for the */
/* substrate in the typical case where the substrate may be space */
/* (implicitly defined substrate). */
scx.scx_trans = GeoIdentityTransform;
scx.scx_area = def->cd_bbox;
scx.scx_use = &dummy;
dummy.cu_def = def;
dummy.cu_id = NULL;
subPlane = DBCellGenerateSubstrate(&scx, subType, &notSubMask,
&ExtCurStyle->exts_globSubstrateShieldTypes, def);
if (subPlane != NULL)
{
pNum = ExtCurStyle->exts_globSubstratePlane;
savePlane = def->cd_planes[pNum];
def->cd_planes[pNum] = subPlane;
return savePlane;
}
else
return NULL;
}
/*
* ----------------------------------------------------------------------------
*
* extRevertSubstrate ---
*
* This routine swaps the substrate plane of CellDef "def" with the plane
* structure provided in the argument "savePlane". It should be called at
* the end of extraction. "savePlane" should be the pointer to the substrate
* plane of "def" before it was swapped out for the modified plane created by
* the routine "extPrepSubstrate", above. The calling routine is responsible
* for knowing if extPrepSubstrate returned NULL in which case there is
* nothing to revert.
*
* Returns:
* Nothing.
*
* Side effects:
* The CellDef "def" has its substrate plane swapped out for "savePlane",
* and the original substrate plane and its contents are freed.
* ----------------------------------------------------------------------------
*/
void
extRevertSubstrate(def, savePlane)
CellDef *def;
Plane *savePlane;
{
int pNum;
Plane *subPlane;
pNum = ExtCurStyle->exts_globSubstratePlane;
subPlane = def->cd_planes[pNum];
def->cd_planes[pNum] = savePlane;
DBFreePaintPlane(subPlane);
TiFreePlane(subPlane);
}
/*
* ----------------------------------------------------------------------------
*
@ -250,9 +381,13 @@ extCellFile(def, f, doLength)
*/
{
NodeRegion *reg;
Plane *saveSub;
UndoDisable();
/* Prep any isolated substrate areas */
saveSub = extPrepSubstrate(def);
/* Output the header: timestamp, technology, calls on cell uses */
if (!SigInterruptPending) extHeader(def, f);
@ -273,6 +408,9 @@ 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();
}

View File

@ -170,11 +170,6 @@ extSubtree(parentUse, reg, f)
float pdone, plast;
SearchContext scx;
TileType subType;
TileTypeBitMask subMask, notSubMask;
Plane *subPlane, *savePlane;
bool hasSubDef = FALSE;
/* Use the display timer to force a 5-second progress check */
GrDisplayStatus = DISPLAY_IN_PROGRESS;
SigSetTimer(5); /* Print at 5-second intervals */
@ -200,54 +195,6 @@ extSubtree(parentUse, reg, f)
ha.ha_cumFlat.et_use = extYuseCum;
HashInit(&ha.ha_connHash, 32, 0);
/* Determine if substrate copying is required. */
hasSubDef = (ExtCurStyle->exts_globSubstratePlane != -1) ? TRUE : FALSE;
if (hasSubDef)
{
/* Find a type to use for the substrate, and the mask of all types */
/* in the same plane as the substrate that are not connected to the */
/* substrate. If there is not a simple type representing the substrate */
/* then do not attempt to resolve substrate regions. */
TTMaskZero(&subMask);
TTMaskSetMask(&subMask, &ExtCurStyle->exts_globSubstrateTypes);
for (subType = TT_TECHDEPBASE; subType < DBNumUserLayers; subType++)
if (TTMaskHasType(&subMask, subType))
if (DBPlane(subType) == ExtCurStyle->exts_globSubstratePlane)
break;
TTMaskCom2(&notSubMask, &subMask);
TTMaskAndMask(&notSubMask, &DBPlaneTypes[ExtCurStyle->exts_globSubstratePlane]);
if (subType == DBNumUserLayers) hasSubDef = FALSE;
}
/* Generate the full flattened substrate into ha->ha_cumFlat (which */
/* was empty initially). This adds layer geometry for the */
/* substrate in the typical case where the substrate may be space */
/* (implicitly defined substrate). */
if (hasSubDef)
{
int pNum;
scx.scx_trans = GeoIdentityTransform;
scx.scx_area = def->cd_bbox;
scx.scx_use = parentUse;
subPlane = DBCellCanonicalSubstrate(&scx, subType, &notSubMask,
&ExtCurStyle->exts_globSubstrateShieldTypes, parentUse);
if (subPlane != NULL)
{
pNum = ExtCurStyle->exts_globSubstratePlane;
savePlane = parentUse->cu_def->cd_planes[pNum];
parentUse->cu_def->cd_planes[pNum] = subPlane;
}
else
hasSubDef = FALSE; /* CellDef has no isolated substrate regions */
}
#ifndef exactinteractions
/*
* Cookie-cutter up def into pieces ExtCurStyle->exts_stepSize by
@ -384,17 +331,6 @@ done:
/* Clear the CU_SUB_EXTRACTED flag from all children instances */
DBCellEnum(def, extClearUseFlags, (ClientData)NULL);
/* Replace the modified substrate plane with the original */
if (hasSubDef)
{
int pNum;
pNum = ExtCurStyle->exts_globSubstratePlane;
parentUse->cu_def->cd_planes[pNum] = savePlane;
DBFreePaintPlane(subPlane);
TiFreePlane(subPlane);
}
}
#ifdef exactinteractions
@ -497,10 +433,6 @@ extSubtreeInteraction(ha)
scx.scx_area = ha->ha_interArea;
scx.scx_use = ha->ha_parentUse;
/*
if (hasSubDef)
DBCellCopySubstrate(&scx, subType, &notSubMask, ha->ha_cumFlat.et_use);
*/
/* Copy parent paint into ha->ha_cumFlat */
DBCellCopyPaint(&scx, &DBAllButSpaceBits, 0, ha->ha_cumFlat.et_use);
@ -511,10 +443,6 @@ extSubtreeInteraction(ha)
*/
oneFlat = extHierNewOne();
oneDef = oneFlat->et_use->cu_def;
/*
if (hasSubDef)
DBCellCopySubstrate(&scx, subType, &notSubMask, oneFlat->et_use);
*/
DBCellCopyPaint(&scx, &DBAllButSpaceBits, 0, oneFlat->et_use);
oneFlat->et_nodes = extFindNodes(oneDef, &ha->ha_clipArea, FALSE);
@ -637,7 +565,6 @@ extSubtreeInteraction(ha)
ha->ha_cumFlat.et_nodes = (NodeRegion *) NULL;
extHierFreeLabels(cumDef);
DBCellClearDef(cumDef);
}
/*
@ -801,18 +728,6 @@ extSubtreeFunc(scx, ha)
/* Record information for finding node names the hard way later */
ha->ha_subUse = use;
/* Copy the substrate into the oneFlat target */
/*
if (ha->ha_subType != -1)
{
newscx.scx_use = ha->ha_cumFlat.et_use;
newscx.scx_area = use->cu_bbox;
GEOCLIP(&newscx.scx_area, &ha->ha_interArea);
newscx.scx_trans = GeoIdentityTransform;
DBCellCopySubstrate(&newscx, ha->ha_subType, ha->ha_notSubMask, oneFlat->et_use);
}
*/
/*
* Yank all array elements of this subcell that lie in the interaction
* area. Transform to parent coordinates. Prefix is true, meaning that
@ -880,17 +795,6 @@ extSubtreeFunc(scx, ha)
cumUse->cu_def->cd_labels = newlab;
}
}
/*
ha->ha_cumFlat.et_nodes =
(NodeRegion *) ExtFindSubstrateRegions(cumUse->cu_def,
&TiPlaneRect,
&ExtCurStyle->exts_activeTypes,
ExtCurStyle->exts_nodeConn,
extUnInit, extHierLabFirst, (int (*)()) NULL);
ExtLabelRegions(cumUse->cu_def, ExtCurStyle->exts_nodeConn,
&(ha->ha_cumFlat.et_nodes), &TiPlaneRect);
*/
}
else
{

View File

@ -372,7 +372,6 @@ SelectRemoveCellUse(use, trans)
{
SearchContext scx;
CellUse selectedUse;
SelRemoveCellArgs args;
/* The search context is the area covered by the cell's bounding box in