From a04bcbc9a373ebf0740cdde994e7d75ccfcabe4d Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 19 Mar 2024 20:41:42 +0100 Subject: [PATCH] Some refactoring (renaming) --- src/db/db/dbLayoutToNetlistSoftConnections.cc | 58 ++++++++-------- src/db/db/dbLayoutToNetlistSoftConnections.h | 68 ++++++++++--------- 2 files changed, 65 insertions(+), 61 deletions(-) diff --git a/src/db/db/dbLayoutToNetlistSoftConnections.cc b/src/db/db/dbLayoutToNetlistSoftConnections.cc index 3ecaf4995..b915f4c54 100644 --- a/src/db/db/dbLayoutToNetlistSoftConnections.cc +++ b/src/db/db/dbLayoutToNetlistSoftConnections.cc @@ -31,15 +31,15 @@ namespace db { // ------------------------------------------------------------------------------- -// SoftConnectionClusterInfo implementation +// SoftConnectionNetGraph implementation -SoftConnectionClusterInfo::SoftConnectionClusterInfo () +SoftConnectionNetGraph::SoftConnectionNetGraph () : m_partial_net_count (0) { // .. nothing yet .. } -void SoftConnectionClusterInfo::add (const db::Net *net, SoftConnectionPinDir dir, const db::Pin *pin, size_t partial_net_count) +void SoftConnectionNetGraph::add (const db::Net *net, SoftConnectionPinDir dir, const db::Pin *pin, size_t partial_net_count) { // limiting the partial net count to 1 means we report errors only once in the // hierarchy, not on every level @@ -66,16 +66,16 @@ SoftConnectionCircuitInfo::SoftConnectionCircuitInfo (const db::Circuit *circuit // .. nothing yet .. } -SoftConnectionClusterInfo &SoftConnectionCircuitInfo::make_cluster () +SoftConnectionNetGraph &SoftConnectionCircuitInfo::make_net_graph () { - m_cluster_info.push_back (SoftConnectionClusterInfo ()); - return m_cluster_info.back (); + m_net_graphs.push_back (SoftConnectionNetGraph ()); + return m_net_graphs.back (); } -void SoftConnectionCircuitInfo::add_pin_info (const db::Pin *pin, SoftConnectionPinDir dir, SoftConnectionClusterInfo *sc_cluster_info) +void SoftConnectionCircuitInfo::add_pin_info (const db::Pin *pin, SoftConnectionPinDir dir, SoftConnectionNetGraph *graph_info) { if (pin) { - m_pin_info.insert (std::make_pair (pin->id (), std::make_pair (dir, sc_cluster_info))); + m_pin_info.insert (std::make_pair (pin->id (), std::make_pair (dir, graph_info))); } } @@ -89,7 +89,7 @@ SoftConnectionPinDir SoftConnectionCircuitInfo::direction_per_pin (const db::Pin return p != m_pin_info.end () ? p->second.first : SoftConnectionPinDir (); } -const SoftConnectionClusterInfo *SoftConnectionCircuitInfo::get_cluster_info_per_pin (const db::Pin *pin) const +const SoftConnectionNetGraph *SoftConnectionCircuitInfo::get_net_graph_per_pin (const db::Pin *pin) const { if (! pin) { return 0; @@ -107,25 +107,25 @@ SoftConnectionInfo::SoftConnectionInfo () // .. nothing yet .. } -void SoftConnectionInfo::build (const db::Netlist &netlist, const db::hier_clusters &net_clusters) +void SoftConnectionInfo::build (const db::Netlist &netlist, const db::hier_clusters &shape_clusters) { for (auto c = netlist.begin_bottom_up (); c != netlist.end_bottom_up (); ++c) { - build_clusters_for_circuit (c.operator-> (), net_clusters.clusters_per_cell (c->cell_index ())); + build_graphs_for_circuit (c.operator-> (), shape_clusters.clusters_per_cell (c->cell_index ())); } } void SoftConnectionInfo::join_soft_connections (db::Netlist &netlist) { if (tl::verbosity () >= 20) { - tl::info << "Joining soft-connected net clusters .."; + tl::info << "Joining soft-connected net graphs .."; } - size_t nclusters_tot = 0; + size_t nnet_graphs_tot = 0; size_t npartial_tot = 0; for (auto c = netlist.begin_top_down (); c != netlist.end_top_down (); ++c) { - size_t nclusters = 0; + size_t nnet_graphs = 0; size_t npartial = 0; auto scc = m_scc_per_circuit.find (c.operator-> ()); @@ -141,7 +141,7 @@ void SoftConnectionInfo::join_soft_connections (db::Netlist &netlist) if (cc != sc->end_clusters ()) { db::Net *net0 = c->net_by_cluster_id (cc->first); tl_assert (net0 != 0); - ++nclusters; + ++nnet_graphs; while (++cc != sc->end_clusters ()) { // TODO: logging? c->join_nets (net0, c->net_by_cluster_id (cc->first)); @@ -151,17 +151,17 @@ void SoftConnectionInfo::join_soft_connections (db::Netlist &netlist) } - nclusters_tot += nclusters; + nnet_graphs_tot += nnet_graphs; npartial_tot += npartial; - if (nclusters > 0 && tl::verbosity () >= 30) { - tl::info << "Circuit " << c->name () << ": joined " << nclusters << " soft-connected net clusters with " << npartial << " partial nets."; + if (nnet_graphs > 0 && tl::verbosity () >= 30) { + tl::info << "Circuit " << c->name () << ": joined " << nnet_graphs << " soft-connected net clusters with " << npartial << " partial nets."; } } if (tl::verbosity () >= 20) { - tl::info << "Joined " << nclusters_tot << " soft-connected net clusters with " << npartial_tot << " partial nets in total."; + tl::info << "Joined " << nnet_graphs_tot << " soft-connected net clusters with " << npartial_tot << " partial nets in total."; } m_scc_per_circuit.clear (); @@ -188,9 +188,9 @@ SoftConnectionInfo::representative_polygon (const db::Net *net, const db::Layout return db::DPolygon (bbox); } -void SoftConnectionInfo::report_partial_nets (const db::Circuit *circuit, const SoftConnectionClusterInfo &cluster_info, db::LayoutToNetlist &l2n, const std::string &path, const db::DCplxTrans &trans, const std::string &top_cell, int &index, std::set &seen) +void SoftConnectionInfo::report_partial_nets (const db::Circuit *circuit, const SoftConnectionNetGraph &net_graph, db::LayoutToNetlist &l2n, const std::string &path, const db::DCplxTrans &trans, const std::string &top_cell, int &index, std::set &seen) { - for (auto cc = cluster_info.begin_clusters (); cc != cluster_info.end_clusters (); ++cc) { + for (auto cc = net_graph.begin_clusters (); cc != net_graph.end_clusters (); ++cc) { const db::Net *net = circuit->net_by_cluster_id (cc->first); @@ -221,7 +221,7 @@ void SoftConnectionInfo::report_partial_nets (const db::Circuit *circuit, const const SoftConnectionCircuitInfo &sci = scc->second; - const SoftConnectionClusterInfo *scci = sci.get_cluster_info_per_pin (sc->pin ()); + const SoftConnectionNetGraph *scci = sci.get_net_graph_per_pin (sc->pin ()); if (! scci || scci->partial_net_count () == 0) { continue; } @@ -271,7 +271,7 @@ void SoftConnectionInfo::report (db::LayoutToNetlist &l2n) } } -void SoftConnectionInfo::build_clusters_for_circuit (const db::Circuit *circuit, const db::connected_clusters &shape_clusters) +void SoftConnectionInfo::build_graphs_for_circuit (const db::Circuit *circuit, const db::connected_clusters &shape_clusters) { SoftConnectionCircuitInfo &sc_circuit_info = m_scc_per_circuit.insert (std::make_pair (circuit, SoftConnectionCircuitInfo (circuit))).first->second; @@ -288,7 +288,7 @@ void SoftConnectionInfo::build_clusters_for_circuit (const db::Circuit *circuit, connected.insert (c->id ()); seen.insert (c->id ()); - SoftConnectionClusterInfo *sc_cluster_info = 0; + SoftConnectionNetGraph *sc_net_graph = 0; while (! connected.empty ()) { @@ -340,16 +340,16 @@ void SoftConnectionInfo::build_clusters_for_circuit (const db::Circuit *circuit, pin = net->begin_pins ()->pin (); } - if (! sc_cluster_info) { - sc_cluster_info = &sc_circuit_info.make_cluster (); + if (! sc_net_graph) { + sc_net_graph = &sc_circuit_info.make_net_graph (); } // we do not count floating nets as they cannot make a functional connection if (! net->is_floating ()) { - sc_cluster_info->add (net, dir, pin, sc_partial_net_count); + sc_net_graph->add (net, dir, pin, sc_partial_net_count); } - sc_circuit_info.add_pin_info (pin, dir, sc_cluster_info); + sc_circuit_info.add_pin_info (pin, dir, sc_net_graph); } @@ -387,7 +387,7 @@ void SoftConnectionInfo::get_net_connections_through_subcircuit (const db::SubCi const SoftConnectionCircuitInfo &sci = scc->second; - const SoftConnectionClusterInfo *scci = sci.get_cluster_info_per_pin (pin); + const SoftConnectionNetGraph *scci = sci.get_net_graph_per_pin (pin); if (scci) { partial_net_count += scci->partial_net_count (); diff --git a/src/db/db/dbLayoutToNetlistSoftConnections.h b/src/db/db/dbLayoutToNetlistSoftConnections.h index a13630465..37e96d40d 100644 --- a/src/db/db/dbLayoutToNetlistSoftConnections.h +++ b/src/db/db/dbLayoutToNetlistSoftConnections.h @@ -121,13 +121,17 @@ private: }; /** - * @brief Describes a soft-connected cluster + * @brief Describes a soft-connected net graph * - * Such a cluster is a collection of nets/shape clusters that are connected via + * Such a graph is a collection of nets/shape clusters that are connected via * soft connections. - * There is also some information about the count of "down-only" nets. + * There is also some information about the count of "down-only" nets. With + * this, this object can serve as a representative model for a circuit's + * content as embedded into a larger graph through subcircuits. + * + * A circuit in general can be made from a number of such net graphs. */ -class DB_PUBLIC SoftConnectionClusterInfo +class DB_PUBLIC SoftConnectionNetGraph { public: typedef std::set pin_set; @@ -135,7 +139,7 @@ public: typedef std::map dir_map; typedef dir_map::const_iterator dir_map_iterator; - SoftConnectionClusterInfo (); + SoftConnectionNetGraph (); /** * @brief Enters information about a specific net @@ -164,9 +168,9 @@ public: } /** - * @brief Gets the pins on the cluster (begin iterator) + * @brief Gets the outside pins on the net graph (begin iterator) * - * The iterator delivers Pin IDs of pins leading outside the circuit this cluster lives in. + * The iterator delivers Pin IDs of pins leading outside the circuit this graph lives in. */ pin_iterator begin_pins () const { @@ -174,7 +178,7 @@ public: } /** - * @brief Gets the pins on the cluster (end iterator) + * @brief Gets the pins on the net graph (end iterator) */ pin_iterator end_pins () const { @@ -206,14 +210,14 @@ private: /** * @brief Provides temporary soft connection information for a circuit * - * Soft connection information is the soft-connected-clusters that are formed inside - * the circuit and how these clusters connect to pins. + * Soft connection information is the soft-connected net graphs that are formed inside + * the circuit and how these graphs connect to pins from the circuit leading outside. */ class DB_PUBLIC SoftConnectionCircuitInfo { public: - typedef std::list cluster_list; - typedef cluster_list::const_iterator cluster_list_iterator; + typedef std::list net_graph_list; + typedef net_graph_list::const_iterator net_graph_list_iterator; /** * @brief Constructor @@ -229,18 +233,18 @@ public: } /** - * @brief Creates a new cluster info object + * @brief Creates a new graph info object */ - SoftConnectionClusterInfo &make_cluster (); + SoftConnectionNetGraph &make_net_graph (); /** * @brief Adds information about a pin * * @param pin The pin * @param dir The direction of connections from the pin - * @param sc_cluster_info The soft-connected net cluster info object + * @param graph_info The soft-connected net graph info object */ - void add_pin_info (const db::Pin *pin, SoftConnectionPinDir dir, SoftConnectionClusterInfo *sc_cluster_info); + void add_pin_info (const db::Pin *pin, SoftConnectionPinDir dir, SoftConnectionNetGraph *graph_info); /** * @brief Gets the direction attribute of the pin @@ -248,30 +252,30 @@ public: SoftConnectionPinDir direction_per_pin (const db::Pin *pin) const; /** - * @brief Gets the soft-connected net cluster info object the pin connects to + * @brief Gets the soft-connected net graph object the pin connects to */ - const SoftConnectionClusterInfo *get_cluster_info_per_pin (const db::Pin *pin) const; + const SoftConnectionNetGraph *get_net_graph_per_pin (const db::Pin *pin) const; /** - * @brief List of per-circui info objects, begin iterator + * @brief List of per-circuit net graph objects, begin iterator */ - cluster_list_iterator begin () const + net_graph_list_iterator begin () const { - return m_cluster_info.begin (); + return m_net_graphs.begin (); } /** - * @brief List of per-circui info objects, end iterator + * @brief List of per-circuit net graph objects, end iterator */ - cluster_list_iterator end () const + net_graph_list_iterator end () const { - return m_cluster_info.end (); + return m_net_graphs.end (); } private: const db::Circuit *mp_circuit; - cluster_list m_cluster_info; - std::map > m_pin_info; + net_graph_list m_net_graphs; + std::map > m_pin_info; }; /** @@ -283,9 +287,9 @@ public: SoftConnectionInfo (); /** - * @brief Builds the soft connection information for the given netlist and net clusters + * @brief Builds the soft connection information for the given netlist and shape clusters */ - void build (const db::Netlist &netlist, const db::hier_clusters &net_clusters); + void build (const db::Netlist &netlist, const db::hier_clusters &shape_clusters); /** * @brief Joins nets connected by soft connections @@ -304,16 +308,16 @@ private: std::map m_scc_per_circuit; /** - * @brief Builds the per-circuit cluster information + * @brief Builds the per-circuit net graphs * * First of all, this method creates a SoftConnectionCircuitInfo object for the circuit. * - * Inside this per-circuit object, it will create a number of SoftConnectionClusterInfo objects - each one + * Inside this per-circuit object, it will create a number of SoftConnectionNetGraph objects - each one * for a cluster of soft-connected nets. * * Call this method bottom-up as it needs SoftConnectionCircuitInfo objects for called circuits. */ - void build_clusters_for_circuit (const db::Circuit *circuit, const db::connected_clusters &shape_clusters); + void build_graphs_for_circuit (const db::Circuit *circuit, const db::connected_clusters &shape_clusters); /** * @brief Gets a value indicating whether the given net connects to subcircuits with up or down connections inside @@ -340,7 +344,7 @@ private: */ std::set net_connections_through_subcircuits (const db::Net *net, size_t &partial_net_count); - void report_partial_nets (const db::Circuit *circuit, const SoftConnectionClusterInfo &cluster_info, LayoutToNetlist &l2n, const std::string &path, const db::DCplxTrans &trans, const std::string &top_cell, int &index, std::set &seen); + void report_partial_nets (const db::Circuit *circuit, const SoftConnectionNetGraph &cluster_info, LayoutToNetlist &l2n, const std::string &path, const db::DCplxTrans &trans, const std::string &top_cell, int &index, std::set &seen); db::DPolygon representative_polygon (const db::Net *net, const db::LayoutToNetlist &l2n, const db::CplxTrans &trans); };