7 py::class_<Net, DataContainer, RawPtrWrapper<Net>> py_net(m,
"Net", R
"(Net class containing information about a net including its source and destination.)");
9 py_net.def(py::self == py::self, R"(
10 Check whether two nets are equal.
12 :returns: True if both nets are equal, false otherwise.
16 py_net.def(py::self != py::self, R"(
17 Check whether two nets are unequal.
19 :returns: True if both nets are unequal, false otherwise.
24 Python requires hash for set and dict container.
30 py_net.def_property_readonly("id", &
Net::get_id, R
"(
31 The unique id of the net.
37 Get the unique id of the net.
39 :returns: The unique id.
44 The netlist this net is associated with.
50 Get the netlist this net is associated with.
52 :returns: The netlist.
53 :rtype: hal_py.Netlist
63 Get the name of the net.
70 Set the name of the net.
72 :param str name: The new name.
76 Get the grouping in which this net is contained.
77 If no grouping contains this gate, *None* is returned.
79 :returns: The grouping.
80 :rtype: hal_py.Grouping
83 py_net.def("add_source", py::overload_cast<Gate*, const std::string&>(&
Net::add_source), py::arg(
"gate"), py::arg(
"pin_name"), R
"(
84 Add a source endpoint to the net.
85 The endpoint is specified by a tuple of a gate and the name of an output pin of that gate.
87 :param hal_py.Gate gate: The gate.
88 :param str pin_name: The name of an output pin of the gate.
89 :returns: The endpoint on success, None otherwise.
90 :rtype: hal_py.Endpoint or None
93 py_net.def("add_source", py::overload_cast<Gate*, GatePin*>(&
Net::add_source), py::arg(
"gate"), py::arg(
"pin"), R
"(
94 Add a source endpoint to the net.
95 The endpoint is specified by a tuple of a gate and an output pin of that gate.
97 :param hal_py.Gate gate: The gate.
98 :param hal_py.GatePin pin: The output pin of the gate.
99 :returns: The endpoint on success, None otherwise.
100 :rtype: hal_py.Endpoint or None
103 py_net.def("remove_source", py::overload_cast<Gate*, const std::string&>(&
Net::remove_source), py::arg(
"gate"), py::arg(
"pin_name"), R
"(
104 Remove a source endpoint from the net.
105 The endpoint is specified by a tuple of a gate and the name of an output pin of that gate.
107 :param hal_py.Gate gate: The gate.
108 :param str pin_name: The name of an output pin of the gate.
109 :returns: True on success, False otherwise.
113 py_net.def("remove_source", py::overload_cast<Gate*, const GatePin*>(&
Net::remove_source), py::arg(
"gate"), py::arg(
"pin"), R
"(
114 Remove a source endpoint from the net.
115 The endpoint is specified by a tuple of a gate and an output pin of that gate.
117 :param hal_py.Gate gate: The gate.
118 :param hal_py.GatePin pin: The output pin of the gate.
119 :returns: True on success, False otherwise.
123 py_net.def("remove_source", py::overload_cast<Endpoint*>(&
Net::remove_source), py::arg(
"ep"), R
"(
124 Remove a source endpoint from the net.
126 :param hal_py.Endpoint ep: The endpoint.
127 :returns: True on success, False otherwise.
131 py_net.def("is_a_source", py::overload_cast<const Gate*>(&
Net::is_a_source, py::const_), py::arg(
"gate"), R
"(
132 Check whether a gate is a source of the net independent of the pin.
134 :param hal_py.Gate gate: The gate.
135 :returns: True if the gate is a source of the net, False otherwise.
139 py_net.def("is_a_source", py::overload_cast<const Gate*, const std::string&>(&
Net::is_a_source, py::const_), py::arg(
"gate"), py::arg(
"pin_name"), R
"(
140 Check whether an endpoint is a source of the net.
141 The endpoint is specified by a tuple of a gate and the name of an output pin of that gate.
143 :param hal_py.Gate gate: The gate.
144 :param str pin_name: The name of an output pin of the gate.
145 :returns: True if the endpoint is a source of the net, False otherwise.
149 py_net.def("is_a_source", py::overload_cast<const Gate*, const GatePin*>(&
Net::is_a_source, py::const_), py::arg(
"gate"), py::arg(
"pin"), R
"(
150 Check whether an endpoint is a source of the net.
151 The endpoint is specified by a tuple of a gate and the name of an output pin of that gate.
153 :param hal_py.Gate gate: The gate.
154 :param hal_py.GatePin pin: The output pin of the gate.
155 :returns: True if the endpoint is a source of the net, False otherwise.
159 py_net.def("is_a_source", py::overload_cast<const Endpoint*>(&
Net::is_a_source, py::const_), py::arg(
"ep"), R
"(
160 Check whether an endpoint is a source of the net.
162 :param hal_py.Endpoint ep: The endpoint.
163 :returns: True if the endpoint is a source of the net, False otherwise.
167 py_net.def_property_readonly("num_of_sources", [](
Net*
n) {
return n->get_num_of_sources(); }, R
"(
168 The number of sources of the net.
174 Get the number of sources of the net.
175 The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.
177 :param lambda filter: An optional filter.
178 :returns: The number of sources.
182 py_net.def_property_readonly("sources", [](
Net*
n) {
return n->get_sources(); }, R
"(
183 A list of sources of the net.
185 :type: list[hal_py.Endpoint]
188 py_net.def("get_sources", &
Net::get_sources, py::arg(
"filter") =
nullptr, R
"(
189 Get a list of sources of the net.
190 The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.
192 :param lambda filter: An optional filter.
193 :returns: A list of source endpoints.
194 :rtype: list[hal_py.Endpoint]
197 py_net.def("add_destination", py::overload_cast<Gate*, const std::string&>(&
Net::add_destination), py::arg(
"gate"), py::arg(
"pin_name"), R
"(
198 Add a destination endpoint to the net.
199 The endpoint is specified by a tuple of a gate and the name of an input pin of that gate.
201 :param hal_py.Gate gate: The gate.
202 :param str pin_name: The name of an input pin of the gate.
203 :returns: The endpoint on success, None otherwise.
204 :rtype: hal_py.Endpoint or None
207 py_net.def("add_destination", py::overload_cast<Gate*, GatePin*>(&
Net::add_destination), py::arg(
"gate"), py::arg(
"pin"), R
"(
208 Add a destination endpoint to the net.
209 The endpoint is specified by a tuple of a gate and an input pin of that gate.
211 :param hal_py.Gate gate: The gate.
212 :param str pin_name: The input pin of the gate.
213 :returns: The endpoint on success, None otherwise.
214 :rtype: hal_py.Endpoint or None
217 py_net.def("remove_destination", py::overload_cast<Gate*, const std::string&>(&
Net::remove_destination), py::arg(
"gate"), py::arg(
"pin_name"), R
"(
218 Remove a destination endpoint from the net.
219 The endpoint is specified by a tuple of a gate and the name of an input pin of that gate.
221 :param hal_py.Gate gate: The gate.
222 :param str pin_name: The name of an input pin of the gate.
223 :returns: True on success, False otherwise.
227 py_net.def("remove_destination", py::overload_cast<Gate*, const GatePin*>(&
Net::remove_destination), py::arg(
"gate"), py::arg(
"pin"), R
"(
228 Remove a destination endpoint from the net.
229 The endpoint is specified by a tuple of a gate and the name of an input pin of that gate.
231 :param hal_py.Gate gate: The gate.
232 :param hal_py.GatePin pin: The input pin of the gate.
233 :returns: True on success, False otherwise.
238 Remove a destination endpoint from the net.
240 :param hal_py.Endpoint ep: The destination endpoint.
241 :returns: True on success, False otherwise.
245 py_net.def("is_a_destination", py::overload_cast<const Gate*>(&
Net::is_a_destination, py::const_), py::arg(
"gate"), R
"(
246 Check whether a gate is a destination of the net independent of the pin.
248 :param hal_py.Gate gate: The gate.
249 :returns: True if the gate is a destination of the net, False otherwise.
253 py_net.def("is_a_destination", py::overload_cast<const Gate*, const std::string&>(&
Net::is_a_destination, py::const_), py::arg(
"gate"), py::arg(
"pin_name"), R
"(
254 Check whether an endpoint is a destination of the net.
255 The endpoint is specified by a tuple of a gate and the name of an input pin of that gate.
257 :param hal_py.Gate gate: The gate.
258 :param str pin_name: The name of an input pin of the gate.
259 :returns: True if the endpoint is a destination of the net, False otherwise.
263 py_net.def("is_a_destination", py::overload_cast<const Gate*, const GatePin*>(&
Net::is_a_destination, py::const_), py::arg(
"gate"), py::arg(
"pin"), R
"(
264 Check whether an endpoint is a destination of the net.
265 The endpoint is specified by a tuple of a gate and an input pin of that gate.
267 :param hal_py.Gate gate: The gate.
268 :param hal_py.GatePin pin: The input pin of the gate.
269 :returns: True if the endpoint is a destination of the net, False otherwise.
273 py_net.def("is_a_destination", py::overload_cast<const Endpoint*>(&
Net::is_a_destination, py::const_), py::arg(
"ep"), R
"(
274 Check whether an endpoint is a destination of the net.
276 :param hal_py.Endpoint ep: The endpoint.
277 :returns: True if the endpoint is a destination of the net, False otherwise.
281 py_net.def_property_readonly("num_of_destinations", [](
Net*
n) {
return n->get_num_of_destinations(); }, R
"(
282 The number of destinations of the net.
288 Get the number of destinations of the net.
289 The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.
291 :param filter: An optional filter.
292 :returns: The number of destinations.
296 py_net.def_property_readonly("destinations", [](
Net*
n) {
return n->get_destinations(); }, R
"(
297 A list of destinations of the net.
299 :type: list[hal_py.Endpoint]
303 Get a vector of destinations of the net.
304 The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.
306 :param filter: An optional filter.
307 :returns: A list of destination endpoints.
308 :rtype: list[hal_py.Endpoint]
312 Check whether the net is unrouted, i.e., it has no source or no destination.
314 :returns: True if the net is unrouted, False otherwise.
319 Check whether the net is connected to GND.
321 :returns: True if the net is connected to GND, False otherwise.
326 Check whether the net is connected to VCC.
328 :returns: True if the net is connected to VCC, False otherwise.
333 Mark this net as a global input net.
335 :returns: True on success, False otherwise.
340 Mark this net as a global output net.
342 :returns: True on success, False otherwise.
347 Unmark this net as a global input net.
349 :returns: True on success, False otherwise.
354 Unmark this net as a global output net.
356 :returns: True on success, False otherwise.
361 Checks whether this net is a global input net.
363 :returns: True if the net is a global input net, False otherwise.
368 Checks whether this net is a global output net.
370 :returns: True if the net is a global output net, False otherwise.
u32 get_num_of_sources(const std::function< bool(Endpoint *ep)> &filter=nullptr) const
Netlist * get_netlist() const
Endpoint * add_destination(Gate *gate, const std::string &pin_name)
bool remove_source(Gate *gate, const std::string &pin_name)
void set_name(const std::string &name)
bool mark_global_input_net()
Endpoint * add_source(Gate *gate, const std::string &pin_name)
const std::string & get_name() const
bool unmark_global_output_net()
bool unmark_global_input_net()
bool mark_global_output_net()
bool is_a_source(const Gate *gate) const
Grouping * get_grouping() const
bool is_global_output_net() const
u32 get_num_of_destinations(const std::function< bool(Endpoint *ep)> &filter=nullptr) const
std::vector< Endpoint * > get_destinations(const std::function< bool(Endpoint *ep)> &filter=nullptr) const
bool is_a_destination(const Gate *gate) const
bool is_global_input_net() const
bool remove_destination(Gate *gate, const std::string &pin_name)
std::vector< Endpoint * > get_sources(const std::function< bool(Endpoint *ep)> &filter=nullptr) const
void net_init(py::module &m)
std::unique_ptr< T, py::nodelete > RawPtrWrapper
const Module * module(const Gate *g, const NodeBoxes &boxes)