From 4aa1364e4bc75b81d9f58cec3c469f4010891a89 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Mon, 1 Jun 2020 15:04:25 +0200 Subject: [PATCH] Fixed DEF reader, updated golden test data. --- .../lefdef/db_plugin/dbDEFImporter.cc | 37 ++++++++++++++++-- .../lefdef/unit_tests/dbLEFDEFImportTests.cc | 10 ++++- testdata/lefdef/specialnets_geo/au.oas.gz | Bin 346 -> 682 bytes .../lefdef/specialnets_geo/au_no_spnet.oas.gz | Bin 224 -> 529 bytes .../specialnets_geo/au_spnet_mapped.oas.gz | Bin 378 -> 765 bytes testdata/lefdef/specialnets_geo/test.def | 6 ++- 6 files changed, 46 insertions(+), 7 deletions(-) diff --git a/src/plugins/streamers/lefdef/db_plugin/dbDEFImporter.cc b/src/plugins/streamers/lefdef/db_plugin/dbDEFImporter.cc index 87c25cfe2..79b23e5a3 100644 --- a/src/plugins/streamers/lefdef/db_plugin/dbDEFImporter.cc +++ b/src/plugins/streamers/lefdef/db_plugin/dbDEFImporter.cc @@ -730,19 +730,30 @@ DEFImporter::read_nets (db::Layout &layout, db::Cell &design, double scale, bool } else { bool prefixed = false; - bool can_have_rect_or_polygon = true; + bool can_have_rect_polygon_or_via = true; if ((was_shield = test ("SHIELD")) == true || test ("NOSHIELD") || test ("ROUTED") || test ("FIXED") || test ("COVER")) { if (was_shield) { take (); } prefixed = true; - can_have_rect_or_polygon = test ("+"); + can_have_rect_polygon_or_via = test ("+"); } bool any = false; - if (can_have_rect_or_polygon && test ("POLYGON")) { + if (can_have_rect_polygon_or_via) { + if (test ("SHAPE")) { + take (); + test ("+"); + } + if (test ("MASK")) { + get_long (); + test ("+"); + } + } + + if (can_have_rect_polygon_or_via && test ("POLYGON")) { std::string ln = get (); @@ -760,7 +771,7 @@ DEFImporter::read_nets (db::Layout &layout, db::Cell &design, double scale, bool any = true; - } else if (can_have_rect_or_polygon && test ("RECT")) { + } else if (can_have_rect_polygon_or_via && test ("RECT")) { std::string ln = get (); @@ -778,6 +789,24 @@ DEFImporter::read_nets (db::Layout &layout, db::Cell &design, double scale, bool any = true; + } else if (can_have_rect_polygon_or_via && test ("VIA")) { + + std::string vn = get (); + db::FTrans ft = get_orient (true /*optional*/); + + test ("("); + db::Vector pt = get_vector (scale); + test (")"); + + std::map::const_iterator vd = m_via_desc.find (vn); + if (vd != m_via_desc.end ()) { + design.insert (db::CellInstArray (db::CellInst (vd->second.cell->cell_index ()), db::Trans (ft.rot (), pt))); + } else { + error (tl::to_string (tr ("Invalid via name: ")) + vn); + } + + any = true; + } else if (prefixed) { read_single_net (nondefaultrule, layout, design, scale, prop_id, specialnets); diff --git a/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImportTests.cc b/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImportTests.cc index 827377a2a..a2de90a2a 100644 --- a/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImportTests.cc +++ b/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImportTests.cc @@ -131,7 +131,15 @@ static void run_test (tl::TestBase *_this, const char *lef_dir, const char *file // normalize the layout by writing to OASIS and reading from .. - std::string tmp_file = _this->tmp_file ("tmp.oas"); + // generate a "unique" name ... + unsigned int hash = 0; + if (au) { + for (const char *cp = au; *cp; ++cp) { + hash = (hash << 4) ^ (hash >> 4) ^ ((unsigned int) *cp); + } + } + + std::string tmp_file = _this->tmp_file (tl::sprintf ("tmp_%x.oas", hash)); { tl::OutputStream stream (tmp_file); diff --git a/testdata/lefdef/specialnets_geo/au.oas.gz b/testdata/lefdef/specialnets_geo/au.oas.gz index cffe301036e98a0a255fff963ec96a3908949e8a..dced1c01d169597f188d940a11aa1f5310af4dcf 100644 GIT binary patch literal 682 zcmY!lcJ=kt^>+;R4CduxWH!_@V0gjKfDB|rrGn#q9V6m{J>C6WUE)3cLR{TlgW|(I zT|zuKSY&u*Akv|J*c8Z!as|hS_y@#0yZZR>a3p7B7Q~n27qIgM$Gf`(#|H%Y2e<}> zL~^pGl;-AEGQ$-x^M!dj#sjfoJXnUC-9I$M$J5W1nT45w2bsgo%m2W_A%qpgNG01q=HrrbA38m>T%cF&$$%!?cC*3KLwogZ}^%NVtbzvf7c3 literal 346 zcmV-g0j2&QiwFo8D3)FT19WY0E^lFT08Z@2gEzO`uOm0 zBxht6#Fyk3u=54SySoI(2L$;CxCVtpa|g?T#01F>N|ScaS3KQzS0 z)6bQeg_(f|nZwQGYskz96ok@1z7aDsm=C78SwN;RGXX{5EM7)YYeoh}CYu0Fc~MJd zMy8Y$V`EWECPpR=4N*~E2Ehl6Cm2NzvoNe-5_`zV&&dGf%BVANF!D2qDljrlU_QYp zD{8>PvWRT~+X}X0JU3Wm#Wpgti!cJ!fut;0*iSJXVmiUpz<-YE7}FW1EsR%~;KCjJ s2be&@J^Z3QAjOPKCm7cN4P^kSKr(X;lPpuiNCpfH08r9-!k+>F07o^Jz5oCK diff --git a/testdata/lefdef/specialnets_geo/au_no_spnet.oas.gz b/testdata/lefdef/specialnets_geo/au_no_spnet.oas.gz index 4bf45b0312df6e018c5d1584253c6957ddcc26cf..021f51106a270a0e6eaf02b9087957147f539168 100644 GIT binary patch literal 529 zcmY!lcJ=kt^>+;R4CduxWH!_@V0gjKfDB|rrGn#q9V6m{J>C6WUE)3cLR{TlgW|(I zT|zuKSY&u*Akv|J*c8Z!as|hS_y@#0yZZR>a3p7B7Q~n27ce7Od|{rB@jz@CpHiBe zTglDt9~$E0>F3JK!py*f%;9G8HDqQ43PNch--wwR%m>rlEFe>unSdg27B8cyH6sHf zlTCo8yr?BJBU4I>v9YKn6C;y`hNvhngWxyD3Ct6i1q)6vGKd^zVOYb&)G(3(0|NjH CakUo! literal 224 zcmV<603ZJ!iwFojGn`%k19WY0E^lFT08Z@2gEzO`uOm0 zBxht6#Fyk3Fe6xeVV;ihKx`PFQkt7v$<6K`8sg*W=gQ2&%)o=p;b!tRWM%{kLTMo1 zh?yD82h-dvAXAu`fFf`fFQce6BLgFoO@OAns3kKaQ%Z`lv8W{zBa?=Ps37yzyJVUeg2RN0ssIj8)hf~ diff --git a/testdata/lefdef/specialnets_geo/au_spnet_mapped.oas.gz b/testdata/lefdef/specialnets_geo/au_spnet_mapped.oas.gz index 7decf1260d997e1cf39da23007c07dbec4fafd37..70d7ce49400a914d3c7979334c442de450e5c290 100644 GIT binary patch literal 765 zcmd^%Jxjw-6o&6PHzqM3#)8*D5_A#kU}A&5pi}fXl_+4ly|The2$;_^ zW|Q1I^l6{wxQY zLZrbaP#SLWW4eP3IuIFjaAR~}@Fy522Syh+qX}t@adL2UboUQ8`b^+~w&MP`g+nA1aBD#TK||R`&&W>z-2+t`|6Ur!Dr}TCk%jR@(ZmJKkS{ z#Zp`ZEnjRqjfSBe9v%0^=}BMBa8a*u;kR49(+&=jbKSFE@0?Brn%Q-$LOxqWjjpyj zLBsVNs!(FYK~FU8q7*4m-H7cnUypVg<LRO9z;3r(W)%c16c|gB`F98*`>2o+=00i4RI?z15UdrVfl1hgqCVjR zhBz=^aE#A*3$K{}jW5i5oWw(u4MC=WA&l^nl8K>QC$17ViLvpfj4+?OgCvoMiR_j@ YI-&efic5JM{O2L$3*NHe>hb~r0R5=4a{vGU diff --git a/testdata/lefdef/specialnets_geo/test.def b/testdata/lefdef/specialnets_geo/test.def index b9b3e39c8..b104eb328 100644 --- a/testdata/lefdef/specialnets_geo/test.def +++ b/testdata/lefdef/specialnets_geo/test.def @@ -16,12 +16,14 @@ VIAS 1 ; END VIAS SPECIALNETS 1 ; - dummy - + ROUTED + RECT M2 ( 350 0 ) ( 200 100 ) + + ROUTED + RECT M2 ( 350 0 ) ( 250 100 ) + POLYGON M1 ( 300 0 ) ( 300 50 ) ( 350 50 ) ( 400 100 ) ( 400 0 ) + ROUTED + POLYGON M2 ( 300 150 ) ( 300 200 ) ( 350 200 ) ( 400 250 ) ( 400 150 ) + RECT M1 ( 0 0 ) ( 100 200 ) - + ROUTED M1 30 ( 0 0 15 ) ( 100 0 0 ) VIA1_dummy ( 100 100 10 ) + + ROUTED M1 30 + MASK 2 ( 0 0 15 ) ( 100 0 0 ) VIA1_dummy ( 100 100 10 ) + ROUTED M2 50 + SHAPE RING + STYLE 1 ( 0 100 ) ( 100 200 ) ( 200 200 ) + + ROUTED + MASK 2 + RECT M2 ( 250 0 ) ( 150 100 ) + + ROUTED + SHAPE RING + MASK 1 + VIA VIA1_dummy E ( 200 200 ) ; END SPECIALNETS END DESIGN