HAL  v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
hal::module_identification::Result Struct Reference

The result of a module identification run containing the candidates. More...

#include </home/runner/work/hal/hal/plugins/module_identification/include/module_identification/api/result.h>

Collaboration diagram for hal::module_identification::Result:
Collaboration graph

Public Member Functions

 Result (Netlist *nl, const std::vector< std::pair< BaseCandidate, VerifiedCandidate >> &result, const std::string &timing_stats_json="")
 Constructor for Result. More...
 
Netlistget_netlist () const
 Get the netlist on which module identification has been performed. More...
 
std::map< u32, std::vector< Gate * > > get_verified_candidate_gates () const
 Get a map of the candidate IDs to the gates contained inside the verified candidates. More...
 
std::map< u32, VerifiedCandidateget_verified_candidates () const
 Get a map of the candidate IDs to the verified candidates. More...
 
std::map< u32, std::vector< Gate * > > get_candidate_gates () const
 Get a map of the candidate IDs to the gates contained inside the candidate. More...
 
std::map< u32, VerifiedCandidateget_candidates () const
 Get a map of the candidate IDs to the candidates. More...
 
hal::Result< std::vector< Gate * > > get_candidate_gates_by_id (const u32 id) const
 Get the gates of the candidate with the corresponding ID. More...
 
hal::Result< VerifiedCandidateget_candidate_by_id (const u32 id) const
 Returns the candidate with the corresponding ID. More...
 
std::set< Gate * > get_all_gates () const
 Get all gates contained in any of the candidates. More...
 
std::set< Gate * > get_all_verified_gates () const
 Get all gates contained in any of the verified candidates. More...
 
hal::Result< std::monostate > create_modules_in_netlist ()
 Creates a HAL module for each candidate of the result. More...
 
std::string get_timing_stats () const
 Get the collected timing information formatted as a JSON string. More...
 
hal::Result< Resultmerge (const Result &other, const std::vector< std::vector< Gate * >> &registers) const
 Merges two results by combining the found verified candidates. More...
 

Static Public Member Functions

static std::vector< std::vector< std::set< Gate * > > > assign_base_candidates_to_iterations (const std::vector< Result > &iteration_results, const bool create_block_lists=false)
 For different runs of the plugin figure out in which iteration the plugin found the highest quality result for each candidate. More...
 

Detailed Description

The result of a module identification run containing the candidates.

Definition at line 54 of file result.h.

Constructor & Destructor Documentation

◆ Result()

hal::module_identification::Result::Result ( Netlist nl,
const std::vector< std::pair< BaseCandidate, VerifiedCandidate >> &  result,
const std::string &  timing_stats_json = "" 
)

Constructor for Result.

Parameters
[in]nl- The netlist on which module identification has been performed.
[in]result- A vector of pairs containing base candidates and their verified candidates.
[in]timing_stats_json- A JSON string containing timing statistics. Defaults to an empty string.

Definition at line 18 of file result.cpp.

Member Function Documentation

◆ assign_base_candidates_to_iterations()

std::vector< std::vector< std::set< Gate * > > > hal::module_identification::Result::assign_base_candidates_to_iterations ( const std::vector< Result > &  iteration_results,
const bool  create_block_lists = false 
)
static

For different runs of the plugin figure out in which iteration the plugin found the highest quality result for each candidate.

This is used to compare the results of different runs of the plugin and afterwards get a list of base candidates for each execution for which this execution gave the best results.

Parameters
[in]iteration_results- A vector of all the execution results.
[in]create_block_lists- A parameter to determine whether to create allow or block lists.
Returns
A vector of allow or block lists for each plugin execution iteration.

Definition at line 872 of file result.cpp.

Referenced by hal::PYBIND11_PLUGIN().

◆ create_modules_in_netlist()

hal::Result< std::monostate > hal::module_identification::Result::create_modules_in_netlist ( )

◆ get_all_gates()

std::set< Gate * > hal::module_identification::Result::get_all_gates ( ) const

Get all gates contained in any of the candidates.

Returns
A set of gates.

Definition at line 107 of file result.cpp.

Referenced by hal::PYBIND11_PLUGIN().

◆ get_all_verified_gates()

std::set< Gate * > hal::module_identification::Result::get_all_verified_gates ( ) const

Get all gates contained in any of the verified candidates.

Returns
A set of gates.

Definition at line 124 of file result.cpp.

Referenced by hal::PYBIND11_PLUGIN().

◆ get_candidate_by_id()

hal::Result< VerifiedCandidate > hal::module_identification::Result::get_candidate_by_id ( const u32  id) const

Returns the candidate with the corresponding ID.

Parameters
[in]id- The ID of the requested candidate.
Returns
OK() and the verified candidate on success, an error otherwise.

Definition at line 97 of file result.cpp.

References ERR, id, and OK.

◆ get_candidate_gates()

std::map< u32, std::vector< Gate * > > hal::module_identification::Result::get_candidate_gates ( ) const

Get a map of the candidate IDs to the gates contained inside the candidate.

This map contains all checked candidates, even the ones not verified. The ID is only unique for this result.

Returns
A map of candidate IDs to a vector of gates.

Definition at line 57 of file result.cpp.

Referenced by hal::PYBIND11_PLUGIN().

◆ get_candidate_gates_by_id()

hal::Result< std::vector< Gate * > > hal::module_identification::Result::get_candidate_gates_by_id ( const u32  id) const

Get the gates of the candidate with the corresponding ID.

Parameters
[in]id- The ID of the requested candidate.
Returns
OK() and a vector of gates on success, an error otherwise.

Definition at line 79 of file result.cpp.

References ERR, id, and OK.

◆ get_candidates()

std::map< u32, VerifiedCandidate > hal::module_identification::Result::get_candidates ( ) const

Get a map of the candidate IDs to the candidates.

This map contains all checked candidates, even the ones not verified. The ID is only unique for this result.

Returns
A map of candidate IDs to candidates.

Definition at line 68 of file result.cpp.

Referenced by hal::PYBIND11_PLUGIN().

◆ get_netlist()

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

Get the netlist on which module identification has been performed.

Returns
The netlist.

Definition at line 23 of file result.cpp.

Referenced by hal::PYBIND11_PLUGIN().

◆ get_timing_stats()

std::string hal::module_identification::Result::get_timing_stats ( ) const

Get the collected timing information formatted as a JSON string.

Returns
A JSON formatted string.

Definition at line 680 of file result.cpp.

Referenced by hal::PYBIND11_PLUGIN().

◆ get_verified_candidate_gates()

std::map< u32, std::vector< Gate * > > hal::module_identification::Result::get_verified_candidate_gates ( ) const

Get a map of the candidate IDs to the gates contained inside the verified candidates.

This map only contains verified candidates that are fully verified. The ID is only unique for this result.

Returns
A map of candidate IDs to a vector of gates.

Definition at line 28 of file result.cpp.

Referenced by hal::PYBIND11_PLUGIN().

◆ get_verified_candidates()

std::map< u32, VerifiedCandidate > hal::module_identification::Result::get_verified_candidates ( ) const

Get a map of the candidate IDs to the verified candidates.

This map only contains verified candidates that are fully verified. The ID is only unique for this result.

Returns
A map of candidate IDs to verified candidates.

Definition at line 43 of file result.cpp.

Referenced by hal::PYBIND11_PLUGIN().

◆ merge()

hal::Result< Result > hal::module_identification::Result::merge ( const Result other,
const std::vector< std::vector< Gate * >> &  registers 
) const

Merges two results by combining the found verified candidates.

When both results contain a verified candidate for the same base candidate, the better one is chosen via the same post-processing used in the orignal module identificaion process. This requires that the base candidates are identical and that all gates of all candidates still exist in the netlist!

Parameters
[in]other- Another module identification result that is merged with this one.
[in]registers- A list of previously identified register groupings that is used in the post-processing.
Returns
OK() and a new merged module identification result on success, an error otherwise.

Definition at line 685 of file result.cpp.

References hal::Module::contains_gate(), ERR, hal::Netlist::get_top_module(), OK, and hal::module_identification::post_processing().


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