From 42f153672ba40e939785def9537d1e97e40e160d Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Mon, 3 Dec 2018 23:02:01 +0100 Subject: [PATCH] WIP: proceed with debugging of hier network processor --- src/db/db/dbHierNetworkProcessor.cc | 35 ++++++++++++++---- .../unit_tests/dbHierNetworkProcessorTests.cc | 9 ++++- testdata/algo/hc_test_au2.gds | Bin 0 -> 3182 bytes testdata/algo/hc_test_l2.gds | Bin 0 -> 1224 bytes 4 files changed, 34 insertions(+), 10 deletions(-) create mode 100644 testdata/algo/hc_test_au2.gds create mode 100644 testdata/algo/hc_test_l2.gds diff --git a/src/db/db/dbHierNetworkProcessor.cc b/src/db/db/dbHierNetworkProcessor.cc index 3ee81d50c..5261a708d 100644 --- a/src/db/db/dbHierNetworkProcessor.cc +++ b/src/db/db/dbHierNetworkProcessor.cc @@ -349,10 +349,11 @@ local_clusters::remove_cluster (typename local_cluster::id_type id) return; } - // TODO: get rid of this const_cast by providing "delete by index" - // m_clusters.erase (id - 1) + // TODO: this const_cast is required. But we know what we're doing ... + // NOTE: we cannot really delete a cluster as this would shift the indexes. So + // we just clear them. local_cluster *to_delete = const_cast *> (& m_clusters.objects ().item (id - 1)); - m_clusters.erase (m_clusters.iterator_from_pointer (to_delete)); + to_delete->clear (); m_needs_update = true; } @@ -370,7 +371,9 @@ local_clusters::join_cluster_with (typename local_cluster::id_type id, typ local_cluster *first = const_cast *> (& m_clusters.objects ().item (id - 1)); first->join_with (*with); - m_clusters.erase (m_clusters.iterator_from_pointer (with)); + // NOTE: we cannot really delete a cluster as this would shift the indexes. So + // we just clear them. + with->clear (); m_needs_update = true; } @@ -707,8 +710,8 @@ public: } typename std::set::const_iterator c = sc->begin (); - ++c; - for (typename std::set::const_iterator cc = c; cc != sc->end (); ++cc) { + typename std::set::const_iterator cc = c; + for (++cc; cc != sc->end (); ++cc) { mp_cell_clusters->join_cluster_with (*c, *cc); } @@ -1074,12 +1077,28 @@ hier_clusters::do_build (cell_clusters_box_converter &cbc, const db::Layou hc_receiver rec (layout, local, *this, cbc, conn); cell_inst_clusters_box_converter cibc (cbc); + // The box scanner needs pointers so we have to first store the instances + // delivered by the cell's iterator (which does not deliver real pointer). + + std::vector inst_storage; + + // TODO: there should be a cell.size () for this ... + size_t n = 0; + for (db::Cell::const_iterator inst = cell.begin (); ! inst.at_end (); ++inst) { + n += 1; + } + + inst_storage.reserve (n); + for (db::Cell::const_iterator inst = cell.begin (); ! inst.at_end (); ++inst) { + inst_storage.push_back (*inst); + } + // handle instance to instance connections { db::box_scanner bs; - for (db::Cell::const_iterator inst = cell.begin (); ! inst.at_end (); ++inst) { + for (std::vector::const_iterator inst = inst_storage.begin (); inst != inst_storage.end (); ++inst) { bs.insert (inst.operator-> (), 0); } @@ -1094,7 +1113,7 @@ hier_clusters::do_build (cell_clusters_box_converter &cbc, const db::Layou for (typename connected_clusters::const_iterator c = local.begin (); c != local.end (); ++c) { bs2.insert1 (c.operator-> (), 0); } - for (db::Cell::const_iterator inst = cell.begin (); ! inst.at_end (); ++inst) { + for (std::vector::const_iterator inst = inst_storage.begin (); inst != inst_storage.end (); ++inst) { bs2.insert2 (inst.operator-> (), 0); } diff --git a/src/db/unit_tests/dbHierNetworkProcessorTests.cc b/src/db/unit_tests/dbHierNetworkProcessorTests.cc index b28c7fee5..c18d6291e 100644 --- a/src/db/unit_tests/dbHierNetworkProcessorTests.cc +++ b/src/db/unit_tests/dbHierNetworkProcessorTests.cc @@ -516,8 +516,8 @@ static void run_hc_test (tl::TestBase *_this, const std::string &file, const std unsigned int lout = net_layers.back ().second; - db::Shapes &out = ly.cell (*ly.begin_top_down ()).shapes (lout); - copy_cluster_shapes (out, *ly.begin_top_down (), hc, *c, db::ICplxTrans (), conn); + db::Shapes &out = ly.cell (*td).shapes (lout); + copy_cluster_shapes (out, *td, hc, *c, db::ICplxTrans (), conn); db::Polygon::area_type area = 0; for (db::Shapes::shape_iterator s = out.begin (db::ShapeIterator::All); ! s.at_end (); ++s) { @@ -547,3 +547,8 @@ TEST(40_HierClusters) { run_hc_test (_this, "hc_test_l1.gds", "hc_test_au1.gds"); } + +TEST(41_HierClusters) +{ + run_hc_test (_this, "hc_test_l2.gds", "hc_test_au2.gds"); +} diff --git a/testdata/algo/hc_test_au2.gds b/testdata/algo/hc_test_au2.gds new file mode 100644 index 0000000000000000000000000000000000000000..86ba92af2e58005b024b12fee6646d1c2bc99925 GIT binary patch literal 3182 zcma);KWI~N5XUbs$;)ev5~ZL+1_y_N0TBvT5JAnLSkNJZh=YTpLkEWr4jsCZd~iczFBHGySSM6@oSR(z z{zu6d{0E~q691GcM_zOEk?$?UyXJVjPE@TkD^(79`o(SEe`EcHm*cu^#C4q3V%CiT&!_OZ#9v8PS8jQwe_Wv=xTwkq`B=^TY&>%l{` z?ocp7`1lbzh#OU!$1X5nBt`>1@c?RQ>Qf7F!8$1JSY-Q-uQJb&`R z)pyW&?O1tER4ZYMB~&@+`=6Pdqb75AP2TT(m+qBw2vy!)%h&&ni5bl>3uWra?0VF&ai|#x2Kz=fY6q)w*Ig9}F+Z{^0Jg!Lm~2LW?al zA1X1vLqY62G`X8nKDc2<7$J!|GZGg)(0F8i9?(XwyI$Iu^@zVnB;6f>>Cjw6si-!p6?RB47#& z!6rqD6kDbUsZyp$VIip&BO=+2Zl1?`XZA8P;AG(E8_sa}@8b*{JZ}j}&8r_GhL77A z!M)-;BF`;8od+iTaAxlP<7c~He^0eK4?ll;*+vpp`>1hX?icI_W#`z|0=0G zIRHjp=QO>yTJn2&|59sLCb66`SQP(`G&-c|!eajgKiPjmp8ZtH?E2*Cw$XHDl^>`_ z^8JAlknQ7U+h}^q;{ASJKlx``XRp+{(^(H`db*oRe}6;wCG`uVHJyJ>(`By}e%bdo znRg@O`4$i-q|tO?>aXM4lt#|ApTCecZb(kYHL>naO|}!?4d>*B^of&jcKC`|^Lw?Q zX0}*gDc?Wdk;ffUIrvyUrXP1o{gwQeExB%)RK`j6e;7@#&WAMeMLZue*53e)Kz2Q( z>B3_DrF>ns$fHfYKdW7Lt$ip>KiaJJ|B_rqlcZ92qxm$N9!-|~rF@;fBD+oT3H9Fd Pt(>NJo0(ts8wB_V&eMqF literal 0 HcmV?d00001