diff --git a/src/plugins/streamers/lefdef/db_plugin/dbDEFImporter.cc b/src/plugins/streamers/lefdef/db_plugin/dbDEFImporter.cc index 5ba6c5e0b..117d88b20 100644 --- a/src/plugins/streamers/lefdef/db_plugin/dbDEFImporter.cc +++ b/src/plugins/streamers/lefdef/db_plugin/dbDEFImporter.cc @@ -782,7 +782,7 @@ DEFImporter::read_nets (db::Layout &layout, db::Cell &design, double scale, bool } } - while (test ("+")) { + while ((in_subnet && ! at_end ()) || test ("+")) { bool was_shield = false; unsigned int mask = 0; @@ -820,6 +820,8 @@ DEFImporter::read_nets (db::Layout &layout, db::Cell &design, double scale, bool } else { + bool any = false; + bool prefixed = false; bool can_have_rect_polygon_or_via = true; @@ -831,8 +833,6 @@ DEFImporter::read_nets (db::Layout &layout, db::Cell &design, double scale, bool can_have_rect_polygon_or_via = test ("+"); } - bool any = false; - if (can_have_rect_polygon_or_via) { if (test ("SHAPE")) { take (); @@ -882,22 +882,29 @@ DEFImporter::read_nets (db::Layout &layout, db::Cell &design, double scale, bool } else if (can_have_rect_polygon_or_via && test ("VIA")) { + // For the via, the masks are encoded in a three-digit number ( ) + unsigned int mask_top = (mask / 100) % 10; + unsigned int mask_cut = (mask / 10) % 10; + unsigned int mask_bottom = mask % 10; + std::string vn = get (); db::FTrans ft = get_orient (true /*optional*/); - test ("("); - db::Vector pt = get_vector (scale); - test (")"); + while (test ("(")) { - std::map::const_iterator vd = m_via_desc.find (vn); - if (vd != m_via_desc.end ()) { - // TODO: no mask specification here? - db::Cell *cell = reader_state ()->via_cell (vn, nondefaultrule, layout, 0, 0, 0, &m_lef_importer); - if (cell) { - design.insert (db::CellInstArray (db::CellInst (cell->cell_index ()), db::Trans (ft.rot (), pt))); + db::Vector pt = get_vector (scale); + test (")"); + + std::map::const_iterator vd = m_via_desc.find (vn); + if (vd != m_via_desc.end ()) { + db::Cell *cell = reader_state ()->via_cell (vn, nondefaultrule, layout, mask_bottom, mask_cut, mask_top, &m_lef_importer); + if (cell) { + design.insert (db::CellInstArray (db::CellInst (cell->cell_index ()), db::Trans (ft.rot (), pt))); + } + } else { + warn (tl::to_string (tr ("Invalid via name: ")) + vn); } - } else { - error (tl::to_string (tr ("Invalid via name: ")) + vn); + } any = true; @@ -1204,7 +1211,7 @@ DEFImporter::read_pins (db::Layout &layout, db::Cell &design, double scale) double x = 0.0, y = 0.0; - while (! at_end () && ! test ("+") && ! test (";")) { + while (! at_end () && ! peek ("+") && ! peek (";")) { test ("("); if (! test ("*")) { @@ -1238,7 +1245,17 @@ DEFImporter::read_pins (db::Layout &layout, db::Cell &design, double scale) } else if (test ("VIA")) { // TODO: implement - error (tl::to_string (tr ("VIA not supported on pins currently"))); + warn (tl::to_string (tr ("VIA not supported on pins currently"))); + + get (); + + if (test ("MASK")) { + get_mask (get_long ()); + } + + test ("("); + db::Vector d = get_vector (scale); + test (")"); } else { while (! peek ("+") && ! peek ("-") && ! peek (";")) { @@ -1432,7 +1449,7 @@ DEFImporter::read_styles (double scale) } - m_styles.insert (std::make_pair (sn, db::Polygon ())).first->second.assign_hull (points.begin (), points.end ()); + m_styles.insert (std::make_pair (sn, db::Polygon ())).first->second.assign_hull (points.begin (), points.end (), false /*don't compress*/); } }