Merge branch 'issue-1472' into wip2

This commit is contained in:
Matthias Koefferlein 2023-09-11 20:24:15 +02:00
commit e9429320bb
6 changed files with 48 additions and 3 deletions

View File

@ -424,17 +424,53 @@ DEFImporter::produce_routing_geometry (db::Cell &design, const Polygon *style, u
}
}
if (options ().joined_paths ()) {
auto pt_from = pt0;
auto pt_to = pt + 1;
// do not split away end segments if they are shorter than half the width
bool dont_join_first = false;
bool dont_join_last = false;
if (pt_to - pt_from >= 3 && (pt_from[1] - pt_from[0]).length() + be < wxy / 2) {
dont_join_first = true;
}
if (pt_to - pt_from >= 3 && (pt_to[-1] - pt_to[-2]).length() + ee < wxy / 2) {
dont_join_last = true;
}
if (options ().joined_paths () || (dont_join_first && dont_join_last && pt_to - pt_from <= 4)) {
// single path
db::Path p (pt0, pt + 1, wxy, be, ee, false);
db::Path p (pt_from, pt_to, 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 {
if (dont_join_first) {
db::Path p (pt_from, pt_from + 3, wxy, be, pt_from + 2 != 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);
}
pt_from += 2;
}
if (dont_join_last) {
db::Path p (pt_to - 3, pt_to, wxy, pt_to - 3 != pt0 ? wxy / 2 : 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);
}
pt_to -= 2;
}
// multipart paths
for (std::vector<db::Point>::const_iterator i = pt0; i != pt; ++i) {
for (auto i = pt_from; i + 1 != pt_to; ++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));
@ -442,6 +478,7 @@ DEFImporter::produce_routing_geometry (db::Cell &design, const Polygon *style, u
design.shapes (layer).insert (p);
}
}
}
was_path_before = true;

View File

@ -1005,3 +1005,9 @@ TEST(208_nets_and_rects)
run_test (_this, "issue-1432", "map:test.map+lef:test.lef+def:test.def", "au.oas", default_options (), false);
}
// issue-1472
TEST(209_invalid_split_paths)
{
run_test (_this, "issue-1472", "map:tech.map+lef:tech.lef.gz+def:test.def.gz", "au.oas", default_options (), false);
}

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

Binary file not shown.

BIN
testdata/lefdef/issue-1472/tech.lef.gz vendored Normal file

Binary file not shown.

2
testdata/lefdef/issue-1472/tech.map vendored Normal file
View File

@ -0,0 +1,2 @@
METAL3 SPNET 28 0
METAL5 SPNET 33 0

BIN
testdata/lefdef/issue-1472/test.def.gz vendored Normal file

Binary file not shown.