From 3f1c3cf20920e59fd26d49cebcc30e14c7512747 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Mon, 15 Jun 2020 01:27:33 +0200 Subject: [PATCH] Extended NetlistCrossReference class so we can easily obtain the other_... objects. --- src/db/db/dbNetlistCrossReference.cc | 33 +++++++++++++++++++++ src/db/db/dbNetlistCrossReference.h | 3 ++ src/db/db/gsiDeclDbNetlistCrossReference.cc | 28 +++++++++++++++++ 3 files changed, 64 insertions(+) diff --git a/src/db/db/dbNetlistCrossReference.cc b/src/db/db/dbNetlistCrossReference.cc index a0a0464a6..479121ba5 100644 --- a/src/db/db/dbNetlistCrossReference.cc +++ b/src/db/db/dbNetlistCrossReference.cc @@ -55,6 +55,39 @@ NetlistCrossReference::per_circuit_data_for (const std::pair::const_iterator i = m_other_pin.find (pin); + if (i != m_other_pin.end ()) { + return i->second; + } else { + return 0; + } +} + +const db::Device * +NetlistCrossReference::other_device_for (const db::Device *device) const +{ + std::map::const_iterator i = m_other_device.find (device); + if (i != m_other_device.end ()) { + return i->second; + } else { + return 0; + } +} + +const db::SubCircuit * +NetlistCrossReference::other_subcircuit_for (const db::SubCircuit *subcircuit) const +{ + std::map::const_iterator i = m_other_subcircuit.find (subcircuit); + if (i != m_other_subcircuit.end ()) { + return i->second; + } else { + return 0; + } +} + const db::Circuit * NetlistCrossReference::other_circuit_for (const db::Circuit *circuit) const { diff --git a/src/db/db/dbNetlistCrossReference.h b/src/db/db/dbNetlistCrossReference.h index d61868445..c0e9be7eb 100644 --- a/src/db/db/dbNetlistCrossReference.h +++ b/src/db/db/dbNetlistCrossReference.h @@ -256,6 +256,9 @@ public: return m_circuits.end (); } + const db::Pin *other_pin_for (const db::Pin *pin) const; + const db::Device *other_device_for (const db::Device *device) const; + const db::SubCircuit *other_subcircuit_for (const db::SubCircuit *subcircuit) const; const db::Circuit *other_circuit_for (const db::Circuit *circuit) const; const db::Net *other_net_for (const db::Net *net) const; const PerNetData *per_net_data_for (const std::pair &nets) const; diff --git a/src/db/db/gsiDeclDbNetlistCrossReference.cc b/src/db/db/gsiDeclDbNetlistCrossReference.cc index 13078d5e1..de230a506 100644 --- a/src/db/db/gsiDeclDbNetlistCrossReference.cc +++ b/src/db/db/gsiDeclDbNetlistCrossReference.cc @@ -403,6 +403,34 @@ Class decl_dbNetlistCrossReference (decl_dbNetlistCom "The return value will be nil if no match is found. " "Otherwise it is the 'b' net for nets from the 'a' netlist and vice versa." ) + + gsi::method ("other_circuit_for", &db::NetlistCrossReference::other_circuit_for, gsi::arg ("circuit"), + "@brief Gets the matching other circuit for a given primary circuit.\n" + "The return value will be nil if no match is found. " + "Otherwise it is the 'b' circuit for circuits from the 'a' netlist and vice versa." + "\n\n" + "This method has been introduced in version 0.27.\n" + ) + + gsi::method ("other_device_for", &db::NetlistCrossReference::other_device_for, gsi::arg ("device"), + "@brief Gets the matching other device for a given primary device.\n" + "The return value will be nil if no match is found. " + "Otherwise it is the 'b' device for devices from the 'a' netlist and vice versa." + "\n\n" + "This method has been introduced in version 0.27.\n" + ) + + gsi::method ("other_pin_for", &db::NetlistCrossReference::other_pin_for, gsi::arg ("pin"), + "@brief Gets the matching other pin for a given primary pin.\n" + "The return value will be nil if no match is found. " + "Otherwise it is the 'b' pin for pins from the 'a' netlist and vice versa." + "\n\n" + "This method has been introduced in version 0.27.\n" + ) + + gsi::method ("other_subcircuit_for", &db::NetlistCrossReference::other_subcircuit_for, gsi::arg ("subcircuit"), + "@brief Gets the matching other subcircuit for a given primary subcircuit.\n" + "The return value will be nil if no match is found. " + "Otherwise it is the 'b' subcircuit for subcircuits from the 'a' netlist and vice versa." + "\n\n" + "This method has been introduced in version 0.27.\n" + ) + gsi::method ("clear", &db::NetlistCrossReference::clear, "@hide\n" ) +