Added a test for joining of layers through multiple global net assignment.

This commit is contained in:
Matthias Koefferlein 2019-01-07 23:57:52 +01:00
parent 315bcdd016
commit 294f1701b5
4 changed files with 44 additions and 2 deletions

View File

@ -877,7 +877,7 @@ static void copy_cluster_shapes (const std::string *&attrs, db::Shapes &out, db:
static void run_hc_test (tl::TestBase *_this, const std::string &file, const std::string &au_file)
{
db::Layout ly;
unsigned int l1 = 0, l2 = 0, l3 = 0, l4 = 0;
unsigned int l1 = 0, l2 = 0, l3 = 0, l4 = 0, l5 = 0, l6 = 0;
{
db::LayerProperties p;
@ -903,6 +903,16 @@ static void run_hc_test (tl::TestBase *_this, const std::string &file, const std
lmap.map (db::LDPair (p.layer, p.datatype), l4 = ly.insert_layer ());
ly.set_properties (l4, p);
p.layer = 5;
p.datatype = 0;
lmap.map (db::LDPair (p.layer, p.datatype), l5 = ly.insert_layer ());
ly.set_properties (l5, p);
p.layer = 6;
p.datatype = 0;
lmap.map (db::LDPair (p.layer, p.datatype), l6 = ly.insert_layer ());
ly.set_properties (l6, p);
db::LoadLayoutOptions options;
options.get_options<db::CommonReaderOptions> ().layer_map = lmap;
options.get_options<db::CommonReaderOptions> ().create_other_layers = false;
@ -920,6 +930,8 @@ static void run_hc_test (tl::TestBase *_this, const std::string &file, const std
normalize_layer (ly, strings, l2);
normalize_layer (ly, strings, l3);
normalize_layer (ly, strings, l4);
normalize_layer (ly, strings, l5);
normalize_layer (ly, strings, l6);
// connect 1 to 1, 1 to 2 and 1 to 3, but *not* 2 to 3
db::Connectivity conn;
@ -929,8 +941,13 @@ static void run_hc_test (tl::TestBase *_this, const std::string &file, const std
conn.connect (l1, l2);
conn.connect (l1, l3);
conn.connect (l1, l4);
conn.connect (l1, l5);
conn.connect (l1, l6);
conn.connect_global (l4, "BULK");
conn.connect_global (l5, "BULK2");
conn.connect_global (l6, "BULK");
conn.connect_global (l6, "BULK2");
db::hier_clusters<db::PolygonRef> hc;
hc.build (ly, ly.cell (*ly.begin_top_down ()), db::ShapeIterator::Polygons, conn);
@ -993,7 +1010,7 @@ static void run_hc_test (tl::TestBase *_this, const std::string &file, const std
static void run_hc_test_with_backannotation (tl::TestBase *_this, const std::string &file, const std::string &au_file)
{
db::Layout ly;
unsigned int l1 = 0, l2 = 0, l3 = 0, l4 = 0;
unsigned int l1 = 0, l2 = 0, l3 = 0, l4 = 0, l5 = 0, l6 = 0;
{
db::LayerProperties p;
@ -1019,6 +1036,16 @@ static void run_hc_test_with_backannotation (tl::TestBase *_this, const std::str
lmap.map (db::LDPair (p.layer, p.datatype), l4 = ly.insert_layer ());
ly.set_properties (l4, p);
p.layer = 5;
p.datatype = 0;
lmap.map (db::LDPair (p.layer, p.datatype), l5 = ly.insert_layer ());
ly.set_properties (l5, p);
p.layer = 6;
p.datatype = 0;
lmap.map (db::LDPair (p.layer, p.datatype), l6 = ly.insert_layer ());
ly.set_properties (l6, p);
db::LoadLayoutOptions options;
options.get_options<db::CommonReaderOptions> ().layer_map = lmap;
options.get_options<db::CommonReaderOptions> ().create_other_layers = false;
@ -1036,6 +1063,8 @@ static void run_hc_test_with_backannotation (tl::TestBase *_this, const std::str
normalize_layer (ly, strings, l2);
normalize_layer (ly, strings, l3);
normalize_layer (ly, strings, l4);
normalize_layer (ly, strings, l5);
normalize_layer (ly, strings, l6);
// connect 1 to 1, 1 to 2 and 1 to 3, but *not* 2 to 3
db::Connectivity conn;
@ -1045,8 +1074,13 @@ static void run_hc_test_with_backannotation (tl::TestBase *_this, const std::str
conn.connect (l1, l2);
conn.connect (l1, l3);
conn.connect (l1, l4);
conn.connect (l1, l5);
conn.connect (l1, l6);
conn.connect_global (l4, "BULK");
conn.connect_global (l5, "BULK2");
conn.connect_global (l6, "BULK");
conn.connect_global (l6, "BULK2");
db::hier_clusters<db::PolygonRef> hc;
hc.build (ly, ly.cell (*ly.begin_top_down ()), db::ShapeIterator::Polygons, conn);
@ -1056,6 +1090,8 @@ static void run_hc_test_with_backannotation (tl::TestBase *_this, const std::str
lm[l2] = ly.insert_layer (db::LayerProperties (102, 0));
lm[l3] = ly.insert_layer (db::LayerProperties (103, 0));
lm[l4] = ly.insert_layer (db::LayerProperties (104, 0));
lm[l5] = ly.insert_layer (db::LayerProperties (105, 0));
lm[l6] = ly.insert_layer (db::LayerProperties (106, 0));
hc.return_to_hierarchy (ly, lm);
CHECKPOINT();
@ -1158,3 +1194,9 @@ TEST(116_HierClusters)
run_hc_test_with_backannotation (_this, "hc_test_l16.gds", "hc_test_au16b.gds");
}
TEST(117_HierClusters)
{
run_hc_test (_this, "hc_test_l17.gds", "hc_test_au17.gds");
run_hc_test_with_backannotation (_this, "hc_test_l17.gds", "hc_test_au17b.gds");
}

BIN
testdata/algo/hc_test_au17.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/hc_test_au17b.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/hc_test_l17.gds vendored Normal file

Binary file not shown.