diff --git a/src/plugins/tools/netx/db_plugin/dbHierProcessor.cc b/src/plugins/tools/netx/db_plugin/dbHierProcessor.cc index 0d5ba4cea..98b38edf3 100644 --- a/src/plugins/tools/netx/db_plugin/dbHierProcessor.cc +++ b/src/plugins/tools/netx/db_plugin/dbHierProcessor.cc @@ -335,6 +335,8 @@ private: static bool instances_interact (const db::Layout *layout1, const db::CellInstArray *inst1, unsigned int layer1, const db::Layout *layout2, const db::CellInstArray *inst2, unsigned int layer2) { + // TODO: this algorithm is not in particular effective for identical arrays + const db::Cell &cell1 = layout1->cell (inst1->object ().cell_index ()); const db::Cell &cell2 = layout2->cell (inst2->object ().cell_index ()); db::box_convert inst2_bc (*layout2, layer2); @@ -353,6 +355,11 @@ instances_interact (const db::Layout *layout1, const db::CellInstArray *inst1, u for (db::CellInstArray::iterator k = inst2->begin_touching (ibox1.enlarged (db::Vector (-1, -1)), inst2_bc); ! k.at_end (); ++k) { + if (inst1 == inst2 && *n == *k) { + // skip self-interactions - this is handled inside the cell + continue; + } + db::ICplxTrans tn2 = inst2->complex_trans (*k); db::Box ibox2 = tn2 * cell2.bbox (layer2); @@ -398,7 +405,10 @@ public: void add (const db::CellInstArray *inst1, int, const db::CellInstArray *inst2, int) { // @@@ TODO: always insert, if both instances come from different layouts - if (*inst1 != *inst2 && instances_interact (mp_subject_layout, inst1, m_subject_layer, mp_intruder_layout, inst2, m_intruder_layer)) { + // NOTE: self-interactions are possible for arrays: different elements of the + // array may interact which is a cell-external interaction. + if ((*inst1 != *inst2 || inst1->size () > 1) + && instances_interact (mp_subject_layout, inst1, m_subject_layer, mp_intruder_layout, inst2, m_intruder_layer)) { (*mp_result) [inst1].first.insert (inst2); } } diff --git a/src/plugins/tools/netx/testdata/hlp10.oas b/src/plugins/tools/netx/testdata/hlp10.oas new file mode 100644 index 000000000..6ca1d9c16 Binary files /dev/null and b/src/plugins/tools/netx/testdata/hlp10.oas differ diff --git a/src/plugins/tools/netx/unit_tests/dbHierProcessorTests.cc b/src/plugins/tools/netx/unit_tests/dbHierProcessorTests.cc index aa9194039..f035a547c 100644 --- a/src/plugins/tools/netx/unit_tests/dbHierProcessorTests.cc +++ b/src/plugins/tools/netx/unit_tests/dbHierProcessorTests.cc @@ -254,3 +254,16 @@ TEST(BasicNot9) "CHILD1[1] 0 insts, 4 shapes (2 times)\n" ); } + +TEST(BasicAnd10) +{ + // Array instances, AND + run_test_bool (_this, "hlp10.oas", TMAnd, 100); +} + +TEST(BasicNot10) +{ + // Array instances, NOT + run_test_bool (_this, "hlp10.oas", TMNot, 101); +} +