Skip to content

Commit

Permalink
Debugging and first tests for DRC
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koefferlein committed Aug 4, 2024
1 parent 29f8285 commit 3521946
Show file tree
Hide file tree
Showing 6 changed files with 176 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/db/db/dbEdgePairsUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ static void insert_into_ep (const db::EdgePair &ep, db::EdgeProcessor &proc, siz

bool edge_pair_interacts (const db::EdgePair &a, const db::Polygon &b)
{
// fall back to edge-only checks for degenerate edge pairs
if (a.area () == 0) {
return edge_interacts (a.first (), b) || edge_interacts (db::Edge (a.first ().p2 (), a.second ().p1 ()), b) ||
edge_interacts (a.second (), b) || edge_interacts (db::Edge (a.second ().p2 (), a.first ().p1 ()), b);
}

db::EdgeProcessor ep;
insert_into_ep (a, ep, 1);
ep.insert (b, 0);
Expand All @@ -56,6 +62,12 @@ bool edge_pair_interacts (const db::EdgePair &a, const db::Polygon &b)

bool edge_pair_is_inside (const db::EdgePair &a, const db::Polygon &b)
{
// fall back to edge-only checks for degenerate edge pairs
if (a.area () == 0) {
return edge_is_inside (a.first (), b) && edge_is_inside (db::Edge (a.first ().p2 (), a.second ().p1 ()), b) &&
edge_is_inside (a.second (), b) && edge_is_inside (db::Edge (a.second ().p2 (), a.first ().p1 ()), b);
}

db::EdgeProcessor ep;
insert_into_ep (a, ep, 1);
ep.insert (b, 0);
Expand All @@ -71,6 +83,12 @@ bool edge_pair_is_inside (const db::EdgePair &a, const db::Polygon &b)

bool edge_pair_is_outside (const db::EdgePair &a, const db::Polygon &b)
{
// fall back to edge-only checks for degenerate edge pairs
if (a.area () == 0) {
return edge_is_outside (a.first (), b) && edge_is_outside (db::Edge (a.first ().p2 (), a.second ().p1 ()), b) &&
edge_is_outside (a.second (), b) && edge_is_outside (db::Edge (a.second ().p2 (), a.first ().p1 ()), b);
}

db::EdgeProcessor ep;
insert_into_ep (a, ep, 1);
ep.insert (b, 0);
Expand All @@ -86,7 +104,8 @@ bool edge_pair_is_outside (const db::EdgePair &a, const db::Polygon &b)

bool edge_pair_interacts (const db::EdgePair &a, const db::Edge &b)
{
return edge_interacts (a.first (), b) || edge_interacts (a.second (), b);
return edge_interacts (a.first (), b) || edge_interacts (db::Edge (a.first ().p2 (), a.second ().p1 ()), b) ||
edge_interacts (a.second (), b) || edge_interacts (db::Edge (a.second ().p2 (), a.first ().p1 ()), b);
}

}
10 changes: 10 additions & 0 deletions src/drc/unit_tests/drcSimpleTests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1953,3 +1953,13 @@ TEST(130d_size_inside_outside)
{
run_test (_this, "130", true);
}

TEST(131_edge_pair_interactions)
{
run_test (_this, "131", false);
}

TEST(131d_edge_pair_interactions)
{
run_test (_this, "131", true);
}
146 changes: 146 additions & 0 deletions testdata/drc/drcSimpleTests_131.drc
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@

source $drc_test_source
target $drc_test_target

if $drc_test_deep
deep
end

l1 = input(1, 0)
l2 = input(2, 0)
l3 = input(3, 0)
l4 = input(4, 0)
l5 = input(5, 0)
l6 = input(6, 0)

l1.output(1, 0)
l2.output(2, 0)
l3.output(3, 0)
l4.output(4, 0)
l5.output(5, 0)
l6.output(6, 0)

eps = l1.sep(l2, 200.nm)

eps.output(10, 0)

l = 100
eps.interacting(l3).output(l + 0, 0)
eps.interacting(l4).output(l + 1, 0)
eps.interacting(l5).output(l + 2, 0)
eps.interacting(l6).output(l + 3, 0)

l = 110
eps.interacting(l3, 1..1).output(l + 0, 0)
eps.interacting(l4, 1..1).output(l + 1, 0)
eps.interacting(l5, 1..1).output(l + 2, 0)
eps.interacting(l6, 1..1).output(l + 3, 0)

l = 120
eps.interacting(l3, 2).output(l + 0, 0)
eps.interacting(l4, 2).output(l + 1, 0)
eps.interacting(l5, 2).output(l + 2, 0)
eps.interacting(l6, 2).output(l + 3, 0)

l = 130
eps.not_interacting(l3).output(l + 0, 0)
eps.not_interacting(l4).output(l + 1, 0)
eps.not_interacting(l5).output(l + 2, 0)
eps.not_interacting(l6).output(l + 3, 0)

l = 140
eps.interacting(l3.edges).output(l + 0, 0)
eps.interacting(l4.edges).output(l + 1, 0)
eps.interacting(l5.edges).output(l + 2, 0)
eps.interacting(l6.edges).output(l + 3, 0)

l = 150
eps.interacting(l3.edges, 1 .. 1).output(l + 0, 0)
eps.interacting(l4.edges, 1 .. 1).output(l + 1, 0)
eps.interacting(l5.edges, 1 .. 1).output(l + 2, 0)
eps.interacting(l6.edges, 1 .. 1).output(l + 3, 0)

l = 160
eps.interacting(l3.edges, 2).output(l + 0, 0)
eps.interacting(l4.edges, 2).output(l + 1, 0)
eps.interacting(l5.edges, 2).output(l + 2, 0)
eps.interacting(l6.edges, 2).output(l + 3, 0)

l = 170
eps.not_interacting(l3.edges).output(l + 0, 0)
eps.not_interacting(l4.edges).output(l + 1, 0)
eps.not_interacting(l5.edges).output(l + 2, 0)
eps.not_interacting(l6.edges).output(l + 3, 0)

l = 180
eps.split_interacting(l3, 1..1)[0].output(l + 0, 0)
eps.split_interacting(l4, 1..1)[0].output(l + 1, 0)
eps.split_interacting(l5, 1..1)[0].output(l + 2, 0)
eps.split_interacting(l6, 1..1)[0].output(l + 3, 0)

l = 190
eps.split_interacting(l3, 1..1)[1].output(l + 0, 0)
eps.split_interacting(l4, 1..1)[1].output(l + 1, 0)
eps.split_interacting(l5, 1..1)[1].output(l + 2, 0)
eps.split_interacting(l6, 1..1)[1].output(l + 3, 0)

l = 200
eps.split_interacting(l3.edges, 1..1)[0].output(l + 0, 0)
eps.split_interacting(l4.edges, 1..1)[0].output(l + 1, 0)
eps.split_interacting(l5.edges, 1..1)[0].output(l + 2, 0)
eps.split_interacting(l6.edges, 1..1)[0].output(l + 3, 0)

l = 210
eps.split_interacting(l3.edges, 1..1)[1].output(l + 0, 0)
eps.split_interacting(l4.edges, 1..1)[1].output(l + 1, 0)
eps.split_interacting(l5.edges, 1..1)[1].output(l + 2, 0)
eps.split_interacting(l6.edges, 1..1)[1].output(l + 3, 0)

l = 300
eps.inside(l3).output(l + 0, 0)
eps.inside(l4).output(l + 1, 0)
eps.inside(l5).output(l + 2, 0)
eps.inside(l6).output(l + 3, 0)

l = 310
eps.not_inside(l3).output(l + 0, 0)
eps.not_inside(l4).output(l + 1, 0)
eps.not_inside(l5).output(l + 2, 0)
eps.not_inside(l6).output(l + 3, 0)

l = 320
eps.split_inside(l3)[0].output(l + 0, 0)
eps.split_inside(l4)[0].output(l + 1, 0)
eps.split_inside(l5)[0].output(l + 2, 0)
eps.split_inside(l6)[0].output(l + 3, 0)

l = 330
eps.split_inside(l3)[1].output(l + 0, 0)
eps.split_inside(l4)[1].output(l + 1, 0)
eps.split_inside(l5)[1].output(l + 2, 0)
eps.split_inside(l6)[1].output(l + 3, 0)

l = 400
eps.outside(l3).output(l + 0, 0)
eps.outside(l4).output(l + 1, 0)
eps.outside(l5).output(l + 2, 0)
eps.outside(l6).output(l + 3, 0)

l = 410
eps.not_outside(l3).output(l + 0, 0)
eps.not_outside(l4).output(l + 1, 0)
eps.not_outside(l5).output(l + 2, 0)
eps.not_outside(l6).output(l + 3, 0)

l = 420
eps.split_outside(l3)[0].output(l + 0, 0)
eps.split_outside(l4)[0].output(l + 1, 0)
eps.split_outside(l5)[0].output(l + 2, 0)
eps.split_outside(l6)[0].output(l + 3, 0)

l = 430
eps.split_outside(l3)[1].output(l + 0, 0)
eps.split_outside(l4)[1].output(l + 1, 0)
eps.split_outside(l5)[1].output(l + 2, 0)
eps.split_outside(l6)[1].output(l + 3, 0)

Binary file added testdata/drc/drcSimpleTests_131.gds
Binary file not shown.
Binary file added testdata/drc/drcSimpleTests_au131.gds
Binary file not shown.
Binary file added testdata/drc/drcSimpleTests_au131d.gds
Binary file not shown.

0 comments on commit 3521946

Please sign in to comment.