mirror of https://github.com/KLayout/klayout.git
Introduces a 'greedy hierarchy' mode for DeepShapeStore for special applications (e.g. strmxor)
This commit is contained in:
parent
3980476455
commit
37cf773a70
|
|
@ -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 ());
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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<DeepShapeStoreState> m_state_stack;
|
||||
bool m_keep_layouts;
|
||||
bool m_wants_all_cells;
|
||||
tl::Mutex m_lock;
|
||||
|
||||
struct DeliveryMappingCacheKey
|
||||
|
|
|
|||
|
|
@ -152,13 +152,13 @@ static std::pair<bool, std::set<db::Box> > 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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<std::pair<bool, std::vector<db::Cell *> > > m_cell_stack;
|
||||
db::Cell *mp_initial_cell;
|
||||
|
||||
|
|
|
|||
|
|
@ -111,6 +111,21 @@ Class<db::DeepShapeStore> 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"
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue