WIP: purge_nets and combine_devices for db::Netlist, GSI bindings.

This commit is contained in:
Matthias Koefferlein 2018-12-25 00:25:07 +01:00
parent d9b0b2f775
commit 792a420e23
3 changed files with 53 additions and 0 deletions

View File

@ -955,4 +955,18 @@ void Netlist::remove_device_class (DeviceClass *device_class)
m_device_classes.erase (device_class);
}
void Netlist::purge_nets ()
{
for (circuit_iterator c = begin_circuits (); c != end_circuits (); ++c) {
c->purge_nets ();
}
}
void Netlist::combine_devices ()
{
for (circuit_iterator c = begin_circuits (); c != end_circuits (); ++c) {
c->combine_devices ();
}
}
}

View File

@ -1573,6 +1573,21 @@ public:
return m_device_classes.end ();
}
/**
* @brief Purge unused nets
*
* This method will purge all nets which return "floating".
*/
void purge_nets ();
/**
* @brief Combine devices
*
* This method will combine devices that can be combined according
* to their device classes "combine_devices" method.
*/
void combine_devices ();
private:
circuit_list m_circuits;
device_class_list m_device_classes;

View File

@ -671,6 +671,18 @@ Class<db::Circuit> decl_dbCircuit ("db", "Circuit",
gsi::method ("clear", &db::Circuit::clear,
"@brief Clears the circuit\n"
"This method removes all objects and clears the other attributes."
) +
gsi::method ("combine_devices", &db::Circuit::combine_devices,
"@brief Combines devices where possible\n"
"This method will combine devices that can be combined according "
"to their device classes 'combine_devices' method.\n"
"For example, serial or parallel resistors can be combined into "
"a single resistor.\n"
) +
gsi::method ("purge_nets", &db::Circuit::purge_nets,
"@brief Purges floating nets.\n"
"Floating nets can be created as effect of reconnections of devices or pins. "
"This method will eliminate all nets that make less than two connections."
),
"@brief Circuits are the basic building blocks of the netlist\n"
"A circuit has pins by which it can connect to the outside. Pins are "
@ -737,6 +749,18 @@ Class<db::Netlist> decl_dbNetlist ("db", "Netlist",
) +
gsi::iterator ("each_device_class", (db::Netlist::device_class_iterator (db::Netlist::*) ()) &db::Netlist::begin_device_classes, (db::Netlist::device_class_iterator (db::Netlist::*) ()) &db::Netlist::end_device_classes,
"@brief Iterates over the device classes of the netlist"
) +
gsi::method ("combine_devices", &db::Netlist::combine_devices,
"@brief Combines devices where possible\n"
"This method will combine devices that can be combined according "
"to their device classes 'combine_devices' method.\n"
"For example, serial or parallel resistors can be combined into "
"a single resistor.\n"
) +
gsi::method ("purge_nets", &db::Netlist::purge_nets,
"@brief Purges floating nets.\n"
"Floating nets can be created as effect of reconnections of devices or pins. "
"This method will eliminate all nets that make less than two connections."
),
"@brief The netlist top-level class\n"
"A netlist is a hierarchical structure of circuits. At least one circuit is the "