From 37fad6da979affd892d84c71e8e590ca76cf0d6c Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 4 Dec 2018 22:30:18 +0100 Subject: [PATCH] WIP: hier network processor - some debugging, more tests. --- src/db/db/dbBoxScanner.h | 3 +- src/db/db/dbHierNetworkProcessor.cc | 36 +++++++++++++----- .../unit_tests/dbHierNetworkProcessorTests.cc | 10 +++++ testdata/algo/hc_test_au3.gds | Bin 0 -> 3324 bytes testdata/algo/hc_test_au4.gds | Bin 0 -> 3418 bytes testdata/algo/hc_test_l3.gds | Bin 0 -> 1258 bytes testdata/algo/hc_test_l4.gds | Bin 0 -> 982 bytes 7 files changed, 38 insertions(+), 11 deletions(-) create mode 100644 testdata/algo/hc_test_au3.gds create mode 100644 testdata/algo/hc_test_au4.gds create mode 100644 testdata/algo/hc_test_l3.gds create mode 100644 testdata/algo/hc_test_l4.gds diff --git a/src/db/db/dbBoxScanner.h b/src/db/db/dbBoxScanner.h index 5c9372fe8..e8c46c693 100644 --- a/src/db/db/dbBoxScanner.h +++ b/src/db/db/dbBoxScanner.h @@ -621,8 +621,9 @@ public: // below m_scanner_thr elements use the brute force approach which is faster in that case for (iterator_type1 i = m_pp1.begin (); i != m_pp1.end (); ++i) { + box_type b1 = bc1 (*i->first); for (iterator_type2 j = m_pp2.begin (); j != m_pp2.end (); ++j) { - if (bs_boxes_overlap (bc1 (*i->first), bc2 (*j->first), enl)) { + if (bs_boxes_overlap (b1, bc2 (*j->first), enl)) { rec.add (i->first, i->second, j->first, j->second); if (rec.stop ()) { return false; diff --git a/src/db/db/dbHierNetworkProcessor.cc b/src/db/db/dbHierNetworkProcessor.cc index 5261a708d..f3db932aa 100644 --- a/src/db/db/dbHierNetworkProcessor.cc +++ b/src/db/db/dbHierNetworkProcessor.cc @@ -103,9 +103,21 @@ interaction_test (const db::PolygonRef &a, const db::PolygonRef &b, const Trans { // TODO: this could be part of db::interact (including transformation) if (a.obj ().is_box () && b.obj ().is_box ()) { - return db::interact (a.obj ().box ().transformed (b.trans ().inverted () * a.trans ()), b.obj ().box ().transformed (trans)); + return db::interact (a.obj ().box ().transformed (a.trans ()), b.obj ().box ().transformed (trans * Trans (b.trans ()))); } else { - return db::interact (a.obj ().transformed (b.trans ().inverted () * a.trans ()), b.obj ().transformed (trans)); + return db::interact (a.obj ().transformed (a.trans ()), b.obj ().transformed (trans * Trans (b.trans ()))); + } +} + +template +static bool +interaction_test (const db::PolygonRef &a, const db::PolygonRef &b, const db::unit_trans &) +{ + // TODO: this could be part of db::interact (including transformation) + if (a.obj ().is_box () && b.obj ().is_box ()) { + return db::interact (a.obj ().box ().transformed (a.trans ()), b.obj ().box ().transformed (b.trans ())); + } else { + return db::interact (a.obj ().transformed (a.trans ()), b.obj ().transformed (b.trans ())); } } @@ -265,12 +277,11 @@ local_cluster::interacts (const local_cluster &other, const db::ICplxTrans { const_cast *> (this)->ensure_sorted (); - if (! other.bbox ().touches (bbox ())) { + box_type common = other.bbox ().transformed (trans) & bbox (); + if (common.empty ()) { return false; } - box_type common = other.bbox () & bbox (); - db::box_scanner2 scanner; transformed_box bc_t (trans); db::box_convert bc; @@ -586,6 +597,11 @@ public: // .. nothing yet .. } + const box_type &operator() (const db::CellInst &cell_inst) const + { + return (*this) (cell_inst.cell_index ()); + } + const box_type &operator() (db::cell_index_type cell_index) const { typename std::map::const_iterator b = m_cache.find (cell_index); @@ -601,7 +617,7 @@ public: const db::Cell &cell = mp_layout->cell (cell_index); for (db::Cell::const_iterator inst = cell.begin (); ! inst.at_end (); ++inst) { const db::CellInstArray &inst_array = inst->cell_inst (); - box += inst_array.raw_bbox () * (*this) (inst_array.object ().cell_index ()); + box += inst_array.bbox (*this); } return m_cache.insert (std::make_pair (cell_index, box)).first->second; @@ -741,10 +757,10 @@ private: void add_pair (const db::Instance &i1, const std::vector &p1, const db::ICplxTrans &t1, const db::Instance &i2, const std::vector &p2, const db::ICplxTrans &t2) { box_type bb1 = (*mp_cbc) (i1.cell_index ()); - box_type b1 = (i1.cell_inst ().raw_bbox () * bb1).transformed (t1); + box_type b1 = i1.cell_inst ().bbox (*mp_cbc).transformed (t1); box_type bb2 = (*mp_cbc) (i2.cell_index ()); - box_type b2 = (i2.cell_inst ().raw_bbox () * bb2).transformed (t2); + box_type b2 = i2.cell_inst ().bbox (*mp_cbc).transformed (t2); if (! b1.touches (b2)) { return; @@ -878,7 +894,7 @@ private: box_type b1 = c1.bbox (); box_type bb2 = (*mp_cbc) (i2.cell_index ()); - box_type b2 = (i2.cell_inst ().raw_bbox () * bb2).transformed (t2); + box_type b2 = i2.cell_inst ().bbox (*mp_cbc).transformed (t2); if (! b1.touches (b2)) { return; @@ -1043,7 +1059,7 @@ struct cell_inst_clusters_box_converter box_type operator() (const db::Instance &inst) const { - return inst.cell_inst ().raw_bbox () * (*mp_cbc) (inst.cell_index ()); + return inst.cell_inst ().bbox (*mp_cbc); } private: diff --git a/src/db/unit_tests/dbHierNetworkProcessorTests.cc b/src/db/unit_tests/dbHierNetworkProcessorTests.cc index c18d6291e..3ca36d282 100644 --- a/src/db/unit_tests/dbHierNetworkProcessorTests.cc +++ b/src/db/unit_tests/dbHierNetworkProcessorTests.cc @@ -552,3 +552,13 @@ TEST(41_HierClusters) { run_hc_test (_this, "hc_test_l2.gds", "hc_test_au2.gds"); } + +TEST(42_HierClusters) +{ + run_hc_test (_this, "hc_test_l3.gds", "hc_test_au3.gds"); +} + +TEST(43_HierClusters) +{ + run_hc_test (_this, "hc_test_l4.gds", "hc_test_au4.gds"); +} diff --git a/testdata/algo/hc_test_au3.gds b/testdata/algo/hc_test_au3.gds new file mode 100644 index 0000000000000000000000000000000000000000..c1998d1e48d9d6630451916beead0e3003bd2a3e GIT binary patch literal 3324 zcma);KWG$D5XR^B_VzaM45vh}xWd9h@IaJ+3L>aiC&=EEQQ5S5z#qdG|8Df)jr&od8d%sfw2K1Wm;RjLja$8SGp-fA#| zhcB3Wy^N}FHHzbRze@ZJGq}ARU6p_#j)q)Y_4qc7dG^Of7fBjxO zbN4Ru{%=tBuFJglS*bc$6i-x*<@fU-k#wIg(;V@$A(Tva;Oo#QB) zd@v!`cUb)SG){O8&OG>*xUqM0^3J_B%e>iU277b)NA=CNfAjM3{T7^$8LTy&^D9;V z$N9W3hjWenmyUxeqLEdpIi>1Czy6$a_FK&Bi+I1Q9k&`I{vPDO}X1R{;Ea0mwjxXGmvyC&UR9zh0lnay8;aN;tuD888rRtz1m)Mlt*<{)f z%4A5x8yQs>n(D%x!SslU0n-ou990Kxxdv0>9oL)(VS>YC=cqbp$t5*>a^3<~rZEv^ zgtw%>8`hXkMiZdaG%NdcK`HA_^n`|7ZqlNabmE$J`(8<@I;~jNh^ZO-<2ba8vx@20 ZQFYnBqPo_7FEe_n%a!vo`8I|j{RKXRFYf>V literal 0 HcmV?d00001 diff --git a/testdata/algo/hc_test_au4.gds b/testdata/algo/hc_test_au4.gds new file mode 100644 index 0000000000000000000000000000000000000000..57d1aa7c0b610f89035a3f55f25b1bdc0a53555e GIT binary patch literal 3418 zcma);y-!q85XH}aJr-OMbWy|?BM}J+n}~^tnivz20wakQ6voQJKfuC*!h*s=I|~aE zDd@DIu&|)8upoxQ(t?757z%*(HD=x`o6 zMD2M1wT^;wjb;4;xmxzCb|H$LIN0A!JGWbL&P@Y_GeD`TRJ*Xb|HdQd)??>{jmOSy zZKYKEdfeQ9^CSHyofB>>0vZJ_!quq<2UwSH0b-b=KDD9#l2d_ zUNmT#`@*DUtg%7MTyK+>vG&chzGv%boMV%gai&dL#`!d8nR|VoRtx^Soy$=)e)|r` zw~hPxsC0NmHuLT$zm5Im{CyJj<~*Y&`-Ra~!k&?x zDW5>K3$d>bT(La=vXSxs9&$fk7KXhq=Yj11!iw637A?l`jum?zSelSM%AQH6cG3`6 zvQOC*r6tDlL^7!4dwaX5K`ZQMEF^n+!k_1iD^Tt129p-gQh&Y(Tj%B6O)2M3cy7@G zdK;mJy$!x+6*x!DK(%`s;sQF^ozers;v3*B^QBZfY0~Pw7|v7S&Ir&yn^Ml%CJzsCIIn7Ej({5q|&yd;SRk literal 0 HcmV?d00001 diff --git a/testdata/algo/hc_test_l3.gds b/testdata/algo/hc_test_l3.gds new file mode 100644 index 0000000000000000000000000000000000000000..f0b6251fa56bdf76b596c9720aec4087a8ad3a46 GIT binary patch literal 1258 zcmaKrJxml)6ot>u&b}FNB&$L<1%>4%goK2U7!!31j3iKOVT^?ZrG|XW`&^&k=#Zuh^Y733$=*D9{!=Nl>yc-ljixKh z{6G-O_xnmfwvSsaqv;9r_gAz0h+Kb_wBTFSv2VC+yb4{5qEpTE$ct0sB8tM{kb zb({JQrRm4JWquje2g$sVGI$NteQDE>rVC5&|0T@}XGo=PPaAABJ)9}{3k^JbNp>3I T6Kd{@y^N-J8mV6z;QP1+?#!F1 literal 0 HcmV?d00001 diff --git a/testdata/algo/hc_test_l4.gds b/testdata/algo/hc_test_l4.gds new file mode 100644 index 0000000000000000000000000000000000000000..933c5ecee9cdc5377ab54beb14398587c91f5fb1 GIT binary patch literal 982 zcmaKqtxv;H6va=w_N|OE1{r3lKp-ZT0E&A|}BjNSMH3kO(A# z5Cjr|KoArHv1A*JvFvi+>n`mQN|TpgbJ}y?{epsR?;x=3^ecQgm_inQ{2iXHDjQ`W zpK_O1ju$rXE*gt#*R$tmyHx~kvQH_sIuFMK)R+wmDr*BMO)f*k2>kY(D`bdl5x%)`t9c zR6pnX#+}#?=~UQ%%Y_aoIx}8>%um!>C+faya_?G1UpGS0HIw{6+T-stngCB9qgA2k zhVlDTQT{|9OS<=(I&ahK0Yx{nN%Xfa^}INLrgy6QA5nCkYl5HW{mlK&h5Wt({D4R( zI@9>m_;*V^rK(%oTt