diff --git a/src/buddies/src/bd/strmxor.cc b/src/buddies/src/bd/strmxor.cc index ccac991fd..a6d8487e6 100644 --- a/src/buddies/src/bd/strmxor.cc +++ b/src/buddies/src/bd/strmxor.cc @@ -754,6 +754,7 @@ bool run_deep_xor (const XORData &xor_data) { db::DeepShapeStore dss; dss.set_threads (xor_data.threads); + dss.set_wants_all_cells (true); // saves time for less cell mapping operations double dbu = std::min (xor_data.layout_a->dbu (), xor_data.layout_b->dbu ()); diff --git a/src/db/db/dbDeepShapeStore.cc b/src/db/db/dbDeepShapeStore.cc index bc9dc11d2..7fb293523 100644 --- a/src/db/db/dbDeepShapeStore.cc +++ b/src/db/db/dbDeepShapeStore.cc @@ -487,13 +487,13 @@ static unsigned int init_layer (db::Layout &layout, const db::RecursiveShapeIter } DeepShapeStore::DeepShapeStore () - : m_keep_layouts (true) + : m_keep_layouts (true), m_wants_all_cells (false) { ++s_instance_count; } DeepShapeStore::DeepShapeStore (const std::string &topcell_name, double dbu) - : m_keep_layouts (true) + : m_keep_layouts (true), m_wants_all_cells (false) { ++s_instance_count; @@ -765,6 +765,16 @@ double DeepShapeStore::max_area_ratio () const return m_state.max_area_ratio (); } +void DeepShapeStore::set_wants_all_cells (bool f) +{ + m_wants_all_cells = f; +} + +bool DeepShapeStore::wants_all_cells () const +{ + return m_wants_all_cells; +} + void DeepShapeStore::set_reject_odd_polygons (bool f) { m_state.set_reject_odd_polygons (f); @@ -929,6 +939,8 @@ DeepLayer DeepShapeStore::create_polygon_layer (const db::RecursiveShapeIterator db::Layout &layout = m_layouts[layout_index]->layout; db::HierarchyBuilder &builder = m_layouts[layout_index]->builder; + builder.set_wants_all_cells (m_wants_all_cells); + unsigned int layer_index = init_layer (layout, si); builder.set_target_layer (layer_index); diff --git a/src/db/db/dbDeepShapeStore.h b/src/db/db/dbDeepShapeStore.h index 1f12063b5..98c53c8fa 100644 --- a/src/db/db/dbDeepShapeStore.h +++ b/src/db/db/dbDeepShapeStore.h @@ -727,6 +727,23 @@ public: */ int threads () const; + /** + * @brief Sets a flag indicating whether the working layouts will store the whole original hierarchy + * + * Setting this flag to true will make the deep shape store copy the + * hierarchy exactly from the origin layouts. This will take somewhat + * more memory but avoid future cell hierarchy mapping operations. + * + * If set to false, only the needed parts of the hierarchy are copied. + * This part may need to grow when further operations are triggered. + */ + void set_wants_all_cells (bool f); + + /** + * @brief Gets a flag indicating whether the working layouts will store the whole original hierarchy + */ + bool wants_all_cells () const; + /** * @brief Sets a flag indicating whether to reject odd polygons * @@ -878,6 +895,7 @@ private: DeepShapeStoreState m_state; std::list m_state_stack; bool m_keep_layouts; + bool m_wants_all_cells; tl::Mutex m_lock; struct DeliveryMappingCacheKey diff --git a/src/db/db/dbHierarchyBuilder.cc b/src/db/db/dbHierarchyBuilder.cc index c8a77cbb6..d8698a83e 100644 --- a/src/db/db/dbHierarchyBuilder.cc +++ b/src/db/db/dbHierarchyBuilder.cc @@ -152,13 +152,13 @@ static std::pair > compute_clip_variant (const db::Box & } HierarchyBuilder::HierarchyBuilder (db::Layout *target, unsigned int target_layer, const db::ICplxTrans &trans, HierarchyBuilderShapeReceiver *pipe) - : mp_target (target), m_initial_pass (true), m_cm_new_entry (false), m_target_layer (target_layer), m_trans (trans) + : mp_target (target), m_initial_pass (true), m_cm_new_entry (false), m_target_layer (target_layer), m_wants_all_cells (false), m_trans (trans) { set_shape_receiver (pipe); } HierarchyBuilder::HierarchyBuilder (db::Layout *target, const db::ICplxTrans &trans, HierarchyBuilderShapeReceiver *pipe) - : mp_target (target), m_initial_pass (true), m_cm_new_entry (false), m_target_layer (0), m_trans (trans) + : mp_target (target), m_initial_pass (true), m_cm_new_entry (false), m_target_layer (0), m_wants_all_cells (false), m_trans (trans) { set_shape_receiver (pipe); } diff --git a/src/db/db/dbHierarchyBuilder.h b/src/db/db/dbHierarchyBuilder.h index 3847e57a6..b3f2104ef 100644 --- a/src/db/db/dbHierarchyBuilder.h +++ b/src/db/db/dbHierarchyBuilder.h @@ -295,7 +295,7 @@ public: */ void set_shape_receiver (HierarchyBuilderShapeReceiver *pipe); - virtual bool wants_all_cells () const { return true; } + virtual bool wants_all_cells () const { return m_wants_all_cells; } virtual void begin (const RecursiveShapeIterator *iter); virtual void end (const RecursiveShapeIterator *iter); virtual void enter_cell (const RecursiveShapeIterator *iter, const db::Cell *cell, const db::Box ®ion, const box_tree_type *complex_region); @@ -312,6 +312,14 @@ public: m_target_layer = target_layer; } + /** + * @brief Sets the target layer - shapes will be put there + */ + void set_wants_all_cells (bool f) + { + m_wants_all_cells = f; + } + /** * @brief Reset the builder - performs a new initial pass */ @@ -417,6 +425,7 @@ private: cell_map_type::const_iterator m_cm_entry; bool m_cm_new_entry; unsigned int m_target_layer; + bool m_wants_all_cells; std::vector > > m_cell_stack; db::Cell *mp_initial_cell; diff --git a/src/db/db/gsiDeclDbDeepShapeStore.cc b/src/db/db/gsiDeclDbDeepShapeStore.cc index ad395cda3..ca4197def 100644 --- a/src/db/db/gsiDeclDbDeepShapeStore.cc +++ b/src/db/db/gsiDeclDbDeepShapeStore.cc @@ -111,6 +111,21 @@ Class decl_dbDeepShapeStore ("db", "DeepShapeStore", gsi::method ("threads", &db::DeepShapeStore::threads, "@brief Gets the number of threads.\n" ) + + gsi::method ("wants_all_cells=", &db::DeepShapeStore::set_wants_all_cells, gsi::arg ("flag"), + "@brief Sets a flag wether to copy the full hierarchy for the working layouts\n" + "\n" + "The DeepShapeStore object keeps a copy of the original hierarchy internally for the working layouts.\n" + "By default, this hierarchy is mapping only non-empty cells. While the operations proceed, more cells " + "may need to be added. This conservative approach saves some memory, but the update operations may " + "reduce overall performance. Setting this flag to 'true' switches to a mode where the full " + "hierarchy is copied always. This will take more memory but may save CPU time.\n" + "\n" + "This attribute has been introduced in version 0.28.10." + ) + + gsi::method ("wants_all_cells", &db::DeepShapeStore::wants_all_cells, + "@brief Gets a flag wether to copy the full hierarchy for the working layouts\n" + "This attribute has been introduced in version 0.28.10." + ) + gsi::method ("reject_odd_polygons=", &db::DeepShapeStore::set_reject_odd_polygons, gsi::arg ("count"), "@brief Sets a flag indicating whether to reject odd polygons\n" "\n" diff --git a/src/lvs/unit_tests/lvsTests.cc b/src/lvs/unit_tests/lvsTests.cc index 5836b7578..18c0810bf 100644 --- a/src/lvs/unit_tests/lvsTests.cc +++ b/src/lvs/unit_tests/lvsTests.cc @@ -142,7 +142,7 @@ TEST(16_private) TEST(17_private) { test_is_long_runner (); - run_test (_this, "test_17.lylvs", "test_17b.cir.gz", "test_17.gds.gz", true, "test_17b_5.lvsdb"); + run_test (_this, "test_17.lylvs", "test_17b.cir.gz", "test_17.gds.gz", true, "test_17b_4.lvsdb"); } TEST(18_private)