mirror of
https://github.com/KLayout/klayout.git
synced 2026-09-02 19:28:37 +02:00
Using NetlistObjectPath for probe_event.
This commit is contained in:
@@ -42,6 +42,109 @@ template <> struct type_traits<lay::NetlistBrowserDialog> : public type_traits<v
|
||||
namespace gsi
|
||||
{
|
||||
|
||||
static void set_root (lay::NetlistObjectPath *path, db::Circuit *r)
|
||||
{
|
||||
path->root = r;
|
||||
}
|
||||
|
||||
static db::Circuit *root (const lay::NetlistObjectPath *path)
|
||||
{
|
||||
return const_cast<db::Circuit *> (path->root);
|
||||
}
|
||||
|
||||
static void set_device (lay::NetlistObjectPath *path, db::Device *r)
|
||||
{
|
||||
path->device = r;
|
||||
}
|
||||
|
||||
static db::Device *device (const lay::NetlistObjectPath *path)
|
||||
{
|
||||
return const_cast<db::Device *> (path->device);
|
||||
}
|
||||
|
||||
static void set_net (lay::NetlistObjectPath *path, db::Net *r)
|
||||
{
|
||||
path->net = r;
|
||||
}
|
||||
|
||||
static db::Net *net (const lay::NetlistObjectPath *path)
|
||||
{
|
||||
return const_cast<db::Net *> (path->net);
|
||||
}
|
||||
|
||||
static std::vector<db::SubCircuit *> path (const lay::NetlistObjectPath *p)
|
||||
{
|
||||
std::vector<db::SubCircuit *> pp;
|
||||
pp.reserve (p->path.size ());
|
||||
for (lay::NetlistObjectPath::path_iterator i = p->path.begin (); i != p->path.end (); ++i) {
|
||||
pp.push_back (const_cast<db::SubCircuit *> (*i));
|
||||
}
|
||||
return pp;
|
||||
}
|
||||
|
||||
static void set_path (lay::NetlistObjectPath *p, const std::vector<db::SubCircuit *> &path)
|
||||
{
|
||||
p->path = lay::NetlistObjectPath::path_type (path.begin (), path.end ());
|
||||
}
|
||||
|
||||
Class<lay::NetlistObjectPath> decl_NetlistObjectPath ("lay", "NetlistObjectPath",
|
||||
gsi::method_ext ("root=", &set_root, gsi::arg ("root"),
|
||||
"@brief Sets the root circuit of the path.\n"
|
||||
"The root circuit is the circuit from which the path starts.\n"
|
||||
) +
|
||||
gsi::method_ext ("root", &root,
|
||||
"@brief Gets the root circuit of the path.\n"
|
||||
) +
|
||||
gsi::method_ext ("path=", &set_path, gsi::arg ("path"),
|
||||
"@brief Sets the path.\n"
|
||||
"The path is a list of subcircuits leading from the root to the final object. "
|
||||
"The final (net, device) object is located in the circuit called by the last subcircuit "
|
||||
"of the subcircuit chain. If the subcircuit list is empty, the final object is located inside "
|
||||
"the root object."
|
||||
) +
|
||||
gsi::method_ext ("path", &path,
|
||||
"@brief Gets the path.\n"
|
||||
) +
|
||||
gsi::method_ext ("net=", &set_net, gsi::arg ("net"),
|
||||
"@brief Sets the net the path points to.\n"
|
||||
"If the path describes the location of a net, this member will indicate it.\n"
|
||||
"The other way to describe a final object is \\device=. If neither a device nor "
|
||||
"net is given, the path describes a circuit and how it is referenced from the root."
|
||||
) +
|
||||
gsi::method_ext ("net", &net,
|
||||
"@brief Gets the net the path points to.\n"
|
||||
) +
|
||||
gsi::method_ext ("device=", &set_device, gsi::arg ("device"),
|
||||
"@brief Sets the device the path points to.\n"
|
||||
"If the path describes the location of a device, this member will indicate it.\n"
|
||||
"The other way to describe a final object is \\net=. If neither a device nor "
|
||||
"net is given, the path describes a circuit and how it is referenced from the root."
|
||||
) +
|
||||
gsi::method_ext ("device", &device,
|
||||
"@brief Gets the device the path points to.\n"
|
||||
) +
|
||||
gsi::method ("is_null", &lay::NetlistObjectPath::is_null,
|
||||
"@brief Returns a value indicating whether the path is an empty one.\n"
|
||||
),
|
||||
"@brief An object describing the instantiation of an object.\n"
|
||||
"This class describes the instantiation of a net or a device or a circuit in terms of "
|
||||
"a root circuit and a subcircuit chain leading to the indicated object.\n"
|
||||
"\n"
|
||||
"See \\net= or \\device= for the indicated object, \\path= for the subcircuit chain.\n"
|
||||
"\n"
|
||||
"This class has been introduced in version 0.27.\n"
|
||||
);
|
||||
|
||||
static lay::NetlistObjectPath current_path_first (lay::NetlistBrowserDialog *dialog)
|
||||
{
|
||||
return dialog->current_path ().first ();
|
||||
}
|
||||
|
||||
static lay::NetlistObjectPath current_path_second (lay::NetlistBrowserDialog *dialog)
|
||||
{
|
||||
return dialog->current_path ().second ();
|
||||
}
|
||||
|
||||
Class<lay::NetlistBrowserDialog> decl_NetlistBrowserDialog ("lay", "NetlistBrowserDialog",
|
||||
gsi::event ("on_current_db_changed", &lay::NetlistBrowserDialog::current_db_changed_event,
|
||||
"@brief This event is triggered when the current database is changed.\n"
|
||||
@@ -51,24 +154,32 @@ Class<lay::NetlistBrowserDialog> decl_NetlistBrowserDialog ("lay", "NetlistBrows
|
||||
"@brief This event is triggered when the selection changed.\n"
|
||||
"The selection can be obtained with \\selected_nets, \\selected_devices, \\selected_subcircuits and \\selected_circuits."
|
||||
) +
|
||||
gsi::event ("on_probe", &lay::NetlistBrowserDialog::probe_event, gsi::arg ("net"), gsi::arg ("subcircuit_path"),
|
||||
gsi::event ("on_probe", &lay::NetlistBrowserDialog::probe_event, gsi::arg ("first_path"), gsi::arg ("second_path"),
|
||||
"@brief This event is triggered when a net is probed.\n"
|
||||
"'subcircuit_path' will contain the subcircuit objects leading to the probed net from the netlist databases' top circuit. "
|
||||
"The first path will indicate the location of the probed net in terms of "
|
||||
"\\subcircuit_path will contain the subcircuit objects leading to the probed net from the circuit given by \\root_circuit. "
|
||||
"This path may not be complete - it may contain null entries if a cell instance can't be associated with a subcircuit."
|
||||
) +
|
||||
gsi::method ("db", &lay::NetlistBrowserDialog::db,
|
||||
"@brief Gets the database the browser is connected to.\n"
|
||||
) +
|
||||
gsi::method_ext ("current_path_first", ¤t_path_first,
|
||||
"@brief Gets the path of the current object on the first (layout in case of LVS database) side.\n"
|
||||
) +
|
||||
gsi::method_ext ("current_path_second", ¤t_path_second,
|
||||
"@brief Gets the path of the current object on the second (schematic in case of LVS database) side.\n"
|
||||
) +
|
||||
// @@@
|
||||
gsi::method ("selected_nets", &lay::NetlistBrowserDialog::selected_nets,
|
||||
"@brief Gets the nets currently selected in the netlist database browser.\n"
|
||||
) +
|
||||
gsi::method ("selected_nets", &lay::NetlistBrowserDialog::selected_devices,
|
||||
gsi::method ("selected_devices", &lay::NetlistBrowserDialog::selected_devices,
|
||||
"@brief Gets the devices currently selected in the netlist database browser.\n"
|
||||
) +
|
||||
gsi::method ("selected_nets", &lay::NetlistBrowserDialog::selected_subcircuits,
|
||||
gsi::method ("selected_subcircuits", &lay::NetlistBrowserDialog::selected_subcircuits,
|
||||
"@brief Gets the subcircuits currently selected in the netlist database browser.\n"
|
||||
) +
|
||||
gsi::method ("selected_nets", &lay::NetlistBrowserDialog::selected_circuits,
|
||||
gsi::method ("selected_circuits", &lay::NetlistBrowserDialog::selected_circuits,
|
||||
"@brief Gets the circuits currently selected in the netlist database browser.\n"
|
||||
),
|
||||
"@brief Represents the netlist browser dialog.\n"
|
||||
|
||||
@@ -135,6 +135,17 @@ NetlistBrowserDialog::db ()
|
||||
return browser_page->db ();
|
||||
}
|
||||
|
||||
const lay::NetlistObjectsPath &
|
||||
NetlistBrowserDialog::current_path () const
|
||||
{
|
||||
if (browser_page) {
|
||||
return browser_page->current_path ();
|
||||
} else {
|
||||
static lay::NetlistObjectsPath empty;
|
||||
return empty;
|
||||
}
|
||||
}
|
||||
|
||||
const std::vector<const db::Net *> &
|
||||
NetlistBrowserDialog::selected_nets () const
|
||||
{
|
||||
@@ -357,7 +368,9 @@ NetlistBrowserDialog::probe_net (const db::DPoint &p, bool trace_path)
|
||||
browser_page->select_path (path);
|
||||
|
||||
// emits the probe event
|
||||
probe_event (net, sc_path);
|
||||
// NOTE: browser_page->current_path () will hold the paired path with the schematic side being
|
||||
// expanded.
|
||||
probe_event (browser_page->current_path ().first (), browser_page->current_path ().second ());
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -54,14 +54,21 @@ public:
|
||||
|
||||
/**
|
||||
* @brief This event is emitted when a shape is probed
|
||||
* The first path is that of the layout, the second that of the schematic in case of a
|
||||
* LVS database.
|
||||
*/
|
||||
tl::event<db::Net *, std::vector<db::SubCircuit *> > probe_event;
|
||||
tl::event<lay::NetlistObjectPath, lay::NetlistObjectPath> probe_event;
|
||||
|
||||
/**
|
||||
* @brief Gets the current database
|
||||
*/
|
||||
db::LayoutToNetlist *db ();
|
||||
|
||||
/**
|
||||
* @brief Gets the current object's path
|
||||
*/
|
||||
const lay::NetlistObjectsPath ¤t_path () const;
|
||||
|
||||
/**
|
||||
* @brief Gets the selected nets
|
||||
*/
|
||||
|
||||
@@ -168,6 +168,14 @@ public:
|
||||
*/
|
||||
void update_highlights ();
|
||||
|
||||
/**
|
||||
* @brief Gets the current object's path
|
||||
*/
|
||||
const lay::NetlistObjectsPath ¤t_path () const
|
||||
{
|
||||
return m_current_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the selected nets
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user