diff --git a/src/buddies/src/bd/bdReaderOptions.cc b/src/buddies/src/bd/bdReaderOptions.cc index e10ab80dc..3d3b9f75e 100644 --- a/src/buddies/src/bd/bdReaderOptions.cc +++ b/src/buddies/src/bd/bdReaderOptions.cc @@ -118,6 +118,7 @@ GenericReaderOptions::GenericReaderOptions () m_lefdef_read_lef_with_def = load_options.get_option_by_name ("lefdef_config.read_lef_with_def").to_bool (); m_lefdef_separate_groups = load_options.get_option_by_name ("lefdef_config.separate_groups").to_bool (); + m_lefdef_joined_paths = load_options.get_option_by_name ("lefdef_config.joined_paths").to_bool (); m_lefdef_map_file = load_options.get_option_by_name ("lefdef_config.map_file").to_string (); m_lefdef_macro_resolution_mode = load_options.get_option_by_name ("lefdef_config.macro_resolution_mode").to_int (); } @@ -441,6 +442,11 @@ GenericReaderOptions::add_options (tl::CommandLineOptions &cmd) "This option is used together with '--" + m_long_prefix + "lefdef-produce-regions'. If given, the region polygons will be put " "into a cell hierarchy where the cells indicate the region groups.\n" ) + << tl::arg (group + + "#--" + m_long_prefix + "lefdef-joined-paths", &m_lefdef_joined_paths, "Specifies to produce joined paths for wires", + "If given, multi-segment paths are created for wires if possible (this will fail for 45 degree segments for example). " + "By default, individual straight segments will be produced." + ) << tl::arg (group + "#!--" + m_long_prefix + "lefdef-dont-produce-via-geometry", &m_lefdef_produce_via_geometry, "Skips vias when producing geometry", "If this option is given, no via geometry will be produced." @@ -793,6 +799,7 @@ GenericReaderOptions::configure (db::LoadLayoutOptions &load_options) load_options.set_option_by_name ("lefdef_config.lef_files", tl::Variant (m_lefdef_lef_files.begin (), m_lefdef_lef_files.end ())); load_options.set_option_by_name ("lefdef_config.read_lef_with_def", m_lefdef_read_lef_with_def); load_options.set_option_by_name ("lefdef_config.separate_groups", m_lefdef_separate_groups); + load_options.set_option_by_name ("lefdef_config.joined_paths", m_lefdef_joined_paths); load_options.set_option_by_name ("lefdef_config.map_file", m_lefdef_map_file); load_options.set_option_by_name ("lefdef_config.macro_resolution_mode", m_lefdef_macro_resolution_mode); load_options.set_option_by_name ("lefdef_config.macro_resolution_mode", m_lefdef_macro_resolution_mode); diff --git a/src/buddies/src/bd/bdReaderOptions.h b/src/buddies/src/bd/bdReaderOptions.h index a03b94481..1ca6e8dcd 100644 --- a/src/buddies/src/bd/bdReaderOptions.h +++ b/src/buddies/src/bd/bdReaderOptions.h @@ -185,6 +185,7 @@ private: std::vector m_lefdef_lef_files; bool m_lefdef_read_lef_with_def; bool m_lefdef_separate_groups; + bool m_lefdef_joined_paths; std::string m_lefdef_map_file; int m_lefdef_macro_resolution_mode; std::vector m_lefdef_lef_layout_files; diff --git a/src/plugins/streamers/lefdef/db_plugin/dbDEFImporter.cc b/src/plugins/streamers/lefdef/db_plugin/dbDEFImporter.cc index 989081b88..c72efceee 100644 --- a/src/plugins/streamers/lefdef/db_plugin/dbDEFImporter.cc +++ b/src/plugins/streamers/lefdef/db_plugin/dbDEFImporter.cc @@ -424,25 +424,25 @@ DEFImporter::produce_routing_geometry (db::Cell &design, const Polygon *style, u } } -#if 0 - // single path - db::Path p (pt0, pt + 1, wxy, be, ee, false); - if (prop_id != 0) { - design.shapes (layer).insert (db::object_with_properties (p, prop_id)); - } else { - design.shapes (layer).insert (p); - } -#else - // multipart paths - for (std::vector::const_iterator i = pt0; i != pt; ++i) { - db::Path p (i, i + 2, wxy, i == pt0 ? be : wxy / 2, i + 1 != pt ? wxy / 2 : ee, false); + if (options ().joined_paths ()) { + // single path + db::Path p (pt0, pt + 1, wxy, be, ee, false); if (prop_id != 0) { design.shapes (layer).insert (db::object_with_properties (p, prop_id)); } else { design.shapes (layer).insert (p); } + } else { + // multipart paths + for (std::vector::const_iterator i = pt0; i != pt; ++i) { + db::Path p (i, i + 2, wxy, i == pt0 ? be : wxy / 2, i + 1 != pt ? wxy / 2 : ee, false); + if (prop_id != 0) { + design.shapes (layer).insert (db::object_with_properties (p, prop_id)); + } else { + design.shapes (layer).insert (p); + } + } } -#endif was_path_before = true; diff --git a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc index 031b34726..dc706400e 100644 --- a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc +++ b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc @@ -515,6 +515,7 @@ LEFDEFReaderOptions::LEFDEFReaderOptions () m_special_routing_suffix (""), m_special_routing_datatype (0), m_separate_groups (false), + m_joined_paths (false), m_map_file (), m_macro_resolution_mode (0), m_read_lef_with_def (true), @@ -592,6 +593,7 @@ LEFDEFReaderOptions &LEFDEFReaderOptions::operator= (const LEFDEFReaderOptions & m_special_routing_datatype = d.m_special_routing_datatype; m_special_routing_datatypes = d.m_special_routing_datatypes; m_separate_groups = d.m_separate_groups; + m_joined_paths = d.m_joined_paths; m_map_file = d.m_map_file; m_macro_resolution_mode = d.m_macro_resolution_mode; m_lef_files = d.m_lef_files; diff --git a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.h b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.h index 84fdc7525..5b9518d1e 100644 --- a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.h +++ b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.h @@ -874,6 +874,16 @@ public: m_separate_groups = f; } + bool joined_paths () const + { + return m_joined_paths; + } + + void set_joined_paths (bool f) + { + m_joined_paths = f; + } + const std::string &map_file () const { return m_map_file; @@ -1009,6 +1019,7 @@ private: std::map m_special_routing_suffixes; std::map m_special_routing_datatypes; bool m_separate_groups; + bool m_joined_paths; std::string m_map_file; unsigned int m_macro_resolution_mode; bool m_read_lef_with_def; diff --git a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFPlugin.cc b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFPlugin.cc index 758c19725..4d551936f 100644 --- a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFPlugin.cc +++ b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFPlugin.cc @@ -424,6 +424,7 @@ class LEFDEFFormatDeclaration tl::make_member (&LEFDEFReaderOptions::read_lef_with_def, &LEFDEFReaderOptions::set_read_lef_with_def, "read-lef-with-def") + tl::make_member (&LEFDEFReaderOptions::macro_resolution_mode, &LEFDEFReaderOptions::set_macro_resolution_mode, "macro-resolution-mode", MacroResolutionModeConverter ()) + tl::make_member (&LEFDEFReaderOptions::separate_groups, &LEFDEFReaderOptions::set_separate_groups, "separate-groups") + + tl::make_member (&LEFDEFReaderOptions::joined_paths, &LEFDEFReaderOptions::set_joined_paths, "joined-paths") + tl::make_member (&LEFDEFReaderOptions::map_file, &LEFDEFReaderOptions::set_map_file, "map-file") ); } diff --git a/src/plugins/streamers/lefdef/db_plugin/gsiDeclDbLEFDEF.cc b/src/plugins/streamers/lefdef/db_plugin/gsiDeclDbLEFDEF.cc index 6c1700eb6..1d2e685f1 100644 --- a/src/plugins/streamers/lefdef/db_plugin/gsiDeclDbLEFDEF.cc +++ b/src/plugins/streamers/lefdef/db_plugin/gsiDeclDbLEFDEF.cc @@ -880,6 +880,20 @@ gsi::Class decl_lefdef_config ("db", "LEFDEFReaderConfi "\n" "This property has been added in version 0.27.\n" ) + + gsi::method ("joined_paths", &db::LEFDEFReaderOptions::joined_paths, + "@brief Gets a value indicating whether to create joined paths for wires.\n" + "If this property is set to true, wires are represented by multi-segment paths as far as possible " + "(this will fail for 45 degree path segments for example). By defauls, wires are represented " + "by multiple straight segments.\n" + "\n" + "This property has been added in version 0.28.8.\n" + ) + + gsi::method ("joined_paths=", &db::LEFDEFReaderOptions::set_joined_paths, gsi::arg ("flag"), + "@brief Sets a value indicating whether to create joined paths for wires.\n" + "See \\joined_paths for details about this property.\n" + "\n" + "This property has been added in version 0.28.8.\n" + ) + gsi::method ("map_file", &db::LEFDEFReaderOptions::map_file, "@brief Gets the layer map file to use.\n" "If a layer map file is given, the reader will pull the layer mapping from this file. The layer mapping rules " diff --git a/src/plugins/streamers/lefdef/lay_plugin/LEFDEFTechnologyComponentEditor.ui b/src/plugins/streamers/lefdef/lay_plugin/LEFDEFTechnologyComponentEditor.ui index d00f96cf6..2909c8638 100644 --- a/src/plugins/streamers/lefdef/lay_plugin/LEFDEFTechnologyComponentEditor.ui +++ b/src/plugins/streamers/lefdef/lay_plugin/LEFDEFTechnologyComponentEditor.ui @@ -6,7 +6,7 @@ 0 0 - 638 + 664 868 @@ -35,7 +35,7 @@ - 2 + 0 @@ -425,34 +425,21 @@ 0 - + Via cell name prefix - - - - - 0 - 0 - - + + - µm + Produce a parent cell per group - - - - Groups - - - - + Qt::Horizontal @@ -465,41 +452,7 @@ - - - - Produce a parent cell per group - - - - - - - Layout DBU - - - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - - + QFrame::NoFrame @@ -523,6 +476,67 @@ + + + + + 0 + 0 + + + + µm + + + + + + + + 0 + 0 + + + + + + + + Layout DBU + + + + + + + Groups + + + + + + + Join paths + + + + + + + Produce multi-segment wire paths + + + + + + + + 0 + 0 + + + + @@ -598,7 +612,6 @@ - 50 false false @@ -773,7 +786,6 @@ - 50 false false false @@ -1011,8 +1023,8 @@ Otherwise it's looked up relative to the LEF or DEF file. 0 0 - 609 - 591 + 679 + 582 @@ -1595,6 +1607,7 @@ type ... move_lef_files_down dbu separate_groups + joined_paths prefix_via_cellname produce_net_names net_prop_name diff --git a/src/plugins/streamers/lefdef/lay_plugin/layLEFDEFImportDialogs.cc b/src/plugins/streamers/lefdef/lay_plugin/layLEFDEFImportDialogs.cc index 4715181c6..e721d4458 100644 --- a/src/plugins/streamers/lefdef/lay_plugin/layLEFDEFImportDialogs.cc +++ b/src/plugins/streamers/lefdef/lay_plugin/layLEFDEFImportDialogs.cc @@ -521,6 +521,7 @@ LEFDEFReaderOptionsEditor::commit (db::FormatSpecificReaderOptions *options, con data->set_lef_labels_suffix (tl::to_string (suffix_lef_labels->text ())); data->set_lef_labels_datatype (datatype_lef_labels->text ().toInt ()); data->set_separate_groups (separate_groups->isChecked ()); + data->set_joined_paths (joined_paths->isChecked ()); data->set_read_lef_with_def (read_lef_with_def->isChecked ()); data->set_map_file (tl::to_string (mapfile_path->text ())); data->set_macro_resolution_mode (macro_resolution_mode->currentIndex ()); @@ -595,6 +596,7 @@ LEFDEFReaderOptionsEditor::setup (const db::FormatSpecificReaderOptions *options suffix_lef_labels->setText (tl::to_qstring (data->lef_labels_suffix ())); datatype_lef_labels->setText (QString::number (data->lef_labels_datatype ())); separate_groups->setChecked (data->separate_groups ()); + joined_paths->setChecked (data->joined_paths ()); read_lef_with_def->setChecked (data->read_lef_with_def ()); mapfile_path->setText (tl::to_qstring (data->map_file ())); layer_map_mode->setCurrentIndex (data->map_file ().empty () ? 1 : 0); diff --git a/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImportTests.cc b/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImportTests.cc index 0dcc0c646..142b1d92d 100644 --- a/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImportTests.cc +++ b/src/plugins/streamers/lefdef/unit_tests/dbLEFDEFImportTests.cc @@ -976,3 +976,13 @@ TEST(206_lef_spacing) run_test (_this, "issue-1282", "read:a.lef", 0, default_options (), false); } +// issue-1345 +TEST(207_joined_paths) +{ + db::LEFDEFReaderOptions lefdef_opt = default_options (); + lefdef_opt.set_joined_paths (true); + run_test (_this, "issue-1345", "lef:in.lef+def:in.def", "au.oas.gz", lefdef_opt, false); + + run_test (_this, "issue-1345", "lef:in.lef+def:in.def", "au-nojoin.oas.gz", default_options (), false); +} + diff --git a/testdata/lefdef/issue-1345/au-nojoin.oas.gz b/testdata/lefdef/issue-1345/au-nojoin.oas.gz new file mode 100644 index 000000000..21816fed7 Binary files /dev/null and b/testdata/lefdef/issue-1345/au-nojoin.oas.gz differ diff --git a/testdata/lefdef/issue-1345/au.oas.gz b/testdata/lefdef/issue-1345/au.oas.gz new file mode 100644 index 000000000..92324dc5c Binary files /dev/null and b/testdata/lefdef/issue-1345/au.oas.gz differ diff --git a/testdata/lefdef/issue-1345/in.def b/testdata/lefdef/issue-1345/in.def new file mode 100644 index 000000000..423d5a4be --- /dev/null +++ b/testdata/lefdef/issue-1345/in.def @@ -0,0 +1,16 @@ +VERSION 5.6 ; +NAMESCASESENSITIVE ON ; +DIVIDERCHAR "/" ; +BUSBITCHARS "<>" ; +DESIGN SMALL ; +UNITS DISTANCE MICRONS 100 ; + +DIEAREA ( -30 -30 ) ( 1030 1030 ) ; + +NETS 1 ; +- TOP ++ ROUTED M1 ( 0 0 ) ( 1000 * ) ( * 1000 ) M2_M1 + NEW M2 ( 1000 1000 ) ( 0 * ) ( 0 0 ) ; +END NETS + +END DESIGN diff --git a/testdata/lefdef/issue-1345/in.lef b/testdata/lefdef/issue-1345/in.lef new file mode 100644 index 000000000..a0359f764 --- /dev/null +++ b/testdata/lefdef/issue-1345/in.lef @@ -0,0 +1,40 @@ +VERSION 5.7 ; +NAMESCASESENSITIVE ON ; +BUSBITCHARS "[]" ; +DIVIDERCHAR "/" ; +UNITS + DATABASE MICRONS 1000 ; +END UNITS + +USEMINSPACING OBS ON ; +USEMINSPACING PIN OFF ; +CLEARANCEMEASURE EUCLIDEAN ; + +MANUFACTURINGGRID 0.05 ; + +LAYER M1 + TYPE ROUTING ; + DIRECTION HORIZONTAL ; + WIDTH 0.2 ; +END M1 + +LAYER V2 + TYPE CUT ; +END V2 + +LAYER M2 + TYPE ROUTING ; + DIRECTION VERTICAL ; + WIDTH 0.2 ; +END M2 + +VIA M2_M1 DEFAULT + LAYER M1 ; + RECT -0.300 -0.300 0.300 0.300 ; + LAYER V2 ; + RECT -0.200 -0.200 0.200 0.200 ; + LAYER M2 ; + RECT -0.300 -0.300 0.300 0.300 ; +END M2_M1 + +END LIBRARY