'extent_refs' DRC function: enabling for edge pairs and edges, clarification of documentation

This commit is contained in:
Matthias Koefferlein 2026-01-11 22:34:52 +01:00
parent b409ed8b44
commit c6faa3e628
14 changed files with 183 additions and 29 deletions

View File

@ -31,6 +31,7 @@
#include "dbEdgesUtils.h" #include "dbEdgesUtils.h"
#include "dbEdgePairFilters.h" #include "dbEdgePairFilters.h"
#include "dbPropertiesFilter.h" #include "dbPropertiesFilter.h"
#include "dbRegionProcessors.h"
#include "gsiDeclDbContainerHelpers.h" #include "gsiDeclDbContainerHelpers.h"
#include "gsiDeclDbMeasureHelpers.h" #include "gsiDeclDbMeasureHelpers.h"
@ -531,6 +532,71 @@ static db::Region extents0 (const db::EdgePairs *r)
return extents2 (r, 0, 0); return extents2 (r, 0, 0);
} }
namespace {
// a combined processor that implements db::RelativeExtents on the edge bounding boxes
class DB_PUBLIC EdgePairsRelativeExtents
: virtual public db::EdgePairToPolygonProcessorBase,
virtual public db::RelativeExtents
{
public:
EdgePairsRelativeExtents (double fx1, double fy1, double fx2, double fy2, db::Coord dx, db::Coord dy)
: db::RelativeExtents (fx1, fy1, fx2, fy2, dx, dy)
{
// .. nothing yet ..
}
// not needed, but mutes
void process (const db::PolygonWithProperties &poly, std::vector<db::PolygonWithProperties> &result) const
{
db::RelativeExtents::process (poly, result);
}
void process (const db::EdgePairWithProperties &ep, std::vector<db::PolygonWithProperties> &result) const
{
db::RelativeExtents::process (db::Polygon (ep.bbox ()), result);
}
};
class DB_PUBLIC EdgePairsRelativeExtentsAsEdges
: virtual public db::EdgePairToEdgeProcessorBase,
virtual public db::RelativeExtentsAsEdges
{
public:
EdgePairsRelativeExtentsAsEdges (double fx1, double fy1, double fx2, double fy2)
: db::RelativeExtentsAsEdges (fx1, fy1, fx2, fy2)
{
// .. nothing yet ..
}
void process (const db::PolygonWithProperties &poly, std::vector<db::EdgeWithProperties> &result) const
{
db::RelativeExtentsAsEdges::process (poly, result);
}
void process (const db::EdgePairWithProperties &ep, std::vector<db::EdgeWithProperties> &result) const
{
db::RelativeExtentsAsEdges::process (db::Polygon (ep.bbox ()), result);
}
};
}
static db::Region extent_refs (const db::EdgePairs *r, double fx1, double fy1, double fx2, double fy2, db::Coord dx, db::Coord dy)
{
db::Region result;
r->processed (result, EdgePairsRelativeExtents (fx1, fy1, fx2, fy2, dx, dy));
return result;
}
static db::Edges extent_refs_edges (const db::EdgePairs *r, double fx1, double fy1, double fx2, double fy2)
{
db::Edges result;
r->processed (result, EdgePairsRelativeExtentsAsEdges (fx1, fy1, fx2, fy2));
return result;
}
static db::Edges edges (const db::EdgePairs *ep) static db::Edges edges (const db::EdgePairs *ep)
{ {
db::Edges e; db::Edges e;
@ -1247,7 +1313,15 @@ Class<db::EdgePairs> decl_EdgePairs (decl_dbShapeCollection, "db", "EdgePairs",
"The boxes will not be merged, so it is possible to determine overlaps " "The boxes will not be merged, so it is possible to determine overlaps "
"of these boxes for example.\n" "of these boxes for example.\n"
) + ) +
method_ext ("filter", &filter, gsi::arg ("filter"), method_ext ("extent_refs", &extent_refs,
"@hide\n"
"This method is provided for DRC implementation.\n"
) +
method_ext ("extent_refs_edges", &extent_refs_edges,
"@hide\n"
"This method is provided for DRC implementation.\n"
) +
method_ext ("filter", &filter, gsi::arg ("filter"),
"@brief Applies a generic filter in place (replacing the edge pairs from the EdgePair collection)\n" "@brief Applies a generic filter in place (replacing the edge pairs from the EdgePair collection)\n"
"See \\EdgePairFilter for a description of this feature.\n" "See \\EdgePairFilter for a description of this feature.\n"
"\n" "\n"

View File

@ -32,6 +32,7 @@
#include "dbOriginalLayerRegion.h" #include "dbOriginalLayerRegion.h"
#include "dbLayoutUtils.h" #include "dbLayoutUtils.h"
#include "dbPropertiesFilter.h" #include "dbPropertiesFilter.h"
#include "dbRegionProcessors.h"
#include "gsiDeclDbContainerHelpers.h" #include "gsiDeclDbContainerHelpers.h"
#include "gsiDeclDbMeasureHelpers.h" #include "gsiDeclDbMeasureHelpers.h"
@ -941,6 +942,69 @@ static std::vector<db::Edges> split_interacting_with_region (const db::Edges *r,
return as_2edges_vector (r->selected_interacting_differential (other, min_count, max_count)); return as_2edges_vector (r->selected_interacting_differential (other, min_count, max_count));
} }
namespace {
// a combined processor that implements db::RelativeExtents on the edge bounding boxes
class DB_PUBLIC EdgesRelativeExtents
: virtual public db::EdgeToPolygonProcessorBase,
virtual public db::RelativeExtents
{
public:
EdgesRelativeExtents (double fx1, double fy1, double fx2, double fy2, db::Coord dx, db::Coord dy)
: db::RelativeExtents (fx1, fy1, fx2, fy2, dx, dy)
{
// .. nothing yet ..
}
// not needed, but mutes
void process (const db::PolygonWithProperties &poly, std::vector<db::PolygonWithProperties> &result) const
{
db::RelativeExtents::process (poly, result);
}
void process (const db::EdgeWithProperties &edge, std::vector<db::PolygonWithProperties> &result) const
{
db::RelativeExtents::process (db::Polygon (edge.bbox ()), result);
}
};
class DB_PUBLIC EdgesRelativeExtentsAsEdges
: virtual public db::EdgeProcessorBase,
virtual public db::RelativeExtentsAsEdges
{
public:
EdgesRelativeExtentsAsEdges (double fx1, double fy1, double fx2, double fy2)
: db::RelativeExtentsAsEdges (fx1, fy1, fx2, fy2)
{
// .. nothing yet ..
}
void process (const db::PolygonWithProperties &poly, std::vector<db::EdgeWithProperties> &result) const
{
db::RelativeExtentsAsEdges::process (poly, result);
}
void process (const db::EdgeWithProperties &edge, std::vector<db::EdgeWithProperties> &result) const
{
db::RelativeExtentsAsEdges::process (db::Polygon (edge.bbox ()), result);
}
};
}
static db::Region extent_refs (const db::Edges *r, double fx1, double fy1, double fx2, double fy2, db::Coord dx, db::Coord dy)
{
db::Region result;
r->processed (result, EdgesRelativeExtents (fx1, fy1, fx2, fy2, dx, dy));
return result;
}
static db::Edges extent_refs_edges (const db::Edges *r, double fx1, double fy1, double fx2, double fy2)
{
return r->processed (EdgesRelativeExtentsAsEdges (fx1, fy1, fx2, fy2));
}
static tl::Variant nth (const db::Edges *edges, size_t n) static tl::Variant nth (const db::Edges *edges, size_t n)
{ {
const db::Edge *e = edges->nth (n); const db::Edge *e = edges->nth (n);
@ -2372,6 +2436,14 @@ Class<db::Edges> decl_Edges (decl_dbShapeCollection, "db", "Edges",
"The boxes will not be merged, so it is possible to determine overlaps " "The boxes will not be merged, so it is possible to determine overlaps "
"of these boxes for example.\n" "of these boxes for example.\n"
) + ) +
method_ext ("extent_refs", &extent_refs,
"@hide\n"
"This method is provided for DRC implementation.\n"
) +
method_ext ("extent_refs_edges", &extent_refs_edges,
"@hide\n"
"This method is provided for DRC implementation.\n"
) +
method_ext ("extended_in", &extended_in, gsi::arg ("e"), method_ext ("extended_in", &extended_in, gsi::arg ("e"),
"@brief Returns a region with shapes representing the edges with the given width\n" "@brief Returns a region with shapes representing the edges with the given width\n"
"@param e The extension width\n" "@param e The extension width\n"

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "klayout_doc.dtd"> <!DOCTYPE language SYSTEM "klayout_doc.dtd">
<!-- generated by /home/matthias/klayout/master/scripts/drc_lvs_doc/extract_doc.rb --> <!-- generated by /home/matthias/klayout/master2/scripts/drc_lvs_doc/extract_doc.rb -->
<!-- DO NOT EDIT! --> <!-- DO NOT EDIT! -->
<doc> <doc>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "klayout_doc.dtd"> <!DOCTYPE language SYSTEM "klayout_doc.dtd">
<!-- generated by /home/matthias/klayout/master/scripts/drc_lvs_doc/extract_doc.rb --> <!-- generated by /home/matthias/klayout/master2/scripts/drc_lvs_doc/extract_doc.rb -->
<!-- DO NOT EDIT! --> <!-- DO NOT EDIT! -->
<doc> <doc>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "klayout_doc.dtd"> <!DOCTYPE language SYSTEM "klayout_doc.dtd">
<!-- generated by /home/matthias/klayout/master/scripts/drc_lvs_doc/extract_doc.rb --> <!-- generated by /home/matthias/klayout/master2/scripts/drc_lvs_doc/extract_doc.rb -->
<!-- DO NOT EDIT! --> <!-- DO NOT EDIT! -->
<doc> <doc>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "klayout_doc.dtd"> <!DOCTYPE language SYSTEM "klayout_doc.dtd">
<!-- generated by /home/matthias/klayout/master/scripts/drc_lvs_doc/extract_doc.rb --> <!-- generated by /home/matthias/klayout/master2/scripts/drc_lvs_doc/extract_doc.rb -->
<!-- DO NOT EDIT! --> <!-- DO NOT EDIT! -->
<doc> <doc>
@ -1182,20 +1182,19 @@ The formal specifiers for lines are:
<li><b>:right </b>or <b>:r </b>: the right line </li> <li><b>:right </b>or <b>:r </b>: the right line </li>
</ul> </ul>
</p><p> </p><p>
Dots are represented by small (2x2 DBU) boxes or point-like The following additional option controls the output format:
</p><p>
<ul>
<li><b>as_boxes </b>: with this option, boxes (rectangular polygons) will be produced on output </li>
<li><b>as_dots </b>or <b>as_edges </b>: with this option, edges will be produced on output </li>
</ul>
</p><p>
Dots on are represented by small (2x2 DBU) boxes or point-like
edges with edge output. Lines are represented by narrow or edges with edge output. Lines are represented by narrow or
flat (2 DBU) boxes or edges for edge output. Edges will follow flat (2 DBU) boxes or edges for edge output. Edges will follow
the orientation convention for the corresponding edges - i.e. the orientation convention for the corresponding edges - i.e.
"inside" of the bounding box is on the right side of the edge. "inside" of the bounding box is on the right side of the edge.
</p><p> </p><p>
The following additional option controls the output format:
</p><p>
<ul>
<li><b>as_boxes </b>: with this option, small boxes will be produced as markers </li>
<li><b>as_dots </b>or <b>as_edges </b>: with this option, point-like edges will be produced for dots
and edges will be produced for line-like selections </li>
</ul>
</p><p>
The following table shows a few applications: The following table shows a few applications:
</p><p> </p><p>
<table> <table>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "klayout_doc.dtd"> <!DOCTYPE language SYSTEM "klayout_doc.dtd">
<!-- generated by /home/matthias/klayout/master/scripts/drc_lvs_doc/extract_doc.rb --> <!-- generated by /home/matthias/klayout/master2/scripts/drc_lvs_doc/extract_doc.rb -->
<!-- DO NOT EDIT! --> <!-- DO NOT EDIT! -->
<doc> <doc>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "klayout_doc.dtd"> <!DOCTYPE language SYSTEM "klayout_doc.dtd">
<!-- generated by /home/matthias/klayout/master/scripts/drc_lvs_doc/extract_doc.rb --> <!-- generated by /home/matthias/klayout/master2/scripts/drc_lvs_doc/extract_doc.rb -->
<!-- DO NOT EDIT! --> <!-- DO NOT EDIT! -->
<doc> <doc>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "klayout_doc.dtd"> <!DOCTYPE language SYSTEM "klayout_doc.dtd">
<!-- generated by /home/matthias/klayout/master/scripts/drc_lvs_doc/extract_doc.rb --> <!-- generated by /home/matthias/klayout/master2/scripts/drc_lvs_doc/extract_doc.rb -->
<!-- DO NOT EDIT! --> <!-- DO NOT EDIT! -->
<doc> <doc>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "klayout_doc.dtd"> <!DOCTYPE language SYSTEM "klayout_doc.dtd">
<!-- generated by /home/matthias/klayout/master/scripts/drc_lvs_doc/extract_doc.rb --> <!-- generated by /home/matthias/klayout/master2/scripts/drc_lvs_doc/extract_doc.rb -->
<!-- DO NOT EDIT! --> <!-- DO NOT EDIT! -->
<doc> <doc>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "klayout_doc.dtd"> <!DOCTYPE language SYSTEM "klayout_doc.dtd">
<!-- generated by /home/matthias/klayout/master/scripts/drc_lvs_doc/extract_doc.rb --> <!-- generated by /home/matthias/klayout/master2/scripts/drc_lvs_doc/extract_doc.rb -->
<!-- DO NOT EDIT! --> <!-- DO NOT EDIT! -->
<doc> <doc>

View File

@ -1463,20 +1463,19 @@ CODE
# @li @b :right @/b or @b :r @/b: the right line @/li # @li @b :right @/b or @b :r @/b: the right line @/li
# @/ul # @/ul
# #
# Dots are represented by small (2x2 DBU) boxes or point-like # The following additional option controls the output format:
#
# @ul
# @li @b as_boxes @/b: with this option, boxes (rectangular polygons) will be produced on output @/li
# @li @b as_dots @/b or @b as_edges @/b: with this option, edges will be produced on output @/li
# @/ul
#
# Dots on are represented by small (2x2 DBU) boxes or point-like
# edges with edge output. Lines are represented by narrow or # edges with edge output. Lines are represented by narrow or
# flat (2 DBU) boxes or edges for edge output. Edges will follow # flat (2 DBU) boxes or edges for edge output. Edges will follow
# the orientation convention for the corresponding edges - i.e. # the orientation convention for the corresponding edges - i.e.
# "inside" of the bounding box is on the right side of the edge. # "inside" of the bounding box is on the right side of the edge.
# #
# The following additional option controls the output format:
#
# @ul
# @li @b as_boxes @/b: with this option, small boxes will be produced as markers @/li
# @li @b as_dots @/b or @b as_edges @/b: with this option, point-like edges will be produced for dots
# and edges will be produced for line-like selections @/li
# @/ul
#
# The following table shows a few applications: # The following table shows a few applications:
# #
# @table # @table
@ -1511,7 +1510,7 @@ CODE
@engine._context("#{f}") do @engine._context("#{f}") do
requires_region requires_edges_edge_pairs_or_region
f = [] f = []
as_edges = false as_edges = false
@ -6105,6 +6104,10 @@ END
self.data.is_a?(RBA::Edges) || self.data.is_a?(RBA::Region) || raise(name ? "#{name} requires an edge or polygon layer" : "Requires an edge or polygon layer") self.data.is_a?(RBA::Edges) || self.data.is_a?(RBA::Region) || raise(name ? "#{name} requires an edge or polygon layer" : "Requires an edge or polygon layer")
end end
def requires_edges_edge_pairs_or_region(name = nil)
self.data.is_a?(RBA::Edges) || self.data.is_a?(RBA::Region) || self.data.is_a?(RBA::EdgePairs) || raise(name ? "#{name} requires an edge, edge pair or polygon layer" : "Requires an edge, edge pair or polygon layer")
end
def requires_edges_texts_or_region(name = nil) def requires_edges_texts_or_region(name = nil)
self.data.is_a?(RBA::Edges) || self.data.is_a?(RBA::Region) || self.data.is_a?(RBA::Texts) || raise(name ? "#{name} requires an edge, text or polygon layer" : "Requires an edge, text or polygon layer") self.data.is_a?(RBA::Edges) || self.data.is_a?(RBA::Region) || self.data.is_a?(RBA::Texts) || raise(name ? "#{name} requires an edge, text or polygon layer" : "Requires an edge, text or polygon layer")
end end

View File

@ -64,6 +64,12 @@ a1.extent_refs(:lc).sized(0.05).output(1051, 1)
a1.extent_refs(:right_center).sized(0.05).output(1052, 0) a1.extent_refs(:right_center).sized(0.05).output(1052, 0)
a1.extent_refs(:rc).sized(0.05).output(1052, 1) a1.extent_refs(:rc).sized(0.05).output(1052, 1)
a1.extent_refs(0.25, 0.5, 0.5, 0.75).output(1053, 0) a1.extent_refs(0.25, 0.5, 0.5, 0.75).output(1053, 0)
a1.extent_refs(0.5, 0.5, 0.25, 0.75, as_edges).output(1054, 0)
a1.extent_refs(0.5, 0.5, 0.25, 0.75, as_boxes).output(1055, 0)
a1.extents.width(0.8.um).extent_refs(0.5, 0.5, 0.25, 0.75, as_edges).output(1056, 0)
a1.extents.width(0.8.um).extent_refs(0.5, 0.5, 0.25, 0.75, as_boxes).output(1057, 0)
a1.extents.width(0.8.um).first_edges.extent_refs(:center, as_edges).output(1058, 0)
a1.extents.width(0.8.um).first_edges.extent_refs(:center, as_boxes).output(1059, 0)
a1.corners.sized(0.05).output(1060, 0) a1.corners.sized(0.05).output(1060, 0)
a1.corners(-90.0, as_boxes).sized(0.05).output(1061, 0) a1.corners(-90.0, as_boxes).sized(0.05).output(1061, 0)

Binary file not shown.