Fixed more weird paths in issue-1472

This commit is contained in:
Matthias Koefferlein 2023-09-11 21:16:36 +02:00
parent e9429320bb
commit 8d2d5bcf47
4 changed files with 32 additions and 17 deletions

View File

@ -428,16 +428,31 @@ DEFImporter::produce_routing_geometry (db::Cell &design, const Polygon *style, u
auto pt_to = pt + 1; auto pt_to = pt + 1;
// do not split away end segments if they are shorter than half the width // do not split away end segments if they are shorter than half the width
bool dont_join_first = false;
bool dont_join_last = false; auto pt_from_split = pt_from;
if (pt_to - pt_from >= 3 && (pt_from[1] - pt_from[0]).length() + be < wxy / 2) { if (be < wxy / 2) {
dont_join_first = true; while (pt_from_split + 1 != pt_to && db::Coord ((pt_from_split[1] - pt_from_split[0]).length ()) < wxy / 2) {
++pt_from_split;
} }
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)) { auto pt_to_split = pt_to;
if (ee < wxy / 2) {
while (pt_to_split - 1 != pt_from && db::Coord ((pt_to_split[-1] - pt_to_split[-2]).length ()) < wxy / 2) {
--pt_to_split;
}
}
if (! options ().joined_paths () && (pt_to_split != pt_to || pt_from_split != pt_from)) {
std::string p0 = pt_from->to_string ();
std::string ln = "(unknown)";
if (design.layout ()) {
ln = design.layout ()->get_properties (layer).to_string ();
}
warn (tl::sprintf (tl::to_string (tr ("Joining path (or parts of it) because of short-edged begin or end segments (layer %s, first point %s)")), ln, p0));
}
if (options ().joined_paths () || pt_to_split - 1 <= pt_from_split + 1 || pt_to_split - 1 == pt_from || pt_from_split + 1 == pt_to) {
// single path // single path
db::Path p (pt_from, pt_to, wxy, be, ee, false); db::Path p (pt_from, pt_to, wxy, be, ee, false);
@ -449,24 +464,24 @@ DEFImporter::produce_routing_geometry (db::Cell &design, const Polygon *style, u
} else { } else {
if (dont_join_first) { if (pt_from_split != pt_from) {
db::Path p (pt_from, pt_from + 3, wxy, be, pt_from + 2 != pt ? wxy / 2 : ee, false); db::Path p (pt_from, pt_from_split + 2, wxy, be, wxy / 2, false);
if (prop_id != 0) { if (prop_id != 0) {
design.shapes (layer).insert (db::object_with_properties<db::Path> (p, prop_id)); design.shapes (layer).insert (db::object_with_properties<db::Path> (p, prop_id));
} else { } else {
design.shapes (layer).insert (p); design.shapes (layer).insert (p);
} }
pt_from += 2; pt_from = pt_from_split + 1;
} }
if (dont_join_last) { if (pt_to_split != pt_to) {
db::Path p (pt_to - 3, pt_to, wxy, pt_to - 3 != pt0 ? wxy / 2 : be, ee, false); db::Path p (pt_to_split - 2, pt_to, wxy, wxy / 2, ee, false);
if (prop_id != 0) { if (prop_id != 0) {
design.shapes (layer).insert (db::object_with_properties<db::Path> (p, prop_id)); design.shapes (layer).insert (db::object_with_properties<db::Path> (p, prop_id));
} else { } else {
design.shapes (layer).insert (p); design.shapes (layer).insert (p);
} }
pt_to -= 2; pt_to = pt_to_split - 1;
} }
// multipart paths // multipart paths
@ -486,7 +501,7 @@ DEFImporter::produce_routing_geometry (db::Cell &design, const Polygon *style, u
} else { } else {
if (! is_isotropic) { if (! is_isotropic) {
warn("Anisotropic wire widths not supported for diagonal wires"); warn (tl::to_string (tr ("Anisotropic wire widths not supported for diagonal wires")));
} }
db::Coord s = (w.first + 1) / 2; db::Coord s = (w.first + 1) / 2;
@ -839,7 +854,7 @@ DEFImporter::read_nets (db::Layout &layout, db::Cell &design, double scale, bool
stored_prop_id = prop_id; stored_prop_id = prop_id;
in_subnet = true; in_subnet = true;
} else { } else {
warn ("Nested subnets"); warn (tl::to_string (tr ("Nested subnets")));
} }
net = stored_netname + "/" + subnetname; net = stored_netname + "/" + subnetname;

View File

@ -429,7 +429,7 @@ TEST(def16)
// (complete example) // (complete example)
db::LEFDEFReaderOptions opt = default_options (); db::LEFDEFReaderOptions opt = default_options ();
opt.set_macro_resolution_mode (1); opt.set_macro_resolution_mode (1);
run_test (_this, "def16", "lef:a.lef+lef:tech.lef+def:a.def", "au_3.oas.gz", opt); run_test (_this, "def16", "lef:a.lef+lef:tech.lef+def:a.def", "au_4.oas.gz", opt);
} }
TEST(100) TEST(100)

Binary file not shown.

Binary file not shown.