Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
183 changes: 182 additions & 1 deletion src/layui/layui/gsiDeclLayNetlistBrowserDialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,83 @@ static lay::NetlistObjectPath second (const lay::NetlistObjectsPath *pp)
return pp->second ();
}

namespace {

struct First
{
lay::NetlistObjectsPath operator() (const lay::NetlistObjectPath &p)
{
return lay::NetlistObjectsPath::from_first (p);
}
};

struct Second
{
lay::NetlistObjectsPath operator() (const lay::NetlistObjectPath &p)
{
return lay::NetlistObjectsPath::from_second (p);
}
};

}

template <class Which>
static lay::NetlistObjectsPath from (const lay::NetlistObjectPath &p)
{
return Which () (p);
}

template <class Which>
static lay::NetlistObjectsPath from_net (const db::Net *net)
{
if (! net) {
return lay::NetlistObjectsPath ();
}

lay::NetlistObjectPath p;
p.root = net->circuit ();
p.net = net;
return Which () (p);
}

template <class Which>
static lay::NetlistObjectsPath from_device (const db::Device *device)
{
if (! device) {
return lay::NetlistObjectsPath ();
}

lay::NetlistObjectPath p;
p.root = device->circuit ();
p.device = device;
return Which () (p);
}

template <class Which>
static lay::NetlistObjectsPath from_circuit (const db::Circuit *circuit)
{
if (! circuit) {
return lay::NetlistObjectsPath ();
}

lay::NetlistObjectPath p;
p.root = circuit;
return Which () (p);
}

template <class Which>
static lay::NetlistObjectsPath from_subcircuit (const db::SubCircuit *subcircuit)
{
if (! subcircuit) {
return lay::NetlistObjectsPath ();
}

lay::NetlistObjectPath p;
p.root = subcircuit->circuit ();
p.path.push_back (subcircuit);
return Which () (p);
}

Class<lay::NetlistObjectsPath> decl_NetlistObjectsPath ("lay", "NetlistObjectsPath",
gsi::method_ext ("first", &first,
"@brief Gets the first object's path.\n"
Expand All @@ -146,6 +223,67 @@ Class<lay::NetlistObjectsPath> decl_NetlistObjectsPath ("lay", "NetlistObjectsPa
"@brief Gets the second object's path.\n"
"In cases of paired netlists (LVS database), the first path points to the schematic netlist object.\n"
"For the single netlist, the second path is always a null path."
) +
gsi::method ("from_first", &from<First>, gsi::arg ("p"),
"@brief Creates a path from given first coordinates.\n"
"Use this constructor to create a paired path from a first set of coordinates (net, circuit, device).\n"
"For single-sided databases (i.e. extracted netlist or schematic only), use the first coordinates. "
"For two-sided database (i.e. LVS cross references), use the first coordinates when you refer to "
"layout netlist objects.\n"
"\n"
"In this version, the minimum requirement for the path is to have a root.\n"
"\n"
"This constructor has been added in version 0.30.8."
) +
gsi::method ("from_first", &from_net<First>, gsi::arg ("net"),
"@brief Creates a path from a given net in the first netlist space.\n"
"\n"
"This constructor has been added in version 0.30.8."
) +
gsi::method ("from_first", &from_device<First>, gsi::arg ("device"),
"@brief Creates a path from a given device in the first netlist space.\n"
"\n"
"This constructor has been added in version 0.30.8."
) +
gsi::method ("from_first", &from_circuit<First>, gsi::arg ("circuit"),
"@brief Creates a path from a given circuit in the first netlist space.\n"
"\n"
"This constructor has been added in version 0.30.8."
) +
gsi::method ("from_first", &from_subcircuit<First>, gsi::arg ("subcircuit"),
"@brief Creates a path from a given subcircuit in the first netlist space.\n"
"\n"
"This constructor has been added in version 0.30.8."
) +
gsi::method ("from_second", &from<Second>, gsi::arg ("p"),
"@brief Creates a path from given second coordinates.\n"
"Use this constructor to create a paired path from a second set of coordinates (net, circuit, device).\n"
"For two-sided database (i.e. LVS cross references), use the second coordinates when you refer to "
"schematic netlist objects.\n"
"\n"
"In this version, the minimum requirement for the path is to have a root.\n"
"\n"
"This constructor has been added in version 0.30.8."
) +
gsi::method ("from_second", &from_net<Second>, gsi::arg ("net"),
"@brief Creates a path from a given net in the second netlist space.\n"
"\n"
"This constructor has been added in version 0.30.8."
) +
gsi::method ("from_second", &from_device<Second>, gsi::arg ("device"),
"@brief Creates a path from a given device in the second netlist space.\n"
"\n"
"This constructor has been added in version 0.30.8."
) +
gsi::method ("from_second", &from_circuit<Second>, gsi::arg ("circuit"),
"@brief Creates a path from a given circuit in the second netlist space.\n"
"\n"
"This constructor has been added in version 0.30.8."
) +
gsi::method ("from_second", &from_subcircuit<Second>, gsi::arg ("subcircuit"),
"@brief Creates a path from a given subcircuit in the second netlist space.\n"
"\n"
"This constructor has been added in version 0.30.8."
),
"@brief An object describing the instantiation of a single netlist object or a pair of those.\n"
"This class is basically a pair of netlist object paths (see \\NetlistObjectPath). When derived from a single netlist view, "
Expand All @@ -156,7 +294,16 @@ Class<lay::NetlistObjectsPath> decl_NetlistObjectsPath ("lay", "NetlistObjectsPa
"If the selected object isn't a matched one, either the first or second path may be a null or a partial path without a final net or device object "
"or a partial path.\n"
"\n"
"This class has been introduced in version 0.27.\n"
"To create a paired path from an existing object (net, device, circuit, subcircuit), use \\from_first and \\from_second.\n"
"Use \\from_first, if the object belongs to the first netlist of the database ('netlist', layout netlist in the LVS context).\n"
"Use \\from_second, if the object belongs to the second netlist of the database ('reference', schematic netlist in the LVS context).\n"
"\n"
"It is also possible to create a paired path from a full path object (including root, a subcircuit path and a target object), either "
"for the first or second side. Use \\from_first and \\from_second with a \\NetlistObjectPath argument in that case.\n"
"A minimum requirement in that case is to set the root (the origin of the path). If no subcircuit path is "
"given (see \\NetlistObjectPath#path), a suitable path leading from the target object (net or device) to the root will be constructed.\n"
"\n"
"This class has been introduced in version 0.27 and has been extended in version 0.30.8.\n"
);

static lay::NetlistObjectPath current_path_first (lay::NetlistBrowserDialog *dialog)
Expand All @@ -169,6 +316,20 @@ static lay::NetlistObjectPath current_path_second (lay::NetlistBrowserDialog *di
return dialog->current_path ().second ();
}

static void set_current_path (lay::NetlistBrowserDialog *dialog, const lay::NetlistObjectsPath *path)
{
if (! path) {
dialog->set_current_path (lay::NetlistObjectsPath ());
} else {
dialog->set_current_path (*path);
}
}

static lay::LayoutViewBase *get_view (lay::NetlistBrowserDialog *dialog)
{
return dialog->view ();
}

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"
Expand All @@ -187,6 +348,16 @@ Class<lay::NetlistBrowserDialog> decl_NetlistBrowserDialog ("lay", "NetlistBrows
gsi::method ("db", &lay::NetlistBrowserDialog::db,
"@brief Gets the database the browser is connected to.\n"
) +
gsi::method ("db_index", &lay::NetlistBrowserDialog::l2n_index,
"@brief Gets the database index inside the view the browser is connected to.\n"
"\n"
"This attribute has been introduced in version 0.30.8.\n"
) +
gsi::method_ext ("view", &get_view,
"@brief Gets the view the browser is connected to.\n"
"\n"
"This attribute has been introduced in version 0.30.8.\n"
) +
gsi::method_ext ("current_path_first", &current_path_first,
"@brief Gets the path of the current object on the first (layout in case of LVS database) side.\n"
) +
Expand All @@ -196,6 +367,16 @@ Class<lay::NetlistBrowserDialog> decl_NetlistBrowserDialog ("lay", "NetlistBrows
gsi::method ("current_path", &lay::NetlistBrowserDialog::current_path,
"@brief Gets the path of the current object as a path pair (combines layout and schematic object paths in case of a LVS database view).\n"
) +
gsi::method_ext ("current_path=", &set_current_path,
"@brief Sets the current path.\n"
"This is the setter corresponding to the 'current_path' getter. Passing nil clears the selection.\n"
"Changing the selection will update the highlights and navigate to the location depending on the "
"settings. An \\on_selection_changed signal is not emitted.\n"
"\n"
"To get a suitable path, see the \\NetlistObjectsPath#from_first and \\NetlistObjectsPath#from_second generators.\n"
"\n"
"This setter has been introduced in version 0.30.8.\n"
) +
gsi::method ("selected_paths", &lay::NetlistBrowserDialog::selected_paths,
"@brief Gets the nets currently selected objects (paths) in the netlist database browser.\n"
"The result is an array of path pairs. See \\NetlistObjectsPath for details about these pairs."
Expand Down
Loading
Loading