Generalized macro resolution mode options for LEF/DEF reader (UI, buddy tools). Added lefdef-lef-layouts for buddy scripts for providing external layouts for FOREIGN.

This commit is contained in:
Matthias Koefferlein 2021-04-22 23:43:28 +02:00
parent 3db1db831f
commit 05901d767e
6 changed files with 139 additions and 61 deletions

View File

@ -124,7 +124,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_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_separate_groups = load_options.get_option_by_name ("lefdef_config.separate_groups").to_bool ();
m_lefdef_map_file = load_options.get_option_by_name ("lefdef_config.map_file").to_string (); m_lefdef_map_file = load_options.get_option_by_name ("lefdef_config.map_file").to_string ();
m_lefdef_produce_lef_macros = (load_options.get_option_by_name ("lefdef_config.macro_resolution_mode").to_int () == 0); m_lefdef_macro_resolution_mode = load_options.get_option_by_name ("lefdef_config.macro_resolution_mode").to_int ();
} }
void void
@ -615,13 +615,27 @@ GenericReaderOptions::add_options (tl::CommandLineOptions &cmd)
"If a map file is used, only the layers present in the map file are generated. No other layers are produced." "If a map file is used, only the layers present in the map file are generated. No other layers are produced."
) )
<< tl::arg (group + << tl::arg (group +
"!--" + m_long_prefix + "lefdef-no-lef-macros", &m_lefdef_produce_lef_macros, "Don't produce LEF macro geometry", "!--" + m_long_prefix + "lefdef-macro-resolution-mode", &m_lefdef_macro_resolution_mode, "Specify how to generate layout from LEF macros",
"This option applies when reading DEF files.\n" "This option applies when reading DEF files.\n"
"\n" "\n"
"If this option is present, no geometry will be produced for LEF macros. Instead, a ghost cell with the name of the LEF " "The following values are accepted for this option:\n"
"macro will be produced. If this option is not given, the LEF macros will be inserted in to these cells " "\n"
"unless a FOREIGN specification is present in the LEF macro. If a FOREIGN specification is given, LEF geometry is never " "* 0: produce LEF geometry unless a FOREIGN cell is specified\n"
"inserted into a DEF file. Instead ghost cells are created." "* 1: produce LEF geometry always and ignore FOREIGN\n"
"* 2: Never produce LEF geometry and assume FOREIGN always\n"
"\n"
"In case of FOREIGN macros in mode 1 or always in mode 2, the '--" + m_long_prefix + "lefdef-lef-layouts' option is available to specify "
"external layout files for providing the LEF macro layouts.\n"
)
<< tl::arg (group +
"--" + m_long_prefix + "lefdef-lef-layouts", &m_lefdef_lef_layout_files, "Layout files for resolving FOREIGN LEF cells from",
"This option applies when reading DEF files.\n"
"\n"
"Use a comma-separated list of file names here to specify which layout files to use for resolving LEF macros. "
"This applies when LEF macros are specified with FOREIGN. By using '--" + m_long_prefix + "lefdef-macro-resolution-mode' you "
"can force external resolution (assume FOREIGN always) or turn it off (ignore FOREIGN).\n"
"\n"
"Relative paths are resolved based on the location of the DEF file which is read."
) )
<< tl::arg (group + << tl::arg (group +
"!--" + m_long_prefix + "lefdef-no-implicit-lef", &m_lefdef_read_lef_with_def, "Disables reading all LEF files together with DEF files", "!--" + m_long_prefix + "lefdef-no-implicit-lef", &m_lefdef_read_lef_with_def, "Disables reading all LEF files together with DEF files",
@ -678,7 +692,7 @@ void GenericReaderOptions::set_dbu (double dbu)
} }
void void
GenericReaderOptions::configure (db::LoadLayoutOptions &load_options) const GenericReaderOptions::configure (db::LoadLayoutOptions &load_options)
{ {
load_options.set_option_by_name ("layer_map", tl::Variant::make_variant (m_layer_map)); load_options.set_option_by_name ("layer_map", tl::Variant::make_variant (m_layer_map));
load_options.set_option_by_name ("create_other_layers", m_create_other_layers); load_options.set_option_by_name ("create_other_layers", m_create_other_layers);
@ -763,7 +777,31 @@ GenericReaderOptions::configure (db::LoadLayoutOptions &load_options) const
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.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.separate_groups", m_lefdef_separate_groups);
load_options.set_option_by_name ("lefdef_config.map_file", m_lefdef_map_file); 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_produce_lef_macros ? 0 : 2); load_options.set_option_by_name ("lefdef_config.macro_resolution_mode", m_lefdef_macro_resolution_mode);
m_lef_layouts.clear ();
tl::Variant lef_layout_ptrs = 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) {
try {
std::unique_ptr<db::Layout> ly (new db::Layout ());
tl::InputStream stream (*l);
db::Reader reader (stream);
db::LoadLayoutOptions load_options;
reader.read (*ly, load_options);
lef_layout_ptrs.push (tl::Variant::make_variant_ref (ly.get ()));
m_lef_layouts.push_back (ly.release ());
} catch (tl::Exception &ex) {
tl::warn << ex.msg ();
}
}
load_options.set_option_by_name ("lefdef_config.macro_layouts", lef_layout_ptrs);
} }
} }

View File

@ -25,6 +25,7 @@
#include "bdCommon.h" #include "bdCommon.h"
#include "dbCommonReader.h" #include "dbCommonReader.h"
#include "tlObject.h"
#include <string> #include <string>
@ -36,6 +37,7 @@ namespace tl
namespace db namespace db
{ {
class LoadLayoutOptions; class LoadLayoutOptions;
class Layout;
} }
namespace bd namespace bd
@ -61,7 +63,7 @@ public:
/** /**
* @brief Configures the reader options object with the options stored in this object * @brief Configures the reader options object with the options stored in this object
*/ */
void configure (db::LoadLayoutOptions &load_options) const; void configure (db::LoadLayoutOptions &load_options);
/** /**
* @brief Sets the option prefix for the short option name * @brief Sets the option prefix for the short option name
@ -183,7 +185,10 @@ private:
bool m_lefdef_read_lef_with_def; bool m_lefdef_read_lef_with_def;
bool m_lefdef_separate_groups; bool m_lefdef_separate_groups;
std::string m_lefdef_map_file; std::string m_lefdef_map_file;
bool m_lefdef_produce_lef_macros; int m_lefdef_macro_resolution_mode;
std::vector<std::string> m_lefdef_lef_layout_files;
tl::shared_collection<db::Layout> m_lef_layouts;
}; };
} }

View File

@ -63,7 +63,7 @@ struct ClipData
}; };
void clip (const ClipData &data) void clip (ClipData &data)
{ {
db::Layout layout; db::Layout layout;
db::Layout target_layout; db::Layout target_layout;

View File

@ -863,9 +863,9 @@ gsi::Class<db::LEFDEFReaderOptions> decl_lefdef_config ("db", "LEFDEFReaderConfi
"are three modes available:\n" "are three modes available:\n"
"\n" "\n"
"@ul\n" "@ul\n"
" @li 0: produce LEF geometry unless a FOREIGN cell is specified (default) @/li\n" " @li 0: produce LEF geometry unless a FOREIGN cell is specified @/li\n"
" @li 1: produce LEF geometry always and ignore FOREIGN @/li\n" " @li 1: produce LEF geometry always and ignore FOREIGN @/li\n"
" @li 2: Never produce LEF geometry @/li\n" " @li 2: Never produce LEF geometry and assume FOREIGN always @/li\n"
"@/ul\n" "@/ul\n"
"\n" "\n"
"If substitution layouts are specified with \\macro_layouts, these are used to provide " "If substitution layouts are specified with \\macro_layouts, these are used to provide "

View File

@ -35,7 +35,7 @@
<item> <item>
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>2</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="tab_3"> <widget class="QWidget" name="tab_3">
<attribute name="title"> <attribute name="title">
@ -255,6 +255,37 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1">
<widget class="QLineEdit" name="prefix_via_cellname">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QCheckBox" name="separate_groups">
<property name="text">
<string>Produce a parent cell per group</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_21">
<property name="text">
<string>Via cell name prefix</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>LEF import into DEF</string>
</property>
</widget>
</item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QLineEdit" name="dbu"> <widget class="QLineEdit" name="dbu">
<property name="sizePolicy"> <property name="sizePolicy">
@ -278,7 +309,38 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="3" rowspan="4"> <item row="1" column="0">
<widget class="QLabel" name="label_22">
<property name="text">
<string>Groups</string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="3">
<widget class="QFrame" name="frame_3">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
</layout>
</widget>
</item>
<item row="0" column="3" rowspan="3">
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -291,49 +353,23 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="1" column="0"> <item row="3" column="1" colspan="3">
<widget class="QLabel" name="label_22"> <widget class="QComboBox" name="macro_resolution_mode">
<property name="text"> <item>
<string>Groups</string> <property name="text">
</property> <string>Produce LEF geometry unless FOREIGN is used</string>
</widget> </property>
</item> </item>
<item row="1" column="1" colspan="2"> <item>
<widget class="QCheckBox" name="separate_groups"> <property name="text">
<property name="text"> <string>Always produce LEF geometry and ignore FOREIGN</string>
<string>Produce a parent cell per group</string> </property>
</property> </item>
</widget> <item>
</item> <property name="text">
<item row="2" column="0"> <string>Never produce LEF geometry and assume FOREIGN always</string>
<widget class="QLabel" name="label_21"> </property>
<property name="text"> </item>
<string>Via cell name prefix</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="prefix_via_cellname">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>LEF import into DEF</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QCheckBox" name="produce_lef_geo">
<property name="text">
<string>Produce LEF geometry</string>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -1362,7 +1398,6 @@ type ...</string>
<tabstop>dbu</tabstop> <tabstop>dbu</tabstop>
<tabstop>separate_groups</tabstop> <tabstop>separate_groups</tabstop>
<tabstop>prefix_via_cellname</tabstop> <tabstop>prefix_via_cellname</tabstop>
<tabstop>produce_lef_geo</tabstop>
<tabstop>produce_net_names</tabstop> <tabstop>produce_net_names</tabstop>
<tabstop>net_prop_name</tabstop> <tabstop>net_prop_name</tabstop>
<tabstop>produce_inst_names</tabstop> <tabstop>produce_inst_names</tabstop>

View File

@ -515,7 +515,7 @@ LEFDEFReaderOptionsEditor::commit (db::FormatSpecificReaderOptions *options, con
data->set_separate_groups (separate_groups->isChecked ()); data->set_separate_groups (separate_groups->isChecked ());
data->set_read_lef_with_def (read_lef_with_def->isChecked ()); data->set_read_lef_with_def (read_lef_with_def->isChecked ());
data->set_map_file (tl::to_string (mapfile_path->text ())); data->set_map_file (tl::to_string (mapfile_path->text ()));
data->set_macro_resolution_mode (produce_lef_geo->isChecked () ? 0 : 2); data->set_macro_resolution_mode (macro_resolution_mode->currentIndex ());
data->clear_lef_files (); data->clear_lef_files ();
for (int i = 0; i < lef_files->count (); ++i) { for (int i = 0; i < lef_files->count (); ++i) {
@ -582,7 +582,7 @@ LEFDEFReaderOptionsEditor::setup (const db::FormatSpecificReaderOptions *options
read_lef_with_def->setChecked (data->read_lef_with_def ()); read_lef_with_def->setChecked (data->read_lef_with_def ());
mapfile_path->setText (tl::to_qstring (data->map_file ())); mapfile_path->setText (tl::to_qstring (data->map_file ()));
layer_map_mode->setCurrentIndex (data->map_file ().empty () ? 1 : 0); layer_map_mode->setCurrentIndex (data->map_file ().empty () ? 1 : 0);
produce_lef_geo->setChecked (data->macro_resolution_mode () == 0); macro_resolution_mode->setCurrentIndex (data->macro_resolution_mode ());
checkbox_changed (); checkbox_changed ();