Enhanced the "lef write -hide" command option to check for metal

wide spacing rules; should result in LEF views that can import
back into magic without DRC errors.
This commit is contained in:
Tim Edwards 2020-03-25 09:29:16 -04:00
parent 5bf2a6ec69
commit 6bae7c25c4
2 changed files with 75 additions and 6 deletions

View File

@ -4031,3 +4031,62 @@ DRCGetDefaultLayerSurround(ttype1, ttype2)
}
return layerSurround;
}
/*
*-----------------------------------------------------------------------------
* DRCGetDefaultLayerWideSpacing ---
*
* Determine a default layer-to-self wide-layer spacing rule from
* the DRC width rules of a layer.
*
* Results:
* The minimum spacing between the specified magic layer type and
* itself, where one of the shapes has width greater than "twidth".
* The result value is in magic internal units.
*
* Side effects:
* None.
*
*-----------------------------------------------------------------------------
*/
int
DRCGetDefaultWideLayerSpacing(ttype, twidth)
TileType ttype;
int twidth;
{
int routeSpacing = 0;
DRCCookie *cptr;
TileTypeBitMask *set;
bool widerule = FALSE;
for (cptr = DRCCurStyle->DRCRulesTbl[ttype][TT_SPACE]; cptr != (DRCCookie *) NULL;
cptr = cptr->drcc_next)
{
if (cptr->drcc_flags & DRC_TRIGGER) /* Widespacing rule */
{
widerule = TRUE;
if (cptr->drcc_dist > twidth) /* Check against rule width */
return routeSpacing;
}
if (widerule && ((cptr->drcc_flags & DRC_REVERSE) == 0)) /* FORWARD only */
{
set = &cptr->drcc_mask;
if (!TTMaskHasType(set, ttype))
if (PlaneMaskHasPlane(DBTypePlaneMaskTbl[ttype], cptr->drcc_plane) &&
(cptr->drcc_dist == cptr->drcc_cdist))
{
routeSpacing = cptr->drcc_dist;
/* Diagnostic */
/*
TxPrintf("DRC: Layer %s has wide spacing %d to layer %s width %d\n",
DBTypeLongNameTbl[ttype1], routeSpacing,
DBTypeLongNameTbl[ttype2], twidth);
*/
}
}
if (!(cptr->drcc_flags & DRC_TRIGGER)) widerule = FALSE;
}
return routeSpacing;
}

View File

@ -1103,15 +1103,25 @@ lefWriteMacro(def, f, scale, hide)
for (thislll = lll; thislll; thislll = thislll->lll_next)
{
int lspace;
int lspacex, lspacey, lwidth;
lab = thislll->lll_label;
lspace = DRCGetDefaultLayerSpacing(lab->lab_type, lab->lab_type);
thislll->lll_area.r_xbot -= lspace;
thislll->lll_area.r_ybot -= lspace;
thislll->lll_area.r_xtop += lspace;
thislll->lll_area.r_ytop += lspace;
/* Look for wide spacing rules. If there are no wide spacing */
/* rules, then fall back on the default spacing rule. */
lwidth = thislll->lll_area.r_xtop - thislll->lll_area.r_xbot;
lspacex = DRCGetDefaultWideLayerSpacing(lab->lab_type, lwidth);
if (lspacex == 0)
lspacex = DRCGetDefaultLayerSpacing(lab->lab_type, lab->lab_type);
lwidth = thislll->lll_area.r_ytop - thislll->lll_area.r_ybot;
lspacey = DRCGetDefaultWideLayerSpacing(lab->lab_type, lwidth);
if (lspacey == 0)
lspacey = DRCGetDefaultLayerSpacing(lab->lab_type, lab->lab_type);
thislll->lll_area.r_xbot -= lspacex;
thislll->lll_area.r_ybot -= lspacey;
thislll->lll_area.r_xtop += lspacex;
thislll->lll_area.r_ytop += lspacey;
DBErase(lc.lefYank, &thislll->lll_area, lab->lab_type);
freeMagic(thislll);