From 8b159a07cd8fd8f5d0f0f9b42b86c2f3b5211502 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Tue, 26 May 2020 17:58:05 -0400 Subject: [PATCH] Corrected LEF annotation so that it does not try to change or any port indexes, or create duplicated port indexes. --- lef/lefRead.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/lef/lefRead.c b/lef/lefRead.c index 36adb32e..1ba0d2db 100644 --- a/lef/lefRead.c +++ b/lef/lefRead.c @@ -1284,7 +1284,7 @@ LefReadPort(lefMacro, f, pinName, pinNum, pinDir, pinUse, oscale, lanno) while (rectList != NULL) { - if (pinNum >= 0) + if ((pinNum >= 0) || (lanno != NULL)) { /* Label this area */ if (lanno != NULL) @@ -1292,6 +1292,30 @@ LefReadPort(lefMacro, f, pinName, pinNum, pinDir, pinUse, oscale, lanno) /* Modify an existing label */ lanno->lab_rect = rectList->r_r; lanno->lab_type = rectList->r_type; + + /* Pin number is not meaninful in LEF files, so keep */ + /* any existing pin number. If original label was not */ + /* a port, then find a non-conflicting port number for */ + /* it. */ + + if (lanno->lab_flags & PORT_DIR_MASK) + pinNum = lanno->lab_flags & PORT_NUM_MASK; + else + { + Label *sl; + int idx; + + pinNum = -1; + for (sl = lefMacro->cd_labels; sl != NULL; sl = sl->lab_next) + { + if (sl->lab_flags & PORT_DIR_MASK) + { + idx = sl->lab_flags & PORT_NUM_MASK; + if (idx > pinNum) pinNum = idx; + } + } + pinNum++; + } } else /* Create a new label (non-rendered) */