From 256a47d7b997c503fa158048c381534904e3e862 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Wed, 30 Nov 2022 16:29:37 -0500 Subject: [PATCH] Added a method for a property named OBS_BBOX to specify a minimum area to be marked as an obstruction when writing a LEF file with the "-hide" option. --- database/DBcellsrch.c | 13 ++++++----- lef/lefWrite.c | 52 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 58 insertions(+), 7 deletions(-) diff --git a/database/DBcellsrch.c b/database/DBcellsrch.c index 51858e9a..69c5e074 100644 --- a/database/DBcellsrch.c +++ b/database/DBcellsrch.c @@ -1804,7 +1804,7 @@ typedef struct _cellpropstruct { * dbScaleProp -- * * Callback function for dbScaleCell. Finds properties that represent - * internal geometry (FIXED_BBOX and MASKHINTS_*) and scale the values + * internal geometry (*_BBOX and MASKHINTS_*) and scale the values * by the numerator / denominator values passed as a pointer to a Point * structure, where p_x is the numerator value and p_y is the denominator * value. @@ -1821,7 +1821,7 @@ int dbScaleProp(name, value, cps) char *newvalue, *vptr; Rect r; - if (!strcmp(name, "FIXED_BBOX")) + if ((strlen(name) > 5) && !strncmp(name + strlen(name) - 5, "_BBOX", 5)) { if (sscanf(value, "%d %d %d %d", &r.r_xbot, &r.r_ybot, &r.r_xtop, &r.r_ytop) == 4) @@ -1899,7 +1899,7 @@ int dbScaleProp(name, value, cps) * dbMoveProp -- * * Callback function for ??. Finds properties that represent - * internal geometry (FIXED_BBOX and MASKHINTS_*) and modifies the values + * internal geometry (*_BBOX and MASKHINTS_*) and modifies the values * by the X, Y values passed as a pointer to a Point structure in ClientData. * * ---------------------------------------------------------------------------- @@ -1914,7 +1914,8 @@ int dbMoveProp(name, value, cps) char *newvalue; Rect r; - if (!strcmp(name, "FIXED_BBOX") || !strncmp(name, "MASKHINTS_", 10)) + if (((strlen(name) > 5) && !strncmp(name + strlen(name) - 5, "_BBOX", 5)) + || !strncmp(name, "MASKHINTS_", 10)) { if (sscanf(value, "%d %d %d %d", &r.r_xbot, &r.r_ybot, &r.r_xtop, &r.r_ytop) == 4) @@ -2099,7 +2100,7 @@ donecell: } /* Check all properties for ones with keys beginning with "MASKHINTS_" - * or the key "FIXED_BBOX", and scale them by the same amount as all + * or ending with "_BBOX", and scale them by the same amount as all * the geometry. */ @@ -2295,7 +2296,7 @@ donecell: DBMovePoint(&cellDef->cd_extended.r_ur, origx, origy); /* Check all properties for ones with keys beginning with "MASKHINTS_" - * or the key "FIXED_BBOX", and move them by the same amount as all + * or ending with "_BBOX", and move them by the same amount as all * the geometry. */ diff --git a/lef/lefWrite.c b/lef/lefWrite.c index 7c094cb1..0968fd9b 100644 --- a/lef/lefWrite.c +++ b/lef/lefWrite.c @@ -553,6 +553,25 @@ lefGetBound(tile, cdata) return 0; } +/* + * ---------------------------------------------------------------------------- + * + * lefHasPaint--- + * + * Simple callback that returns 1 to stop the search when any tile matching + * the search mask is found. + * + * ---------------------------------------------------------------------------- + */ + +int +lefHasPaint(tile, clientData) + Tile *tile; + ClientData clientData; +{ + return 1; +} + /* * ---------------------------------------------------------------------------- * @@ -1722,8 +1741,31 @@ lefWriteMacro(def, f, scale, setback, pinonly, toplayer, domaster) /* sure that every pin has a legal path to the outside of the */ /* cell. Otherwise, this routine can block internal pins. */ - Rect layerBound; + Rect layerBound, manualBound; labelLinkedList *thislll; + bool propfound; + char *propvalue; + + /* If there is a property OBS_BBOX, then use the value of the */ + /* defined box to set the minimum hidden area. This will still */ + /* get clipped to the setback. */ + + propvalue = (char *)DBPropGet(def, "OBS_BBOX", &propfound); + if (propfound) + { + if (sscanf(propvalue, "%d %d %d %d", + &(manualBound.r_xbot), + &(manualBound.r_ybot), + &(manualBound.r_xtop), + &(manualBound.r_ytop)) != 4) + { + TxError("Improper values for obstruction bounding box " + "OBS_BBOX property"); + manualBound = GeoNullRect; + } + } + else + manualBound = GeoNullRect; for (ttype = TT_TECHDEPBASE; ttype < DBNumTypes; ttype++) if (TTMaskHasType(&lmask, ttype)) @@ -1736,6 +1778,14 @@ lefWriteMacro(def, f, scale, setback, pinonly, toplayer, domaster) DBSrPaintArea((Tile *)NULL, lefFlatUse.cu_def->cd_planes[pNum], &TiPlaneRect, &DBAllButSpaceAndDRCBits, lefGetBound, (ClientData)(&layerBound)); + + /* Add any manual boundary if there is any */ + /* material at all in the cell on this plane. */ + if (!GEO_RECTNULL(&manualBound)) + if (DBSrPaintArea((Tile *)NULL, def->cd_planes[pNum], + &TiPlaneRect, &DBAllButSpaceAndDRCBits, + lefHasPaint, (ClientData)NULL) == 1) + GeoInclude(&manualBound, &layerBound); } /* Clip layerBound to setback boundary */