From 35249ef0b551975401ec8a2b5db633ac0a6da405 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Wed, 19 Aug 2020 23:47:25 +0200 Subject: [PATCH] Reading LEF/DEF map files such that MASK is applied to previous entries too. --- .../lefdef/db_plugin/dbLEFDEFImporter.cc | 51 +++++++++--------- .../lefdef/db_plugin/dbLEFDEFImporter.h | 2 +- .../lefdef/db_plugin/dbLEFDEFPlugin.cc | 2 +- .../lefdef/unit_tests/dbLEFDEFImportTests.cc | 6 +-- testdata/lefdef/mapfile/au.oas.gz | Bin 1091 -> 1059 bytes 5 files changed, 32 insertions(+), 29 deletions(-) diff --git a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc index 63d4b2685..6ac750f72 100644 --- a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc +++ b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc @@ -729,6 +729,11 @@ LEFDEFReaderState::read_map_file (const std::string &path, db::Layout &layout) purpose_translation ["VIA"] = ViaGeometry; purpose_translation ["BLOCKAGE"] = Blockage; + std::map purpose_translation_rev; + for (std::map::const_iterator i = purpose_translation.begin (); i != purpose_translation.end (); ++i) { + purpose_translation_rev.insert (std::make_pair (i->second, i->first)); + } + std::map >, db::LayerProperties> layer_map; while (! ts.at_end ()) { @@ -745,7 +750,6 @@ LEFDEFReaderState::read_map_file (const std::string &path, db::Layout &layout) std::string w1, w2; int layer = 0, datatype = 0; size_t max_purpose_str = 10; - bool purpose_abbreviated = false; if (ex.try_read_word (w1) && ex.try_read_word (w2, "._$,/:") && ex.try_read (layer) && ex.try_read (datatype)) { @@ -790,9 +794,12 @@ LEFDEFReaderState::read_map_file (const std::string &path, db::Layout &layout) // (separating, translating and recombing the purposes) std::set > translated_purposes; - std::string purpose_str; std::vector purposes = tl::split (w2, ","); + std::reverse (purposes.begin (), purposes.end ()); + + unsigned int mask = 0; + for (std::vector::const_iterator p = purposes.begin (); p != purposes.end (); ++p) { std::string p_uc = tl::to_upper_case (*p); @@ -801,8 +808,6 @@ LEFDEFReaderState::read_map_file (const std::string &path, db::Layout &layout) std::string ps; ex.read_word_or_quoted (ps); - unsigned int mask = 0; - if (ex.test (":")) { if (ex.test ("MASK") && ex.test (":")) { ex.read (mask); @@ -811,33 +816,31 @@ LEFDEFReaderState::read_map_file (const std::string &path, db::Layout &layout) std::map::const_iterator i = purpose_translation.find (ps); if (i != purpose_translation.end ()) { - translated_purposes.insert (std::make_pair (i->second, mask)); + } - if (! purpose_abbreviated) { + } - if (! purpose_str.empty ()) { - purpose_str += "/"; - } + // create a visual description string for the combined purposes + std::string purpose_str; - if (purpose_str.size () > max_purpose_str) { + for (std::set >::const_iterator p = translated_purposes.begin (); p != translated_purposes.end (); ++p) { - purpose_abbreviated = true; - purpose_str += "..."; + if (p != translated_purposes.begin ()) { + purpose_str += "/"; + } - } else { - - purpose_str += i->first; - - if (mask > 0) { - purpose_str += ":"; - purpose_str += tl::to_string (mask); - } - - } - - } + std::string ps = purpose_translation_rev [p->first]; + if (p->second > 0) { + ps += ":"; + ps += tl::to_string (p->second); + } + if ((purpose_str + ps).size () > max_purpose_str) { + purpose_str += "..."; + break; + } else { + purpose_str += ps; } } diff --git a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.h b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.h index 4009a7ad6..ca1007e6c 100644 --- a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.h +++ b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.h @@ -851,9 +851,9 @@ enum LayerPurpose Routing = 0, // from DEF only SpecialRouting, // from DEF only ViaGeometry, // from LEF+DEF - Label, // from LEF+DEF Pins, // from DEF LEFPins, // from LEF + Label, // from LEF+DEF Obstructions, // from LEF only Outline, // from LEF+DEF Blockage, // from DEF only diff --git a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFPlugin.cc b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFPlugin.cc index 6ac19b03f..13801edd5 100644 --- a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFPlugin.cc +++ b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFPlugin.cc @@ -164,7 +164,7 @@ private: if (tl::file_exists (input_dir)) { - std::vector entries = tl::dir_entries (input_dir); + std::vector entries = tl::dir_entries (input_dir, true, false, true); for (std::vector::const_iterator e = entries.begin (); e != entries.end (); ++e) { if (is_lef_format (*e)) { diff --git a/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImportTests.cc b/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImportTests.cc index b4c8a1f8e..f32115248 100644 --- a/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImportTests.cc +++ b/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImportTests.cc @@ -492,30 +492,30 @@ TEST(113_masks_1) "'M0PO.SPNET:2' : 'M0PO.SPNET:2' (1/201)\n" "'M0PO.VIA:1' : 'M0PO.VIA:1' (1/102)\n" "'M0PO.VIA:2' : 'M0PO.VIA:2' (1/202)\n" - "M0PO.LABEL : M0PO.LABEL (1/1)\n" "M0PO.PIN : M0PO.PIN (1/2)\n" "'M0PO.PIN:1' : 'M0PO.PIN:1' (1/110)\n" "'M0PO.PIN:2' : 'M0PO.PIN:2' (1/210)\n" + "M0PO.LABEL : M0PO.LABEL (1/1)\n" "'M1.NET:1' : 'M1.NET:1' (3/100)\n" "'M1.NET:2' : 'M1.NET:2' (3/200)\n" "'M1.SPNET:1' : 'M1.SPNET:1' (3/101)\n" "'M1.SPNET:2' : 'M1.SPNET:2' (3/201)\n" "'M1.VIA:1' : 'M1.VIA:1' (3/102)\n" "'M1.VIA:2' : 'M1.VIA:2' (3/202)\n" - "M1.LABEL : M1.LABEL (3/1)\n" "M1.PIN : M1.PIN (3/2)\n" "'M1.PIN:1' : 'M1.PIN:1' (3/110)\n" "'M1.PIN:2' : 'M1.PIN:2' (3/210)\n" + "M1.LABEL : M1.LABEL (3/1)\n" "'VIA0.NET:1' : 'VIA0.NET:1' (2/100)\n" "'VIA0.NET:2' : 'VIA0.NET:2' (2/200)\n" "'VIA0.SPNET:1' : 'VIA0.SPNET:1' (2/101)\n" "'VIA0.SPNET:2' : 'VIA0.SPNET:2' (2/201)\n" "'VIA0.VIA:1' : 'VIA0.VIA:1' (2/102)\n" "'VIA0.VIA:2' : 'VIA0.VIA:2' (2/202)\n" - "VIA0.LABEL : VIA0.LABEL (2/1)\n" "VIA0.PIN : VIA0.PIN (2/2)\n" "'VIA0.PIN:1' : 'VIA0.PIN:1' (2/110)\n" "'VIA0.PIN:2' : 'VIA0.PIN:2' (2/210)\n" + "VIA0.LABEL : VIA0.LABEL (2/1)\n" ) } diff --git a/testdata/lefdef/mapfile/au.oas.gz b/testdata/lefdef/mapfile/au.oas.gz index d0ee614aea2d2210123b3fc51fdfea624971a6e1..b91e51866a40fd9ee6695667c7baf464007eada0 100644 GIT binary patch delta 255 zcmX@iv6y4R4Rs-3g8+X$Ki3fb-~bS*r>Dov#mvBiCO(;+F?4bTquJybMw!X$7@g_` ze2vg_@d0&V73CHR^K>*oQ_T&s1G_j_y&;-uU*hsg=dyi5!X0KxA#+W-In delta 286 zcmZ3?ahPMm4Sg|Rg8+X$A6K^kPd|Mi+iOeDvCm1yuCU0a)5)`gx