Debugging: proper assignment of net names through labels.

This commit is contained in:
Matthias Koefferlein 2020-05-20 23:27:06 +02:00
parent e9af72ee28
commit 854320d52d
5 changed files with 46 additions and 19 deletions

View File

@ -990,7 +990,7 @@ template <class T> struct get_shape_flags { };
template <>
struct get_shape_flags<db::Edge>
{
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<db::Edge>
template <>
struct get_shape_flags<db::PolygonRef>
{
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<db::PolygonRef>
template <>
struct get_shape_flags<db::NetShape>
{
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<T>::build_clusters (const db::Cell &cell, const db::Connectivity
db::box_convert<T> bc;
addressable_shape_delivery<T> heap;
attr_accessor<T> attr;
db::ShapeIterator::flags_type shape_flags = get_shape_flags<T> () (attr_equivalence != 0 /*with attributes*/);
db::ShapeIterator::flags_type shape_flags = get_shape_flags<T> () ();
for (db::Connectivity::layer_iterator l = conn.begin_layers (); l != conn.end_layers (); ++l) {
const db::Shapes &shapes = cell.shapes (*l);

View File

@ -31,6 +31,7 @@
#include "dbCell.h"
#include "dbInstElement.h"
#include "tlEquivalenceClusters.h"
#include "tlAssert.h"
#include <map>
#include <list>
@ -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<const db::Text *> (attr - 1);
return t->string ();
}
}

View File

@ -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));
}
}

View File

@ -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<db::NetShape> &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

Binary file not shown.