mirror of https://github.com/KLayout/klayout.git
Added an option for not reading all LEF files along with DEF files, but only selected ones.
This commit is contained in:
parent
3da56815a0
commit
d7fab925a0
|
|
@ -349,7 +349,8 @@ LEFDEFReaderOptions::LEFDEFReaderOptions ()
|
|||
m_special_routing_datatype (0),
|
||||
m_separate_groups (false),
|
||||
m_map_file (),
|
||||
m_macro_resolution_mode (0)
|
||||
m_macro_resolution_mode (false),
|
||||
m_read_lef_with_def (true)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
|
@ -418,6 +419,7 @@ LEFDEFReaderOptions &LEFDEFReaderOptions::operator= (const LEFDEFReaderOptions &
|
|||
m_map_file = d.m_map_file;
|
||||
m_macro_resolution_mode = d.m_macro_resolution_mode;
|
||||
m_lef_files = d.m_lef_files;
|
||||
m_read_lef_with_def = d.m_read_lef_with_def;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -738,6 +738,16 @@ public:
|
|||
m_lef_files = lf;
|
||||
}
|
||||
|
||||
bool read_lef_with_def () const
|
||||
{
|
||||
return m_read_lef_with_def;
|
||||
}
|
||||
|
||||
void set_read_lef_with_def (bool f)
|
||||
{
|
||||
m_read_lef_with_def = f;
|
||||
}
|
||||
|
||||
bool separate_groups () const
|
||||
{
|
||||
return m_separate_groups;
|
||||
|
|
@ -829,6 +839,7 @@ private:
|
|||
bool m_separate_groups;
|
||||
std::string m_map_file;
|
||||
unsigned int m_macro_resolution_mode;
|
||||
bool m_read_lef_with_def;
|
||||
std::vector<std::string> m_lef_files;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -158,22 +158,26 @@ private:
|
|||
|
||||
// Additionally read all LEF files next to the DEF file
|
||||
|
||||
std::string input_dir = tl::absolute_path (m_stream.absolute_path ());
|
||||
if (lefdef_options->read_lef_with_def ()) {
|
||||
|
||||
if (tl::file_exists (input_dir)) {
|
||||
std::string input_dir = tl::absolute_path (m_stream.absolute_path ());
|
||||
|
||||
std::vector<std::string> entries = tl::dir_entries (input_dir);
|
||||
for (std::vector<std::string>::const_iterator e = entries.begin (); e != entries.end (); ++e) {
|
||||
if (tl::file_exists (input_dir)) {
|
||||
|
||||
if (is_lef_format (*e)) {
|
||||
std::vector<std::string> entries = tl::dir_entries (input_dir);
|
||||
for (std::vector<std::string>::const_iterator e = entries.begin (); e != entries.end (); ++e) {
|
||||
|
||||
std::string lp = tl::combine_path (input_dir, *e);
|
||||
if (is_lef_format (*e)) {
|
||||
|
||||
tl::SelfTimer timer (tl::verbosity () >= 21, tl::to_string (tr ("Reading LEF file: ")) + lp);
|
||||
std::string lp = tl::combine_path (input_dir, *e);
|
||||
|
||||
tl::InputStream lef_stream (lp);
|
||||
tl::log << tl::to_string (tr ("Reading")) << " " << lp;
|
||||
importer.read_lef (lef_stream, layout, state);
|
||||
tl::SelfTimer timer (tl::verbosity () >= 21, tl::to_string (tr ("Reading LEF file: ")) + lp);
|
||||
|
||||
tl::InputStream lef_stream (lp);
|
||||
tl::log << tl::to_string (tr ("Reading")) << " " << lp;
|
||||
importer.read_lef (lef_stream, layout, state);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -323,6 +327,7 @@ class LEFDEFFormatDeclaration
|
|||
tl::make_member (&LEFDEFReaderOptions::special_routing_datatype_str, &LEFDEFReaderOptions::set_special_routing_datatype_str, "special-routing-datatype-string") +
|
||||
tl::make_member (&LEFDEFReaderOptions::via_cellname_prefix, &LEFDEFReaderOptions::set_via_cellname_prefix, "via-cellname-prefix") +
|
||||
tl::make_member (&LEFDEFReaderOptions::begin_lef_files, &LEFDEFReaderOptions::end_lef_files, &LEFDEFReaderOptions::push_lef_file, "lef-files") +
|
||||
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::map_file, &LEFDEFReaderOptions::set_map_file, "map-file")
|
||||
|
|
|
|||
|
|
@ -712,6 +712,20 @@ gsi::Class<db::LEFDEFReaderOptions> decl_lefdef_config ("db", "LEFDEFReaderConfi
|
|||
gsi::method ("lef_files=", &db::LEFDEFReaderOptions::set_lef_files,
|
||||
"@brief Sets the list technology LEF files to additionally import\n"
|
||||
"See \\lef_files for details."
|
||||
) +
|
||||
gsi::method ("read_lef_with_def", &db::LEFDEFReaderOptions::read_lef_with_def,
|
||||
"@brief Gets a value indicating whether to read all LEF files in the same directory than the DEF file.\n"
|
||||
"If this property is set to true (the default), the DEF reader will automatically consume all LEF files "
|
||||
"next to the DEF file in addition to the LEF files specified with \\lef_files. If set to false, only the "
|
||||
"LEF files specified with \\lef_files will be read.\n"
|
||||
"\n"
|
||||
"This property has been added in version 0.27.\n"
|
||||
) +
|
||||
gsi::method ("read_lef_with_def=", &db::LEFDEFReaderOptions::set_read_lef_with_def, gsi::arg ("flag"),
|
||||
"@brief Sets a value indicating whether to read all LEF files in the same directory than the DEF file.\n"
|
||||
"See \\read_lef_with_def for details about this property.\n"
|
||||
"\n"
|
||||
"This property has been added in version 0.27.\n"
|
||||
),
|
||||
"@brief Detailed LEF/DEF reader options\n"
|
||||
"This class is a aggregate belonging to the \\LoadLayoutOptions class. It provides options for the LEF/DEF reader. "
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>LEF Files (specify what LEF files to use additionally)</string>
|
||||
<string>LEF Files</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
|
|
@ -189,6 +189,13 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="read_lef_with_def">
|
||||
<property name="text">
|
||||
<string>for DEF: also read all LEF files in the same directory than the DEF file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
|||
|
|
@ -452,6 +452,7 @@ LEFDEFReaderOptionsEditor::commit (db::FormatSpecificReaderOptions *options, con
|
|||
data->set_labels_suffix (tl::to_string (suffix_labels->text ()));
|
||||
data->set_labels_datatype (datatype_labels->text ().toInt ());
|
||||
data->set_separate_groups (separate_groups->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 (produce_lef_geo->isChecked () ? 0 : 2);
|
||||
|
||||
|
|
@ -514,6 +515,7 @@ LEFDEFReaderOptionsEditor::setup (const db::FormatSpecificReaderOptions *options
|
|||
suffix_labels->setText (tl::to_qstring (data->labels_suffix ()));
|
||||
datatype_labels->setText (QString::number (data->labels_datatype ()));
|
||||
separate_groups->setChecked (data->separate_groups ());
|
||||
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);
|
||||
produce_lef_geo->setChecked (data->macro_resolution_mode () == 0);
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include "dbLEFImporter.h"
|
||||
|
||||
#include "tlUnitTest.h"
|
||||
#include "dbTestSupport.h"
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
|
|
@ -527,3 +528,48 @@ TEST(114_lef_skips_end_library)
|
|||
run_test (_this, "lef-skips-end-library", "lef:in.lef+def:in.def", "au.oas", opt, false);
|
||||
}
|
||||
|
||||
TEST(200_lefdef_plugin)
|
||||
{
|
||||
db::Layout ly;
|
||||
|
||||
std::string fn_path (tl::testsrc ());
|
||||
fn_path += "/testdata/lefdef/masks-1/";
|
||||
|
||||
db::LEFDEFReaderOptions lefdef_opt = default_options ();
|
||||
lefdef_opt.set_map_file ("in.map");
|
||||
db::LoadLayoutOptions opt;
|
||||
opt.set_options (lefdef_opt);
|
||||
|
||||
{
|
||||
tl::InputStream is (fn_path + "in.def");
|
||||
db::Reader reader (is);
|
||||
reader.read (ly, opt);
|
||||
}
|
||||
|
||||
db::compare_layouts (_this, ly, fn_path + "au_plugin_def.oas.gz", db::WriteOAS);
|
||||
}
|
||||
|
||||
TEST(201_lefdef_plugin_explicit_lef)
|
||||
{
|
||||
db::Layout ly;
|
||||
|
||||
std::string fn_path (tl::testsrc ());
|
||||
fn_path += "/testdata/lefdef/masks-1/";
|
||||
|
||||
db::LEFDEFReaderOptions lefdef_opt = default_options ();
|
||||
lefdef_opt.set_map_file ("in.map");
|
||||
std::vector<std::string> lf;
|
||||
lf.push_back ("hidden/in_tech.lef");
|
||||
lefdef_opt.set_lef_files (lf);
|
||||
lefdef_opt.set_read_lef_with_def (false);
|
||||
db::LoadLayoutOptions opt;
|
||||
opt.set_options (lefdef_opt);
|
||||
|
||||
{
|
||||
tl::InputStream is (fn_path + "in.def");
|
||||
db::Reader reader (is);
|
||||
reader.read (ly, opt);
|
||||
}
|
||||
|
||||
db::compare_layouts (_this, ly, fn_path + "au_plugin_alt_lef.oas.gz", db::WriteOAS);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -312,6 +312,10 @@ TEST(1)
|
|||
EXPECT_EQ (options.lef_files ().size (), size_t (1));
|
||||
EXPECT_EQ (*options.begin_lef_files (), "ABC.lef");
|
||||
|
||||
EXPECT_EQ (options.read_lef_with_def (), true);
|
||||
options.set_read_lef_with_def (false);
|
||||
EXPECT_EQ (options.read_lef_with_def (), false);
|
||||
|
||||
|
||||
options.set_map_file ("ABC.map");
|
||||
EXPECT_EQ (options.map_file (), "ABC.map");
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,32 @@
|
|||
LAYER M0PO
|
||||
TYPE MASTERSLICE ;
|
||||
WIDTH 0.02 ;
|
||||
MASKS 2 ;
|
||||
END M0PO
|
||||
LAYER VIA0
|
||||
TYPE CUT ;
|
||||
MASKS 2 ;
|
||||
END VIA0
|
||||
LAYER M1
|
||||
TYPE MASTERSLICE ;
|
||||
WIDTH 0.024 ;
|
||||
MASKS 2 ;
|
||||
END M1
|
||||
LAYER VIA1
|
||||
TYPE CUT ;
|
||||
MASKS 2 ;
|
||||
END VIA1
|
||||
LAYER M2
|
||||
TYPE MASTERSLICE ;
|
||||
WIDTH 0.03 ;
|
||||
MASKS 2 ;
|
||||
END M2
|
||||
|
||||
VIA square
|
||||
LAYER M0PO ;
|
||||
RECT -0.08 -0.08 0.08 0.08 ;
|
||||
LAYER VIA0 ;
|
||||
RECT -0.08 -0.08 0.08 0.08 ;
|
||||
LAYER M1 ;
|
||||
RECT -0.08 -0.08 0.08 0.08 ;
|
||||
END square
|
||||
|
|
@ -9,7 +9,7 @@ LAYER VIA0
|
|||
END VIA0
|
||||
LAYER M1
|
||||
TYPE MASTERSLICE ;
|
||||
WIDTH 0.025 ;
|
||||
WIDTH 0.024 ;
|
||||
MASKS 2 ;
|
||||
END M1
|
||||
LAYER VIA1
|
||||
|
|
|
|||
|
|
@ -353,6 +353,10 @@ class DBReaders_TestClass < TestBase
|
|||
conf.lef_files = [ "u.lef", "v.lef" ]
|
||||
assert_equal(conf.lef_files.join(","), "u.lef,v.lef")
|
||||
|
||||
assert_equal(conf.read_lef_with_def, true)
|
||||
conf.read_lef_with_def = false
|
||||
assert_equal(conf.read_lef_with_def, false)
|
||||
|
||||
end
|
||||
|
||||
# MAG Options
|
||||
|
|
|
|||
Loading…
Reference in New Issue