From e66b2e1338b5aa740c18cfdba0a95f7261352759 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Wed, 26 Apr 2023 10:24:13 -0400 Subject: [PATCH] Rearranged the "lef write" routine so that the search for antenna gate and diffusion area on each pin is done before erasing parts of the cell that are to be hidden by obstruction layers. That preserves the antenna information even when "-hide" is used. This corrects the issue raised by Kareem Farid in the github issue tracker #236. --- VERSION | 2 +- lef/lefWrite.c | 62 +++++++++++++++++++++++++------------------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/VERSION b/VERSION index d925c416..574ba35b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.394 +8.3.395 diff --git a/lef/lefWrite.c b/lef/lefWrite.c index 0968fd9b..88a45201 100644 --- a/lef/lefWrite.c +++ b/lef/lefWrite.c @@ -1440,11 +1440,42 @@ lefWriteMacro(def, f, scale, setback, pinonly, toplayer, domaster) scx.scx_area = labr; SelectClear(); + SelectNet(&scx, lab->lab_type, 0, NULL, FALSE); + + // 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.). + // For diffusion, use the types declared in the "tiedown" + // statement in the extract section of the techfile. + + antgatearea = 0; + for (pNum = PL_TECHDEPBASE; pNum < DBNumPlanes; pNum++) + { + DBSrPaintArea((Tile *)NULL, SelectDef->cd_planes[pNum], + &TiPlaneRect, &gatetypemask, + lefAccumulateArea, (ClientData) &antgatearea); + // Stop after first plane with geometry to avoid double-counting + // contacts. + if (antgatearea > 0) break; + } + + antdiffarea = 0; + for (pNum = PL_TECHDEPBASE; pNum < DBNumPlanes; pNum++) + { + DBSrPaintArea((Tile *)NULL, SelectDef->cd_planes[pNum], + &TiPlaneRect, &difftypemask, + lefAccumulateArea, (ClientData) &antdiffarea); + // Stop after first plane with geometry to avoid double-counting + // contacts. + if (antdiffarea > 0) break; + } + if (setback == 0) { Rect carea; labelLinkedList *newlll; + SelectClear(); if (pinonly == 0) carea = labr; else @@ -1484,7 +1515,6 @@ lefWriteMacro(def, f, scale, setback, pinonly, toplayer, domaster) /* For -hide with setback, select the entire net and then */ /* remove the part inside the setback area. */ - SelectNet(&scx, lab->lab_type, 0, NULL, FALSE); GEO_EXPAND(&boundary, -setback, &carea); SelRemoveArea(&carea, &DBAllButSpaceAndDRCBits, NULL); @@ -1505,8 +1535,6 @@ lefWriteMacro(def, f, scale, setback, pinonly, toplayer, domaster) } else { - SelectNet(&scx, lab->lab_type, 0, NULL, FALSE); - /* Apply any pin setback */ if (pinonly >= 0) { @@ -1523,34 +1551,6 @@ lefWriteMacro(def, f, scale, setback, pinonly, toplayer, domaster) } } - // 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.). - // For diffusion, use the types declared in the "tiedown" - // statement in the extract section of the techfile. - - antgatearea = 0; - for (pNum = PL_TECHDEPBASE; pNum < DBNumPlanes; pNum++) - { - DBSrPaintArea((Tile *)NULL, SelectDef->cd_planes[pNum], - &TiPlaneRect, &gatetypemask, - lefAccumulateArea, (ClientData) &antgatearea); - // Stop after first plane with geometry to avoid double-counting - // contacts. - if (antgatearea > 0) break; - } - - antdiffarea = 0; - for (pNum = PL_TECHDEPBASE; pNum < DBNumPlanes; pNum++) - { - DBSrPaintArea((Tile *)NULL, SelectDef->cd_planes[pNum], - &TiPlaneRect, &difftypemask, - lefAccumulateArea, (ClientData) &antdiffarea); - // Stop after first plane with geometry to avoid double-counting - // contacts. - if (antdiffarea > 0) break; - } - if (toplayer) { for (pTop = DBNumPlanes - 1; pTop >= PL_TECHDEPBASE; pTop--)