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 cffe30103..dced1c01d 100644 Binary files a/testdata/lefdef/specialnets_geo/au.oas.gz and b/testdata/lefdef/specialnets_geo/au.oas.gz differ diff --git a/testdata/lefdef/specialnets_geo/au_no_spnet.oas.gz b/testdata/lefdef/specialnets_geo/au_no_spnet.oas.gz index 4bf45b031..021f51106 100644 Binary files a/testdata/lefdef/specialnets_geo/au_no_spnet.oas.gz and b/testdata/lefdef/specialnets_geo/au_no_spnet.oas.gz differ diff --git a/testdata/lefdef/specialnets_geo/au_spnet_mapped.oas.gz b/testdata/lefdef/specialnets_geo/au_spnet_mapped.oas.gz index 7decf1260..70d7ce494 100644 Binary files a/testdata/lefdef/specialnets_geo/au_spnet_mapped.oas.gz and b/testdata/lefdef/specialnets_geo/au_spnet_mapped.oas.gz differ 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