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

Represents a verified candidate for module identification. More...

#include </home/runner/work/hal/hal/plugins/module_identification/include/module_identification/candidates/verified_candidate.h>

Collaboration diagram for hal::module_identification::VerifiedCandidate:
Collaboration graph

Public Member Functions

 VerifiedCandidate (const std::vector< std::vector< Net * >> &operands, const std::vector< Net * > &output_nets, const std::vector< Net * > &control_signals, const std::vector< std::map< Net *, BooleanFunction::Value >> &control_signal_mappings, const std::map< std::map< Net *, BooleanFunction::Value >, BooleanFunction > &word_level_operations, const std::vector< Gate * > &gates, const std::vector< Gate * > &base_gates, const std::map< std::string, std::string > &additional_data, const std::set< CandidateType > &types)
 Constructor for VerifiedCandidate. More...
 
 VerifiedCandidate ()
 Default constructor for an empty/unverified VerifiedCandidate. More...
 
bool operator== (const VerifiedCandidate &other) const
 Equality comparison operator for two verified candidates. More...
 
std::string get_candidate_info () const
 Get the candidate information as a string. More...
 
bool is_verified () const
 Check if the candidate is verified. More...
 
std::string get_name () const
 Get the name of the candidate that represents the functionality of the candidate. More...
 
BooleanFunction get_merged_word_level_operation () const
 Get the merged word-level operation for the candidate. More...
 

Static Public Member Functions

static hal::Result< VerifiedCandidatemerge (const std::vector< VerifiedCandidate > &candidates)
 Merge multiple verified candidates into a single candidate. More...
 

Public Attributes

std::vector< std::vector< Net * > > m_operands
 
std::vector< Net * > m_output_nets
 
std::vector< Net * > m_control_signals
 
std::vector< std::map< Net *, BooleanFunction::Value > > m_control_signal_mappings
 
std::map< std::map< Net *, BooleanFunction::Value >, BooleanFunctionm_word_level_operations
 
std::vector< Gate * > m_gates
 
std::vector< Gate * > m_base_gates
 
std::vector< Net * > m_total_input_nets
 
std::vector< Net * > m_total_output_nets
 
std::set< CandidateTypem_types
 
bool m_verified
 

Detailed Description

Represents a verified candidate for module identification.

This class is used to represent a verified candidate within the module identification process, providing methods for their creation, manipulation, and verification.

Definition at line 49 of file verified_candidate.h.

Constructor & Destructor Documentation

◆ VerifiedCandidate() [1/2]

hal::module_identification::VerifiedCandidate::VerifiedCandidate ( const std::vector< std::vector< Net * >> &  operands,
const std::vector< Net * > &  output_nets,
const std::vector< Net * > &  control_signals,
const std::vector< std::map< Net *, BooleanFunction::Value >> &  control_signal_mappings,
const std::map< std::map< Net *, BooleanFunction::Value >, BooleanFunction > &  word_level_operations,
const std::vector< Gate * > &  gates,
const std::vector< Gate * > &  base_gates,
const std::map< std::string, std::string > &  additional_data,
const std::set< CandidateType > &  types 
)

Constructor for VerifiedCandidate.

Parameters
[in]operands- A vector of vectors of operand nets.
[in]output_nets- A vector of output nets.
[in]control_signals- A vector of control signal nets.
[in]control_signal_mappings- A vector of mappings from nets to their Boolean values.
[in]word_level_operations- A map of control signal mappings to their respective word-level operations.
[in]gates- A vector of gates associated with the candidate.
[in]base_gates- A vector of base gates associated with the candidate.
[in]additional_data- A map of additional data.
[in]types- A set of candidate types.

Definition at line 16 of file verified_candidate.cpp.

◆ VerifiedCandidate() [2/2]

hal::module_identification::VerifiedCandidate::VerifiedCandidate ( )

Default constructor for an empty/unverified VerifiedCandidate.

Definition at line 29 of file verified_candidate.cpp.

References m_base_gates, m_control_signal_mappings, m_control_signals, m_gates, m_operands, m_output_nets, m_types, m_verified, and m_word_level_operations.

Referenced by merge().

Member Function Documentation

◆ get_candidate_info()

std::string hal::module_identification::VerifiedCandidate::get_candidate_info ( ) const

Get the candidate information as a string.

Returns
A string containing the candidate information.

Definition at line 48 of file verified_candidate.cpp.

References hal::data, hal::enum_to_string(), hal::utils::join(), m_control_signal_mappings, m_control_signals, m_gates, m_operands, m_output_nets, m_types, and m_verified.

Referenced by hal::PYBIND11_PLUGIN().

◆ get_merged_word_level_operation()

BooleanFunction hal::module_identification::VerifiedCandidate::get_merged_word_level_operation ( ) const

Get the merged word-level operation for the candidate.

The mergred word-level operation includes all word-level oprations that we were able to verify for different control mappings of the candidate.

Returns
The merged word-level operation as a Boolean function.

Definition at line 196 of file verified_candidate.cpp.

References hal::BooleanFunction::And(), hal::BooleanFunction::clone(), hal::BooleanFunction::Const(), hal::BooleanFunction::Eq(), hal::BooleanFunctionNetDecorator::get_boolean_variable(), hal::BooleanFunction::is_empty(), hal::BooleanFunction::Ite(), log_error, m_output_nets, m_word_level_operations, net, hal::BooleanFunction::size(), and hal::BooleanFunction::Var().

Referenced by hal::PYBIND11_PLUGIN().

◆ get_name()

std::string hal::module_identification::VerifiedCandidate::get_name ( ) const

Get the name of the candidate that represents the functionality of the candidate.

Returns
A string containing the name of the candidate.

Definition at line 186 of file verified_candidate.cpp.

References hal::utils::join(), and m_types.

Referenced by hal::PYBIND11_PLUGIN().

◆ is_verified()

bool hal::module_identification::VerifiedCandidate::is_verified ( ) const

Check if the candidate is verified.

Returns
true if the candidate is verified, false otherwise.

Definition at line 43 of file verified_candidate.cpp.

References m_verified.

Referenced by hal::PYBIND11_PLUGIN().

◆ merge()

Result< VerifiedCandidate > hal::module_identification::VerifiedCandidate::merge ( const std::vector< VerifiedCandidate > &  candidates)
static

Merge multiple verified candidates into a single candidate.

This function merges a vector of verified candidates into a single candidate.

Parameters
[in]candidates- A vector of verified candidates to merge.
Returns
OK() and the merged verified candidate on success, an error otherwise.

Definition at line 98 of file verified_candidate.cpp.

References ERR, log_warning, OK, and VerifiedCandidate().

Referenced by hal::PYBIND11_PLUGIN().

◆ operator==()

bool hal::module_identification::VerifiedCandidate::operator== ( const VerifiedCandidate other) const
inline

Equality comparison operator for two verified candidates.

Compares two verified candidates for equality.

Parameters
[in]other- The verified candidate to compare against.
Returns
true if the candidates are equal, false otherwise.

Definition at line 88 of file verified_candidate.h.

References m_control_signal_mappings, m_control_signals, m_gates, m_operands, m_output_nets, m_types, and m_verified.

Member Data Documentation

◆ m_base_gates

std::vector<Gate*> hal::module_identification::VerifiedCandidate::m_base_gates

A vector of base gates associated with the candidate.

Definition at line 167 of file verified_candidate.h.

Referenced by hal::PYBIND11_PLUGIN(), and VerifiedCandidate().

◆ m_control_signal_mappings

std::vector<std::map<Net*, BooleanFunction::Value> > hal::module_identification::VerifiedCandidate::m_control_signal_mappings

A vector of all control mappings covered by this candidate.

Definition at line 152 of file verified_candidate.h.

Referenced by get_candidate_info(), operator==(), hal::PYBIND11_PLUGIN(), and VerifiedCandidate().

◆ m_control_signals

std::vector<Net*> hal::module_identification::VerifiedCandidate::m_control_signals

A vector of control signal nets.

Definition at line 147 of file verified_candidate.h.

Referenced by get_candidate_info(), operator==(), hal::PYBIND11_PLUGIN(), and VerifiedCandidate().

◆ m_gates

std::vector<Gate*> hal::module_identification::VerifiedCandidate::m_gates

A vector of gates associated with the candidate.

Definition at line 162 of file verified_candidate.h.

Referenced by get_candidate_info(), operator==(), hal::PYBIND11_PLUGIN(), and VerifiedCandidate().

◆ m_operands

std::vector<std::vector<Net*> > hal::module_identification::VerifiedCandidate::m_operands

A vector of operands.

Definition at line 137 of file verified_candidate.h.

Referenced by get_candidate_info(), operator==(), hal::PYBIND11_PLUGIN(), and VerifiedCandidate().

◆ m_output_nets

std::vector<Net*> hal::module_identification::VerifiedCandidate::m_output_nets

◆ m_total_input_nets

std::vector<Net*> hal::module_identification::VerifiedCandidate::m_total_input_nets

A vector of all input nets to the gate subgraph, regardless of whether they appear in a word-level operation or not..

Definition at line 172 of file verified_candidate.h.

Referenced by hal::PYBIND11_PLUGIN().

◆ m_total_output_nets

std::vector<Net*> hal::module_identification::VerifiedCandidate::m_total_output_nets

A vector of all output nets of the subgrapg, regardless of whether they appear in a word-level operation or not.

Definition at line 177 of file verified_candidate.h.

Referenced by hal::PYBIND11_PLUGIN().

◆ m_types

std::set<CandidateType> hal::module_identification::VerifiedCandidate::m_types

The set of contained candidate types.

Definition at line 182 of file verified_candidate.h.

Referenced by get_candidate_info(), get_name(), operator==(), hal::PYBIND11_PLUGIN(), and VerifiedCandidate().

◆ m_verified

bool hal::module_identification::VerifiedCandidate::m_verified

Indicates whether the candidate is verified.

Definition at line 187 of file verified_candidate.h.

Referenced by get_candidate_info(), is_verified(), operator==(), hal::PYBIND11_PLUGIN(), and VerifiedCandidate().

◆ m_word_level_operations

std::map<std::map<Net*, BooleanFunction::Value>, BooleanFunction> hal::module_identification::VerifiedCandidate::m_word_level_operations

A map of control signal mappings to their respective word-level operations.

Definition at line 157 of file verified_candidate.h.

Referenced by get_merged_word_level_operation(), hal::PYBIND11_PLUGIN(), and VerifiedCandidate().


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