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

bool

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.

Parameters
  • gate_id (int) – The ID of the gate to assign.

  • force (bool) – Overwrite previous assignment.

Returns

True on success, false otherwise.

Return type

bool

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

bool

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.

Parameters
  • module_id (int) – The ID of the module to assign.

  • force (bool) – Overwrite previous assignment.

Returns

True on success, false otherwise.

Return type

bool

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

bool

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.

Parameters
  • net_id (int) – The ID of the net to assign.

  • force (bool) – Overwrite previous assignment.

Returns

True on success, false otherwise.

Return type

bool

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

bool

contains_gate_by_id(self: hal_py.Grouping, gate_id: int) bool

Check whether a gate is in the grouping by ID.

Parameters

gate_id (int) – The ID of the gate to check for.

Returns

True on success, false otherwise.

Return type

bool

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

bool

contains_module_by_id(self: hal_py.Grouping, module_id: int) bool

Check whether a module is in the grouping by ID.

Parameters

module_id (int) – The ID of the module to check for.

Returns

True on success, false otherwise.

Return type

bool

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

bool

contains_net_by_id(self: hal_py.Grouping, net_id: int) bool

Check whether a net is in the grouping by ID.

Parameters

net_id (int) – The ID of the net to check for.

Returns

True on success, false otherwise.

Return type

bool

property gate_ids

The IDs of all gates contained within the grouping.

Type

list[int]

property gates

All gates contained within the grouping.

Type

list[hal_py.Gate]

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.

Parameters

filter (lambda) – Filter function to be evaluated on each gate.

Returns

A list of gate IDs.

Return type

list[int]

get_gates(*args, **kwargs)

Overloaded function.

  1. 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]

  2. 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

int

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.

Parameters

filter (lambda) – Filter function to be evaluated on each module.

Returns

A list of module IDs.

Return type

list[int]

get_modules(*args, **kwargs)

Overloaded function.

  1. 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]

  2. 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

str

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.

Parameters

filter (lambda) – Filter function to be evaluated on each net.

Returns

A list of net IDs.

Return type

list[int]

get_netlist(self: hal_py.Grouping) hal_py.Netlist

Get the netlist this grouping is associated with.

Returns

The netlist.

Return type

hal_py.Netlist

get_nets(*args, **kwargs)

Overloaded function.

  1. 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]

  2. 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 id

The unique ID of the grouping.

Type

int

property module_ids

The IDs of all modules contained within the grouping. :type: list[int]

property modules

All modules contained within the grouping.

Type

list[hal_py.Module]

property name

The name of the grouping.

Type

str

property net_ids

The IDs of all nets contained within the grouping.

Type

list[int]

property netlist

The netlist this grouping is associated with.

Type

hal_py.Netlist

property nets

All nets contained within the grouping.

Type

list[hal_py.Net]

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

bool

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.

Parameters

gate_id (int) – The ID of the gate to remove.

Returns

True on success, false otherwise.

Return type

bool

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

bool

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.

Parameters

module_id (int) – The ID of the module to remove.

Returns

True on success, false otherwise.

Return type

bool

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

bool

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.

Parameters

net_id (int) – The ID of the net to remove.

Returns

True on success, false otherwise.

Return type

bool

set_name(self: hal_py.Grouping, name: str) None

Set the name of the grouping.

Parameters

name (str) – The new name.