From df77f7853c043cb1b1710148cecc537b147a2545 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Mon, 29 Jul 2019 09:51:48 -0400 Subject: [PATCH] Corrected the handling of UNPLACED components in a DEF file, which was previously (and erroneously) lumped with PLACED and FIXED which take a position argument afterward. Note that this fix allows the DEF file to be read without error but does not have the (presumably desired) behavior of parsing SITE information from the LEF file and ROWS information from the DEF file and giving each unplaced component an arbitrary but legal position. That would require a significant amount of additional coding work. --- lef/defRead.c | 50 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/lef/defRead.c b/lef/defRead.c index d4a1377f..a9026263 100644 --- a/lef/defRead.c +++ b/lef/defRead.c @@ -775,11 +775,12 @@ enum def_orient {DEF_NORTH, DEF_SOUTH, DEF_EAST, DEF_WEST, DEF_FLIPPED_WEST}; int -DefReadLocation(use, f, oscale, tptr) +DefReadLocation(use, f, oscale, tptr, noplace) CellUse *use; FILE *f; float oscale; Transform *tptr; + bool noplace; { Rect *r, tr, rect; int keyword; @@ -791,21 +792,32 @@ DefReadLocation(use, f, oscale, tptr) "N", "S", "E", "W", "FN", "FS", "FE", "FW" }; - token = LefNextToken(f, TRUE); - if (*token != '(') goto parse_error; - token = LefNextToken(f, TRUE); - if (sscanf(token, "%f", &x) != 1) goto parse_error; - token = LefNextToken(f, TRUE); - if (sscanf(token, "%f", &y) != 1) goto parse_error; - token = LefNextToken(f, TRUE); - if (*token != ')') goto parse_error; - token = LefNextToken(f, TRUE); - - keyword = Lookup(token, orientations); - if (keyword < 0) + if (noplace) { - LefError(DEF_ERROR, "Unknown macro orientation \"%s\".\n", token); - return -1; + LefError(DEF_WARNING, "Unplaced component \"%s\" will be put at origin.\n", + use->cu_id); + x = 0; + y = 0; + keyword = DEF_NORTH; + } + else + { + token = LefNextToken(f, TRUE); + if (*token != '(') goto parse_error; + token = LefNextToken(f, TRUE); + if (sscanf(token, "%f", &x) != 1) goto parse_error; + token = LefNextToken(f, TRUE); + if (sscanf(token, "%f", &y) != 1) goto parse_error; + token = LefNextToken(f, TRUE); + if (*token != ')') goto parse_error; + token = LefNextToken(f, TRUE); + + keyword = Lookup(token, orientations); + if (keyword < 0) + { + LefError(DEF_ERROR, "Unknown macro orientation \"%s\".\n", token); + return -1; + } } /* The standard transformations are all defined to rotate */ @@ -1062,7 +1074,7 @@ DefReadPins(f, rootDef, sname, oscale, total) break; case DEF_PINS_PROP_FIXED: case DEF_PINS_PROP_PLACED: - DefReadLocation(NULL, f, oscale, &t); + DefReadLocation(NULL, f, oscale, &t, FALSE); if (curlayer == -1) pending = TRUE; else @@ -1522,10 +1534,12 @@ DefReadComponents(f, rootDef, sname, oscale, total) switch (subkey) { case DEF_PROP_PLACED: - case DEF_PROP_UNPLACED: case DEF_PROP_FIXED: case DEF_PROP_COVER: - DefReadLocation(defUse, f, oscale, &t); + DefReadLocation(defUse, f, oscale, &t, FALSE); + break; + case DEF_PROP_UNPLACED: + DefReadLocation(defUse, f, oscale, &t, TRUE); break; case DEF_PROP_SOURCE: case DEF_PROP_WEIGHT: