diff --git a/lef/lefCmd.c b/lef/lefCmd.c index 81cf3c80..faa5d31e 100644 --- a/lef/lefCmd.c +++ b/lef/lefCmd.c @@ -92,8 +92,10 @@ CmdLef(w, cmd) * other than pin area surrounding labels, * with the indicated setback distance. */ - bool lefPinOnly = FALSE; /* If TRUE, make pins only where labels - * are defined, not the whole net. + int lefPinOnly = -1; /* If >= 0, make pins only where labels + * are defined, not the whole net. Values + * > 0 limit how far pins can extend into + * the interior of the cell. */ bool lefTopLayer = FALSE; /* If TRUE, only output the topmost * layer used by a pin, and make @@ -238,7 +240,16 @@ CmdLef(w, cmd) } } else if (!strncmp(cmd->tx_argv[i], "-pinonly", 8)) - lefPinOnly = TRUE; + { + lefPinOnly = 0; + if ((i < (cmd->tx_argc - 1)) && + StrIsNumeric(cmd->tx_argv[i + 1])) + { + lefPinOnly = cmdParseCoord(w, cmd->tx_argv[i + 1], + FALSE, TRUE); + i++; + } + } else if (!strncmp(cmd->tx_argv[i], "-toplayer", 9)) lefTopLayer = TRUE; else if (!strncmp(cmd->tx_argv[i], "-nomaster", 9)) @@ -294,7 +305,17 @@ CmdLef(w, cmd) else if (!strncmp(cmd->tx_argv[i], "-pinonly", 8)) { if (is_lef) - lefPinOnly = TRUE; + { + lefPinOnly = 0; + if ((i < (cmd->tx_argc - 1)) && + StrIsNumeric(cmd->tx_argv[i + 1])) + { + lefPinOnly = cmdParseCoord(w, cmd->tx_argv[i + 1], + FALSE, TRUE); + cargs--; + i++; + } + } else TxPrintf("The \"-pinonly\" option is only for lef write\n"); } diff --git a/lef/lefWrite.c b/lef/lefWrite.c index 357482ef..aa12f0e6 100644 --- a/lef/lefWrite.c +++ b/lef/lefWrite.c @@ -1100,7 +1100,7 @@ lefWriteMacro(def, f, scale, setback, pinonly, toplayer, domaster) FILE *f; /* Output to this file */ float scale; /* Output distance units conversion factor */ int setback; /* If >= 0, hide all detail except pins inside setback */ - bool pinonly; /* If TRUE, only place pins where labels are defined */ + int pinonly; /* If >= 0, only place pins where labels are defined */ bool toplayer; /* If TRUE, only output topmost layer of pins */ bool domaster; /* If TRUE, write masterslice layers */ { @@ -1417,17 +1417,23 @@ lefWriteMacro(def, f, scale, setback, pinonly, toplayer, domaster) scx.scx_area = labr; SelectClear(); - if ((pinonly == TRUE) || (setback == 0)) + if (setback == 0) { Rect carea; labelLinkedList *newlll; - if (pinonly == TRUE) + if (pinonly == 0) carea = labr; else { - SelectChunk(&scx, lab->lab_type, 0, &carea, FALSE); - if (GEO_RECTNULL(&carea)) carea = labr; + SelectChunk(&scx, lab->lab_type, 0, &carea, FALSE); + if (GEO_RECTNULL(&carea)) carea = labr; + else if (pinonly > 0) + { + Rect psetback; + GEO_EXPAND(&boundary, -pinonly, &psetback); + SelRemoveArea(&psetback, &DBAllButSpaceAndDRCBits); + } } /* Note that a sticky label could be placed over multiple */ @@ -1457,6 +1463,14 @@ lefWriteMacro(def, f, scale, setback, pinonly, toplayer, domaster) GEO_EXPAND(&boundary, -setback, &carea); SelRemoveArea(&carea, &DBAllButSpaceAndDRCBits); + /* Apply any additional setback from the "-pinonly" option */ + if (pinonly > setback) + { + Rect psetback; + GEO_EXPAND(&boundary, -pinonly, &psetback); + SelRemoveArea(&psetback, &DBAllButSpaceAndDRCBits); + } + /* Paint over the label area so that labels do not simply */ /* disappear by being inside the setback area. */ @@ -1465,8 +1479,25 @@ lefWriteMacro(def, f, scale, setback, pinonly, toplayer, domaster) DBStdPaintTbl(lab->lab_type, pNum), (PaintUndoInfo *) NULL); } else + { SelectNet(&scx, lab->lab_type, 0, NULL, FALSE); + /* Apply any pin setback */ + if (pinonly >= 0) + { + Rect psetback; + GEO_EXPAND(&boundary, -pinonly, &psetback); + SelRemoveArea(&psetback, &DBAllButSpaceAndDRCBits); + + /* Paint over the label area so that labels do not simply */ + /* disappear by being inside the setback area. */ + + pNum = DBPlane(lab->lab_type); + DBPaintPlane(SelectDef->cd_planes[pNum], &labr, + DBStdPaintTbl(lab->lab_type, pNum), (PaintUndoInfo *) NULL); + } + } + // Search for gate and diff types and accumulate antenna // areas. For gates, check for all gate types tied to // devices with MOSFET types (including "msubcircuit", etc.). @@ -1982,7 +2013,7 @@ LefWriteAll(rootUse, writeTopCell, lefTech, lefHide, lefPinOnly, lefTopLayer, bool writeTopCell; bool lefTech; int lefHide; - bool lefPinOnly; + int lefPinOnly; bool lefTopLayer; bool lefDoMaster; bool recurse; @@ -2125,7 +2156,7 @@ LefWriteCell(def, outName, isRoot, lefTech, lefHide, lefPinOnly, lefTopLayer, bool isRoot; /* Is this the root cell? */ bool lefTech; /* Output layer information if TRUE */ int lefHide; /* Hide detail other than pins if >= 0 */ - bool lefPinOnly; /* Only generate pins on label areas */ + int lefPinOnly; /* Only generate pins on label areas */ bool lefTopLayer; /* Use only topmost layer of pin if TRUE */ bool lefDoMaster; /* Write masterslice layers if TRUE */ {