From a74f11e3b24c231b9b61e2d9d03f4e8b0d3a4cb8 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Wed, 30 Mar 2022 17:17:09 -0400 Subject: [PATCH] One correction to prevent some unnecessary messages when doing a label annotation from a DEF file. --- lef/defRead.c | 52 +++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 8 deletions(-) diff --git a/lef/defRead.c b/lef/defRead.c index 83e50c43..142903c6 100644 --- a/lef/defRead.c +++ b/lef/defRead.c @@ -90,7 +90,7 @@ DefAddRoutes(rootDef, f, oscale, special, netname, ruleset, defLayerMap, annotat bool valid = FALSE; /* is there a valid reference point? */ bool initial = TRUE; bool labeled = TRUE; - Rect locarea; + Rect locarea, r; int extend, lextend, hextend; float x, y, z, w; int routeWidth, paintWidth, saveWidth; @@ -676,16 +676,52 @@ endCoord: { /* paint */ if (annotate == FALSE) + { DBPaint(rootDef, &routeTop->r_r, routeTop->r_type); - /* label */ - if (labeled == FALSE) + /* label */ + if (labeled == FALSE) + { + r.r_xbot = r.r_xtop = (routeTop->r_r.r_xbot + routeTop->r_r.r_xtop) / 2; + r.r_ybot = r.r_ytop = (routeTop->r_r.r_ybot + routeTop->r_r.r_ytop) / 2; + DBPutLabel(rootDef, &r, GEO_CENTER, netname, routeTop->r_type, 0, 0); + labeled = TRUE; + } + } + else { - Rect r; - r.r_xbot = r.r_xtop = (routeTop->r_r.r_xbot + routeTop->r_r.r_xtop) / 2; - r.r_ybot = r.r_ytop = (routeTop->r_r.r_ybot + routeTop->r_r.r_ytop) / 2; - DBPutLabel(rootDef, &r, GEO_CENTER, netname, routeTop->r_type, 0, 0); - labeled = TRUE; + /* When annotating, make sure there is a valid layer under the */ + /* label. If not, then wait for the next bit of geometry. */ + + if (labeled == FALSE) + { + Tile *tp; + Plane *plane = rootDef->cd_planes[DBPlane(routeTop->r_type)]; + tp = plane->pl_hint; + GOTOPOINT(tp, &routeTop->r_r.r_ll); + if (TiGetType(tp) == routeTop->r_type) + { + r.r_xbot = r.r_xtop = + (routeTop->r_r.r_xbot + routeTop->r_r.r_xtop) / 2; + r.r_ybot = r.r_ytop = + (routeTop->r_r.r_ybot + routeTop->r_r.r_ytop) / 2; + DBPutLabel(rootDef, &r, GEO_CENTER, netname, routeTop->r_type, + 0, 0); + labeled = TRUE; + } + if ((labeled == FALSE) && (routeTop->r_next == NULL)) + { + TxError("Warning: Label \"%s\" did not land on any existing" + " net geometry.\n", netname); + r.r_xbot = r.r_xtop = + (routeTop->r_r.r_xbot + routeTop->r_r.r_xtop) / 2; + r.r_ybot = r.r_ytop = + (routeTop->r_r.r_ybot + routeTop->r_r.r_ytop) / 2; + DBPutLabel(rootDef, &r, GEO_CENTER, netname, routeTop->r_type, + 0, 0); + labeled = TRUE; + } + } } /* advance to next point and free record (1-delayed) */