mirror of
https://github.com/KLayout/klayout.git
synced 2026-09-08 04:08:14 +02:00
WIP: bugfix - hierarchical net extractor wasn't considering self-interactions between instance array elements.
This commit is contained in:
@@ -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<db::InstElement> 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<db::InstElement> 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<db::InstElement> 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
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user