From 740f5509647f33deaa43cdd1b780e898fe5035e4 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 13 Dec 2020 19:54:23 +0100 Subject: [PATCH] WIP: handling the case of entirely lost libraries. --- src/db/db/dbLayout.cc | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/db/db/dbLayout.cc b/src/db/db/dbLayout.cc index a9c94c2ad..d627ac812 100644 --- a/src/db/db/dbLayout.cc +++ b/src/db/db/dbLayout.cc @@ -519,6 +519,7 @@ Layout::set_technology_name (const std::string &tech) // determine which library to map to what std::map mapping; std::set seen; + std::set lost; for (db::Layout::iterator c = begin (); c != end (); ++c) { @@ -535,25 +536,32 @@ Layout::set_technology_name (const std::string &tech) if (new_id.first && new_id.second != l->get_id ()) { mapping.insert (std::make_pair (l->get_id (), new_id.second)); + } else if (! new_id.first) { + lost.insert (lib_proxy->lib_id ()); } } } - if (! mapping.empty ()) { + if (! mapping.empty () || ! lost.empty ()) { bool needs_cleanup = false; std::vector > pcells_to_map; std::vector lib_cells_to_map; + std::vector lib_cells_lost; for (db::Layout::iterator c = begin (); c != end (); ++c) { std::map::const_iterator m; db::LibraryProxy *lib_proxy = dynamic_cast (&*c); - if (lib_proxy && (m = mapping.find (lib_proxy->lib_id ())) != mapping.end ()) { + if (! lib_proxy) { + continue; + } + + if ((m = mapping.find (lib_proxy->lib_id ())) != mapping.end ()) { db::Library *lib = db::LibraryManager::instance ().lib (lib_proxy->lib_id ()); db::Cell *lib_cell = &lib->layout ().cell (lib_proxy->library_cell_index ()); @@ -566,6 +574,12 @@ Layout::set_technology_name (const std::string &tech) needs_cleanup = true; + } else if (lost.find (lib_proxy->lib_id ()) != lost.end ()) { + + lib_cells_lost.push_back (lib_proxy); + + needs_cleanup = true; + } } @@ -635,6 +649,17 @@ Layout::set_technology_name (const std::string &tech) } + for (std::vector::const_iterator lp = lib_cells_lost.begin (); lp != lib_cells_lost.end (); ++lp) { + + db::cell_index_type ci = (*lp)->Cell::cell_index (); + + // substitute by a cold proxy + db::ProxyContextInfo info; + get_context_info (ci, info); + create_cold_proxy_as (info, ci); + + } + if (needs_cleanup) { cleanup (); }