From 6eac98907f9152eeac488a1340b56ea53a3f6351 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 21 Nov 2020 01:00:28 +0100 Subject: [PATCH] WIP: bugfix. --- .../lefdef/db_plugin/dbLEFDEFImporter.cc | 32 +++++++++++-------- .../lefdef/unit_tests/dbLEFDEFImportTests.cc | 12 +++++++ 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc index 647dd099a..e0f573282 100644 --- a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc +++ b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc @@ -954,16 +954,6 @@ 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 ()) { - if (i->second == All) { - for (std::map::const_iterator p = purpose_translation.begin (); p != purpose_translation.end (); ++p) { - if (p->second != All) { - translated_purposes.insert (std::make_pair (p->second, mask)); - } - } - } else { - translated_purposes.insert (std::make_pair (i->second, mask)); - } - if (i->second == Routing) { if (ex.test (":VOLTAGE:")) { @@ -982,14 +972,28 @@ LEFDEFReaderState::read_map_file (const std::string &path, db::Layout &layout) } - if (ex.test (":MASK:")) { - if (ex.test ("MASK") && ex.test (":")) { - ex.read (mask); + } + + if (ex.test (":MASK:")) { + ex.read (mask); + } + + if (i == purpose_translation.end ()) { + + tl::warn << tl::sprintf (tl::to_string (tr ("Reading layer map file %s, line %d: purpose %s ignored for layer %s")), path, ts.line_number (), ps, w1); + + } else if (i->second == All) { + + for (std::map::const_iterator p = purpose_translation.begin (); p != purpose_translation.end (); ++p) { + if (p->second != All) { + translated_purposes.insert (std::make_pair (p->second, mask)); } } } else { - tl::warn << tl::sprintf (tl::to_string (tr ("Reading layer map file %s, line %d: purpose %s ignored for layer %s")), path, ts.line_number (), ps, w1); + + translated_purposes.insert (std::make_pair (i->second, mask)); + } } diff --git a/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImportTests.cc b/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImportTests.cc index 93921cac8..72332bedf 100644 --- a/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImportTests.cc +++ b/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImportTests.cc @@ -549,6 +549,18 @@ TEST(115_componentmaskshift) run_test (_this, "masks-2", "lef:in_tech.lef+lef:in.lef+def:in.def", "au.oas.gz", options, false); } +TEST(116_name_to_ld_target_mapping) +{ + db::LEFDEFReaderOptions options = default_options (); + db::LayerMap lm = db::LayerMap::from_string_file_format ("metal1: 1\nvia1: 2\nmetal2: 3\nOUTLINE: 42/17"); + options.set_layer_map (lm); + + db::LayerMap lm_read = run_test (_this, "via_properties", "lef:in.lef+def:in.def", "au.oas.gz", options, false); + EXPECT_EQ (lm_read.to_string (), + "layer_map('OUTLINE : OUTLINE (4/0)';'metal1.VIA : metal1 (1/0)';'metal2.VIA : metal2 (3/0)';'via1.VIA : via1 (2/0)')" + ) +} + TEST(200_lefdef_plugin) { db::Layout ly;