Merge pull request #1368 from KLayout/issue-1345

Fixed issue-1345 (feature request: create a def single/mulitpart path…
This commit is contained in:
Matthias Köfferlein 2023-05-14 00:00:59 +02:00 committed by GitHub
commit 570d1a36f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 189 additions and 72 deletions

View File

@ -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);

View File

@ -185,6 +185,7 @@ private:
std::vector<std::string> 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<std::string> m_lefdef_lef_layout_files;

View File

@ -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<db::Path> (p, prop_id));
} else {
design.shapes (layer).insert (p);
}
#else
// multipart paths
for (std::vector<db::Point>::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<db::Path> (p, prop_id));
} else {
design.shapes (layer).insert (p);
}
} else {
// multipart paths
for (std::vector<db::Point>::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<db::Path> (p, prop_id));
} else {
design.shapes (layer).insert (p);
}
}
}
#endif
was_path_before = true;

View File

@ -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;

View File

@ -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<unsigned int, std::string> m_special_routing_suffixes;
std::map<unsigned int, int> 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;

View File

@ -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")
);
}

View File

@ -880,6 +880,20 @@ gsi::Class<db::LEFDEFReaderOptions> 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 "

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>638</width>
<width>664</width>
<height>868</height>
</rect>
</property>
@ -35,7 +35,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>2</number>
<number>0</number>
</property>
<widget class="QWidget" name="tab_3">
<attribute name="title">
@ -425,34 +425,21 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QLabel" name="label_21">
<property name="text">
<string>Via cell name prefix</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item row="1" column="1" colspan="2">
<widget class="QCheckBox" name="separate_groups">
<property name="text">
<string>µm</string>
<string>Produce a parent cell per group</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_22">
<property name="text">
<string>Groups</string>
</property>
</widget>
</item>
<item row="0" column="3" rowspan="3">
<item row="0" column="3" rowspan="4">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -465,41 +452,7 @@
</property>
</spacer>
</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="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Layout DBU</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="0" column="1">
<widget class="QLineEdit" name="dbu">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="1" colspan="3">
<item row="4" column="1" colspan="3">
<widget class="QFrame" name="frame_3">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
@ -523,6 +476,67 @@
</layout>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>µm</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="dbu">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Layout DBU</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_22">
<property name="text">
<string>Groups</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_33">
<property name="text">
<string>Join paths</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QCheckBox" name="joined_paths">
<property name="text">
<string>Produce multi-segment wire paths</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<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>
</layout>
</widget>
</item>
@ -598,7 +612,6 @@
<widget class="QCheckBox" name="produce_net_names">
<property name="font">
<font>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
@ -773,7 +786,6 @@
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
<underline>false</underline>
@ -1011,8 +1023,8 @@ Otherwise it's looked up relative to the LEF or DEF file.
<rect>
<x>0</x>
<y>0</y>
<width>609</width>
<height>591</height>
<width>679</width>
<height>582</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
@ -1595,6 +1607,7 @@ type ...</string>
<tabstop>move_lef_files_down</tabstop>
<tabstop>dbu</tabstop>
<tabstop>separate_groups</tabstop>
<tabstop>joined_paths</tabstop>
<tabstop>prefix_via_cellname</tabstop>
<tabstop>produce_net_names</tabstop>
<tabstop>net_prop_name</tabstop>

View File

@ -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);

View File

@ -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);
}

Binary file not shown.

BIN
testdata/lefdef/issue-1345/au.oas.gz vendored Normal file

Binary file not shown.

16
testdata/lefdef/issue-1345/in.def vendored Normal file
View File

@ -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

40
testdata/lefdef/issue-1345/in.lef vendored Normal file
View File

@ -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