Grouping
- class hal_py.Grouping
A grouping is an unstructured collection of gates, nets, and modules that do not need to be connected in any way. It is designed to act as a container to temporarily store related entities during netlist exploration. In contrast to a module, it does not allow for hierarchization. Each gate, net, or module within the netlist may only be assigned to a single grouping.
- assign_gate(self: hal_py.Grouping, gate: hal_py.Gate, force: bool = False) bool
Assign a gate to the grouping. Fails if the gate is already contained within another grouping. 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.
- Parameters
gate (hal_py.Gate) – The gate to assign.
force (bool) – Overwrite previous assignment.
- Returns
True on success, false otherwise.
- Return type
- assign_gate_by_id(self: hal_py.Grouping, gate_id: int, force: bool = False) bool
Assign a gate to the grouping by ID. Fails if the gate is already contained within another grouping. 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.
- assign_module(self: hal_py.Grouping, module: hal_py.Module, force: bool = False) bool
Assign a module to the grouping. Fails if the module is already contained within another grouping. 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.
- Parameters
module (hal_py.Gate) – The module to assign.
force (bool) – Overwrite previous assignment.
- Returns
True on success, false otherwise.
- Return type
- assign_module_by_id(self: hal_py.Grouping, module_id: int, force: bool = False) bool
Assign a module to the grouping by ID. Fails if the module is already contained within another grouping. 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.
- assign_net(self: hal_py.Grouping, net: hal_py.Net, force: bool = False) bool
Assign a net to the grouping. Fails if the net is already contained within another grouping. 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.
- Parameters
net (hal_py.Net) – The net to assign.
force (bool) – Overwrite previous assignment.
- Returns
True on success, false otherwise.
- Return type
- assign_net_by_id(self: hal_py.Grouping, net_id: int, force: bool = False) bool
Assign a net to the grouping by ID. Fails if the net is already contained within another grouping. 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.
- contains_gate(self: hal_py.Grouping, gate: hal_py.Gate) bool
Check whether a gate is in the grouping.
- Parameters
gate (hal_py.Gate) – The gate to check for.
- Returns
True on success, false otherwise.
- Return type
- contains_gate_by_id(self: hal_py.Grouping, gate_id: int) bool
Check whether a gate is in the grouping by ID.
- contains_module(self: hal_py.Grouping, module: hal_py.Module) bool
Check whether a module is in the grouping.
- Parameters
module (hal_py.Gate) – The module to check for.
- Returns
True on success, false otherwise.
- Return type
- contains_module_by_id(self: hal_py.Grouping, module_id: int) bool
Check whether a module is in the grouping by ID.
- contains_net(self: hal_py.Grouping, net: hal_py.Net) bool
Check whether a net is in the grouping.
- Parameters
net (hal_py.Net) – The net to check for.
- Returns
True on success, false otherwise.
- Return type
- contains_net_by_id(self: hal_py.Grouping, net_id: int) bool
Check whether a net is in the grouping by ID.
- property gates
All gates contained within the grouping.
- Type
- get_gate_ids(self: hal_py.Grouping, filter: Callable[[hal_py.Gate], bool] = None) List[int]
Get the IDs of all gates contained within the grouping. The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.
- get_gates(*args, **kwargs)
Overloaded function.
get_gates(self: hal_py.Grouping) -> List[hal_py.Gate]
Get all gates contained within the grouping.
- returns
A list of gates.
- rtype
list[hal_py.Gate]
get_gates(self: hal_py.Grouping, filter: Callable[[hal_py.Gate], bool]) -> List[hal_py.Gate]
Get all gates contained within the grouping. The filter is evaluated on every candidate such that the result only contains those matching the specified condition.
- param lambda filter
Filter function to be evaluated on each gate.
- returns
A list of gates.
- rtype
list[hal_py.Gate]
- get_id(self: hal_py.Grouping) int
Get the unique ID of the grouping.
- Returns
The unique id.
- Return type
- get_module_ids(self: hal_py.Grouping, filter: Callable[[hal_py.Module], bool] = None) List[int]
Get the IDs of all modules contained within the grouping. The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.
- get_modules(*args, **kwargs)
Overloaded function.
get_modules(self: hal_py.Grouping) -> List[hal_py.Module]
Get all modules contained within the grouping.
- returns
A list of modules.
- rtype
list[hal_py.Module]
get_modules(self: hal_py.Grouping, filter: Callable[[hal_py.Module], bool]) -> List[hal_py.Module]
Get all modules contained within the grouping. The filter is evaluated on every candidate such that the result only contains those matching the specified condition.
- param lambda filter
Filter function to be evaluated on each module.
- returns
A list of modules.
- rtype
list[hal_py.Module]
- get_name(self: hal_py.Grouping) str
Get the name of the grouping.
- Returns
The name.
- Return type
- get_net_ids(self: hal_py.Grouping, filter: Callable[[hal_py.Net], bool] = None) List[int]
Get the IDs of all nets contained within the grouping. The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.
- get_netlist(self: hal_py.Grouping) hal_py.Netlist
Get the netlist this grouping is associated with.
- Returns
The netlist.
- Return type
- get_nets(*args, **kwargs)
Overloaded function.
get_nets(self: hal_py.Grouping) -> List[hal_py.Net]
Get all nets contained within the grouping.
- returns
A list of nets.
- rtype
list[hal_py.Net]
get_nets(self: hal_py.Grouping, filter: Callable[[hal_py.Net], bool]) -> List[hal_py.Net]
Get all nets contained within the grouping. The filter is evaluated on every candidate such that the result only contains those matching the specified condition.
- param lambda filter
Filter function to be evaluated on each net.
- returns
A list of nets.
- rtype
list[hal_py.Net]
- property module_ids
The IDs of all modules contained within the grouping. :type: list[int]
- property modules
All modules contained within the grouping.
- Type
- property netlist
The netlist this grouping is associated with.
- Type
- property nets
All nets contained within the grouping.
- Type
- remove_gate(self: hal_py.Grouping, gate: hal_py.Gate) bool
Remove a gate from the grouping. Fails if the gate is not contained within the grouping.
- Parameters
gate (hal_py.Gate) – The gate to remove.
- Returns
True on success, false otherwise.
- Return type
- remove_gate_by_id(self: hal_py.Grouping, gate_id: int) bool
Remove a gate from the grouping by ID. Fails if the gate is not contained within the grouping.
- remove_module(self: hal_py.Grouping, module: hal_py.Module) bool
Remove a module from the grouping. Fails if the module is not contained within the grouping.
- Parameters
module (hal_py.Gate) – The module to remove.
- Returns
True on success, false otherwise.
- Return type
- remove_module_by_id(self: hal_py.Grouping, module_id: int) bool
Remove a module from the grouping by ID. Fails if the module is not contained within the grouping.
- remove_net(self: hal_py.Grouping, net: hal_py.Net) bool
Remove a net from the grouping. Fails if the net is not contained within the grouping.
- Parameters
net (hal_py.Net) – The net to remove.
- Returns
True on success, false otherwise.
- Return type
- remove_net_by_id(self: hal_py.Grouping, net_id: int) bool
Remove a net from the grouping by ID. Fails if the net is not contained within the grouping.
- set_name(self: hal_py.Grouping, name: str) None
Set the name of the grouping.
- Parameters
name (str) – The new name.