Module

class hal_py.module

Bases: hal_py.data_container

assign_gate(self: hal_py.module, gate: hal_py.gate) → bool

Moves a gate into this module. The gate is removed from its previous module in the process.

Parameters:gate (hal_py.gate) – The gate to add.
Returns:True on success.
Return type:bool
contains_gate(self: hal_py.module, gate: hal_py.gate, recusive: bool=False) → bool

Checks whether a gate is in the module. If p recursive is true, all submodules are searched as well.

Parameters:
  • gate (hal_py.gate) – The gate to search for.
  • recursive (bool) – Look into submodules too
Returns:

True if the gate is in the object.

Return type:

bool

data

Gets all stored data.

Returns:A dict from ((1) category, (2) key) to ((1) type, (2) value)
Return type:dict[tuple(str,str), tuple(str,str)]
data_keys

Returns all data key

Returns:A list of tuples ((1) category, (2) key)
Return type:list[tuple(str,str)]
delete_data(self: hal_py.data_container, category: str, key: str, log_with_info_level: bool=False) → bool

Deletes custom data.

Parameters:
  • category (str) – Category of key
  • key (str) – Data key
  • log_with_info_level (bool) – Force explicit logging channel ‘netlist’ with log level info to trace GUI events (default = false)
Returns:

True on success.

Return type:

bool

gates

Gets all gates of the module.

Returns:A set of gates.
Return type:set(hal_py.gate)
get_data_by_key(self: hal_py.data_container, category: str, key: str) → Tuple[str, str]

Gets data specified by key and category

Parameters:
  • category (str) – Category of key
  • key (str) – Data key
Returns:

The tuple ((1) type, (2) value)

Return type:

tuple(str, str)

get_gate_by_id(self: hal_py.module, id: int, recursive: bool=False) → hal_py.gate

Get a gate specified by id. If recursive parameter is true, all submodule are searched aswell.

Parameters:
  • id (int) – The gate’s id.
  • recursive (bool) – Look into submodules too.
Returns:

The gate or None.

Return type:

hal_py.gate or None

get_gates(self: hal_py.module, gate_type_filter: str='__DONT_CARE__', name_filter: str='__DONT_CARE__', recursive: bool=False) → Set[hal_py.gate]

Returns all associated gates. You can filter with the optional parameters. If the parameter recursive is true, all submodules are searched aswell.

Parameters:
  • gate_type_filter (str) – Filter for the gate type.
  • name_filter (str) – Filter for the name.
  • recursive (bool) – Look into submodules too.
Returns:

A set of gates.

Return type:

set(hal_py.gate)

get_id(self: hal_py.module) → int

Returns the unique ID of the module object.

Returns:The unique id.
Return type:int
get_input_nets(self: hal_py.module, name_filter: str='__DONT_CARE__') → Set[hal_py.net]

Get the input nets to this module. A module input net is either a global input to the netlist or has a source outside of the module.

Parameters:name_filter (str) – Filter for the name.
Returns:A set of module input nets.
Return type:set(hal_py.net)
get_internal_nets(self: hal_py.module, name_filter: str='__DONT_CARE__') → Set[hal_py.net]

Get the internal nets to this module. A net is internal if its source and at least one output are inside the module. Therefore it may contain some nets that are also regarded as output nets.

Parameters:name_filter (str) – Filter for the name.
Returns:The set of internal nets.
Return type:set(hal_py.net)
get_name(self: hal_py.module) → str

Gets the module’s name.

Returns:The name.
Return type:str
get_netlist(self: hal_py.module) → hal_py.netlist

Get the netlist this module is associated with.

Returns:The netlist.
Return type:hal_py.netlist
get_output_nets(self: hal_py.module, name_filter: str='__DONT_CARE__') → Set[hal_py.net]

Get the output nets to this module. A module output net is either a global output of the netlist or has a destination outside of the module.

Parameters:name_filter (str) – Filter for the name.
Returns:The set of module output nets.
Return type:set(hal_py.net)
get_parent_module(self: hal_py.module) → hal_py.module

Get the parent of this module. This returns None for the top module.

Returns:The parent module.
Return type:hal_py.module or None
get_submodules(self: hal_py.module, name_filter: str='__DONT_CARE__', recursive: bool=False) → Set[hal_py.module]

Get all direct submodules of this submodule. If recursive parameter is true, all indirect submodules are also included.

Parameters:
  • name_filter (str) – Filter for the name.
  • recursive (bool) – Look into submodules aswell.
Returns:

The set of submodules:

Return type:

set(hal_py.module)

id

Returns the unique ID of the module object.

Returns:The unique id.
Return type:int
name

The module’s name.

Type:str
remove_gate(self: hal_py.module, gate: hal_py.gate) → bool

Removes a gate from the module object.

Parameters:gate (hal_py.gate) – The gate to remove.
Returns:True on success.
Return type:bool
set_data(self: hal_py.data_container, category: str, key: str, value_data_type: str, value: str, log_with_info_level: bool=False) → bool

Sets a custom data entry If it does not exist yet, it is added.

Parameters:
  • category (str) – Key category
  • key (str) – Data key
  • data_type (str) – Data type of value
  • value (str) – Data value
  • log_with_info_level (bool) – Force explicit logging channel ‘netlist’ with log level info to trace GUI events (default = false)
Returns:

True on success.

Return type:

bool

set_name(self: hal_py.module, name: str) → None

Sets the module’s name.

Parameters:name (str) – The new name.
set_parent_module(self: hal_py.module, new_parent: hal_py.module) → bool

Set the parent of this module. If the new parent is a submodule of this module, the new parent is added as a direct submodule to the old parent first.

Returns:True if the parent was changed
Return type:bool