First bug fixes

* Only check for layers in the selected stack - this
  avoids problems with "masking" pin shapes for example
* Use shape transformation for shapes inside hierarchy
This commit is contained in:
Matthias Koefferlein
2025-12-02 23:00:07 +01:00
parent a957386291
commit fc4a8b92b0
6 changed files with 71 additions and 42 deletions
+22 -16
View File
@@ -87,7 +87,7 @@ Finder::closer (double d)
}
void
Finder::start (lay::LayoutViewBase *view, unsigned int cv_index, const std::vector<db::DCplxTrans> &trans, const db::DBox &region, const db::DBox &scan_region, int min_level, int max_level, const std::vector<int> &layers)
Finder::start (lay::LayoutViewBase *view, unsigned int cv_index, const std::vector<db::DCplxTrans> &trans, const db::DBox &region, const db::DBox &scan_region, int min_level, int max_level, const std::vector<unsigned int> &layers)
{
const lay::CellView &cv = view->cellview (cv_index);
@@ -100,8 +100,8 @@ Finder::start (lay::LayoutViewBase *view, unsigned int cv_index, const std::vect
if (layers.size () == 1) {
m_box_convert = db::box_convert <db::CellInst, false> (*mp_layout, (unsigned int) layers [0]);
m_cell_box_convert = db::box_convert <db::Cell, false> ((unsigned int) layers [0]);
m_box_convert = db::box_convert <db::CellInst, false> (*mp_layout, layers [0]);
m_cell_box_convert = db::box_convert <db::Cell, false> (layers [0]);
} else {
@@ -202,7 +202,7 @@ Finder::do_find (const db::Cell &cell, int level, const db::DCplxTrans &vp, cons
if (level <= m_max_level /*take level of cell itself*/
&& cell.is_proxy ()
&& m_layers.size () == 1
&& (unsigned int) m_layers [0] == mp_layout->guiding_shape_layer ()) {
&& m_layers [0] == mp_layout->guiding_shape_layer ()) {
// when looking at the guiding shape layer, we can visit this cell as well allowing to find the guiding shapes
@@ -339,7 +339,7 @@ ShapeFinder::find (LayoutViewBase *view, const db::DBox &region_mu)
std::sort (lprops.begin (), lprops.end (), LPContextCompareOp ());
std::vector<int> layers;
std::vector<unsigned int> layers;
for (std::vector<lay::LayerPropertiesConstIterator>::const_iterator llp = lprops.begin (); llp != lprops.end (); ) {
layers.clear ();
@@ -347,7 +347,10 @@ ShapeFinder::find (LayoutViewBase *view, const db::DBox &region_mu)
lay::LayerPropertiesConstIterator lp0 = *llp;
LPContextEqualOp eq;
do {
layers.push_back ((*llp)->layer_index ());
int li = (*llp)->layer_index ();
if (li >= 0) {
layers.push_back ((unsigned int) li);
}
++llp;
} while (llp != lprops.end () && eq(lp0, *llp));
@@ -398,16 +401,19 @@ ShapeFinder::find (lay::LayoutViewBase *view, const lay::LayerProperties &lprops
lay::TextInfo text_info (view);
mp_text_info = (m_flags & db::ShapeIterator::Texts) != 0 ? &text_info : 0;
std::vector<int> layers;
layers.push_back (lprops.layer_index ());
std::vector<unsigned int> layers;
int li = lprops.layer_index ();
if (li >= 0) {
layers.push_back ((unsigned int) li);
}
bool result = find_internal (view, lprops.cellview_index (), &lprops.prop_sel (), lprops.inverse_prop_sel (), lprops.hier_levels (), lprops.trans (), layers, region_mu);
mp_progress = 0;
return result;
}
bool
ShapeFinder::find_internal (lay::LayoutViewBase *view, unsigned int cv_index, const std::set<db::properties_id_type> *prop_sel, bool inv_prop_sel, const lay::HierarchyLevelSelection &hier_sel, const std::vector<db::DCplxTrans> &trans_mu, const std::vector<int> &layers, const db::DBox &region_mu)
bool
ShapeFinder::find_internal (lay::LayoutViewBase *view, unsigned int cv_index, const std::set<db::properties_id_type> *prop_sel, bool inv_prop_sel, const lay::HierarchyLevelSelection &hier_sel, const std::vector<db::DCplxTrans> &trans_mu, const std::vector<unsigned int> &layers, const db::DBox &region_mu)
{
m_cv_index = cv_index;
@@ -511,13 +517,13 @@ ShapeFinder::visit_cell (const db::Cell &cell, const db::Box &hit_box, const db:
if (! point_mode ()) {
for (std::vector<int>::const_iterator l = layers ().begin (); l != layers ().end (); ++l) {
for (std::vector<unsigned int>::const_iterator l = layers ().begin (); l != layers ().end (); ++l) {
if (layers ().size () == 1 || (layers ().size () > 1 && cell.bbox ((unsigned int) *l).touches (scan_box))) {
if (layers ().size () == 1 || (layers ().size () > 1 && cell.bbox (*l).touches (scan_box))) {
checkpoint ();
const db::Shapes &shapes = cell.shapes ((unsigned int) *l);
const db::Shapes &shapes = cell.shapes (*l);
db::ShapeIterator shape = shapes.begin_touching (scan_box, m_flags, mp_prop_sel, m_inv_prop_sel);
while (! shape.at_end ()) {
@@ -563,9 +569,9 @@ ShapeFinder::visit_cell (const db::Cell &cell, const db::Box &hit_box, const db:
} else {
for (std::vector<int>::const_iterator l = layers ().begin (); l != layers ().end (); ++l) {
for (std::vector<unsigned int>::const_iterator l = layers ().begin (); l != layers ().end (); ++l) {
if (layers ().size () == 1 || (layers ().size () > 1 && cell.bbox ((unsigned int) *l).touches (scan_box))) {
if (layers ().size () == 1 || (layers ().size () > 1 && cell.bbox (*l).touches (scan_box))) {
checkpoint ();
@@ -793,7 +799,7 @@ InstFinder::find_internal (LayoutViewBase *view, unsigned int cv_index, const db
try {
std::vector<db::DCplxTrans> tv;
tv.push_back (trans_mu);
start (view, cv_index, tv, region_mu, region_mu, view->get_min_hier_levels (), view->get_max_hier_levels (), std::vector<int> ());
start (view, cv_index, tv, region_mu, region_mu, view->get_min_hier_levels (), view->get_max_hier_levels (), std::vector<unsigned int> ());
} catch (StopException) {
// ..
}
+6 -6
View File
@@ -132,7 +132,7 @@ public:
}
protected:
const std::vector<int> &layers () const
const std::vector<unsigned int> &layers () const
{
return m_layers;
}
@@ -183,7 +183,7 @@ protected:
* @param max_level The maximum hierarchy level to check
* @param layers A set of layers to check
*/
void start (LayoutViewBase *view, unsigned int cv_index, const std::vector<db::DCplxTrans> &trans, const db::DBox &region, const db::DBox &scan_region, int min_level, int max_level, const std::vector<int> &layers = std::vector<int> ());
void start (LayoutViewBase *view, unsigned int cv_index, const std::vector<db::DCplxTrans> &trans, const db::DBox &region, const db::DBox &scan_region, int min_level, int max_level, const std::vector<unsigned int> &layers = std::vector<unsigned int> ());
/**
* @brief Provide a basic edge test facility
@@ -232,7 +232,7 @@ private:
unsigned int m_cv_index;
db::Box m_region;
db::Box m_scan_region;
std::vector<int> m_layers;
std::vector<unsigned int> m_layers;
double m_distance;
bool m_point_mode;
bool m_catch_all;
@@ -267,8 +267,8 @@ public:
*/
ShapeFinder (bool point_mode, bool top_level_sel, db::ShapeIterator::flags_type flags, const std::set<lay::ObjectInstPath> *excludes = 0, bool capture_all_shapes = false);
bool find (LayoutViewBase *view, const lay::LayerProperties &lprops, const db::DBox &region_mu);
bool find (LayoutViewBase *view, const db::DBox &region_mu);
bool find (lay::LayoutViewBase *view, const lay::LayerProperties &lprops, const db::DBox &region_mu);
bool find (lay::LayoutViewBase *view, const db::DBox &region_mu);
iterator begin () const
{
@@ -327,7 +327,7 @@ private:
bool inv_prop_sel,
const lay::HierarchyLevelSelection &hier_sel,
const std::vector<db::DCplxTrans> &trans_mu,
const std::vector<int> &layers,
const std::vector<unsigned int> &layers,
const db::DBox &region_mu);
const std::set<lay::ObjectInstPath> *mp_excludes;