diff --git a/src/db/db/dbCommonReader.cc b/src/db/db/dbCommonReader.cc index f52e5cdf2..a2a7b597e 100644 --- a/src/db/db/dbCommonReader.cc +++ b/src/db/db/dbCommonReader.cc @@ -54,6 +54,7 @@ CommonReader::make_cell (db::Layout &layout, const std::string &cn) common_reader_error (tl::sprintf (tl::to_string (tr ("A cell with name %s already exists")), cn)); } + m_temp_cells.erase (cell.cell_index ()); cell.set_ghost_cell (false); return cell.cell_index (); @@ -98,6 +99,7 @@ CommonReader::make_cell (db::Layout &layout, size_t id) common_reader_error (tl::sprintf (tl::to_string (tr ("A cell with ID %ld already exists")), id)); } + m_temp_cells.erase (cell.cell_index ()); cell.set_ghost_cell (false); return cell.cell_index (); @@ -180,6 +182,7 @@ CommonReader::rename_cell (db::Layout &layout, size_t id, const std::string &cn) db::cell_index_type ci = layout.add_anonymous_cell (); layout.cell (ci).set_ghost_cell (true); + m_temp_cells.insert (ci); m_id_map [id] = std::make_pair (cn, ci); m_name_map [cn] = std::make_pair (id, ci); @@ -195,6 +198,7 @@ CommonReader::cell_for_instance (db::Layout &layout, size_t id) std::map >::iterator iid = m_id_map.find (id); if (iid != m_id_map.end ()) { + m_temp_cells.erase (iid->second.second); return iid->second.second; } else { @@ -216,6 +220,7 @@ CommonReader::cell_for_instance (db::Layout &layout, const std::string &cn) std::map >::iterator iname = m_name_map.find (cn); if (iname != m_name_map.end ()) { + m_temp_cells.erase (iname->second.second); return iname->second.second; } else { @@ -423,6 +428,12 @@ CommonReader::finish (db::Layout &layout) } + // remove temporary cells (some that were "declared" by "rename_cell" but not used by cell_for_instance) + + for (std::set::const_iterator ci = m_temp_cells.begin (); ci != m_temp_cells.end (); ++ci) { + layout.delete_cell (*ci); + } + // resolve layer multi-mapping for (std::map, unsigned int>::const_iterator i = m_multi_mapping_placeholders.begin (); i != m_multi_mapping_placeholders.end (); ++i) { diff --git a/src/db/db/dbCommonReader.h b/src/db/db/dbCommonReader.h index 81d361672..0fe3c8081 100644 --- a/src/db/db/dbCommonReader.h +++ b/src/db/db/dbCommonReader.h @@ -251,6 +251,7 @@ protected: private: std::map > m_id_map; std::map > m_name_map; + std::set m_temp_cells; std::map m_name_for_id; CellConflictResolution m_cc_resolution; bool m_create_layers; diff --git a/src/plugins/streamers/oasis/unit_tests/dbOASISReader.cc b/src/plugins/streamers/oasis/unit_tests/dbOASISReaderTests.cc similarity index 99% rename from src/plugins/streamers/oasis/unit_tests/dbOASISReader.cc rename to src/plugins/streamers/oasis/unit_tests/dbOASISReaderTests.cc index 8534e0ab4..836c901f1 100644 --- a/src/plugins/streamers/oasis/unit_tests/dbOASISReader.cc +++ b/src/plugins/streamers/oasis/unit_tests/dbOASISReaderTests.cc @@ -264,6 +264,11 @@ TEST(2_6) run_test (_this, "2.6"); } +TEST(2_7) +{ + run_test (_this, "2.7"); +} + TEST(3_1) { run_test (_this, "3.1"); diff --git a/src/plugins/streamers/oasis/unit_tests/unit_tests.pro b/src/plugins/streamers/oasis/unit_tests/unit_tests.pro index 2532285f9..d5aab7467 100644 --- a/src/plugins/streamers/oasis/unit_tests/unit_tests.pro +++ b/src/plugins/streamers/oasis/unit_tests/unit_tests.pro @@ -6,7 +6,7 @@ TARGET = oasis_tests include($$PWD/../../../../lib_ut.pri) SOURCES = \ - dbOASISReader.cc \ + dbOASISReaderTests.cc \ dbOASISWriter2.cc \ dbOASISWriter.cc \ diff --git a/testdata/oasis/mkall.sh b/testdata/oasis/mkall.sh index 633e4f313..b56d4e137 100755 --- a/testdata/oasis/mkall.sh +++ b/testdata/oasis/mkall.sh @@ -6,6 +6,6 @@ export LANG for t in *.ot; do out=`echo $t | sed 's/.ot$/.oas/'` echo "$t -> $out" - ./mkoasis.tcl $t $out + tclsh ./mkoasis.tcl $t $out done diff --git a/testdata/oasis/t2.3.ot b/testdata/oasis/t2.3.ot index 3ef18cfa8..8b08f014d 100644 --- a/testdata/oasis/t2.3.ot +++ b/testdata/oasis/t2.3.ot @@ -14,12 +14,12 @@ header uint 0 ;# offset table is in start record for { set i 0 } { $i < 12 } { incr i } { uint 0 } -# XYZ gets assigned 1 +# ABC gets assigned 1 record CELLNAME_ID str ABC uint 1 -# ABC gets assigned 0 implicitly +# XYZ gets assigned 0 implicitly record CELLNAME str XYZ ;# FAIL: implicit and explicit assignment may not be mixed diff --git a/testdata/oasis/t2.4.ot b/testdata/oasis/t2.4.ot index d1def8758..a8848fea0 100644 --- a/testdata/oasis/t2.4.ot +++ b/testdata/oasis/t2.4.ot @@ -20,12 +20,12 @@ header uint 0 ;# offset table is in start record for { set i 0 } { $i < 12 } { incr i } { uint 0 } -# XYZ gets assigned 1 +# ABC gets assigned 1 record CELLNAME_ID str ABC uint 1 -# ABC gets assigned 0 +# XYZ gets assigned 0 record CELLNAME_ID str XYZ uint 0 diff --git a/testdata/oasis/t2.5.ot b/testdata/oasis/t2.5.ot index 055f73530..e9b789051 100644 --- a/testdata/oasis/t2.5.ot +++ b/testdata/oasis/t2.5.ot @@ -14,12 +14,12 @@ header uint 0 ;# offset table is in start record for { set i 0 } { $i < 12 } { incr i } { uint 0 } -# XYZ gets assigned 1 +# ABC gets assigned 1 record CELLNAME_ID str ABC uint 1 -# ABC gets assigned 0 +# XYZ gets assigned 0 record CELLNAME_ID str XYZ uint 0 diff --git a/testdata/oasis/t2.7.oas b/testdata/oasis/t2.7.oas new file mode 100644 index 000000000..9d33c53d9 Binary files /dev/null and b/testdata/oasis/t2.7.oas differ diff --git a/testdata/oasis/t2.7.ot b/testdata/oasis/t2.7.ot new file mode 100644 index 000000000..3f9326c79 --- /dev/null +++ b/testdata/oasis/t2.7.ot @@ -0,0 +1,35 @@ +# +# t2.7.ot +# Two cells, one just declared but not present +# Unused CELLNAME must not generate an empty cell +# +# begin_lib 0.001 +# begin_cell {XYZ} +# end_cell +# end_lib +# +# + +header + real 0 1000.0 + uint 0 ;# offset table is in start record + for { set i 0 } { $i < 12 } { incr i } { uint 0 } + +# ABC gets assigned 1 +record CELLNAME_ID + str ABC + uint 1 + +# XYZ gets assigned 0 +record CELLNAME_ID + str XYZ + uint 0 + +# Cell XYZ (empty) +record CELL_ID + uint 0 + +# no body. + +tail + diff --git a/testdata/oasis/t2.7_au.txt b/testdata/oasis/t2.7_au.txt new file mode 100644 index 000000000..d6c3a7de4 --- /dev/null +++ b/testdata/oasis/t2.7_au.txt @@ -0,0 +1,4 @@ +begin_lib 0.001 +begin_cell {XYZ} +end_cell +end_lib