diff --git a/src/plugins/streamers/lefdef/db_plugin/dbDEFImporter.cc b/src/plugins/streamers/lefdef/db_plugin/dbDEFImporter.cc index 382aa9b92..5ee27d495 100644 --- a/src/plugins/streamers/lefdef/db_plugin/dbDEFImporter.cc +++ b/src/plugins/streamers/lefdef/db_plugin/dbDEFImporter.cc @@ -1136,10 +1136,23 @@ DEFImporter::do_read (db::Layout &layout) std::pair dl = open_layer (layout, g->first, Pins); if (dl.first) { + + db::properties_id_type prop_id = 0; + if (produce_pin_props ()) { + db::PropertiesRepository::properties_set props; + props.insert (std::make_pair (pin_prop_name_id (), tl::Variant (label))); + prop_id = layout.properties_repository ().properties_id (props); + } + for (std::vector::const_iterator p = g->second.begin (); p != g->second.end (); ++p) { db::Polygon pt = p->transformed (trans); - design.shapes (dl.second).insert (pt); + if (prop_id == 0) { + design.shapes (dl.second).insert (pt); + } else { + design.shapes (dl.second).insert (db::PolygonWithProperties (pt, prop_id)); + } } + } dl = open_layer (layout, g->first, Label); diff --git a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc index 1588405ac..55a4e7ecc 100644 --- a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc +++ b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc @@ -41,6 +41,8 @@ LEFDEFReaderOptions::LEFDEFReaderOptions () m_net_property_name (1), m_produce_inst_names (true), m_inst_property_name (1), + m_produce_pin_names (false), + m_pin_property_name (1), m_produce_cell_outlines (true), m_cell_outline_layer ("OUTLINE"), m_produce_placement_blockages (true), @@ -77,6 +79,8 @@ LEFDEFReaderOptions::LEFDEFReaderOptions (const LEFDEFReaderOptions &d) m_net_property_name (d.m_net_property_name), m_produce_inst_names (d.m_produce_inst_names), m_inst_property_name (d.m_inst_property_name), + m_produce_pin_names (d.m_produce_pin_names), + m_pin_property_name (d.m_pin_property_name), m_produce_cell_outlines (d.m_produce_cell_outlines), m_cell_outline_layer (d.m_cell_outline_layer), m_produce_placement_blockages (d.m_produce_placement_blockages), @@ -357,7 +361,8 @@ LEFDEFLayerDelegate::finish (db::Layout &layout) LEFDEFImporter::LEFDEFImporter () : mp_progress (0), mp_stream (0), mp_layer_delegate (0), m_produce_net_props (false), m_net_prop_name_id (0), - m_produce_inst_props (false), m_inst_prop_name_id (0) + m_produce_inst_props (false), m_inst_prop_name_id (0), + m_produce_pin_props (false), m_pin_prop_name_id (0) { // .. nothing yet .. } @@ -393,6 +398,14 @@ LEFDEFImporter::read (tl::InputStream &stream, db::Layout &layout, LEFDEFLayerDe m_inst_prop_name_id = layout.properties_repository ().prop_name_id (ld.tech_comp ()->inst_property_name ()); } + m_produce_pin_props = false; + m_pin_prop_name_id = 0; + + if (ld.tech_comp () && ld.tech_comp ()->produce_pin_names ()) { + m_produce_pin_props = true; + m_pin_prop_name_id = layout.properties_repository ().prop_name_id (ld.tech_comp ()->pin_property_name ()); + } + try { mp_progress = &progress; diff --git a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.h b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.h index a75012c29..8058accd0 100644 --- a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.h +++ b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.h @@ -145,6 +145,26 @@ public: m_inst_property_name = s; } + bool produce_pin_names () const + { + return m_produce_pin_names; + } + + void set_produce_pin_names (bool f) + { + m_produce_pin_names = f; + } + + const tl::Variant &pin_property_name () const + { + return m_pin_property_name; + } + + void set_pin_property_name (const tl::Variant &s) + { + m_pin_property_name = s; + } + bool produce_cell_outlines () const { return m_produce_cell_outlines; @@ -423,6 +443,8 @@ private: tl::Variant m_net_property_name; bool m_produce_inst_names; tl::Variant m_inst_property_name; + bool m_produce_pin_names; + tl::Variant m_pin_property_name; bool m_produce_cell_outlines; std::string m_cell_outline_layer; bool m_produce_placement_blockages; @@ -696,6 +718,22 @@ protected: return m_inst_prop_name_id; } + /** + * @brief Gets a flag indicating whether pinance names shall be produced as properties + */ + bool produce_pin_props () const + { + return m_produce_pin_props; + } + + /** + * @brief Gets the property name id of the pinance name property + */ + db::property_names_id_type pin_prop_name_id () const + { + return m_pin_prop_name_id; + } + protected: void create_generated_via (std::vector &bottom, std::vector &cut, @@ -719,6 +757,8 @@ private: db::property_names_id_type m_net_prop_name_id; bool m_produce_inst_props; db::property_names_id_type m_inst_prop_name_id; + bool m_produce_pin_props; + db::property_names_id_type m_pin_prop_name_id; const std::string &next (); }; diff --git a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFPlugin.cc b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFPlugin.cc index add3019b7..d9b10b28a 100644 --- a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFPlugin.cc +++ b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFPlugin.cc @@ -239,6 +239,8 @@ class LEFDEFFormatDeclaration tl::make_member (&LEFDEFReaderOptions::net_property_name, &LEFDEFReaderOptions::set_net_property_name, "net-property-name") + tl::make_member (&LEFDEFReaderOptions::produce_inst_names, &LEFDEFReaderOptions::set_produce_inst_names, "produce-inst-names") + tl::make_member (&LEFDEFReaderOptions::inst_property_name, &LEFDEFReaderOptions::set_inst_property_name, "inst-property-name") + + tl::make_member (&LEFDEFReaderOptions::produce_pin_names, &LEFDEFReaderOptions::set_produce_pin_names, "produce-pin-names") + + tl::make_member (&LEFDEFReaderOptions::pin_property_name, &LEFDEFReaderOptions::set_pin_property_name, "pin-property-name") + tl::make_member (&LEFDEFReaderOptions::produce_cell_outlines, &LEFDEFReaderOptions::set_produce_cell_outlines, "produce-cell-outlines") + tl::make_member (&LEFDEFReaderOptions::cell_outline_layer, &LEFDEFReaderOptions::set_cell_outline_layer, "cell-outline-layer") + tl::make_member (&LEFDEFReaderOptions::produce_placement_blockages, &LEFDEFReaderOptions::set_produce_placement_blockages, "produce-placement-blockages") + diff --git a/src/plugins/streamers/lefdef/db_plugin/dbLEFImporter.cc b/src/plugins/streamers/lefdef/db_plugin/dbLEFImporter.cc index 4d30269fa..95506ff67 100644 --- a/src/plugins/streamers/lefdef/db_plugin/dbLEFImporter.cc +++ b/src/plugins/streamers/lefdef/db_plugin/dbLEFImporter.cc @@ -126,8 +126,28 @@ LEFImporter::get_iteration (db::Layout &layout) return t; } +template +static db::Shape insert_shape (db::Cell &cell, unsigned int layer_id, const Shape &shape, const Trans &trans, db::properties_id_type prop_id) +{ + if (prop_id == 0) { + return cell.shapes (layer_id).insert (shape.transformed (trans)); + } else { + return cell.shapes (layer_id).insert (db::object_with_properties (shape.transformed (trans), prop_id)); + } +} + +template +static db::Shape insert_shape (db::Cell &cell, unsigned int layer_id, const Shape &shape, db::properties_id_type prop_id) +{ + if (prop_id == 0) { + return cell.shapes (layer_id).insert (shape); + } else { + return cell.shapes (layer_id).insert (db::object_with_properties (shape, prop_id)); + } +} + void -LEFImporter::read_geometries (db::Layout &layout, db::Cell &cell, LayerPurpose purpose, std::map *collect_bboxes) +LEFImporter::read_geometries (db::Layout &layout, db::Cell &cell, LayerPurpose purpose, std::map *collect_bboxes, db::properties_id_type prop_id) { int layer_id = -1; std::string layer_name; @@ -194,14 +214,14 @@ LEFImporter::read_geometries (db::Layout &layout, db::Cell &cell, LayerPurpose p std::vector ti = get_iteration (layout); if (layer_id >= 0) { for (std::vector::const_iterator t = ti.begin (); t != ti.end (); ++t) { - db::Shape s = cell.shapes (layer_id).insert (p.transformed (*t)); + db::Shape s = insert_shape (cell, layer_id, p, *t, prop_id); if (collect_bboxes) { collect_bboxes->insert (std::make_pair (layer_name, db::Box ())).first->second = s.bbox (); } } } } else if (layer_id >= 0) { - db::Shape s = cell.shapes (layer_id).insert (p); + db::Shape s = insert_shape (cell, layer_id, p, prop_id); if (collect_bboxes) { collect_bboxes->insert (std::make_pair (layer_name, db::Box ())).first->second = s.bbox (); } @@ -235,14 +255,14 @@ LEFImporter::read_geometries (db::Layout &layout, db::Cell &cell, LayerPurpose p std::vector ti = get_iteration (layout); if (layer_id >= 0) { for (std::vector::const_iterator t = ti.begin (); t != ti.end (); ++t) { - db::Shape s = cell.shapes (layer_id).insert (p.transformed (*t)); + db::Shape s = insert_shape (cell, layer_id, p, *t, prop_id); if (collect_bboxes) { collect_bboxes->insert (std::make_pair (layer_name, db::Box ())).first->second = s.bbox (); } } } } else if (layer_id >= 0) { - db::Shape s = cell.shapes (layer_id).insert (p); + db::Shape s = insert_shape (cell, layer_id, p, prop_id); if (collect_bboxes) { collect_bboxes->insert (std::make_pair (layer_name, db::Box ())).first->second = s.bbox (); } @@ -275,14 +295,14 @@ LEFImporter::read_geometries (db::Layout &layout, db::Cell &cell, LayerPurpose p std::vector ti = get_iteration (layout); if (layer_id >= 0) { for (std::vector::const_iterator t = ti.begin (); t != ti.end (); ++t) { - db::Shape s = cell.shapes (layer_id).insert (b.transformed (*t)); + db::Shape s = insert_shape (cell, layer_id, b, *t, prop_id); if (collect_bboxes) { collect_bboxes->insert (std::make_pair (layer_name, db::Box ())).first->second = s.bbox (); } } } } else if (layer_id >= 0) { - db::Shape s = cell.shapes (layer_id).insert (b); + db::Shape s = insert_shape (cell, layer_id, b, prop_id); if (collect_bboxes) { collect_bboxes->insert (std::make_pair (layer_name, db::Box ())).first->second = s.bbox (); } @@ -685,9 +705,6 @@ LEFImporter::do_read (db::Layout &layout) test (";"); } else if (test ("PORT")) { - std::map bboxes; - read_geometries (layout, cell, Pins, &bboxes); - // produce pin labels // TODO: put a label on every single object? std::string label = pn; @@ -698,6 +715,16 @@ LEFImporter::do_read (db::Layout &layout) } */ + db::properties_id_type prop_id = 0; + if (produce_pin_props ()) { + db::PropertiesRepository::properties_set props; + props.insert (std::make_pair (pin_prop_name_id (), tl::Variant (label))); + prop_id = layout.properties_repository ().properties_id (props); + } + + std::map bboxes; + read_geometries (layout, cell, Pins, &bboxes, prop_id); + for (std::map ::const_iterator b = bboxes.begin (); b != bboxes.end (); ++b) { std::pair dl = open_layer (layout, b->first, Label); if (dl.first) { diff --git a/src/plugins/streamers/lefdef/db_plugin/dbLEFImporter.h b/src/plugins/streamers/lefdef/db_plugin/dbLEFImporter.h index 3d016f382..9811d9bfc 100644 --- a/src/plugins/streamers/lefdef/db_plugin/dbLEFImporter.h +++ b/src/plugins/streamers/lefdef/db_plugin/dbLEFImporter.h @@ -108,7 +108,7 @@ private: std::map m_vias; std::vector get_iteration (db::Layout &layout); - void read_geometries (db::Layout &layout, db::Cell &cell, LayerPurpose purpose, std::map *collect_bboxes = 0); + void read_geometries (db::Layout &layout, db::Cell &cell, LayerPurpose purpose, std::map *collect_bboxes = 0, properties_id_type prop_id = 0); }; } diff --git a/src/plugins/streamers/lefdef/db_plugin/gsiDeclDbLEFDEF.cc b/src/plugins/streamers/lefdef/db_plugin/gsiDeclDbLEFDEF.cc index 0725ab314..f0640f3e4 100644 --- a/src/plugins/streamers/lefdef/db_plugin/gsiDeclDbLEFDEF.cc +++ b/src/plugins/streamers/lefdef/db_plugin/gsiDeclDbLEFDEF.cc @@ -76,6 +76,36 @@ static void set_net_property_name (db::LEFDEFReaderOptions *config, const tl::Va config->set_net_property_name (name); } +static tl::Variant get_instance_property_name (const db::LEFDEFReaderOptions *config) +{ + if (config->produce_inst_names ()) { + return config->inst_property_name (); + } else { + return tl::Variant (); + } +} + +static void set_instance_property_name (db::LEFDEFReaderOptions *config, const tl::Variant &name) +{ + config->set_produce_inst_names (! name.is_nil ()); + config->set_inst_property_name (name); +} + +static tl::Variant get_pin_property_name (const db::LEFDEFReaderOptions *config) +{ + if (config->produce_pin_names ()) { + return config->pin_property_name (); + } else { + return tl::Variant (); + } +} + +static void set_pin_property_name (db::LEFDEFReaderOptions *config, const tl::Variant &name) +{ + config->set_produce_pin_names (! name.is_nil ()); + config->set_pin_property_name (name); +} + static gsi::Class decl_lefdef_config ("db", "LEFDEFReaderConfiguration", gsi::method ("layer_map", (db::LayerMap &(db::LEFDEFReaderOptions::*) ()) &db::LEFDEFReaderOptions::layer_map, @@ -112,7 +142,7 @@ gsi::Class decl_lefdef_config ("db", "LEFDEFReaderConfi ) + gsi::method_ext ("net_property_name", &get_net_property_name, "@brief Gets a value indicating whether and how to produce net names as properties.\n" - "If set to a value not nil, net names will be attached to the shapes and instances generated as user properties.\n" + "If set to a value not nil, net names will be attached to the net shapes generated as user properties.\n" "This attribute then specifies the user property name to be used for attaching the net names.\n" "If set to nil, no net names will be produced.\n" "\n" @@ -122,6 +152,38 @@ gsi::Class decl_lefdef_config ("db", "LEFDEFReaderConfi "@brief Sets a value indicating whether and how to produce net names as properties.\n" "See \\net_property_name for details." ) + + gsi::method_ext ("pin_property_name", &get_pin_property_name, + "@brief Gets a value indicating whether and how to produce pin names as properties.\n" + "If set to a value not nil, pin names will be attached to the pin shapes generated as user properties.\n" + "This attribute then specifies the user property name to be used for attaching the pin names.\n" + "If set to nil, no pin names will be produced.\n" + "\n" + "The corresponding setter is \\pin_property_name=.\n" + "\n" + "This method has been introduced in version 0.26.4." + ) + + gsi::method_ext ("pin_property_name=", &set_pin_property_name, gsi::arg ("name"), + "@brief Sets a value indicating whether and how to produce pin names as properties.\n" + "See \\pin_property_name for details.\n" + "\n" + "This method has been introduced in version 0.26.4." + ) + + gsi::method_ext ("instance_property_name", &get_instance_property_name, + "@brief Gets a value indicating whether and how to produce instance names as properties.\n" + "If set to a value not nil, instance names will be attached to the instances generated as user properties.\n" + "This attribute then specifies the user property name to be used for attaching the instance names.\n" + "If set to nil, no instance names will be produced.\n" + "\n" + "The corresponding setter is \\instance_property_name=.\n" + "\n" + "This method has been introduced in version 0.26.4." + ) + + gsi::method_ext ("instance_property_name=", &set_instance_property_name, gsi::arg ("name"), + "@brief Sets a value indicating whether and how to produce instance names as properties.\n" + "See \\instance_property_name for details.\n" + "\n" + "This method has been introduced in version 0.26.4." + ) + gsi::method ("produce_cell_outlines", &db::LEFDEFReaderOptions::produce_cell_outlines, "@brief Gets a value indicating whether to produce cell outlines.\n" "If set to true, cell outlines will be produced on the layer given by \\cell_outline_layer. " diff --git a/src/plugins/streamers/lefdef/lay_plugin/LEFDEFTechnologyComponentEditor.ui b/src/plugins/streamers/lefdef/lay_plugin/LEFDEFTechnologyComponentEditor.ui index f72dc2a35..2b2dcf365 100644 --- a/src/plugins/streamers/lefdef/lay_plugin/LEFDEFTechnologyComponentEditor.ui +++ b/src/plugins/streamers/lefdef/lay_plugin/LEFDEFTechnologyComponentEditor.ui @@ -264,24 +264,8 @@ 6 - - - - - - - :/right.png - - - - - - - - - - - + + 0 @@ -296,122 +280,6 @@ - - - - - - - Blockages - - - - - - - - 0 - 0 - - - - - - - :/right.png - - - - - - - - - - On layer with spec ... - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - Pin labels - - - - - - - Pins - - - - - - - Via geometry - - - - - - - Routing - - - - - - - Produce ... - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - - 0 - 0 - - - - Cell outlines - - - - - - - GDS datatype ... - - - - - - - - - - - - - - - - Layer name suffix ... - - - - - - @@ -419,53 +287,8 @@ - - - - - - - - 0 - 0 - - - - Blockages - - - - - - - - 0 - 0 - - - - - - - :/right.png - - - - - - - <html><body>(<a href="int:/about/variant_notation.xml">See here for the name notation</a>)</body></html> - - - Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing - - - - - - - - + + @@ -481,8 +304,8 @@ - - + + 0 @@ -497,8 +320,31 @@ + + + + Produce ... + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + + + 0 + 0 + + + + Cell outlines + + + - + 0 @@ -513,6 +359,71 @@ + + + + + 50 + false + false + false + + + + Produce ... + + + + + + + + + + Inst names + + + + + + + + 0 + 0 + + + + Blockages + + + + + + + <html><body>(<a href="int:/about/variant_notation.xml">See here for the name notation</a>)</body></html> + + + Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing + + + + + + + + + + GDS datatype ... + + + + + + + Layer name suffix ... + + + @@ -529,8 +440,75 @@ - - + + + + On layer with spec ... + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + + + + + + + + + + + + + + Via geometry + + + + + + + + + + :/right.png + + + + + + + Qt::Vertical + + + + + + + Produce ... + + + + + + + Pins + + + + + + + Regions + + + + + 0 @@ -545,33 +523,77 @@ - - + + - Inst names + + + + :/right.png - - + + - - - - - 50 - false - false - false - - + + + + + - Produce ... + Pin names - - + + + + + + + :/right.png + + + + + + + + + + Obstructions + + + + + + + + 0 + 0 + + + + + + + :/right.png + + + + + + + + + + + + + Routing + + @@ -589,11 +611,28 @@ - - + + - - + + + + + + + Pin labels + + + + + + + Blockages + + + + + 0 @@ -608,35 +647,14 @@ - - - - - - - Obstructions + + + + + 0 + 0 + - - - - - - - - - Produce ... - - - - - - - Regions - - - - - @@ -645,15 +663,17 @@ - - - - Qt::Vertical - - + + - - + + + + + + + + @@ -759,18 +779,6 @@ produce_pins suffix_pins datatype_pins - produce_obstructions - suffix_obstructions - datatype_obstructions - produce_routing - suffix_routing - datatype_routing - produce_labels - suffix_labels - datatype_labels - produce_blockages - suffix_blockages - datatype_blockages read_all_cbx diff --git a/src/plugins/streamers/lefdef/lay_plugin/layLEFDEFImportDialogs.cc b/src/plugins/streamers/lefdef/lay_plugin/layLEFDEFImportDialogs.cc index 75a4cd528..14474fa23 100644 --- a/src/plugins/streamers/lefdef/lay_plugin/layLEFDEFImportDialogs.cc +++ b/src/plugins/streamers/lefdef/lay_plugin/layLEFDEFImportDialogs.cc @@ -347,6 +347,7 @@ LEFDEFReaderOptionsEditor::LEFDEFReaderOptionsEditor (QWidget *parent) connect (produce_net_names, SIGNAL (stateChanged (int)), this, SLOT (checkbox_changed ())); connect (produce_inst_names, SIGNAL (stateChanged (int)), this, SLOT (checkbox_changed ())); + connect (produce_pin_names, SIGNAL (stateChanged (int)), this, SLOT (checkbox_changed ())); connect (produce_outlines, SIGNAL (stateChanged (int)), this, SLOT (checkbox_changed ())); connect (produce_placement_blockages, SIGNAL (stateChanged (int)), this, SLOT (checkbox_changed ())); connect (produce_regions, SIGNAL (stateChanged (int)), this, SLOT (checkbox_changed ())); @@ -376,6 +377,7 @@ LEFDEFReaderOptionsEditor::commit (db::FormatSpecificReaderOptions *options, con data->set_layer_map (layer_map->get_layer_map ()); data->set_produce_net_names (produce_net_names->isChecked ()); data->set_produce_inst_names (produce_inst_names->isChecked ()); + data->set_produce_pin_names (produce_pin_names->isChecked ()); double dbu_value = 0.0; tl::from_string (tl::to_string (dbu->text ()), dbu_value); @@ -404,6 +406,16 @@ LEFDEFReaderOptionsEditor::commit (db::FormatSpecificReaderOptions *options, con data->set_inst_property_name (v); } + // parse the pin property name (may throw an exception) + { + std::string np = tl::to_string (pin_prop_name->text ()); + tl::Extractor ex (np.c_str ()); + tl::Variant v; + ex.read (v); + ex.expect_end (); + data->set_pin_property_name (v); + } + data->set_produce_cell_outlines (produce_outlines->isChecked ()); data->set_cell_outline_layer (tl::to_string (outline_layer->text ())); data->set_produce_regions (produce_regions->isChecked ()); @@ -454,6 +466,8 @@ LEFDEFReaderOptionsEditor::setup (const db::FormatSpecificReaderOptions *options net_prop_name->setText (tl::to_qstring (data->net_property_name ().to_parsable_string ())); produce_inst_names->setChecked (data->produce_inst_names ()); inst_prop_name->setText (tl::to_qstring (data->inst_property_name ().to_parsable_string ())); + produce_pin_names->setChecked (data->produce_pin_names ()); + pin_prop_name->setText (tl::to_qstring (data->pin_property_name ().to_parsable_string ())); produce_outlines->setChecked (data->produce_cell_outlines ()); outline_layer->setText (tl::to_qstring (data->cell_outline_layer ())); produce_regions->setChecked (data->produce_regions ()); @@ -499,6 +513,7 @@ LEFDEFReaderOptionsEditor::checkbox_changed () { net_prop_name->setEnabled (produce_net_names->isChecked ()); inst_prop_name->setEnabled (produce_inst_names->isChecked ()); + pin_prop_name->setEnabled (produce_pin_names->isChecked ()); outline_layer->setEnabled (produce_outlines->isChecked ()); region_layer->setEnabled (produce_regions->isChecked ()); placement_blockage_layer->setEnabled (produce_placement_blockages->isChecked ()); diff --git a/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImport.cc b/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImport.cc index 315a5fc34..79f06c647 100644 --- a/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImport.cc +++ b/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImport.cc @@ -30,7 +30,7 @@ #include -static void run_test (tl::TestBase *_this, const char *lef_dir, const char *filename, const char *au, bool priv = true) +static db::LEFDEFReaderOptions default_options () { db::LEFDEFReaderOptions tc; tc.set_via_geometry_datatype (0); @@ -45,6 +45,12 @@ static void run_test (tl::TestBase *_this, const char *lef_dir, const char *file tc.set_labels_suffix (".LABEL"); tc.set_blockages_datatype (4); tc.set_blockages_suffix (".BLK"); + + return tc; +} + +static void run_test (tl::TestBase *_this, const char *lef_dir, const char *filename, const char *au, const db::LEFDEFReaderOptions &tc, bool priv = true) +{ db::LEFDEFLayerDelegate ld (&tc); db::Manager m; @@ -150,91 +156,107 @@ static void run_test (tl::TestBase *_this, const char *lef_dir, const char *file TEST(1) { - run_test (_this, "lef1", "lef:in.lef", 0); + run_test (_this, "lef1", "lef:in.lef", 0, default_options ()); } TEST(2) { - run_test (_this, "lef2", "lef:in.lef", "au.oas.gz"); + run_test (_this, "lef2", "lef:in.lef", "au.oas.gz", default_options ()); } TEST(3) { - run_test (_this, "lef3", "lef:in.lef", "au.oas.gz"); + run_test (_this, "lef3", "lef:in.lef", "au.oas.gz", default_options ()); } TEST(4) { - run_test (_this, "lef4", "lef:in.lef", 0); + run_test (_this, "lef4", "lef:in.lef", 0, default_options ()); } TEST(5) { - run_test (_this, "lef5", "lef:in.lef", 0); + run_test (_this, "lef5", "lef:in.lef", 0, default_options ()); } TEST(6) { - run_test (_this, "lef6", "lef:in.lef", 0); + run_test (_this, "lef6", "lef:in.lef", 0, default_options ()); } TEST(7) { - run_test (_this, "lef7", "lef:in_tech.lef+lef:in.lef", "au.oas.gz"); + run_test (_this, "lef7", "lef:in_tech.lef+lef:in.lef", "au.oas.gz", default_options ()); } TEST(10) { - run_test (_this, "def1", "lef:in.lef+def:in.def", "au.oas.gz"); + run_test (_this, "def1", "lef:in.lef+def:in.def", "au.oas.gz", default_options ()); } TEST(11) { - run_test (_this, "def2", "lef:0.lef+lef:1.lef+def:in.def.gz", "au.oas.gz"); + run_test (_this, "def2", "lef:0.lef+lef:1.lef+def:in.def.gz", "au.oas.gz", default_options ()); } TEST(12) { - run_test (_this, "def3", "lef:in.lef+def:in.def", "au.oas.gz"); + run_test (_this, "def3", "lef:in.lef+def:in.def", "au.oas.gz", default_options ()); } TEST(13) { - run_test (_this, "def4", "lef:in.lef+def:in.def", "au.oas.gz"); + run_test (_this, "def4", "lef:in.lef+def:in.def", "au.oas.gz", default_options ()); } TEST(14) { - run_test (_this, "def5", "lef:in.lef+def:in.def", "au.oas.gz"); + run_test (_this, "def5", "lef:in.lef+def:in.def", "au.oas.gz", default_options ()); } TEST(15) { - run_test (_this, "def6", "lef:cells.lef+lef:tech.lef+def:in.def.gz", "au.oas.gz"); + run_test (_this, "def6", "lef:cells.lef+lef:tech.lef+def:in.def.gz", "au.oas.gz", default_options ()); } TEST(16) { - run_test (_this, "def7", "lef:cells.lef+lef:tech.lef+def:in.def.gz", "au.oas.gz"); + run_test (_this, "def7", "lef:cells.lef+lef:tech.lef+def:in.def.gz", "au.oas.gz", default_options ()); } TEST(17) { - run_test (_this, "def8", "lef:tech.lef+def:in.def", "au.oas.gz"); + run_test (_this, "def8", "lef:tech.lef+def:in.def", "au.oas.gz", default_options ()); } TEST(18) { - run_test (_this, "def9", "lef:tech.lef+lef:cells_modified.lef+def:in.def", "au.oas.gz"); + run_test (_this, "def9", "lef:tech.lef+lef:cells_modified.lef+def:in.def", "au.oas.gz", default_options ()); } TEST(19) { - run_test (_this, "def10", "def:in.def", "au.oas.gz"); + run_test (_this, "def10", "def:in.def", "au.oas.gz", default_options ()); } TEST(20) { - run_test (_this, "issue-172", "lef:in.lef+def:in.def", "au.oas.gz", false); + run_test (_this, "issue-172", "lef:in.lef+def:in.def", "au.oas.gz", default_options (), false); +} + +TEST(21) +{ + db::LEFDEFReaderOptions opt = default_options (); + opt.set_produce_pin_names (true); + opt.set_pin_property_name (2); + run_test (_this, "issue-489", "lef:in.lef+def:in.def", "au.oas", opt, false); +} + +TEST(22) +{ + db::LEFDEFReaderOptions opt = default_options (); + opt.set_produce_pin_names (true); + opt.set_pin_property_name (3); + run_test (_this, "issue-489b", "lef:in_tech.lef+lef:in.lef", "au.oas.gz", opt, false); } diff --git a/testdata/lefdef/issue-489/au.oas b/testdata/lefdef/issue-489/au.oas new file mode 100644 index 000000000..436fa32c6 Binary files /dev/null and b/testdata/lefdef/issue-489/au.oas differ diff --git a/testdata/lefdef/issue-489/in.def b/testdata/lefdef/issue-489/in.def new file mode 100644 index 000000000..6220e6ab0 --- /dev/null +++ b/testdata/lefdef/issue-489/in.def @@ -0,0 +1,34 @@ +VERSION 5.7 ; +DIVIDERCHAR "/" ; +BUSBITCHARS "[]" ; +DESIGN test ; +UNITS DISTANCE MICRONS 2000 ; + +DIEAREA ( 0 0 ) ( 37520 7840 ) ; + +PINS 12 ; +- VDD + NET VDD + SPECIAL + DIRECTION INOUT + USE POWER + + LAYER M2 ( -320 0 ) ( 320 37520 ) ++ FIXED ( 37520 3920 ) W ; +- VSS + NET VSS + SPECIAL + DIRECTION INOUT + USE GROUND + + PORT + + LAYER M2 ( -18760 0 ) ( 18760 640 ) ++ FIXED ( 18760 -320 ) N + + PORT + + LAYER M2 ( -18760 0 ) ( 18760 640 ) ++ FIXED ( 18760 8160 ) S + ; +END PINS + +SPECIALNETS 4 ; +- VSS ( * VSS ) ++ ROUTED M2 640 + SHAPE FOLLOWPIN ( 0 0 ) ( 37520 * ) +NEW M2 640 + SHAPE FOLLOWPIN ( 0 7840 ) ( 37520 * ) + + USE GROUND + ; +- VDD ( * VDD ) ++ ROUTED M2 640 + SHAPE FOLLOWPIN ( 0 3920 ) ( 37520 * ) + + USE POWER + ; +END SPECIALNETS +END DESIGN diff --git a/testdata/lefdef/issue-489/in.lef b/testdata/lefdef/issue-489/in.lef new file mode 100644 index 000000000..3e497ca36 --- /dev/null +++ b/testdata/lefdef/issue-489/in.lef @@ -0,0 +1,63 @@ +VERSION 5.7 ; + +BUSBITCHARS "[]" ; +DIVIDERCHAR "/" ; +UNITS + DATABASE MICRONS 1000 ; +END UNITS + +MANUFACTURINGGRID 0.002 ; + +USEMINSPACING OBS OFF ; + +LAYER overlap + TYPE OVERLAP ; +END overlap + +LAYER contact + TYPE CUT ; +END contact + +LAYER metal1 + TYPE ROUTING ; + DIRECTION HORIZONTAL ; +END metal1 + +LAYER via1 + TYPE CUT ; +END via1 + +LAYER metal2 + TYPE ROUTING ; + DIRECTION VERTICAL ; +END metal2 + +LAYER via2 + TYPE CUT ; +END via2 + +LAYER metal3 + TYPE ROUTING ; + DIRECTION HORIZONTAL ; +END metal3 + +LAYER via3 + TYPE CUT ; +END via3 + +LAYER metal4 + TYPE ROUTING ; + DIRECTION VERTICAL ; +END metal4 + +LAYER via4 + TYPE CUT ; +END via4 + +LAYER metal5 + TYPE ROUTING ; + DIRECTION HORIZONTAL ; +END metal5 + + +END LIBRARY diff --git a/testdata/lefdef/issue-489b/au.oas.gz b/testdata/lefdef/issue-489b/au.oas.gz new file mode 100644 index 000000000..e0b7b8e99 Binary files /dev/null and b/testdata/lefdef/issue-489b/au.oas.gz differ diff --git a/testdata/lefdef/issue-489b/in.lef b/testdata/lefdef/issue-489b/in.lef new file mode 100644 index 000000000..857ae0d04 --- /dev/null +++ b/testdata/lefdef/issue-489b/in.lef @@ -0,0 +1,23 @@ +MACRO dummy + CLASS CORE ; + FOREIGN dummy 0.000 0.000 ; + ORIGIN 0.000 0.000 ; + SIZE 0.384 BY 0.480 ; + SYMMETRY X Y ; + SITE BLABLA ; + PROPERTY LEF58_EDGETYPE " + EDGETYPE LEFT L ; + EDGETYPE RIGHT R ; + " ; + PIN Z + ANTENNADIFFAREA 0.009048 ; + DIRECTION OUTPUT ; + PORT + LAYER M1 ; + RECT 0.306 0.357 0.318 0.403 ; + RECT 0.318 0.115 0.352 0.403 ; + VIA 0.336 0.167 square ; + VIA 0.336 0.351 square ; + END + END Z +END dummy diff --git a/testdata/lefdef/issue-489b/in_tech.lef b/testdata/lefdef/issue-489b/in_tech.lef new file mode 100644 index 000000000..eb0e75b0b --- /dev/null +++ b/testdata/lefdef/issue-489b/in_tech.lef @@ -0,0 +1,36 @@ +LAYER OD + TYPE IMPLANT ; +END OD +LAYER VTS_N + TYPE IMPLANT ; +END VTS_N +LAYER VTS_P + TYPE IMPLANT ; +END VTS_P +LAYER M0OD + TYPE IMPLANT ; +END M0OD +LAYER M0PO + TYPE MASTERSLICE ; +END M0PO +LAYER VIA0 + TYPE CUT ; +END VIA0 +LAYER M1 + TYPE MASTERSLICE ; +END M1 +LAYER VIA1 + TYPE CUT ; +END VIA1 +LAYER M2 + TYPE MASTERSLICE ; +END M2 + +VIA square + LAYER M0PO ; + RECT -0.006 -0.006 0.006 0.006 ; + LAYER VIA0 ; + RECT -0.006 -0.006 0.006 0.006 ; + LAYER M1 ; + RECT -0.006 -0.006 0.006 0.006 ; +END square diff --git a/testdata/ruby/dbReaders.rb b/testdata/ruby/dbReaders.rb index 524191687..4c89cc871 100644 --- a/testdata/ruby/dbReaders.rb +++ b/testdata/ruby/dbReaders.rb @@ -178,6 +178,147 @@ class DBReaders_TestClass < TestBase end + # LEF/DEF Options + def test_lefdef_options + + conf = RBA::LEFDEFReaderConfiguration::new + lm = RBA::LayerMap::new + lm.map(RBA::LayerInfo::new(1, 0), 2, RBA::LayerInfo::new(42, 17)) + conf.layer_map = lm + + opt = RBA::LoadLayoutOptions::new + opt.lefdef_config = conf + assert_equal(opt.lefdef_config.layer_map.to_string, "1/0 : 42/17\n") + assert_equal(opt.dup.lefdef_config.layer_map.to_string, "1/0 : 42/17\n") + + assert_equal(conf.layer_map.to_string, "1/0 : 42/17\n") + + conf.create_other_layers = false + assert_equal(conf.create_other_layers, false) + conf.create_other_layers = true + assert_equal(conf.create_other_layers, true) + + conf.dbu = 2.5 + assert_equal(conf.dbu, 2.5) + + assert_equal(conf.net_property_name, 1) + conf.net_property_name = "x" + assert_equal(conf.net_property_name, "x") + conf.net_property_name = 2 + assert_equal(conf.net_property_name, 2) + conf.net_property_name = nil + assert_equal(conf.net_property_name, nil) + + assert_equal(conf.pin_property_name, nil) + conf.pin_property_name = "y" + assert_equal(conf.pin_property_name, "y") + conf.pin_property_name = 3 + assert_equal(conf.pin_property_name, 3) + conf.pin_property_name = nil + assert_equal(conf.pin_property_name, nil) + + assert_equal(conf.instance_property_name, 1) + conf.instance_property_name = "z" + assert_equal(conf.instance_property_name, "z") + conf.instance_property_name = 4 + assert_equal(conf.instance_property_name, 4) + conf.instance_property_name = nil + assert_equal(conf.instance_property_name, nil) + + assert_equal(conf.produce_cell_outlines, true) + conf.produce_cell_outlines = false + assert_equal(conf.produce_cell_outlines, false) + + assert_equal(conf.cell_outline_layer, "OUTLINE") + conf.cell_outline_layer = "17/1" + assert_equal(conf.cell_outline_layer, "17/1") + + assert_equal(conf.produce_placement_blockages, true) + conf.produce_placement_blockages = false + assert_equal(conf.produce_placement_blockages, false) + + assert_equal(conf.placement_blockage_layer, "PLACEMENT_BLK") + conf.placement_blockage_layer = "17/2" + assert_equal(conf.placement_blockage_layer, "17/2") + + assert_equal(conf.produce_via_geometry, true) + conf.produce_via_geometry = false + assert_equal(conf.produce_via_geometry, false) + + assert_equal(conf.via_geometry_suffix, "") + conf.via_geometry_suffix = "XVIA" + assert_equal(conf.via_geometry_suffix, "XVIA") + + assert_equal(conf.via_geometry_datatype, 0) + conf.via_geometry_datatype = 17 + assert_equal(conf.via_geometry_datatype, 17) + + assert_equal(conf.produce_pins, true) + conf.produce_pins = false + assert_equal(conf.produce_pins, false) + + assert_equal(conf.pins_suffix, ".PIN") + conf.pins_suffix = "XPIN" + assert_equal(conf.pins_suffix, "XPIN") + + assert_equal(conf.pins_datatype, 2) + conf.pins_datatype = 18 + assert_equal(conf.pins_datatype, 18) + + assert_equal(conf.produce_obstructions, true) + conf.produce_obstructions = false + assert_equal(conf.produce_obstructions, false) + + assert_equal(conf.obstructions_suffix, ".OBS") + conf.obstructions_suffix = "XOBS" + assert_equal(conf.obstructions_suffix, "XOBS") + + assert_equal(conf.obstructions_datatype, 3) + conf.obstructions_datatype = 19 + assert_equal(conf.obstructions_datatype, 19) + + assert_equal(conf.produce_blockages, true) + conf.produce_blockages = false + assert_equal(conf.produce_blockages, false) + + assert_equal(conf.blockages_suffix, ".BLK") + conf.blockages_suffix = "XBLK" + assert_equal(conf.blockages_suffix, "XBLK") + + assert_equal(conf.blockages_datatype, 4) + conf.blockages_datatype = 20 + assert_equal(conf.blockages_datatype, 20) + + assert_equal(conf.produce_labels, true) + conf.produce_labels = false + assert_equal(conf.produce_labels, false) + + assert_equal(conf.labels_suffix, ".LABEL") + conf.labels_suffix = "XLABEL" + assert_equal(conf.labels_suffix, "XLABEL") + + assert_equal(conf.labels_datatype, 1) + conf.labels_datatype = 21 + assert_equal(conf.labels_datatype, 21) + + assert_equal(conf.produce_routing, true) + conf.produce_routing = false + assert_equal(conf.produce_routing, false) + + assert_equal(conf.routing_suffix, "") + conf.routing_suffix = "XROUT" + assert_equal(conf.routing_suffix, "XROUT") + + assert_equal(conf.routing_datatype, 0) + conf.routing_datatype = 22 + assert_equal(conf.routing_datatype, 22) + + assert_equal(conf.lef_files.join(","), "") + conf.lef_files = [ "u.lef", "v.lef" ] + assert_equal(conf.lef_files.join(","), "u.lef,v.lef") + + end + # MAG Options def test_mag_options