diff --git a/src/db/db/dbHierNetworkProcessor.cc b/src/db/db/dbHierNetworkProcessor.cc index 77f33297e..6a87619f4 100644 --- a/src/db/db/dbHierNetworkProcessor.cc +++ b/src/db/db/dbHierNetworkProcessor.cc @@ -885,6 +885,16 @@ public: add_pair (*i1, p, t, *i2, p, t); } + /** + * @brief Single-instance treatment - may be required because of interactions between array members + */ + void finish (const db::Instance *i, unsigned int /*p1*/) + { + if (i->size () > 1) { + add_single_inst (*i); + } + } + /** * @brief Receiver main event for local-to-instance interactions */ @@ -1076,6 +1086,69 @@ private: } + /** + * @brief Single instance treatment + */ + void add_single_inst (const db::Instance &i) + { + box_type bb = (*mp_cbc) (i.cell_index ()); + const db::Cell &cell = mp_layout->cell (i.cell_index ()); + + for (db::CellInstArray::iterator ii = i.begin (); ! ii.at_end (); ++ii) { + + db::ICplxTrans tt = i.complex_trans (*ii); + box_type ib = bb.transformed (tt); + + std::vector pp; + pp.push_back (db::InstElement (i, ii)); + + bool any = false; + bool first = true; + + for (db::CellInstArray::iterator ii2 = i.begin_touching (ib, mp_layout); ! ii2.at_end (); ++ii2) { + + db::ICplxTrans tt2 = i.complex_trans (*ii2); + if (tt.equal (tt2)) { + // skip the initial instance + continue; + } + + box_type ib2 = bb.transformed (tt2); + + if (ib.touches (ib2)) { + + std::vector pp2; + pp2.push_back (db::InstElement (i, ii2)); + + box_type common = (ib & ib2); + add_single_pair (common, i.cell_index (), pp, tt, i.cell_index (), pp2, tt2); + + // dive into cell of ii2 - this is a self-interaction of a cell with parts of itself + // as these self-interactions are expected to be the same always (regular array), we can skip this test the next times. + if (first) { + for (db::Cell::touching_iterator jj2 = cell.begin_touching (common.transformed (tt2.inverted ())); ! jj2.at_end (); ++jj2) { + std::vector p; + db::ICplxTrans t; + add_pair (i, p, t, *jj2, pp2, tt2); + } + } + + any = true; + + } + + } + + first = false; + + // we don't expect more to happen on the next instance + if (! any) { + break; + } + + } + } + /** * @brief Handles a local clusters vs. the clusters of a specific child instance or instance array * @param c1 The local cluster diff --git a/src/db/unit_tests/dbHierNetworkProcessorTests.cc b/src/db/unit_tests/dbHierNetworkProcessorTests.cc index b58f0460a..bb05fe3c4 100644 --- a/src/db/unit_tests/dbHierNetworkProcessorTests.cc +++ b/src/db/unit_tests/dbHierNetworkProcessorTests.cc @@ -1006,6 +1006,18 @@ TEST(110_HierClusters) TEST(111_HierClusters) { run_hc_test (_this, "hc_test_l11.gds", "hc_test_au11.gds"); - run_hc_test_with_backannotation (_this, "hc_test_l4.gds", "hc_test_au4b.gds"); + run_hc_test_with_backannotation (_this, "hc_test_l11.gds", "hc_test_au11b.gds"); +} + +TEST(112_HierClusters) +{ + run_hc_test (_this, "hc_test_l12.gds", "hc_test_au12.gds"); + run_hc_test_with_backannotation (_this, "hc_test_l12.gds", "hc_test_au12b.gds"); +} + +TEST(113_HierClusters) +{ + run_hc_test (_this, "hc_test_l13.gds", "hc_test_au13.gds"); + run_hc_test_with_backannotation (_this, "hc_test_l13.gds", "hc_test_au13b.gds"); } diff --git a/testdata/algo/hc_test_au11b.gds b/testdata/algo/hc_test_au11b.gds new file mode 100644 index 000000000..ee96f0842 Binary files /dev/null and b/testdata/algo/hc_test_au11b.gds differ diff --git a/testdata/algo/hc_test_au12.gds b/testdata/algo/hc_test_au12.gds new file mode 100644 index 000000000..72d2f1097 Binary files /dev/null and b/testdata/algo/hc_test_au12.gds differ diff --git a/testdata/algo/hc_test_au12b.gds b/testdata/algo/hc_test_au12b.gds new file mode 100644 index 000000000..e70c96177 Binary files /dev/null and b/testdata/algo/hc_test_au12b.gds differ diff --git a/testdata/algo/hc_test_au13.gds b/testdata/algo/hc_test_au13.gds new file mode 100644 index 000000000..d7fe0cc21 Binary files /dev/null and b/testdata/algo/hc_test_au13.gds differ diff --git a/testdata/algo/hc_test_au13b.gds b/testdata/algo/hc_test_au13b.gds new file mode 100644 index 000000000..f14dfeaa9 Binary files /dev/null and b/testdata/algo/hc_test_au13b.gds differ diff --git a/testdata/algo/hc_test_l12.gds b/testdata/algo/hc_test_l12.gds new file mode 100644 index 000000000..17c1a90df Binary files /dev/null and b/testdata/algo/hc_test_l12.gds differ diff --git a/testdata/algo/hc_test_l13.gds b/testdata/algo/hc_test_l13.gds new file mode 100644 index 000000000..b3dccbed4 Binary files /dev/null and b/testdata/algo/hc_test_l13.gds differ