Refinement

* Option added to buddy tools ("lefdef-skip-duplicate-macros")
* Properly adding to GSI
* Tests for GSI binding in LoadLayoutOptions
This commit is contained in:
Matthias Koefferlein 2026-08-05 18:29:23 +02:00
parent a654c707b3
commit 52a96a618c
4 changed files with 27 additions and 6 deletions

View File

@ -112,6 +112,7 @@ GenericReaderOptions::GenericReaderOptions ()
m_lefdef_produce_special_routing = load_options.get_option_by_name ("lefdef_config.produce_special_routing").to_bool ();
m_lefdef_special_routing_suffix = load_options.get_option_by_name ("lefdef_config.special_routing_suffix_str").to_string ();
m_lefdef_special_routing_datatype = load_options.get_option_by_name ("lefdef_config.special_routing_datatype_str").to_string ();
m_lefdef_skip_duplicate_macros = load_options.get_option_by_name ("lefdef_config.skip_duplicate_macros").to_bool ();
tl::Variant lef_files = load_options.get_option_by_name ("lefdef_config.lef_files");
for (tl::Variant::const_iterator i = lef_files.begin (); i != lef_files.end (); ++i) {
@ -686,6 +687,15 @@ GenericReaderOptions::add_options (tl::CommandLineOptions &cmd)
"See also '--" + m_long_prefix + "lefdef-read-lef-with-def' for an option to implicitly read all LEF files in the same "
"place than the DEF file.\n"
)
<< tl::arg (group +
"#--" + m_long_prefix + "lefdef-skip-duplicate-macros", &m_lefdef_skip_duplicate_macros, "Skip duplicate LEF macros",
"This option applies when reading DEF files.\n"
"\n"
"If this option is present, having the same macro in different LEF files is a warning rather than being an error. "
"In that case, the first occurance is used. Use this option with care, as it may render invalid layouts when "
"the versions of the macro are defined differently. It is intended for cases, when macros with the same name are guaranteed "
"to be identical. KLayout does not check, if that is actually the case."
)
;
}
@ -814,6 +824,7 @@ GenericReaderOptions::configure (db::LoadLayoutOptions &load_options)
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);
load_options.set_option_by_name ("lefdef_config.paths_relative_to_cwd", true);
load_options.set_option_by_name ("lefdef_config.skip_duplicate_macros", m_lefdef_skip_duplicate_macros);
tl::Variant lef_layout_files = tl::Variant::empty_list ();
for (std::vector<std::string>::const_iterator l = m_lefdef_lef_layout_files.begin (); l != m_lefdef_lef_layout_files.end (); ++l) {

View File

@ -189,6 +189,7 @@ private:
std::vector<std::string> m_lefdef_map_files;
int m_lefdef_macro_resolution_mode;
std::vector<std::string> m_lefdef_lef_layout_files;
bool m_lefdef_skip_duplicate_macros;
};
/**

View File

@ -968,17 +968,22 @@ gsi::Class<db::LEFDEFReaderOptions> decl_lefdef_config ("db", "LEFDEFReaderConfi
"This property has been added in version 0.27. The ability to supply multiple files has been added in version 0.30.6.\n"
) +
gsi::method ("skip_duplicate_macros", &db::LEFDEFReaderOptions::skip_duplicate_macros,
"@brief Get the setting for wether to skip douplicate LEF Macro definitions.\n"
"This property describes what to do when while reading LEF files douplicate MACRO definitions are "
"discovered. Normally an error is issued and the import fails. When setting this flag to true a"
"warning is issued and the macro definition is skipped. So always the first definition of MACRO is used.\n"
"@brief Gets a value indicating wether to skip duplicate LEF Macro definitions.\n"
"If this property is 'true', having the same macro in different LEF files is a warning rather than being an error. "
"In that case, the first occurance is used. Use this option with care, as it may render invalid layouts when "
"the versions of the macro are defined differently. It is intended for cases, when macros with the same name are guaranteed "
"to be identical. KLayout does not check, if that is actually the case."
"\n"
"The default is 'false' (duplicate macro names are an error).\n"
"\n"
"This property has been added in version 0.30.x.\n"
) +
gsi::method ("skip_duplicate_macros=", &db::LEFDEFReaderOptions::set_skip_duplicate_macros, gsi::arg ("skip_duplicate_macros"),
"@brief Sets mode how to handle douplicate MARCO definitions.\n"
"@brief Sets a value indicating wether to skip duplicate LEF Macro definitions.\n"
"\n"
"This property has been added in version 0.30.x.\n"
"See \\skip_duplicate_macros for a description of this property.\n"
"\n"
"This property has been added in version 0.30.11.\n"
) +
gsi::method ("macro_resolution_mode", &db::LEFDEFReaderOptions::macro_resolution_mode,
"@brief Gets the macro resolution mode (LEF macros into DEF).\n"

View File

@ -392,6 +392,10 @@ class DBReaders_TestClass < TestBase
conf.read_lef_with_def = false
assert_equal(conf.read_lef_with_def, false)
assert_equal(conf.skip_duplicate_macros, false)
conf.skip_duplicate_macros = true
assert_equal(conf.skip_duplicate_macros, true)
end
# MAG Options