diff --git a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc index 55a4e7ecc..a60e37a89 100644 --- a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc +++ b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc @@ -656,38 +656,44 @@ LEFDEFImporter::create_generated_via (std::vector &bottom, top.push_back (db::Polygon (via_box.enlarged (te).moved (to))); const char *p = pattern.c_str (); - int rp = 0; + int rp = pattern.empty () ? -1 : 0; const char *p0 = p, *p1 = p; for (int r = 0; r < rows; ++r) { - if (rp == 0 && *p) { + if (rp == 0) { - // read a new row specification - rp = 0; - while (*p && is_hex_digit (*p)) { - rp = (rp * 16) + hex_value (*p++); - } - if (*p == '_') { - ++p; - } - - p0 = p; if (*p) { - while (*p && (is_hex_digit (*p) || toupper (*p) == 'R')) { + + // read a new row specification + rp = 0; + while (*p && is_hex_digit (*p)) { + rp = (rp * 16) + hex_value (*p++); + } + if (*p == '_') { ++p; } - } - p1 = p; - if (*p == '_') { - ++p; + + p0 = p; + if (*p) { + while (*p && (is_hex_digit (*p) || toupper (*p) == 'R')) { + ++p; + } + } + p1 = p; + if (*p == '_') { + ++p; + } + } } - if (rp > 0) { + if (rp != 0) { - --rp; + if (rp > 0) { + --rp; + } const char *pp = p0; unsigned int d = 0; diff --git a/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImport.cc b/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImport.cc index 79f06c647..92e3eb883 100644 --- a/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImport.cc +++ b/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImport.cc @@ -260,3 +260,8 @@ TEST(22) run_test (_this, "issue-489b", "lef:in_tech.lef+lef:in.lef", "au.oas.gz", opt, false); } +TEST(23) +{ + run_test (_this, "issue-517", "def:in.def", "au.oas.gz", default_options (), false); +} + diff --git a/testdata/lefdef/issue-517/au.oas.gz b/testdata/lefdef/issue-517/au.oas.gz new file mode 100644 index 000000000..429872948 Binary files /dev/null and b/testdata/lefdef/issue-517/au.oas.gz differ diff --git a/testdata/lefdef/issue-517/in.def b/testdata/lefdef/issue-517/in.def new file mode 100644 index 000000000..fcb5a4789 --- /dev/null +++ b/testdata/lefdef/issue-517/in.def @@ -0,0 +1,29 @@ + +VERSION 5.6 ; +NAMESCASESENSITIVE ON ; +DIVIDERCHAR "/" ; +BUSBITCHARS "<>" ; +DESIGN SMALL ; +UNITS DISTANCE MICRONS 100 ; + +DIEAREA ( -30 -30 ) ( 1030 1030 ) ; + +VIAS 1 ; +- via1_960x340 ++ VIARULE Via1Array-0 + + CUTSIZE 140 140 + + LAYERS metal1 via1 metal2 + + CUTSPACING 160 160 + + ENCLOSURE 110 100 110 100 + + ROWCOL 1 3 +; +END VIAS + +SPECIALNETS 1 ; +- VDD ( * VDD ) ++ ROUTED metal1 0 + SHAPE STRIPE ( 500 500 ) via1_960x340 ++ USE POWER ; +END SPECIALNETS + +END DESIGN +