Netlist¶
-
class
hal_py.
Netlist
¶ Netlist class containing information about the netlist including its gates, modules, nets, and groupings as well as the underlying gate library.
-
clear_caches
(self: hal_py.Netlist) → None¶ Clear all internal caches of the netlist. In a typical application, calling this function is not required.
-
copy
(self: hal_py.Netlist) → hal_py.Netlist¶ Create a deep copy of the netlist.
Returns: The copy of the netlist. Return type: hal_py.Netlist
-
create_gate
(*args, **kwargs)¶ Overloaded function.
create_gate(self: hal_py.Netlist, gate_id: int, gate_type: hal_py.GateType, name: str, x: int = -1, y: int = -1) -> hal::Gate
Create a new gate and add it to the netlist.
param int gate_id: The unique ID of the gate. param hal_py.GateType gate_type: The gate type. param str name: The name of the gate. param int x: The x-coordinate of the gate. param int y: The y-coordinate of the gate. returns: The new gate on success, None otherwise. rtype: hal_py.Gate or None create_gate(self: hal_py.Netlist, gate_type: hal_py.GateType, name: str, x: int = -1, y: int = -1) -> hal::Gate
Create a new gate and add it to the netlist. The ID of the gate is set automatically.
param hal_py.GateType gate_type: The gate type. param str name: The name of the gate. param int x: The x-coordinate of the gate. param int y: The y-coordinate of the gate. returns: The new gate on success, None otherwise. rtype: hal_py.Gate or None
-
create_grouping
(*args, **kwargs)¶ Overloaded function.
create_grouping(self: hal_py.Netlist, grouping_id: int, name: str) -> hal::Grouping
Create a new grouping and add it to the netlist.
param int grouping_id: The unique ID of the grouping. param str name: The name of the grouping. returns: The new grouping on success, None otherwise. rtype: hal_py.Grouping or None create_grouping(self: hal_py.Netlist, name: str) -> hal::Grouping
Create a new grouping and add it to the netlist. The ID of the grouping is set automatically.
param str name: The name of the grouping. returns: The new grouping on success, None otherwise. rtype: hal_py.Grouping or None
-
create_module
(*args, **kwargs)¶ Overloaded function.
create_module(self: hal_py.Netlist, module_id: int, name: str, parent: hal::Module, gates: List[hal::Gate] = []) -> hal::Module
Create a new module and add it to the netlist.
param int module_id: The unique ID of the module. param str name: The name of the module. param hal_py.Module parent: The parent module. param list gates: Gates to assign to the new module. returns: The new module on succes, None on error. rtype: hal_py.Module or None create_module(self: hal_py.Netlist, name: str, parent: hal::Module, gates: List[hal::Gate] = []) -> hal::Module
Create a new module and add it to the netlist. The ID of the module is set automatically.
param str name: The name of the module. param hal_py.Module parent: The parent module. param list gates: Gates to assign to the new module. returns: The new module on succes, None on error. rtype: hal_py.Module or None
-
create_net
(*args, **kwargs)¶ Overloaded function.
create_net(self: hal_py.Netlist, net_id: int, name: str) -> hal::Net
Create a new net and add it to the netlist.
param int net_id: The unique ID of the net. param str name: The name of the net. returns: The new net on success, None otherwise. rtype: hal_py.Net or None create_net(self: hal_py.Netlist, name: str) -> hal::Net
Create a new net and add it to the netlist. The ID of the net is set automatically.
param str name: The name of the net. returns: The new net on success, None otherwise. rtype: hal_py.Net or None
-
delete_gate
(self: hal_py.Netlist, gate: hal::Gate) → bool¶ Remove a gate from the netlist.
Parameters: gate (hal_py.Gate) – The gate. Returns: True on success, false otherwise. Return type: bool
-
delete_grouping
(self: hal_py.Netlist, grouping: hal::Grouping) → bool¶ Remove a grouping from the netlist.
Parameters: grouping (hal_py.Grouping) – The grouping. Returns: True on success, false otherwise. Return type: bool
-
delete_module
(self: hal_py.Netlist, module: hal::Module) → bool¶ Remove a module from the netlist. Submodules, gates and nets under this module will be moved to the parent of this module.
Parameters: module (hal_py.Module) – The module. Returns: True on success, false otherwise. Return type: bool
-
delete_net
(self: hal_py.Netlist, net: hal::Net) → bool¶ Removes a net from the netlist.
Parameters: net (hal_py.Net) – The net. Returns: True on success, false otherwise. Return type: bool
-
enable_automatic_net_checks
(self: hal_py.Netlist, enable_checks: bool = True) → None¶ Enables or disables automatic checks on nets that determine whether a net is an input or output of a module.
WARNING: if disabled, the user is responsible to assign correct input and output nets and create respective module pins. Wrong usage may result in unknown behavior or crashes.
Parameters: enable_checks (bool) – Set True to enable automatic checks, False otherwise.
-
gate_library
¶ The gate library associated with the netlist.
Type: hal_py.GateLibrary
-
gates
¶ All gates contained within the netlist.
Type: list[hal_py.Gate]
-
get_design_name
(self: hal_py.Netlist) → str¶ Get the name of the design.
Returns: The name of the design. Return type: str
-
get_device_name
(self: hal_py.Netlist) → str¶ Get the name of the target device.
Returns: The name of the target device. Return type: str
-
get_free_gate_ids
(self: hal_py.Netlist) → Set[int]¶ Get a set of all gate IDs that have previously been used but been freed ever since.
Returns: All freed gate IDs. Return type: set[int]
-
get_free_grouping_ids
(self: hal_py.Netlist) → Set[int]¶ Get a set of all grouping IDs that have previously been used but been freed ever since.
Returns: All freed grouping IDs. Return type: set[int]
-
get_free_module_ids
(self: hal_py.Netlist) → Set[int]¶ Get a set of all module IDs that have previously been used but been freed ever since.
Returns: All freed module IDs. Return type: set[int]
-
get_free_net_ids
(self: hal_py.Netlist) → Set[int]¶ Get a set of all net IDs that have previously been used but been freed ever since.
Returns: All freed net IDs. Return type: set[int]
-
get_gate_by_id
(self: hal_py.Netlist, gate_id: int) → hal::Gate¶ Get the gate specified by the given ID.
Parameters: gate_id (int) – The unique ID of the gate. Returns: The gate on success, None otherwise. Return type: hal_py.Gate or None
-
get_gate_library
(self: hal_py.Netlist) → hal_py.GateLibrary¶ Get the gate library associated with the netlist.
Returns: The gate library. Return type: hal_py.GateLibrary
-
get_gates
(*args, **kwargs)¶ Overloaded function.
get_gates(self: hal_py.Netlist) -> List[hal::Gate]
Get all gates contained within the netlist.
returns: A list of gates. rtype: list[hal_py.Gate] get_gates(self: hal_py.Netlist, filter: Callable[[hal::Gate], bool]) -> List[hal::Gate]
Get all gates contained within the netlist. The filter is evaluated on every gate such that the result only contains gates 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_global_input_nets
(self: hal_py.Netlist) → List[hal::Net]¶ Get all global input nets.
Returns: A list of nets. Return type: list[hal_py.Net]
-
get_global_output_nets
(self: hal_py.Netlist) → List[hal::Net]¶ Get all global output nets.
Returns: A list of nets. Return type: list[hal_py.Net]
-
get_gnd_gates
(self: hal_py.Netlist) → List[hal::Gate]¶ Get all global GND gates.
Returns: A list of gates. Return type: list[hal_py.Gate]
-
get_grouping_by_id
(self: hal_py.Netlist, grouping_id: int) → hal::Grouping¶ Get the grouping specified by the given ID.
Parameters: grouping_id (int) – The unique ID of the grouping. Returns: The grouping on success, nullptr otherwise. Return type: hal_py.Grouping
-
get_groupings
(*args, **kwargs)¶ Overloaded function.
get_groupings(self: hal_py.Netlist) -> List[hal::Grouping]
Get all groupings contained within the netlist.
returns: A list of groupings. rtype: list[hal_py.Grouping] get_groupings(self: hal_py.Netlist, filter: Callable[[hal::Grouping], bool]) -> List[hal::Grouping]
Get all groupings contained within the netlist. The filter is evaluated on every grouping such that the result only contains groupings matching the specified condition.
param lambda filter: Filter function to be evaluated on each grouping. returns: A list of groupings. rtype: list[hal_py.Grouping]
-
get_id
(self: hal_py.Netlist) → int¶ Get the ID of the netlist. If not explicitly set, the ID defaults to 0.
Returns: The ID of the netlist. Return type: int
-
get_input_filename
(self: hal_py.Netlist) → os.PathLike¶ Get the path to the input file.
Returns: The path to the input file. Return type: pathlib.Path
-
get_module_by_id
(self: hal_py.Netlist, module_id: int) → hal::Module¶ Get the module specified by the given ID.
Parameters: module_id (int) – The unique ID of the module. Returns: The module on success, None otherwise. Return type: hal_py.Module
-
get_modules
(*args, **kwargs)¶ Overloaded function.
get_modules(self: hal_py.Netlist) -> List[hal::Module]
Get all modules contained within the netlist, including the top module.
returns: A list of modules. rtype: list[hal_py.Module] get_modules(self: hal_py.Netlist, filter: Callable[[hal::Module], bool]) -> List[hal::Module]
Get all modules contained within the netlist, including the top module. The filter is evaluated on every module such that the result only contains modules 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_net_by_id
(self: hal_py.Netlist, net_id: int) → hal::Net¶ Get the net specified by the given ID.
Parameters: net_id (int) – The unique ID of the net. Returns: The net on success, None otherwise. Return type: hal_py.Net or None
-
get_nets
(*args, **kwargs)¶ Overloaded function.
get_nets(self: hal_py.Netlist) -> List[hal::Net]
Get all nets contained within the netlist.
returns: A list of nets. rtype: list[hal_py.Net] get_nets(self: hal_py.Netlist, filter: Callable[[hal::Net], bool]) -> List[hal::Net]
Get all nets contained within the netlist.<br> The filter is evaluated on every net such that the result only contains nets 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]
-
get_next_gate_id
(self: hal_py.Netlist) → int¶ Get the gate ID following the highest currently used ID.
Returns: The next gate ID. Return type: int
-
get_next_grouping_id
(self: hal_py.Netlist) → int¶ Get the grouping ID following the highest currently used ID.
Returns: The next grouping ID. Return type: int
-
get_next_module_id
(self: hal_py.Netlist) → int¶ Get the module ID following the highest currently used ID.
Returns: The next module ID. Return type: int
-
get_next_net_id
(self: hal_py.Netlist) → int¶ Get the net ID following the highest currently used ID.
Returns: The next net ID. Return type: int
-
get_top_module
(self: hal_py.Netlist) → hal::Module¶ Get the top module of the netlist.
Returns: The top module. Return type: hal_py.Module
-
get_unique_gate_id
(self: hal_py.Netlist) → int¶ Get a spare gate ID. The value of 0 is reserved and represents an invalid ID.
Returns: The gate ID. Return type: int
-
get_unique_grouping_id
(self: hal_py.Netlist) → int¶ Get a spare and unique grouping ID. The value of 0 is reserved and represents an invalid ID.
Returns: The grouping ID. Return type: int
-
get_unique_module_id
(self: hal_py.Netlist) → int¶ Get a spare module ID. The value of 0 is reserved and represents an invalid ID.
Returns: The module ID. Return type: int
-
get_unique_net_id
(self: hal_py.Netlist) → int¶ Get a spare net ID. The value of 0 is reserved and represents an invalid ID.
Returns: The net ID. Return type: int
-
get_used_gate_ids
(self: hal_py.Netlist) → Set[int]¶ Get a set of all currently used gate IDs.
Returns: All used gate IDs. Return type: set[int]
-
get_used_grouping_ids
(self: hal_py.Netlist) → Set[int]¶ Get a set of all currently used grouping IDs.
Returns: All used grouping IDs. Return type: set[int]
-
get_used_module_ids
(self: hal_py.Netlist) → Set[int]¶ Get a set of all currently used module IDs.
Returns: All used module IDs. Return type: set[int]
-
get_used_net_ids
(self: hal_py.Netlist) → Set[int]¶ Get a set of all currently used net IDs.
Returns: All used net IDs. Return type: set[int]
-
get_vcc_gates
(self: hal_py.Netlist) → List[hal::Gate]¶ Get all global VCC gates.
Returns: A list of gates. Return type: list[hal_py.Gate]
-
global_input_nets
¶ All global input nets.
Type: list[hal_py.Net]
-
global_output_nets
¶ All global output nets.
Type: list[hal_py.Net]
-
gnd_gates
¶ All global GND gates.
Type: list[hal_py.Gate]
-
groupings
¶ All groupings contained within the netlist.
Type: list[hal_py.Grouping]
-
is_gate_in_netlist
(self: hal_py.Netlist, gate: hal::Gate) → bool¶ Check whether the gate is registered in the netlist.
Parameters: gate (hal_py.Gate) – The gate to check. Returns: True if the gate is in the netlist, false otherwise. Return type: bool
-
is_global_input_net
(self: hal_py.Netlist, net: hal::Net) → bool¶ Check whether a net is a global input net.
Parameters: net (hal_py.Net) – The net to check. Returns: True if the net is a global input net, false otherwise. Return type: bool
-
is_global_output_net
(self: hal_py.Netlist, net: hal::Net) → bool¶ Check whether a net is a global output net.
Parameters: net (hal_py.Net) – The net to check. Returns: True if the net is a global output net, false otherwise. Return type: bool
-
is_gnd_gate
(self: hal_py.Netlist, gate: hal::Gate) → bool¶ Check whether a gate is a global GND gate.
Parameters: gate (hal_py.Gate) – The gate to check. Returns: True if the gate is a global GND gate, false otherwise. Return type: bool
-
is_grouping_in_netlist
(self: hal_py.Netlist, grouping: hal::Grouping) → bool¶ Check whether the grouping is registered in the netlist.
Parameters: grouping (hal_py.Module) – The grouping to check. Returns: True on success, false otherwise. Return type: bool
-
is_module_in_netlist
(self: hal_py.Netlist, module: hal::Module) → bool¶ Check whether a module is registered in the netlist.
Parameters: module (hal_py.Module) – The module to check. Returns: True if the module is in the netlist, false otherwise. Return type: bool
-
is_net_in_netlist
(self: hal_py.Netlist, net: hal::Net) → bool¶ Check whether a net is registered in the netlist.
Parameters: net (hal_py.Net) – The net to check. Returns: True if the net is in the netlist, false otherwise. Return type: bool
-
is_vcc_gate
(self: hal_py.Netlist, gate: hal::Gate) → bool¶ Check whether a gate is a global VCC gate.
Parameters: gate (hal_py.Gate) – The gate to check. Returns: True if the gate is a global VCC gate, false otherwise. Return type: bool
-
load_gate_locations_from_data
(self: hal_py.Netlist, data_category: str = '', data_identifiers: Tuple[str, str] = ('', '')) → bool¶ Load the locations of the gates in the netlist from their associated data using the specified category and identifier. If no parameter is given, the data is querried using the default category and identifier stored with the gate library.
Parameters: Returns: True on success, False otherwise.
Return type:
-
mark_global_input_net
(self: hal_py.Netlist, net: hal::Net) → bool¶ Mark a net as a global input net.
Parameters: net (hal_py.Net) – The net. Returns: True on success, false otherwise. Return type: bool
-
mark_global_output_net
(self: hal_py.Netlist, net: hal::Net) → bool¶ Mark a net as a global output net.
Parameters: net (hal_py.Net) – The net. Returns: True on success, false otherwise. Return type: bool
-
mark_gnd_gate
(self: hal_py.Netlist, gate: hal::Gate) → bool¶ Mark a gate as global GND gate.
Parameters: gate (hal_py.Gate) – The gate. Returns: True on success, false otherwise. Return type: bool
-
mark_vcc_gate
(self: hal_py.Netlist, gate: hal::Gate) → bool¶ Mark a gate as global VCC gate.
Parameters: gate (hal_py.Gate) – The gate. Returns: True on success, false otherwise. Return type: bool
-
modules
¶ All modules contained within the netlist, including the top module.
Type: list[hal_py.Module]
-
nets
¶ All nets contained within the netlist.
Type: list[hal_py.Net]
-
set_design_name
(self: hal_py.Netlist, design_name: str) → None¶ Set the name of the design.
Parameters: design_name (str) – The new name of the design.
-
set_device_name
(self: hal_py.Netlist, device_name: str) → None¶ Set the name of the target device.
Parameters: divice_name (str) – The name of the target device.
-
set_free_gate_ids
(self: hal_py.Netlist, ids: Set[int]) → None¶ Set a set of all gate IDs that have previously been used but been freed ever since.
Parameters: ids (set[int]) – All freed gate IDs.
-
set_free_grouping_ids
(self: hal_py.Netlist, ids: Set[int]) → None¶ Set a set of all grouping IDs that have previously been used but been freed ever since.
Parameters: ids (set[int]) – All freed grouping IDs.
-
set_free_module_ids
(self: hal_py.Netlist, ids: Set[int]) → None¶ Set a set of all module IDs that have previously been used but been freed ever since.
Parameters: ids (set[int]) – All freed module IDs.
-
set_free_net_ids
(self: hal_py.Netlist, ids: Set[int]) → None¶ Set a set of all net IDs that have previously been used but been freed ever since.
Parameters: ids (set[int]) – All freed net IDs.
-
set_id
(self: hal_py.Netlist, id: int) → None¶ Set the ID of the netlist to the specified value.
Parameters: id (int) – The new ID of the netlist.
-
set_input_filename
(self: hal_py.Netlist, path: os.PathLike) → None¶ Set the path to the input file.
Parameters: filename (pathlib.Path) – The path to the input file.
-
set_next_gate_id
(self: hal_py.Netlist, id: int) → None¶ Set the gate ID following the highest currently used ID.
Parameters: id (int) – The next gate ID.
-
set_next_grouping_id
(self: hal_py.Netlist, id: int) → None¶ Set the grouping ID following the highest currently used ID.
Parameters: id (int) – The next grouping ID.
-
set_next_module_id
(self: hal_py.Netlist, id: int) → None¶ Set the module ID following the highest currently used ID.
Parameters: id (int) – The next module ID.
-
set_next_net_id
(self: hal_py.Netlist, id: int) → None¶ Set the net ID following the highest currently used ID.
Parameters: id (int) – The next net ID.
-
set_used_gate_ids
(self: hal_py.Netlist, ids: Set[int]) → None¶ Set a set of all currently used gate IDs.
Parameters: ids (set[int]) – All used gate IDs.
-
set_used_grouping_ids
(self: hal_py.Netlist, ids: Set[int]) → None¶ Set a set of all currently used grouping IDs.
Parameters: ids (set[int]) – All used grouping IDs.
-
set_used_module_ids
(self: hal_py.Netlist, ids: Set[int]) → None¶ Set a set of all currently used module IDs.
Parameters: ids (set[int]) – All used module IDs.
-
set_used_net_ids
(self: hal_py.Netlist, ids: Set[int]) → None¶ Set a set of all currently used net IDs.
Parameters: ids (set[int]) – All used net IDs.
-
top_module
¶ The top module of the netlist.
Type: hal_py.Module
-
unmark_global_input_net
(self: hal_py.Netlist, net: hal::Net) → bool¶ Unmark a global input net.
Parameters: net (hal_py.Net) – The net. Returns: True on success, false otherwise. Return type: bool
-
unmark_global_output_net
(self: hal_py.Netlist, net: hal::Net) → bool¶ Unmark a global output net.
Parameters: net (hal_py.Net) – The net. Returns: True on success, false otherwise. Return type: bool
-
unmark_gnd_gate
(self: hal_py.Netlist, gate: hal::Gate) → bool¶ Unmark a global GND gate.
Parameters: gate (hal_py.Gate) – The gate. Returns: True on success, false otherwise. Return type: bool
-
unmark_vcc_gate
(self: hal_py.Netlist, gate: hal::Gate) → bool¶ Unmark a global VCC gate.
Parameters: gate (hal_py.Gate) – The gate. Returns: True on success, false otherwise. Return type: bool
-
vcc_gates
¶ All global VCC gates.
Type: list[hal_py.Gate]
-