Dataflow Analysis (DANA)

class dataflow.DataflowPlugin
execute(self: dataflow.DataflowPlugin, netlist: hal_py.Netlist, output_path: str, sizes: List[int], draw_graph: bool = False, create_modules: bool = False, register_stage_identification: bool = False, known_groups: List[List[int]] = [], min_group_size: int = 8) → List[List[hal_py.Gate]]

Executes the dataflow analysis plugin (DANA). Starting from the netlist DANA tries to identify high-level registers.

Parameters:
  • netlist (hal_py.Netlist) – The netlist to operate on.
  • output_path (str) – Path where the dataflow graph should be written to
  • sizes (list[int]) – Prioritized sizes.
  • draw_graph (bool) – Switch to turn on/off the generation of the graph.
  • create_modules (bool) – Switch to turn on/off the creation of HAL modules for the registers.
  • register_stage_identification (bool) – Switch to turn on/off the register stage rule. Note that this rule can be too restrictive and is turned off by default.
  • known_groups (list[list[int]]) – Previously known groups that stay untouched.
Returns:

Register groups created by DANA

Return type:

list[list[hal_py.Gate]]

get_name(self: dataflow.DataflowPlugin) → str

Get the name of the plugin.

Returns:Plugin name.
Return type:str
get_version(self: dataflow.DataflowPlugin) → str

Get the version of the plugin.

Returns:Plugin version.
Return type:str
name

The name of the plugin.

Type:str
version

The version of the plugin.

Type:str
class dataflow.Dataflow.Configuration

Holds the configuration of a dataflow analysis run.

__init__(self: dataflow.Dataflow.Configuration) → None

Constructs a new dataflow analysis configuration.

enable_register_stages

Enable register stage identification as part of dataflow analysis. Defaults to False.

Type:bool
expected_sizes

Expected group sizes. Groups of these sizes will be prioritized. Defaults to an empty list.

Type:list[int]
known_groups

Already identified groups of sequential gates as a list of groups with each group being a list of gate IDs. Defaults to an empty list.

Type:list[list[int]]
min_group_size

Minimum size of a group. Smaller groups will be penalized during analysis. Defaults to 8.

Type:int
with_expected_sizes(self: dataflow.Dataflow.Configuration, sizes: List[int]) → dataflow.Dataflow.Configuration

Set the expected group sizes. Groups of these sizes will be prioritized.

Parameters:sizes (list[int]) – The expected group sizes.
Returns:The updated dataflow analysis configuration.
Return type:dataflow.Dataflow.Configuration
with_known_groups(*args, **kwargs)

Overloaded function.

  1. with_known_groups(self: dataflow.Dataflow.Configuration, groups: List[hal_py.Module]) -> dataflow.Dataflow.Configuration

    Set already identified groups of sequential gates as a list of groups with each group being a module.

    param list[hal_py.Module] groups:
     A list of groups.
    returns:The updated dataflow analysis configuration.
    rtype:dataflow.Dataflow.Configuration
  2. with_known_groups(self: dataflow.Dataflow.Configuration, groups: List[hal_py.Grouping]) -> dataflow.Dataflow.Configuration

    Set already identified groups of sequential gates as a vector of groups with each group being a grouping.

    param list[hal_py.Grouping] groups:
     A list of groups.
    returns:The updated dataflow analysis configuration.
    rtype:dataflow.Dataflow.Configuration
  3. with_known_groups(self: dataflow.Dataflow.Configuration, groups: List[List[hal_py.Gate]]) -> dataflow.Dataflow.Configuration

    Set already identified groups of sequential gates as a list of groups with each group being a list of gates.

    param list[list[hal_py.Gate]] groups:
     A list of groups.
    returns:The updated dataflow analysis configuration.
    rtype:dataflow.Dataflow.Configuration
  4. with_known_groups(self: dataflow.Dataflow.Configuration, groups: List[List[int]]) -> dataflow.Dataflow.Configuration

    Set already identified groups of sequential gates as a list of groups with each group being a list of gate IDs.

    param list[list[int]] groups:
     A list of groups.
    returns:The updated dataflow analysis configuration.
    rtype:dataflow.Dataflow.Configuration
with_min_group_size(self: dataflow.Dataflow.Configuration, size: int) → dataflow.Dataflow.Configuration

Set the minimum size of a group. Smaller groups will be penalized during analysis.

Parameters:size (int) – The minimum group size.
Returns:The updated dataflow analysis configuration.
Return type:dataflow.Dataflow.Configuration
with_register_stage_identification(self: dataflow.Dataflow.Configuration, enable: bool = True) → dataflow.Dataflow.Configuration

Enable register stage identification as part of dataflow analysis.

Parameters:enable (bool) – Set True to enable register stage identification, False otherwise. Defaults to True.
Returns:The updated dataflow analysis configuration.
Return type:dataflow.Dataflow.Configuration
with_type_consistency(self: dataflow.Dataflow.Configuration, enable: bool = True) → dataflow.Dataflow.Configuration

Enable type consistency as part of dataflow analysis when deciding whether two gates are allowed to merge into the same group.

Parameters:enable (bool) – Set True to enable type consistency inside of a group, False otherwise. Defaults to True.
Returns:The updated dataflow analysis configuration.
Return type:dataflow.Dataflow.Configuration
class dataflow.Dataflow.Result

The result of a dataflow analysis run containing the identified groups of sequential gates and their interconnections.

create_modules(self: dataflow.Dataflow.Result, group_ids: Set[int] = set()) → Optional[Dict[int, hal_py.Module]]

Create modules for the dataflow analysis result.

Parameters:group_ids (set[int]) – The group IDs to consider. If no IDs are provided, all groups will be considered. Defaults to an empty set.
Returns:A map from group IDs to Modules on success, None otherwise.
Return type:dict[int,hal_py.Module] or None
get_gate_control_nets(self: dataflow.Dataflow.Result, gate: hal_py.Gate, type: hal_py.PinType) → Optional[Set[hal_py.Net]]

Get the control nets of the given gate that are connected to a pin of the specified type.

Parameters:
Returns:

A set of control nets of the gate on success, None otherwise.

Return type:

set[hal_py.Net] or None

get_gate_predecessors(self: dataflow.Dataflow.Result, gate: hal_py.Gate) → Optional[Set[hal_py.Gate]]

Get the sequential predecessor gates of the given sequential gate.

Parameters:gate (hal_py.Gate) – The gate.
Returns:The predecessors of the gate as a set of gates on success, None otherwise.
Return type:set[hal_py.Gate] or None
get_gate_successors(self: dataflow.Dataflow.Result, gate: hal_py.Gate) → Optional[Set[hal_py.Gate]]

Get the sequential successor gates of the given sequential gate.

Parameters:gate (hal_py.Gate) – The gate.
Returns:The successors of the gate as a set of gates on success, None otherwise.
Return type:set[hal_py.Gate] or None
get_gates(self: dataflow.Dataflow.Result) → List[hal_py.Gate]

Get all gates contained in any of the groups groups.

Returns:A list of gates.
Return type:list[hal_py.Gate]
get_gates_of_group(self: dataflow.Dataflow.Result, group_id: int) → Optional[Set[hal_py.Gate]]

Get the gates of the specified group of sequential gates.

Parameters:group_id (int) – The ID of the group.
Returns:The gates of the group as a set on success, None otherwise.
Return type:set[hal_py.Gate] or None
get_group_control_nets(self: dataflow.Dataflow.Result, group_id: int, type: hal_py.PinType) → Optional[Set[hal_py.Net]]

Get the control nets of the group with the given group ID that are connected to a pin of the specified type.

Parameters:
Returns:

A set of control nets of the group on success, None otherwise.

Return type:

set[hal_py.Net] or None

get_group_id_of_gate(self: dataflow.Dataflow.Result, gate: hal_py.Gate) → Optional[int]

Get the group ID of the group that contains the given gate.

Parameters:gate (hal_py.Gate) – The gate.
Returns:The group ID on success, None otherwise.
Return type:int or None
get_group_list(self: dataflow.Dataflow.Result, group_ids: Set[int] = set()) → List[List[hal_py.Gate]]

Get the groups of the dataflow analysis result as a list.

Parameters:group_ids (set[int]) – The group IDs to consider. If no IDs are provided, all groups will be considered. Defaults to an empty set.
Returns:A list of groups with each group being a list of gates.
Return type:list[list[hal_py.Gate]]
get_group_predecessors(self: dataflow.Dataflow.Result, group_id: int) → Optional[Set[int]]

Get the predecessor groups of the group with the given ID.

Parameters:group_id (int) – The ID of the group.
Returns:The predecessors of the group as a set of group IDs on success, None otherwise.
Return type:set[int] or None
get_group_successors(self: dataflow.Dataflow.Result, group_id: int) → Optional[Set[int]]

Get the successor groups of the group with the given ID.

Parameters:group_id (int) – The group ID.
Returns:The successors of the group as a set of group IDs on success, None otherwise.
Return type:set[int] or None
get_groups(self: dataflow.Dataflow.Result) → Dict[int, Set[hal_py.Gate]]

Get the groups of sequential gates resulting from dataflow analysis.

Returns:A dict from group ID to a set of gates belonging to the respective group.
Return type:dict[int,set[hal_py.Gate]]
get_netlist(self: dataflow.Dataflow.Result) → hal_py.Netlist

Get the netlist on which dataflow analysis has been performed.

Returns:The netlist.
Return type:hal_py.Netlist
merge_groups(self: dataflow.Dataflow.Result, group_ids: List[int]) → Optional[int]

Merge multiple groups specified by ID. All specified groups are merged into the first group of the provided vector and are subsequently deleted.

Parameters:group_ids (set[int]) – The group IDs of the groups to merge.
Returns:The ID of the group that all over groups have been merged into on success, None otherwise.
Return type:int or None
split_group(self: dataflow.Dataflow.Result, group_id: int, new_groups: List[Set[hal_py.Gate]]) → Optional[List[int]]

Split a group into multiple smaller groups specified by sets of gates. All gates of the group to split must be contained in the sets exactly once and all gates in the sets must be contained in the group to split. The group that is being split is deleted in the process.

Parameters:
  • group_id (int) – The group ID of the group to split.
  • new_groups (list[set[hal_py.Gate]]) – A list of groups specified as unordered sets of gates.
Returns:

The group IDs of the newly created groups in the order of the provided sets.

Return type:

list[int]

write_dot(self: dataflow.Dataflow.Result, out_path: os.PathLike, group_ids: Set[int] = set()) → bool

Write the dataflow graph as a DOT graph to the specified location.

Parameters:
  • out_path (pathlib.Path) – The output path.
  • group_ids (set[int]) – The group IDs to consider. If no IDs are provided, all groups will be considered. Defaults to an empty set.
Returns:

True on success, False otherwise.

Return type:

bool

write_txt(self: dataflow.Dataflow.Result, out_path: os.PathLike, group_ids: Set[int] = set()) → bool

Write the groups resulting from dataflow analysis to a .txt file.

Parameters:
  • out_path (pathlib.Path) – The output path.
  • group_ids (set[int]) – The group IDs to consider. If no IDs are provided, all groups will be considered. Defaults to an empty set.
Returns:

True on success, False otherwise.

Return type:

bool

dataflow.Dataflow.analyze(nl: hal_py.Netlist, config: dataflow.Dataflow.Configuration = <dataflow.Dataflow.Configuration object at 0x7f820f447cf0>) → Optional[hal::dataflow::Result]

Analyze the datapath to identify word-level registers in the given netlist.

Parameters:
Returns:

The dataflow analysis result on success, None otherwise.

Return type:

dataflow.Dataflow.Result or None