mirror of
https://github.com/RTimothyEdwards/magic.git
synced 2026-08-22 14:17:43 +02:00
Implemented an additional setback value for "lef write -hide <value>"
that produces a result that looks like "lef write -hide" in the middle but "lef write" around the edge. Can be useful for catching all the detail around the edges but obscuring/simplifying the bulk of the cell interior.
This commit is contained in:
+114
-7
@@ -1095,11 +1095,11 @@ LefWritePinHeader(f, lab)
|
||||
*/
|
||||
|
||||
void
|
||||
lefWriteMacro(def, f, scale, hide, toplayer)
|
||||
lefWriteMacro(def, f, scale, setback, toplayer)
|
||||
CellDef *def; /* Def for which to generate LEF output */
|
||||
FILE *f; /* Output to this file */
|
||||
float scale; /* Output distance units conversion factor */
|
||||
bool hide; /* If TRUE, hide all detail except pins */
|
||||
int setback; /* If >= 0, hide all detail except pins inside setback */
|
||||
bool toplayer; /* If TRUE, only output topmost layer of pins */
|
||||
{
|
||||
bool propfound, ispwrrail;
|
||||
@@ -1275,6 +1275,14 @@ lefWriteMacro(def, f, scale, hide, toplayer)
|
||||
&boundary.r_ybot, &boundary.r_xtop, &boundary.r_ytop);
|
||||
}
|
||||
|
||||
/* Check if (boundry less setback) is degenerate. If so, then */
|
||||
/* there is no effect of the "-hide" option. */
|
||||
if (setback > 0)
|
||||
{
|
||||
if ((boundary.r_xtop - boundary.r_xbot) < (2 * setback)) setback = -1;
|
||||
if ((boundary.r_ytop - boundary.r_ybot) < (2 * setback)) setback = -1;
|
||||
}
|
||||
|
||||
/* Write position and size information */
|
||||
/* Note: Using "0.0 - X" prevents fprintf from generating "negative */
|
||||
/* zeros" in the output. */
|
||||
@@ -1399,7 +1407,7 @@ lefWriteMacro(def, f, scale, hide, toplayer)
|
||||
scx.scx_area = labr;
|
||||
SelectClear();
|
||||
|
||||
if (hide)
|
||||
if (setback == 0)
|
||||
{
|
||||
Rect carea;
|
||||
labelLinkedList *newlll;
|
||||
@@ -1423,6 +1431,18 @@ lefWriteMacro(def, f, scale, hide, toplayer)
|
||||
newlll->lll_next = lll;
|
||||
lll = newlll;
|
||||
}
|
||||
else if (setback > 0)
|
||||
{
|
||||
Rect carea;
|
||||
|
||||
/* For -hide with setback, select the entire net and then */
|
||||
/* remove the part inside the setback area. Note that this */
|
||||
/* does not check if this causes the label to disappear. */
|
||||
|
||||
SelectNet(&scx, lab->lab_type, 0, NULL, FALSE);
|
||||
GEO_EXPAND(&boundary, -setback, &carea);
|
||||
SelRemoveArea(&carea, &DBAllButSpaceAndDRCBits);
|
||||
}
|
||||
else
|
||||
SelectNet(&scx, lab->lab_type, 0, NULL, FALSE);
|
||||
|
||||
@@ -1578,7 +1598,7 @@ lefWriteMacro(def, f, scale, hide, toplayer)
|
||||
|
||||
/* Restrict to routing planes only */
|
||||
|
||||
if (hide)
|
||||
if (setback >= 0)
|
||||
{
|
||||
/* If details of the cell are to be hidden, then first paint */
|
||||
/* all route layers with an obstruction rectangle the size of */
|
||||
@@ -1598,6 +1618,7 @@ lefWriteMacro(def, f, scale, hide, toplayer)
|
||||
for (ttype = TT_TECHDEPBASE; ttype < DBNumTypes; ttype++)
|
||||
if (TTMaskHasType(&lmask, ttype))
|
||||
{
|
||||
Rect r;
|
||||
layerBound.r_xbot = layerBound.r_xtop = 0;
|
||||
for (pNum = PL_TECHDEPBASE; pNum < DBNumPlanes; pNum++)
|
||||
if (TTMaskHasType(&DBPlaneTypes[pNum], ttype))
|
||||
@@ -1607,6 +1628,10 @@ lefWriteMacro(def, f, scale, hide, toplayer)
|
||||
lefGetBound, (ClientData)(&layerBound));
|
||||
}
|
||||
|
||||
/* Clip layerBound to setback boundary */
|
||||
GEO_EXPAND(&boundary, -setback, &r);
|
||||
GeoClip(&layerBound, &r);
|
||||
|
||||
DBPaint(lc.lefYank, &layerBound, ttype);
|
||||
}
|
||||
|
||||
@@ -1630,6 +1655,43 @@ lefWriteMacro(def, f, scale, hide, toplayer)
|
||||
DBErase(lc.lefYank, &thislll->lll_area, lab->lab_type);
|
||||
freeMagic(thislll);
|
||||
}
|
||||
|
||||
if (setback > 0)
|
||||
{
|
||||
/* For -hide with setback, yank everything in the area outside */
|
||||
/* the setback. */
|
||||
|
||||
for (pNum = PL_TECHDEPBASE; pNum < DBNumPlanes; pNum++)
|
||||
{
|
||||
Rect r;
|
||||
lc.pNum = pNum;
|
||||
|
||||
r = def->cd_bbox;
|
||||
r.r_ytop = boundary.r_ybot + setback;
|
||||
DBSrPaintArea((Tile *)NULL, lefFlatDef->cd_planes[pNum],
|
||||
&r, &DBAllButSpaceAndDRCBits,
|
||||
lefYankGeometry, (ClientData) &lc);
|
||||
r = def->cd_bbox;
|
||||
r.r_ybot = boundary.r_ytop - setback;
|
||||
DBSrPaintArea((Tile *)NULL, lefFlatDef->cd_planes[pNum],
|
||||
&r, &DBAllButSpaceAndDRCBits,
|
||||
lefYankGeometry, (ClientData) &lc);
|
||||
r = def->cd_bbox;
|
||||
r.r_ybot = boundary.r_ybot + setback;
|
||||
r.r_ytop = boundary.r_ytop - setback;
|
||||
r.r_xtop = boundary.r_xbot + setback;
|
||||
DBSrPaintArea((Tile *)NULL, lefFlatDef->cd_planes[pNum],
|
||||
&r, &DBAllButSpaceAndDRCBits,
|
||||
lefYankGeometry, (ClientData) &lc);
|
||||
r = def->cd_bbox;
|
||||
r.r_ybot = boundary.r_ybot + setback;
|
||||
r.r_ytop = boundary.r_ytop - setback;
|
||||
r.r_xbot = boundary.r_xtop - setback;
|
||||
DBSrPaintArea((Tile *)NULL, lefFlatDef->cd_planes[pNum],
|
||||
&r, &DBAllButSpaceAndDRCBits,
|
||||
lefYankGeometry, (ClientData) &lc);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1652,7 +1714,7 @@ lefWriteMacro(def, f, scale, hide, toplayer)
|
||||
lefWriteGeometry, (ClientData) &lc);
|
||||
|
||||
/* Additional yank & write for contacts (although ignore contacts for -hide) */
|
||||
if (!hide)
|
||||
if (setback < 0)
|
||||
{
|
||||
lc.lefMode = LEF_MODE_OBS_CONTACT;
|
||||
DBSrPaintArea((Tile *)NULL, lefFlatDef->cd_planes[pNum],
|
||||
@@ -1663,6 +1725,51 @@ lefWriteMacro(def, f, scale, hide, toplayer)
|
||||
lefWriteGeometry, (ClientData) &lc);
|
||||
lc.lefMode = LEF_MODE_OBSTRUCT;
|
||||
}
|
||||
else if (setback > 0)
|
||||
{
|
||||
Rect r;
|
||||
|
||||
/* Apply only to area outside setback. */
|
||||
lc.lefMode = LEF_MODE_OBS_CONTACT;
|
||||
|
||||
r = def->cd_bbox;
|
||||
r.r_ytop = boundary.r_ybot + setback;
|
||||
DBSrPaintArea((Tile *)NULL, lefFlatDef->cd_planes[pNum],
|
||||
&r, &DBAllButSpaceAndDRCBits,
|
||||
lefYankContacts, (ClientData) &lc);
|
||||
DBSrPaintArea((Tile *)NULL, lc.lefYank->cd_planes[pNum],
|
||||
&r, &lc.rmask, lefWriteGeometry, (ClientData) &lc);
|
||||
|
||||
r = def->cd_bbox;
|
||||
r.r_ybot = boundary.r_ytop - setback;
|
||||
DBSrPaintArea((Tile *)NULL, lefFlatDef->cd_planes[pNum],
|
||||
&r, &DBAllButSpaceAndDRCBits,
|
||||
lefYankContacts, (ClientData) &lc);
|
||||
DBSrPaintArea((Tile *)NULL, lc.lefYank->cd_planes[pNum],
|
||||
&r, &lc.rmask, lefWriteGeometry, (ClientData) &lc);
|
||||
|
||||
r = def->cd_bbox;
|
||||
r.r_ybot = boundary.r_ybot + setback;
|
||||
r.r_ytop = boundary.r_ytop - setback;
|
||||
r.r_xtop = boundary.r_xbot + setback;
|
||||
DBSrPaintArea((Tile *)NULL, lefFlatDef->cd_planes[pNum],
|
||||
&r, &DBAllButSpaceAndDRCBits,
|
||||
lefYankContacts, (ClientData) &lc);
|
||||
DBSrPaintArea((Tile *)NULL, lc.lefYank->cd_planes[pNum],
|
||||
&r, &lc.rmask, lefWriteGeometry, (ClientData) &lc);
|
||||
|
||||
r = def->cd_bbox;
|
||||
r.r_ybot = boundary.r_ybot + setback;
|
||||
r.r_ytop = boundary.r_ytop - setback;
|
||||
r.r_xbot = boundary.r_xtop - setback;
|
||||
DBSrPaintArea((Tile *)NULL, lefFlatDef->cd_planes[pNum],
|
||||
&r, &DBAllButSpaceAndDRCBits,
|
||||
lefYankContacts, (ClientData) &lc);
|
||||
DBSrPaintArea((Tile *)NULL, lc.lefYank->cd_planes[pNum],
|
||||
&r, &lc.rmask, lefWriteGeometry, (ClientData) &lc);
|
||||
|
||||
lc.lefMode = LEF_MODE_OBSTRUCT;
|
||||
}
|
||||
}
|
||||
|
||||
if (lc.numWrites > 0)
|
||||
@@ -1843,7 +1950,7 @@ LefWriteAll(rootUse, writeTopCell, lefTech, lefHide, lefTopLayer, recurse)
|
||||
CellUse *rootUse;
|
||||
bool writeTopCell;
|
||||
bool lefTech;
|
||||
bool lefHide;
|
||||
int lefHide;
|
||||
bool lefTopLayer;
|
||||
bool recurse;
|
||||
{
|
||||
@@ -1979,7 +2086,7 @@ LefWriteCell(def, outName, isRoot, lefTech, lefHide, lefTopLayer)
|
||||
char *outName; /* Name of output file, or NULL. */
|
||||
bool isRoot; /* Is this the root cell? */
|
||||
bool lefTech; /* Output layer information if TRUE */
|
||||
bool lefHide; /* Hide detail other than pins if TRUE */
|
||||
int lefHide; /* Hide detail other than pins if >= 0 */
|
||||
bool lefTopLayer; /* Use only topmost layer of pin if TRUE */
|
||||
{
|
||||
char *filename;
|
||||
|
||||
Reference in New Issue
Block a user