diff --git a/src/db/db/dbLayoutToNetlist.cc b/src/db/db/dbLayoutToNetlist.cc index 997fe993d..83395e612 100644 --- a/src/db/db/dbLayoutToNetlist.cc +++ b/src/db/db/dbLayoutToNetlist.cc @@ -1691,9 +1691,10 @@ NetBuilder::build_nets (const std::vector *nets, const std::mapdbu (); db::ICplxTrans tr = db::CplxTrans (dbu).inverted () * subcircuit.trans () * db::CplxTrans (dbu); - db::properties_id_type netname_propid = make_netname_propid (target ().properties_repository (), prop_mode, netname_prop, *n); + std::string net_name_prefix = subcircuit.expanded_name () + ":"; + db::properties_id_type netname_propid = make_netname_propid (target ().properties_repository (), prop_mode, netname_prop, *n, net_name_prefix); - build_net_rec (*n, c->cell_index (), lmap, subcircuit.expanded_name () + ":", netname_propid, tr); + build_net_rec (*n, c->cell_index (), lmap, net_name_prefix, netname_propid, tr); } @@ -1853,7 +1854,7 @@ NetBuilder::build_net_rec (const db::Net &net, db::cell_index_type circuit_cell, } db::properties_id_type -NetBuilder::make_netname_propid (db::PropertiesRepository &pr, NetPropertyMode net_prop_mode, const tl::Variant &netname_prop, const db::Net &net) +NetBuilder::make_netname_propid (db::PropertiesRepository &pr, NetPropertyMode net_prop_mode, const tl::Variant &netname_prop, const db::Net &net, const std::string &net_name_prefix) { if (net_prop_mode == NPM_NoProperties) { @@ -1874,13 +1875,13 @@ NetBuilder::make_netname_propid (db::PropertiesRepository &pr, NetPropertyMode n if (net_prop_mode == NPM_NetQualifiedNameOnly) { std::vector l; l.reserve (2); - l.push_back (tl::Variant (net.expanded_name ())); + l.push_back (tl::Variant (net_name_prefix + net.expanded_name ())); l.push_back (tl::Variant (net.circuit ()->name ())); propset.insert (std::make_pair (name_propnameid, tl::Variant (l))); } else if (net_prop_mode == NPM_NetIDOnly) { propset.insert (std::make_pair (name_propnameid, tl::Variant (reinterpret_cast (&net)))); } else { - propset.insert (std::make_pair (name_propnameid, tl::Variant (net.expanded_name ()))); + propset.insert (std::make_pair (name_propnameid, tl::Variant (net_name_prefix + net.expanded_name ()))); } } diff --git a/src/db/db/dbLayoutToNetlist.h b/src/db/db/dbLayoutToNetlist.h index dd99a3763..e6bb022af 100644 --- a/src/db/db/dbLayoutToNetlist.h +++ b/src/db/db/dbLayoutToNetlist.h @@ -1071,7 +1071,7 @@ public: /** * @brief A helper function to create a property ID for a given net, net property name and net property mode */ - static db::properties_id_type make_netname_propid (db::PropertiesRepository &pr, NetPropertyMode net_prop_mode, const tl::Variant &netname_prop, const db::Net &net); + static db::properties_id_type make_netname_propid (db::PropertiesRepository &pr, NetPropertyMode net_prop_mode, const tl::Variant &netname_prop, const db::Net &net, const std::string &net_name_prefix = std::string ()); private: struct CellReuseTableKey diff --git a/src/db/db/dbNetlistExtractor.cc b/src/db/db/dbNetlistExtractor.cc index 0eba50e93..2f02bc160 100644 --- a/src/db/db/dbNetlistExtractor.cc +++ b/src/db/db/dbNetlistExtractor.cc @@ -285,7 +285,8 @@ NetlistExtractor::extract_nets (const db::DeepShapeStore &dss, unsigned int layo for (connected_clusters_type::all_iterator c = clusters.begin_all (); ! c.at_end (); ++c) { const db::local_cluster &lc = clusters.cluster_by_id (*c); - if (clusters.connections_for_cluster (*c).empty () && lc.empty ()) { + const connected_clusters_type::connections_type &cc = clusters.connections_for_cluster (*c); + if (cc.empty () && lc.empty ()) { // this is an entirely empty cluster so we skip it. // Such clusters are left over when joining clusters. continue; @@ -313,6 +314,23 @@ NetlistExtractor::extract_nets (const db::DeepShapeStore &dss, unsigned int layo } } +#if 0 + // This code will pull net names from subcircuits into their parents if those nets are dummy connections + // made to satisfy the subcircuit's pin, but not to make a physical connection. + // Don't know whether this is a good idea, so this code is disabled for now. + + if (net_names.empty () && clusters.is_dummy (*c) && net->subcircuit_pin_count () == 1) { + // in the case of a dummy connection (partially connected subcircuits) create a + // new name indicating the subcircuit and the subcircuit net name - this makes subcircuit + // net names available (the net is pseudo-root inside in the subcircuit) + const db::NetSubcircuitPinRef &sc_pin = *net->begin_subcircuit_pins (); + const db::Net *sc_net = sc_pin.subcircuit ()->circuit_ref ()->net_for_pin (sc_pin.pin_id ()); + if (sc_net && ! sc_net->name ().empty ()) { + net_names.insert (sc_pin.subcircuit ()->expanded_name () + ":" + sc_net->name ()); + } + } +#endif + assign_net_names (net, net_names); if (! clusters.is_root (*c)) {