From 2ef3290f65f98d3340ce06137bea2515d6e23a34 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 3 Nov 2020 21:18:47 +0100 Subject: [PATCH] WIP: updated some golden data (only sequence of cells), restored old error messages, proper reporting of cell names in OASIS error messages --- src/db/db/dbCommonReader.cc | 16 +++++++++++++- src/db/db/dbCommonReader.h | 6 +++++ .../oasis/db_plugin/dbOASISReader.cc | 8 ++++++- .../oasis/unit_tests/dbOASISWriter.cc | 22 +++++++++---------- testdata/oasis/t2.4.ot | 4 ++-- testdata/oasis/t2.4_au.txt | 4 ++-- testdata/oasis/t2.6_au.txt | 4 ++-- 7 files changed, 45 insertions(+), 19 deletions(-) diff --git a/src/db/db/dbCommonReader.cc b/src/db/db/dbCommonReader.cc index 8028653eb..8728f986d 100644 --- a/src/db/db/dbCommonReader.cc +++ b/src/db/db/dbCommonReader.cc @@ -128,9 +128,23 @@ CommonReader::cell_by_id (size_t id) const } } +const std::string & +CommonReader::name_for_id (size_t id) const +{ + std::map::const_iterator n = m_name_for_id.find (id); + if (n != m_name_for_id.end ()) { + return n->second; + } else { + static std::string empty; + return empty; + } +} + void CommonReader::rename_cell (db::Layout &layout, size_t id, const std::string &cn) { + m_name_for_id.insert (std::make_pair (id, cn)); + std::map >::iterator iid = m_id_map.find (id); std::map >::iterator iname = m_name_map.find (cn); @@ -256,7 +270,7 @@ CommonReader::finish (db::Layout &layout) for (std::map >::const_iterator i = m_id_map.begin (); i != m_id_map.end (); ++i) { if (i->second.first.empty ()) { - common_reader_warn (tl::sprintf (tl::to_string (tr ("Cell name missing for ID %ld")), i->first)); + common_reader_warn (tl::sprintf (tl::to_string (tr ("No cellname defined for cell name id %ld")), i->first)); any_missing = true; } } diff --git a/src/db/db/dbCommonReader.h b/src/db/db/dbCommonReader.h index 8bdf8ffb6..2bcecfaa7 100644 --- a/src/db/db/dbCommonReader.h +++ b/src/db/db/dbCommonReader.h @@ -105,6 +105,11 @@ public: */ void rename_cell (db::Layout &layout, size_t id, const std::string &cn); + /** + * @brief Gets the name for a given cell ID if known, otherwise returns an empty string + */ + const std::string &name_for_id (size_t id) const; + /** * @brief Returns a cell reference by ID * If the cell does not exist, it's created. It is marked as ghost cell until @@ -139,6 +144,7 @@ protected: private: std::map > m_id_map; std::map > m_name_map; + std::map m_name_for_id; CellConflictResolution m_cc_resolution; }; diff --git a/src/plugins/streamers/oasis/db_plugin/dbOASISReader.cc b/src/plugins/streamers/oasis/db_plugin/dbOASISReader.cc index 0dbe5e759..3bf5485a5 100644 --- a/src/plugins/streamers/oasis/db_plugin/dbOASISReader.cc +++ b/src/plugins/streamers/oasis/db_plugin/dbOASISReader.cc @@ -1153,6 +1153,11 @@ OASISReader::do_read (db::Layout &layout) cell_index = make_cell (layout, id); + m_cellname = name_for_id (id); + if (m_cellname.empty ()) { + m_cellname = std::string ("#") + tl::to_string (id); + } + } else { if (m_expect_strict_mode == 1) { @@ -1168,6 +1173,8 @@ OASISReader::do_read (db::Layout &layout) cell_index = make_cell (layout, name); + m_cellname = name; + } reset_modal_variables (); @@ -3260,7 +3267,6 @@ OASISReader::do_read_cell (db::cell_index_type cell_index, db::Layout &layout) m_instances_with_props.clear (); m_progress.set (m_stream.pos ()); - m_cellname = layout.cell_name (cell_index); bool xy_absolute = true; diff --git a/src/plugins/streamers/oasis/unit_tests/dbOASISWriter.cc b/src/plugins/streamers/oasis/unit_tests/dbOASISWriter.cc index ce4f6c479..9e7e48aef 100644 --- a/src/plugins/streamers/oasis/unit_tests/dbOASISWriter.cc +++ b/src/plugins/streamers/oasis/unit_tests/dbOASISWriter.cc @@ -570,11 +570,11 @@ TEST(100) const char *expected = "begin_lib 0.001\n" + "begin_cell {$4}\n" + "end_cell\n" "begin_cell {$1}\n" "box 1 0 {0 100} {1000 1200}\n" "end_cell\n" - "begin_cell {$4}\n" - "end_cell\n" "begin_cell {$3}\n" "sref {$1} 90 1 1 {-10 20}\n" "sref {$4} 90 1 1 {-10 20}\n" @@ -1327,14 +1327,14 @@ TEST(116) " {{name} {117}}\n" "}\n" "begin_libp $props 0.001\n" + "begin_cell {$2}\n" + "end_cell\n" "set props {\n" " {42 {42}}\n" "}\n" "begin_cellp $props {$1}\n" "path 1 0 0 0 0 {0 100} {1000 1200}\n" "end_cell\n" - "begin_cell {$2}\n" - "end_cell\n" "end_lib\n" ; @@ -1376,14 +1376,14 @@ TEST(116) " {{name} {117}}\n" "}\n" "begin_libp $props 0.001\n" + "begin_cell {$2}\n" + "end_cell\n" "set props {\n" " {42 {42}}\n" "}\n" "begin_cellp $props {$1}\n" "path 1 0 0 0 0 {0 100} {1000 1200}\n" "end_cell\n" - "begin_cell {$2}\n" - "end_cell\n" "end_lib\n" ; @@ -1431,17 +1431,17 @@ TEST(116) "}\n" "begin_libp $props 0.001\n" "set props {\n" + " {{S_BOUNDING_BOX} {2,0,0,0,0}}\n" + "}\n" + "begin_cellp $props {$2}\n" + "end_cell\n" + "set props {\n" " {{S_BOUNDING_BOX} {0,0,100,1000,1100}}\n" " {42 {42}}\n" "}\n" "begin_cellp $props {$1}\n" "path 1 0 0 0 0 {0 100} {1000 1200}\n" "end_cell\n" - "set props {\n" - " {{S_BOUNDING_BOX} {2,0,0,0,0}}\n" - "}\n" - "begin_cellp $props {$2}\n" - "end_cell\n" "end_lib\n" ; diff --git a/testdata/oasis/t2.4.ot b/testdata/oasis/t2.4.ot index 8a625c7cf..d1def8758 100644 --- a/testdata/oasis/t2.4.ot +++ b/testdata/oasis/t2.4.ot @@ -7,10 +7,10 @@ # Explicit assignment of ID's # # begin_lib 0.001 -# begin_cell {ABC} -# end_cell # begin_cell {XYZ} # end_cell +# begin_cell {ABC} +# end_cell # end_lib # # diff --git a/testdata/oasis/t2.4_au.txt b/testdata/oasis/t2.4_au.txt index ede7f7760..aee39fbb5 100644 --- a/testdata/oasis/t2.4_au.txt +++ b/testdata/oasis/t2.4_au.txt @@ -1,6 +1,6 @@ begin_lib 0.001 -begin_cell {ABC} -end_cell begin_cell {XYZ} end_cell +begin_cell {ABC} +end_cell end_lib diff --git a/testdata/oasis/t2.6_au.txt b/testdata/oasis/t2.6_au.txt index 3c0ebf770..ec8221a98 100644 --- a/testdata/oasis/t2.6_au.txt +++ b/testdata/oasis/t2.6_au.txt @@ -1,6 +1,6 @@ begin_lib 0.001 -begin_cell {ABC} -end_cell begin_cell { XYZ} end_cell +begin_cell {ABC} +end_cell end_lib