mirror of https://github.com/KLayout/klayout.git
Added cluster_id property to db::Net
This commit is contained in:
parent
80999475f4
commit
83a38037e5
|
|
@ -145,11 +145,13 @@ const Pin *NetPinRef::pin (const db::Circuit *c) const
|
|||
// Net class implementation
|
||||
|
||||
Net::Net ()
|
||||
: m_cluster_id (0)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
Net::Net (const Net &other)
|
||||
: m_cluster_id (0)
|
||||
{
|
||||
operator= (other);
|
||||
}
|
||||
|
|
@ -160,6 +162,7 @@ Net &Net::operator= (const Net &other)
|
|||
m_name = other.m_name;
|
||||
m_pins = other.m_pins;
|
||||
m_ports = other.m_ports;
|
||||
m_cluster_id = other.m_cluster_id;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -169,6 +172,7 @@ void Net::clear ()
|
|||
m_name.clear ();
|
||||
m_ports.clear ();
|
||||
m_pins.clear ();
|
||||
m_cluster_id = 0;
|
||||
}
|
||||
|
||||
void Net::set_name (const std::string &name)
|
||||
|
|
@ -176,6 +180,11 @@ void Net::set_name (const std::string &name)
|
|||
m_name = name;
|
||||
}
|
||||
|
||||
void Net::set_cluster_id (size_t ci)
|
||||
{
|
||||
m_cluster_id = ci;
|
||||
}
|
||||
|
||||
void Net::add_pin (const NetPinRef &pin)
|
||||
{
|
||||
m_pins.push_back (pin);
|
||||
|
|
|
|||
|
|
@ -409,6 +409,22 @@ public:
|
|||
return m_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets the cluster ID of this net
|
||||
*
|
||||
* The cluster ID links the net to a cluster from the
|
||||
* hierarchical layout netlist extractor.
|
||||
*/
|
||||
void set_cluster_id (size_t ci);
|
||||
|
||||
/**
|
||||
* @brief Gets the cluster ID
|
||||
*/
|
||||
size_t cluster_id () const
|
||||
{
|
||||
return m_cluster_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Adds a pin to this net
|
||||
*/
|
||||
|
|
@ -457,6 +473,7 @@ private:
|
|||
port_list m_ports;
|
||||
pin_list m_pins;
|
||||
std::string m_name;
|
||||
size_t m_cluster_id;
|
||||
|
||||
void translate_devices (const std::map<const Device *, Device *> &map);
|
||||
void translate_subcircuits (const std::map<const SubCircuit *, SubCircuit *> &map);
|
||||
|
|
|
|||
|
|
@ -320,3 +320,21 @@ TEST(5_SubCircuit)
|
|||
EXPECT_EQ (sc2.name (), "sc");
|
||||
EXPECT_EQ (sc2.trans ().to_string (), "r0 *2.5 0,0");
|
||||
}
|
||||
|
||||
TEST(6_Net)
|
||||
{
|
||||
db::Net n, n2;
|
||||
|
||||
n.set_name ("n");
|
||||
EXPECT_EQ (n.name (), "n");
|
||||
n.set_cluster_id (17);
|
||||
EXPECT_EQ (int (n.cluster_id ()), 17);
|
||||
|
||||
n2 = n;
|
||||
EXPECT_EQ (n2.name (), "n");
|
||||
EXPECT_EQ (int (n2.cluster_id ()), 17);
|
||||
|
||||
n.clear ();
|
||||
EXPECT_EQ (n.name (), "");
|
||||
EXPECT_EQ (int (n.cluster_id ()), 0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue