diff --git a/calma/CalmaRdpt.c b/calma/CalmaRdpt.c index 40a9e118..e87949e4 100644 --- a/calma/CalmaRdpt.c +++ b/calma/CalmaRdpt.c @@ -987,9 +987,9 @@ calmaElementText() { idx = sl->lab_flags & PORT_NUM_MASK; if (idx > i) i = idx; - if ((sl != lab) && !strcmp(sl->lab_text, textbody)) + if ((idx > 0) && (sl != lab) && !strcmp(sl->lab_text, textbody)) { - i = (sl->lab_flags & PORT_NUM_MASK) - 1; + i = idx - 1; break; } } diff --git a/lef/lefWrite.c b/lef/lefWrite.c index 5852bf10..70ab5305 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;