From eb71121c3841b4776e7bcf01c387c9608235a270 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 23 Sep 2018 22:34:50 +0200 Subject: [PATCH] WIP: bugfix - intra-array self interactions. --- .../tools/netx/db_plugin/dbHierProcessor.cc | 12 +++++++++++- src/plugins/tools/netx/testdata/hlp10.oas | Bin 0 -> 478 bytes .../tools/netx/unit_tests/dbHierProcessorTests.cc | 13 +++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 src/plugins/tools/netx/testdata/hlp10.oas 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 0000000000000000000000000000000000000000..6ca1d9c163b2000b74dc80fb15ebd1463cbe0f3f GIT binary patch literal 478 zcmY!lcJ=kt^>+;R4CduxWH!_@V0gjKfDB|rrGn#q9V6m{J>C6WUE)3cLR{TlgW|(I zT|zuKSY&u*Akv|J*c8Z!as|hS_y@#0yZZR>Fauf4V1m`z!_&uwmr>N1k%5t^L;a7~ zS7uR5CPty7yw=Fw(0-? literal 0 HcmV?d00001 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); +} +