diff --git a/src/db/db/dbCircuit.cc b/src/db/db/dbCircuit.cc index 07d8cb338..10022a34e 100644 --- a/src/db/db/dbCircuit.cc +++ b/src/db/db/dbCircuit.cc @@ -408,7 +408,7 @@ void Circuit::join_nets (Net *net, Net *with) } while (with->begin_pins () != with->end_pins ()) { - connect_pin (with->begin_pins ()->pin_id (), net); + join_pin_with_net (with->begin_pins ()->pin_id (), net); } if (netlist ()->callbacks ()) { @@ -698,6 +698,25 @@ void Circuit::connect_pin (size_t pin_id, Net *net) m_pin_refs [pin_id] = Net::pin_iterator (); } + if (net) { + net->add_pin (NetPinRef (pin_id)); + } +} + +void Circuit::join_pin_with_net (size_t pin_id, Net *net) +{ + if (net_for_pin (pin_id) == net) { + return; + } + + if (pin_id < m_pin_refs.size ()) { + Net::pin_iterator p = m_pin_refs [pin_id]; + if (! tl::is_null_iterator (p) && p->net ()) { + p->net ()->erase_pin (p); + } + m_pin_refs [pin_id] = Net::pin_iterator (); + } + if (net) { if (net->begin_pins () != net->end_pins ()) { join_pins (net->begin_pins ()->pin_id (), pin_id); diff --git a/src/db/db/dbCircuit.h b/src/db/db/dbCircuit.h index 5c90ed4a0..22253a78c 100644 --- a/src/db/db/dbCircuit.h +++ b/src/db/db/dbCircuit.h @@ -702,6 +702,15 @@ public: */ void connect_pin (size_t pin_id, Net *net); + /** + * @brief Adds a pin to the given net + * The pin will be added to the net. If there is already a pin + * on the net, the existing and new pin will be joined. + * This usually implies that nets further up in the hierarchy + * are joined too. + */ + void join_pin_with_net (size_t pin_id, Net *net); + /** * @brief Renames the pin with the given ID */ diff --git a/src/db/db/gsiDeclDbLayoutToNetlist.cc b/src/db/db/gsiDeclDbLayoutToNetlist.cc index d60455c71..dfaa7046a 100644 --- a/src/db/db/gsiDeclDbLayoutToNetlist.cc +++ b/src/db/db/gsiDeclDbLayoutToNetlist.cc @@ -712,6 +712,7 @@ Class decl_dbLayoutToNetlist ("db", "LayoutToNetlist", "@brief Reads the extracted netlist from the file.\n" "This method employs the native format of KLayout.\n" ) + + // @@@ Add API for logs gsi::method_ext ("antenna_check", &antenna_check, gsi::arg ("gate"), gsi::arg ("metal"), gsi::arg ("ratio"), gsi::arg ("diodes", std::vector (), "[]"), gsi::arg ("texts", (db::Texts *) 0, "nil"), "@brief Runs an antenna check on the extracted clusters\n" "\n"