7 py::class_<Grouping, RawPtrWrapper<Grouping>> py_grouping(m,
"Grouping", R
"(
8 A grouping is an unstructured collection of gates, nets, and modules that do not need to be connected in any way.
9 It is designed to act as a container to temporarily store related entities during netlist exploration.
10 In contrast to a module, it does not allow for hierarchization.
11 Each gate, net, or module within the netlist may only be assigned to a single grouping.
15 The unique ID of the grouping.
21 Get the unique ID of the grouping.
23 :returns: The unique id.
28 The name of the grouping.
34 Get the name of the grouping.
41 Set the name of the grouping.
43 :param str name: The new name.
46 py_grouping.def_property_readonly(
48 The netlist this grouping is associated with.
55 Get the netlist this grouping is associated with.
57 :returns: The netlist.
58 :rtype: hal_py.Netlist
62 Assign a gate to the grouping.
63 Fails if the gate is already contained within another grouping.
64 If force is set and the gate is contained in another grouping, it is removed from the previous grouping to be assigned to this one.
66 :param hal_py.Gate gate: The gate to assign.
67 :param bool force: Overwrite previous assignment.
68 :returns: True on success, false otherwise.
73 Assign a gate to the grouping by ID.
74 Fails if the gate is already contained within another grouping.
75 If force is set and the gate is contained in another grouping, it is removed from the previous grouping to be assigned to this one.
77 :param int gate_id: The ID of the gate to assign.
78 :param bool force: Overwrite previous assignment.
79 :returns: True on success, false otherwise.
83 py_grouping.def_property_readonly("gates", py::overload_cast<>(&
Grouping::get_gates, py::const_), R
"(
84 All gates contained within the grouping.
86 :type: list[hal_py.Gate]
90 Get all gates contained within the grouping.
92 :returns: A list of gates.
93 :rtype: list[hal_py.Gate]
96 py_grouping.def("get_gates", py::overload_cast<
const std::function<
bool(
Gate*)>&>(&
Grouping::get_gates, py::const_), py::arg(
"filter"), R
"(
97 Get all gates contained within the grouping.
98 The filter is evaluated on every candidate such that the result only contains those matching the specified condition.
100 :param lambda filter: Filter function to be evaluated on each gate.
101 :returns: A list of gates.
102 :rtype: list[hal_py.Gate]
105 py_grouping.def_property_readonly(
107 The IDs of all gates contained within the grouping.
113 Get the IDs of all gates contained within the grouping.
114 The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.
116 :param lambda filter: Filter function to be evaluated on each gate.
117 :returns: A list of gate IDs.
122 Remove a gate from the grouping.
123 Fails if the gate is not contained within the grouping.
125 :param hal_py.Gate gate: The gate to remove.
126 :returns: True on success, false otherwise.
131 Remove a gate from the grouping by ID.
132 Fails if the gate is not contained within the grouping.
134 :param int gate_id: The ID of the gate to remove.
135 :returns: True on success, false otherwise.
140 Check whether a gate is in the grouping.
142 :param hal_py.Gate gate: The gate to check for.
143 :returns: True on success, false otherwise.
148 Check whether a gate is in the grouping by ID.
150 :param int gate_id: The ID of the gate to check for.
151 :returns: True on success, false otherwise.
155 py_grouping.def("assign_net", &
Grouping::assign_net, py::arg(
"net"), py::arg(
"force") =
false, R
"(
156 Assign a net to the grouping.
157 Fails if the net is already contained within another grouping.
158 If force is set and the net is contained in another grouping, it is removed from the previous grouping to be assigned to this one.
160 :param hal_py.Net net: The net to assign.
161 :param bool force: Overwrite previous assignment.
162 :returns: True on success, false otherwise.
167 Assign a net to the grouping by ID.
168 Fails if the net is already contained within another grouping.
169 If force is set and the net is contained in another grouping, it is removed from the previous grouping to be assigned to this one.
171 :param int net_id: The ID of the net to assign.
172 :param bool force: Overwrite previous assignment.
173 :returns: True on success, false otherwise.
177 py_grouping.def_property_readonly("nets", py::overload_cast<>(&
Grouping::get_nets, py::const_), R
"(
178 All nets contained within the grouping.
180 :type: list[hal_py.Net]
184 Get all nets contained within the grouping.
186 :returns: A list of nets.
187 :rtype: list[hal_py.Net]
190 py_grouping.def("get_nets", py::overload_cast<
const std::function<
bool(
Net*)>&>(&
Grouping::get_nets, py::const_), py::arg(
"filter"), R
"(
191 Get all nets contained within the grouping.
192 The filter is evaluated on every candidate such that the result only contains those matching the specified condition.
194 :param lambda filter: Filter function to be evaluated on each net.
195 :returns: A list of nets.
196 :rtype: list[hal_py.Net]
199 py_grouping.def_property_readonly(
201 The IDs of all nets contained within the grouping.
207 Get the IDs of all nets contained within the grouping.
208 The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.
210 :param lambda filter: Filter function to be evaluated on each net.
211 :returns: A list of net IDs.
216 Remove a net from the grouping.
217 Fails if the net is not contained within the grouping.
219 :param hal_py.Net net: The net to remove.
220 :returns: True on success, false otherwise.
225 Remove a net from the grouping by ID.
226 Fails if the net is not contained within the grouping.
228 :param int net_id: The ID of the net to remove.
229 :returns: True on success, false otherwise.
234 Check whether a net is in the grouping.
236 :param hal_py.Net net: The net to check for.
237 :returns: True on success, false otherwise.
242 Check whether a net is in the grouping by ID.
244 :param int net_id: The ID of the net to check for.
245 :returns: True on success, false otherwise.
250 Assign a module to the grouping.
251 Fails if the module is already contained within another grouping.
252 If force is set and the module is contained in another grouping, it is removed from the previous grouping to be assigned to this one.
254 :param hal_py.Gate module: The module to assign.
255 :param bool force: Overwrite previous assignment.
256 :returns: True on success, false otherwise.
261 Assign a module to the grouping by ID.
262 Fails if the module is already contained within another grouping.
263 If force is set and the module is contained in another grouping, it is removed from the previous grouping to be assigned to this one.
265 :param int module_id: The ID of the module to assign.
266 :param bool force: Overwrite previous assignment.
267 :returns: True on success, false otherwise.
271 py_grouping.def_property_readonly("modules", py::overload_cast<>(&
Grouping::get_modules, py::const_), R
"(
272 All modules contained within the grouping.
274 :type: list[hal_py.Module]
278 Get all modules contained within the grouping.
280 :returns: A list of modules.
281 :rtype: list[hal_py.Module]
284 py_grouping.def("get_modules", py::overload_cast<
const std::function<
bool(
Module*)>&>(&
Grouping::get_modules, py::const_), py::arg(
"filter"), R
"(
285 Get all modules contained within the grouping.
286 The filter is evaluated on every candidate such that the result only contains those matching the specified condition.
288 :param lambda filter: Filter function to be evaluated on each module.
289 :returns: A list of modules.
290 :rtype: list[hal_py.Module]
293 py_grouping.def_property_readonly(
295 The IDs of all modules contained within the grouping.
300 Get the IDs of all modules contained within the grouping.
301 The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.
303 :param lambda filter: Filter function to be evaluated on each module.
304 :returns: A list of module IDs.
309 Remove a module from the grouping.
310 Fails if the module is not contained within the grouping.
312 :param hal_py.Gate module: The module to remove.
313 :returns: True on success, false otherwise.
318 Remove a module from the grouping by ID.
319 Fails if the module is not contained within the grouping.
321 :param int module_id: The ID of the module to remove.
322 :returns: True on success, false otherwise.
327 Check whether a module is in the grouping.
329 :param hal_py.Gate module: The module to check for.
330 :returns: True on success, false otherwise.
335 Check whether a module is in the grouping by ID.
337 :param int module_id: The ID of the module to check for.
338 :returns: True on success, false otherwise.
std::vector< u32 > get_gate_ids(const std::function< bool(Gate *)> &filter=nullptr) const
const std::vector< Gate * > & get_gates() const
bool remove_gate_by_id(const u32 gate_id)
bool contains_module_by_id(const u32 module_id) const
bool assign_module(Module *module, bool force=false)
bool contains_net_by_id(const u32 net_id) const
std::vector< u32 > get_module_ids(const std::function< bool(Module *)> &filter=nullptr) const
bool remove_net(Net *net)
Netlist * get_netlist() const
bool contains_net(Net *net) const
std::vector< u32 > get_net_ids(const std::function< bool(Net *)> &filter=nullptr) const
bool remove_net_by_id(const u32 net_id)
bool assign_gate(Gate *gate, bool force=false)
bool assign_module_by_id(const u32 module_id, bool force=false)
std::string get_name() const
bool remove_gate(Gate *gate)
void set_name(std::string name)
const std::vector< Net * > & get_nets() const
bool contains_module(Module *module) const
const std::vector< Module * > & get_modules() const
bool remove_module(Module *module)
bool contains_gate_by_id(const u32 gate_id) const
bool contains_gate(Gate *gate) const
bool assign_net_by_id(const u32 net_id, bool force=false)
bool assign_gate_by_id(const u32 gate_id, bool force=false)
bool assign_net(Net *net, bool force=false)
void grouping_init(py::module &m)
std::unique_ptr< T, py::nodelete > RawPtrWrapper
const Module * module(const Gate *g, const NodeBoxes &boxes)