diff --git a/src/db/db/dbHierNetworkProcessor.cc b/src/db/db/dbHierNetworkProcessor.cc index babb8d5fc..33ae690d4 100644 --- a/src/db/db/dbHierNetworkProcessor.cc +++ b/src/db/db/dbHierNetworkProcessor.cc @@ -990,7 +990,7 @@ template struct get_shape_flags { }; template <> struct get_shape_flags { - db::ShapeIterator::flags_type operator() (bool /*with_attr*/) const + db::ShapeIterator::flags_type operator() () const { return db::ShapeIterator::Edges; } @@ -999,7 +999,7 @@ struct get_shape_flags template <> struct get_shape_flags { - db::ShapeIterator::flags_type operator() (bool /*with_attr*/) const + db::ShapeIterator::flags_type operator() () const { return db::ShapeIterator::Polygons; } @@ -1008,13 +1008,9 @@ struct get_shape_flags template <> struct get_shape_flags { - db::ShapeIterator::flags_type operator() (bool with_attr) const + db::ShapeIterator::flags_type operator() () const { - if (with_attr) { - return db::ShapeIterator::flags_type (db::ShapeIterator::Polygons | db::ShapeIterator::Texts); - } else { - return db::ShapeIterator::flags_type (db::ShapeIterator::Polygons); - } + return db::ShapeIterator::flags_type (db::ShapeIterator::Polygons | db::ShapeIterator::Texts); } }; @@ -1030,7 +1026,7 @@ local_clusters::build_clusters (const db::Cell &cell, const db::Connectivity db::box_convert bc; addressable_shape_delivery heap; attr_accessor attr; - db::ShapeIterator::flags_type shape_flags = get_shape_flags () (attr_equivalence != 0 /*with attributes*/); + db::ShapeIterator::flags_type shape_flags = get_shape_flags () (); for (db::Connectivity::layer_iterator l = conn.begin_layers (); l != conn.end_layers (); ++l) { const db::Shapes &shapes = cell.shapes (*l); diff --git a/src/db/db/dbHierNetworkProcessor.h b/src/db/db/dbHierNetworkProcessor.h index 577eef944..625a972b8 100644 --- a/src/db/db/dbHierNetworkProcessor.h +++ b/src/db/db/dbHierNetworkProcessor.h @@ -31,6 +31,7 @@ #include "dbCell.h" #include "dbInstElement.h" #include "tlEquivalenceClusters.h" +#include "tlAssert.h" #include #include @@ -1365,7 +1366,17 @@ inline db::properties_id_type prop_id_from_attr (size_t attr) */ inline size_t text_ref_to_attr (const db::Text *tr) { - return size_t (tr) * 2 + 1; + return size_t (tr) + 1; +} + +/** + * @brief Gets the text value from an attribute ID + */ +inline const char *text_from_attr (size_t attr) +{ + tl_assert ((attr & 1) != 0); + const db::Text *t = reinterpret_cast (attr - 1); + return t->string (); } } diff --git a/src/db/db/dbNetlistExtractor.cc b/src/db/db/dbNetlistExtractor.cc index bfe1fba9f..7783ffbc6 100644 --- a/src/db/db/dbNetlistExtractor.cc +++ b/src/db/db/dbNetlistExtractor.cc @@ -300,19 +300,23 @@ void NetlistExtractor::collect_labels (const connected_clusters_type &clusters, const local_cluster_type &lc = clusters.cluster_by_id (cid); for (local_cluster_type::attr_iterator a = lc.begin_attr (); a != lc.end_attr (); ++a) { - if (! db::is_prop_id_attr (*a)) { - continue; - } + if (db::is_prop_id_attr (*a)) { - db::properties_id_type pi = db::prop_id_from_attr (*a); + db::properties_id_type pi = db::prop_id_from_attr (*a); - const db::PropertiesRepository::properties_set &ps = mp_layout->properties_repository ().properties (pi); - for (db::PropertiesRepository::properties_set::const_iterator j = ps.begin (); j != ps.end (); ++j) { + const db::PropertiesRepository::properties_set &ps = mp_layout->properties_repository ().properties (pi); + for (db::PropertiesRepository::properties_set::const_iterator j = ps.begin (); j != ps.end (); ++j) { + + if (m_text_annot_name_id.first && j->first == m_text_annot_name_id.second) { + net_names.insert (j->second.to_string ()); + } - if (m_text_annot_name_id.first && j->first == m_text_annot_name_id.second) { - net_names.insert (j->second.to_string ()); } + } else { + + net_names.insert (db::text_from_attr (*a)); + } } diff --git a/src/db/unit_tests/dbNetlistExtractorTests.cc b/src/db/unit_tests/dbNetlistExtractorTests.cc index c6864d444..8b3600bd5 100644 --- a/src/db/unit_tests/dbNetlistExtractorTests.cc +++ b/src/db/unit_tests/dbNetlistExtractorTests.cc @@ -77,6 +77,7 @@ static void dump_nets_to_layout (const db::Netlist &nl, const db::hier_clusters< for (db::Circuit::const_net_iterator n = c->begin_nets (); n != c->end_nets (); ++n) { + std::string nn = "NET_" + c->name () + "_" + n->expanded_name (); const db::local_cluster &lc = clusters.clusters_per_cell (c->cell_index ()).cluster_by_id (n->cluster_id ()); bool any_shapes = false; @@ -86,7 +87,6 @@ static void dump_nets_to_layout (const db::Netlist &nl, const db::hier_clusters< if (any_shapes || (with_device_cells && n->terminal_count() > 0)) { - std::string nn = "NET_" + c->name () + "_" + n->expanded_name (); db::Cell &net_cell = ly.cell (ly.add_cell (nn.c_str ())); cell.insert (db::CellInstArray (db::CellInst (net_cell.cell_index ()), db::Trans ())); @@ -288,6 +288,14 @@ TEST(1_DeviceAndNetExtraction) net_ex.extract_nets (dss, 0, conn, nl, cl); + // check if net names are properly assigned + db::Circuit *top_circuit = nl.circuit_by_name ("RINGO"); + EXPECT_EQ (top_circuit != 0, true); + if (top_circuit) { + db::Net *fb_net = top_circuit->net_by_name ("FB"); + EXPECT_EQ (fb_net != 0, true); + } + // debug layers produced for nets // 202/0 -> Active // 203/0 -> Poly @@ -518,6 +526,14 @@ TEST(1a_DeviceAndNetExtractionWithTextsAsLabels) net_ex.extract_nets (dss, 0, conn, nl, cl); + // check if net names are properly assigned + db::Circuit *top_circuit = nl.circuit_by_name ("RINGO"); + EXPECT_EQ (top_circuit != 0, true); + if (top_circuit) { + db::Net *fb_net = top_circuit->net_by_name ("FB"); + EXPECT_EQ (fb_net != 0, true); + } + // debug layers produced for nets // 202/0 -> Active // 203/0 -> Poly diff --git a/testdata/algo/device_extract_au1a.gds b/testdata/algo/device_extract_au1a.gds index 79534b993..47ac063c7 100644 Binary files a/testdata/algo/device_extract_au1a.gds and b/testdata/algo/device_extract_au1a.gds differ