diff --git a/VERSION b/VERSION index 70e23b87..6635c799 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.2.202 +8.2.203 diff --git a/calma/CalmaRdpt.c b/calma/CalmaRdpt.c index f0edac74..40a9e118 100644 --- a/calma/CalmaRdpt.c +++ b/calma/CalmaRdpt.c @@ -979,13 +979,19 @@ calmaElementText() /* No port information can be encoded in the GDS file, so */ /* assume defaults, and assume that the port order is the */ - /* order in which labels arrive in the GDS stream. */ + /* order in which labels arrive in the GDS stream. If */ + /* ports have the same text, then give them the same index. */ i = -1; for (sl = cifReadCellDef->cd_labels; sl != NULL; sl = sl->lab_next) { idx = sl->lab_flags & PORT_NUM_MASK; if (idx > i) i = idx; + if ((sl != lab) && !strcmp(sl->lab_text, textbody)) + { + i = (sl->lab_flags & PORT_NUM_MASK) - 1; + break; + } } i++; lab->lab_flags |= (PORT_NUM_MASK & i); diff --git a/drc/DRCtech.c b/drc/DRCtech.c index 19a906dc..8cde7197 100644 --- a/drc/DRCtech.c +++ b/drc/DRCtech.c @@ -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; +} + diff --git a/lef/lefWrite.c b/lef/lefWrite.c index 4391d727..193ab5de 100644 --- a/lef/lefWrite.c +++ b/lef/lefWrite.c @@ -836,6 +836,7 @@ lefWriteMacro(def, f, scale, hide) /* List of pins (ports) (to be refined?) */ lc.lefMode = LEF_MODE_PORT; + lc.numWrites = 0; /* Determine the maximum port number, then output ports in order */ maxport = -1; @@ -1103,17 +1104,48 @@ lefWriteMacro(def, f, scale, hide) for (thislll = lll; thislll; thislll = thislll->lll_next) { - int lspace; + int lspacex, lspacey, lwidth, mspace; 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; - DBErase(lc.lefYank, &thislll->lll_area, lab->lab_type); + mspace = DRCGetDefaultWideLayerSpacing(lab->lab_type, 1E6); + if (mspace == 0) + mspace = DRCGetDefaultLayerSpacing(lab->lab_type, lab->lab_type); + /* 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); + + /* Is the label touching the boundary? If so, then use the */ + /* maximum space from the inside edge. */ + if (thislll->lll_area.r_xtop >= boundary.r_xtop) + thislll->lll_area.r_xbot -= mspace; + else + thislll->lll_area.r_xbot -= lspacex; + + if (thislll->lll_area.r_ytop >= boundary.r_ytop) + thislll->lll_area.r_ybot -= mspace; + else + thislll->lll_area.r_ybot -= lspacey; + + if (thislll->lll_area.r_xbot <= boundary.r_xbot) + thislll->lll_area.r_xtop += mspace; + else + thislll->lll_area.r_xtop += lspacex; + + if (thislll->lll_area.r_ybot <= boundary.r_ybot) + thislll->lll_area.r_ytop += mspace; + else + thislll->lll_area.r_ytop += lspacey; + + DBErase(lc.lefYank, &thislll->lll_area, lab->lab_type); freeMagic(thislll); } }