From 404799bdfd14d8ebf08c21436ec5edea78221ca9 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 2 Aug 2020 00:56:55 +0200 Subject: [PATCH] Bugfixed map file reader for mask case, added test --- .../lefdef/db_plugin/dbLEFDEFImporter.cc | 7 ++- .../lefdef/unit_tests/dbLEFDEFImportTests.cc | 37 ++++++++++++++ src/unit_tests/utTestConsole.cc | 2 +- testdata/lefdef/masks-1/au_map.oas.gz | Bin 0 -> 1648 bytes testdata/lefdef/masks-1/test.map | 46 ------------------ 5 files changed, 44 insertions(+), 48 deletions(-) create mode 100644 testdata/lefdef/masks-1/au_map.oas.gz delete mode 100644 testdata/lefdef/masks-1/test.map diff --git a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc index d2520e9bf..669ed3baa 100644 --- a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc +++ b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc @@ -783,7 +783,7 @@ LEFDEFReaderState::read_map_file (const std::string &path, db::Layout &layout) tl::Extractor ex (p_uc.c_str ()); std::string ps; - ex.read (ps); + ex.read_word_or_quoted (ps); unsigned int mask = 0; @@ -805,6 +805,11 @@ LEFDEFReaderState::read_map_file (const std::string &path, db::Layout &layout) } + if (mask > 0) { + purpose_str += ":"; + purpose_str += tl::to_string (mask); + } + } std::string final_name = w1 + "." + purpose_str; diff --git a/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImportTests.cc b/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImportTests.cc index 6d31847b8..593aa04d6 100644 --- a/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImportTests.cc +++ b/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImportTests.cc @@ -473,5 +473,42 @@ TEST(113_masks_1) "'VIA0.VIA:2' : VIA0 (2/202)\n" "'M0PO.NET:1' : M0PO (1/100)\n" ) + + options = default_options (); + lm_read = run_test (_this, "masks-1", "map:in.map+lef:in_tech.lef+def:in.def", "au_map.oas.gz", options, false); + + EXPECT_EQ (lm_read.to_string_file_format (), + "OUTLINE : OUTLINE (4/0)\n" + "'M0PO.NET:1' : 'M0PO.NET:1' (1/100)\n" + "'M0PO.NET:2' : 'M0PO.NET:2' (1/200)\n" + "'M0PO.SPNET:1' : 'M0PO.SPNET:1' (1/101)\n" + "'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" + "'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" + "'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" + ) } diff --git a/src/unit_tests/utTestConsole.cc b/src/unit_tests/utTestConsole.cc index 7726bc948..0ff24c14f 100644 --- a/src/unit_tests/utTestConsole.cc +++ b/src/unit_tests/utTestConsole.cc @@ -193,7 +193,7 @@ const char *ANSI_GREEN = "\033[32m"; const char *ANSI_RESET = "\033[0m"; TestConsole::TestConsole (FILE *file) - : m_file (file), m_col (0), m_max_col (250), m_columns (50), m_rows (0), m_file_is_tty (false) + : m_file (file), m_col (0), m_max_col (400), m_columns (50), m_rows (0), m_file_is_tty (false) { ms_instance = this; diff --git a/testdata/lefdef/masks-1/au_map.oas.gz b/testdata/lefdef/masks-1/au_map.oas.gz new file mode 100644 index 0000000000000000000000000000000000000000..45638cae1ea3ad06a4b1e9a2162a0a3a8d214671 GIT binary patch literal 1648 zcmd^9%Wl&^6rDSh)~W4~mc~J?(gh2IK%$DhjMxNXilxMf>a@Vhs)!>YLB&HzbVU(c z#5eF6d_vMy)h#~|VACan4foF2!~CL`lsC;cvIu!eZvr z@-~xn(0!OD(M}xp(kLE>JK=8nAnJ|pS1YYrOUZljzYHzUPSWvkl->>deb;(+@O=8@ zX=YtY(w$zCj&_HmaCiJ@MWAIx?Du-2u!z9;LCN)4)k_7BVOzcl5h=!ah0*gT_u(o^=$(sB*W2@>$em`eB}~v7uAgS+Sf9 zioorD-lV`LOGs;h5Y%EJDu}!N?V>>;GR!VvL#F|3?~g$da=&Uyh^bt!k=DqHtx>k> zjG$CiLjoHkQ6py=5w#_-E#tSGQOyW(C}%X%8l_=Nv`}?K(6KSOowvm4zLl||2ZGD{ zrVWa4TuBsdact`XQ}WOl-8W-QQF#{f_{BN4rp}_Vq0<1}H@SlhipU+RFHZMO8Z>sQ z5>tbm?wg77S=AfI7S*iAhE8F0-->aWeg-w(_yW^6M@NnKc(}$pUIQdfKrvGy*xETi zt^css&S7CKtj6OC{&ju6() zw$|S=fZ!u{*ksk~aNr+c!e-!IKEp-L@Axt6o0|+iE#pd>XU$*+Oa^Z?zhxWNZ9u@( bZm%