HAL
hal::dataflow::Result Class Reference

Result of a dataflow analysis run. More...

#include <result.h>

Collaboration diagram for hal::dataflow::Result:
Collaboration graph

Public Member Functions

 Result (Netlist *nl, const Grouping &grouping)
 
Netlistget_netlist () const
 Get the netlist on which dataflow analysis has been performed. More...
 
const std::unordered_map< u32, std::unordered_set< Gate * > > & get_groups () const
 Get the groups of sequential gates resulting from dataflow analysis. More...
 
std::vector< Gate * > get_gates () const
 Get all gates contained in any of the groups groups. More...
 
hal::Result< std::unordered_set< Gate * > > get_gates_of_group (const u32 group_id) const
 Get the gates of the specified group of sequential gates. More...
 
hal::Result< u32get_group_id_of_gate (const Gate *gate) const
 Get the group ID of the group that contains the given gate. More...
 
hal::Result< std::unordered_set< Net * > > get_group_control_nets (const u32 group_id, const PinType type) const
 Get the control nets of the group with the given group ID that are connected to a pin of the specified type. More...
 
hal::Result< std::unordered_set< Net * > > get_gate_control_nets (const Gate *gate, const PinType type) const
 Get the control nets of the given gate that are connected to a pin of the specified type. More...
 
hal::Result< std::unordered_set< u32 > > get_group_successors (const u32 group_id) const
 Get the successor groups of the group with the given ID. More...
 
hal::Result< std::unordered_set< Gate * > > get_gate_successors (const Gate *gate) const
 Get the sequential successor gates of the given sequential gate. More...
 
hal::Result< std::unordered_set< u32 > > get_group_predecessors (const u32 group_id) const
 Get the predecessor groups of the group with the given ID. More...
 
hal::Result< std::unordered_set< Gate * > > get_gate_predecessors (const Gate *gate) const
 Get the sequential predecessor gates of the given sequential gate. More...
 
hal::Result< std::monostate > write_dot (const std::filesystem::path &out_path, const std::unordered_set< u32 > &group_ids={}) const
 Write the dataflow graph as a DOT graph to the specified location. More...
 
hal::Result< std::monostate > write_txt (const std::filesystem::path &out_path, const std::unordered_set< u32 > &group_ids={}) const
 Write the groups resulting from dataflow analysis to a .txt file. More...
 
hal::Result< std::unordered_map< u32, Module * > > create_modules (const std::unordered_set< u32 > &group_ids={}) const
 Create modules for the dataflow analysis result. More...
 
hal::Result< std::unordered_map< u32, Module * > > create_modules (const std::map< const GateType *, std::string > &module_suffixes, const std::map< std::pair< PinDirection, std::string >, std::string > &pin_prefixes, const std::unordered_set< u32 > &group_ids) const
 Create modules for the dataflow analysis result. More...
 
hal::Result< std::unordered_map< u32, Module * > > create_modules (const std::map< GateTypeProperty, std::string > &module_suffixes, const std::map< std::pair< PinDirection, std::string >, std::string > &pin_prefixes, const std::unordered_set< u32 > &group_ids) const
 Create modules for the dataflow analysis result. More...
 
std::vector< std::vector< Gate * > > get_groups_as_list (const std::unordered_set< u32 > &group_ids={}) const
 Get the groups of the dataflow analysis result as a list. More...
 
hal::Result< u32merge_groups (const std::vector< u32 > &group_ids)
 Merge multiple groups specified by ID. More...
 
hal::Result< std::vector< u32 > > split_group (u32 group_id, const std::vector< std::unordered_set< Gate * >> &new_groups)
 Split a group into multiple smaller groups specified by sets of gates. More...
 

Detailed Description

Result of a dataflow analysis run.

This class holds result of a dataflow analysis run, which contains the identified groups of sequential gates and their interconnections. Each such group is assigned a unique ID by which it can be addressed in many of the member functions of this class. Please note that this ID is not related to any other HAL ID.

Definition at line 56 of file result.h.

Constructor & Destructor Documentation

◆ Result()

Member Function Documentation

◆ create_modules() [1/3]

hal::Result< std::unordered_map< u32, Module * > > hal::dataflow::Result::create_modules ( const std::map< const GateType *, std::string > &  module_suffixes,
const std::map< std::pair< PinDirection, std::string >, std::string > &  pin_prefixes,
const std::unordered_set< u32 > &  group_ids 
) const

Create modules for the dataflow analysis result.

Please note that the IDs of the module are assigned independent of the group IDs of the register groups.

Parameters
[in]module_suffixes- The suffixes to use for modules containing only gates of a specific gate type. Defaults to "module" for mixed and unspecified gate types.
[in]pin_prefixes- The prefixes to use for the module pins that (within the module) only connect to gate pins of a specific name.
[in]group_ids- The group IDs to consider. If no IDs are provided, all groups will be considered.
Returns
Ok() and a map from group IDs to Modules on success, an error otherwise.

Definition at line 422 of file result.cpp.

References hal::Endpoint::get_gate(), hal::PinGroup< T >::get_type(), hal::input, log_info, log_warning, OK, hal::output, and hal::utils::starts_with().

◆ create_modules() [2/3]

hal::Result< std::unordered_map< u32, Module * > > hal::dataflow::Result::create_modules ( const std::map< GateTypeProperty, std::string > &  module_suffixes,
const std::map< std::pair< PinDirection, std::string >, std::string > &  pin_prefixes,
const std::unordered_set< u32 > &  group_ids 
) const

Create modules for the dataflow analysis result.

Please note that the IDs of the module are assigned independent of the group IDs of the register groups.

Parameters
[in]module_suffixes- The suffixes to use for modules containing only gates of a specific gate type. All gate types featuring the specified gate type property are considered, but the module must still be pure (i.e., all gates must be of the same type) for the suffix to be used. Defaults to "module" for mixed and unspecified gate types.
[in]pin_prefixes- The prefixes to use for the module pins that (within the module) only connect to gate pins of a specific name.
[in]group_ids- The group IDs to consider. If no IDs are provided, all groups will be considered.
Returns
Ok() and a map from group IDs to Modules on success, an error otherwise.

Definition at line 597 of file result.cpp.

References type.

◆ create_modules() [3/3]

hal::Result< std::unordered_map< u32, Module * > > hal::dataflow::Result::create_modules ( const std::unordered_set< u32 > &  group_ids = {}) const

Create modules for the dataflow analysis result.

Please note that the IDs of the module are assigned independent of the group IDs of the register groups.

Parameters
[in]group_ids- The group IDs to consider. If an empty set is provided, all groups will be considered. Defaults to an empty set.
Returns
Ok() and a map from group IDs to Modules on success, an error otherwise.

Definition at line 417 of file result.cpp.

◆ get_gate_control_nets()

hal::Result< std::unordered_set< Net * > > hal::dataflow::Result::get_gate_control_nets ( const Gate gate,
const PinType  type 
) const

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

Parameters
[in]gate- The gate.
[in]type- The pin type.
Returns
Ok() and a set of control nets of the gate on success, an error otherwise.

Definition at line 169 of file result.cpp.

References ERR, OK, and type.

◆ get_gate_predecessors()

hal::Result< std::unordered_set< Gate * > > hal::dataflow::Result::get_gate_predecessors ( const Gate gate) const

Get the sequential predecessor gates of the given sequential gate.

Parameters
[in]gate- The gate.
Returns
Ok() and the predecessors of the gate as a set of gates on success, an error otherwise.

Definition at line 233 of file result.cpp.

References ERR, and OK.

◆ get_gate_successors()

hal::Result< std::unordered_set< Gate * > > hal::dataflow::Result::get_gate_successors ( const Gate gate) const

Get the sequential successor gates of the given sequential gate.

Parameters
[in]gate- The gate.
Returns
Ok() and the successors of the gate as a set of gates on success, an error otherwise.

Definition at line 203 of file result.cpp.

References ERR, and OK.

◆ get_gates()

std::vector< Gate * > hal::dataflow::Result::get_gates ( ) const

Get all gates contained in any of the groups groups.

Returns
A vector of gates.

Definition at line 109 of file result.cpp.

Referenced by hal::PYBIND11_PLUGIN().

◆ get_gates_of_group()

hal::Result< std::unordered_set< Gate * > > hal::dataflow::Result::get_gates_of_group ( const u32  group_id) const

Get the gates of the specified group of sequential gates.

Parameters
[in]group_id- The ID of the group.
Returns
Ok() and the gates of the group as a set on success, an error otherwise.

Definition at line 121 of file result.cpp.

References ERR, and OK.

◆ get_group_control_nets()

hal::Result< std::unordered_set< Net * > > hal::dataflow::Result::get_group_control_nets ( const u32  group_id,
const PinType  type 
) const

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

Parameters
[in]group_id- The group ID.
[in]type- The pin type.
Returns
Ok() and a set of control nets of the group on success, an error otherwise.

Definition at line 150 of file result.cpp.

References ERR, OK, and type.

◆ get_group_id_of_gate()

hal::Result< u32 > hal::dataflow::Result::get_group_id_of_gate ( const Gate gate) const

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

Parameters
[in]gate- The gate.
Returns
Ok() and the group ID on success, an error otherwise.

Definition at line 133 of file result.cpp.

References ERR, and OK.

◆ get_group_predecessors()

hal::Result< std::unordered_set< u32 > > hal::dataflow::Result::get_group_predecessors ( const u32  group_id) const

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

Parameters
[in]group_id- The group ID.
Returns
Ok() and the predecessors of the group as a set of group IDs on success, an error otherwise.

Definition at line 218 of file result.cpp.

References ERR, and OK.

◆ get_group_successors()

hal::Result< std::unordered_set< u32 > > hal::dataflow::Result::get_group_successors ( const u32  group_id) const

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

Parameters
[in]group_id- The group ID.
Returns
Ok() and the successors of the group as a set of group IDs on success, an error otherwise.

Definition at line 188 of file result.cpp.

References ERR, and OK.

◆ get_groups()

const std::unordered_map< u32, std::unordered_set< Gate * > > & hal::dataflow::Result::get_groups ( ) const

Get the groups of sequential gates resulting from dataflow analysis.

Returns
A map from group ID to a set of gates belonging to the respective group.

Definition at line 104 of file result.cpp.

Referenced by hal::PYBIND11_PLUGIN().

◆ get_groups_as_list()

std::vector< std::vector< Gate * > > hal::dataflow::Result::get_groups_as_list ( const std::unordered_set< u32 > &  group_ids = {}) const

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

Parameters
[in]group_ids- The group IDs to consider. If no IDs are provided, all groups will be considered. Defaults to an empty set.
Returns
A vector of groups with each group being a vector of gates.

Definition at line 614 of file result.cpp.

Referenced by hal::PYBIND11_PLUGIN().

◆ get_netlist()

Netlist * hal::dataflow::Result::get_netlist ( ) const

Get the netlist on which dataflow analysis has been performed.

Returns
The netlist.

Definition at line 99 of file result.cpp.

Referenced by hal::PYBIND11_PLUGIN().

◆ merge_groups()

hal::Result< u32 > hal::dataflow::Result::merge_groups ( const std::vector< u32 > &  group_ids)

Merge multiple groups specified by ID.

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

Parameters
[in]group_ids- The group IDs of the groups to merge.
Returns
The ID of the group that all other groups have been merged into on success, an error otherwise.

Definition at line 634 of file result.cpp.

References ERR, test_plugin::g, and OK.

◆ split_group()

hal::Result< std::vector< u32 > > hal::dataflow::Result::split_group ( u32  group_id,
const std::vector< std::unordered_set< Gate * >> &  new_groups 
)

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
[in]group_id- The group ID of the group to split.
[in]new_groups- A vector of groups specified as unordered sets of gates.
Returns
The group IDs of the newly created groups in the order of the provided sets.

Definition at line 707 of file result.cpp.

References hal::clock, hal::enable, ERR, test_plugin::g, OK, hal::reset, hal::set, and type.

◆ write_dot()

hal::Result< std::monostate > hal::dataflow::Result::write_dot ( const std::filesystem::path &  out_path,
const std::unordered_set< u32 > &  group_ids = {} 
) const

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

Parameters
[in]out_path- The output path.
[in]group_ids- The group IDs to consider. If no IDs are provided, all groups will be considered. Defaults to an empty set.
Returns
Ok() on success, an error otherwise.

Definition at line 248 of file result.cpp.

References ERR, log_info, and OK.

◆ write_txt()

hal::Result< std::monostate > hal::dataflow::Result::write_txt ( const std::filesystem::path &  out_path,
const std::unordered_set< u32 > &  group_ids = {} 
) const

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

Parameters
[in]out_path- The output path.
[in]group_ids- The group IDs to consider. If no IDs are provided, all groups will be considered. Defaults to an empty set.
Returns
Ok() on success, an error otherwise.

Definition at line 321 of file result.cpp.

References hal::clock, hal::data, hal::enable, ERR, id, hal::utils::join(), log_info, name, OK, hal::reset, hal::set, and type.


The documentation for this class was generated from the following files: