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

Represents a functional candidate derived from structural candidates. More...

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

Collaboration diagram for hal::module_identification::FunctionalCandidate:
Collaboration graph

Public Member Functions

 FunctionalCandidate (StructuralCandidate *sc, u32 max_control_signal, module_identification::CandidateType candidate_type)
 Constructor for FunctionalCandidate. More...
 
hal::Result< VerifiedCandidatecheck (const std::vector< BooleanFunction > &output_functions, const std::vector< std::vector< Gate * >> &registers)
 Check whether a functional candidate with the given input operands and output functions is actually implementing the function specified by its type. More...
 
void add_additional_data (std::string key, std::string value)
 Add additional data to the functional candidate. More...
 
std::map< std::string, std::string > get_all_additional_data () const
 Get all additional data of the functional candidate. More...
 
std::string get_candidate_info () const
 Get candidate information as a string. More...
 

Static Public Member Functions

static hal::Result< std::vector< FunctionalCandidate > > create_candidates (StructuralCandidate *sc, u32 max_control_signal, CandidateContext &ctx, module_identification::CandidateType candidate_type, const std::vector< std::vector< Gate * >> &registers)
 Create functional candidates from a structural candidate. More...
 
static hal::Result< std::vector< FunctionalCandidate > > find_control_signals (CandidateContext &ctx, const FunctionalCandidate &candidate)
 Find control signals for a functional candidate. More...
 
static hal::Result< std::vector< FunctionalCandidate > > order_input_operands (CandidateContext &ctx, const FunctionalCandidate &candidate)
 Order input operands for a functional candidate. More...
 
static hal::Result< std::vector< FunctionalCandidate > > discard_equal_candidate (CandidateContext &ctx, const FunctionalCandidate &candidate)
 Discard equal candidates based on their number of input signals. More...
 
static hal::Result< std::vector< FunctionalCandidate > > trim_to_single_output_net (CandidateContext &ctx, const FunctionalCandidate &candidate)
 Trim a functional candidate to a single output net. More...
 
static hal::Result< std::vector< FunctionalCandidate > > create_sign_extension_variants (CandidateContext &ctx, const FunctionalCandidate &candidate)
 Create sign extension variants of a functional candidate. More...
 
static hal::Result< std::vector< FunctionalCandidate > > identify_control_signals (CandidateContext &ctx, const FunctionalCandidate &candidate)
 Identify control signals for an adder, subtractor, or counter. More...
 
static hal::Result< std::vector< FunctionalCandidate > > realize_control_signals (CandidateContext &ctx, const FunctionalCandidate &candidate)
 Realize control signals for an adder, subtractor, or counter by setting the control signals to concrete values. More...
 
static hal::Result< std::vector< FunctionalCandidate > > update_input_output_stats (CandidateContext &ctx, const FunctionalCandidate &candidate)
 Update input and output statistics for an adder, subtractor, or counter. More...
 
static hal::Result< std::vector< FunctionalCandidate > > permute_single_input_signals (CandidateContext &ctx, const FunctionalCandidate &candidate)
 Permute single input signals for an adder, subtractor, or counter. More...
 
static hal::Result< std::vector< FunctionalCandidate > > build_input_operands (CandidateContext &ctx, const FunctionalCandidate &candidate)
 Build input operands for an adder, subtractor, or counter. More...
 
static hal::Result< std::vector< FunctionalCandidate > > order_output_signals (CandidateContext &ctx, const FunctionalCandidate &candidate)
 Order output signals for an adder, subtractor, or counter. More...
 
static hal::Result< std::vector< FunctionalCandidate > > create_sign_bit_variants (CandidateContext &ctx, const FunctionalCandidate &candidate)
 Create sign bit variants for an adder, subtractor, or counter. More...
 
static hal::Result< std::vector< FunctionalCandidate > > create_input_extension_variants (CandidateContext &ctx, const FunctionalCandidate &candidate)
 Create input extension variants for an adder, subtractor, or counter. More...
 
static hal::Result< std::vector< FunctionalCandidate > > create_output_net_variant (CandidateContext &ctx, const FunctionalCandidate &candidate)
 Create output net variants for an adder, subtractor, or counter. More...
 
static hal::Result< std::vector< FunctionalCandidate > > add_single_input_signals (CandidateContext &ctx, const FunctionalCandidate &candidate)
 Add single input signals for an adder, subtractor, or counter. More...
 
static hal::Result< std::vector< FunctionalCandidate > > early_abort (CandidateContext &ctx, const FunctionalCandidate &candidate)
 Early abort process for a functional candidate. More...
 
static hal::Result< std::vector< FunctionalCandidate > > create_operand_control_variations (CandidateContext &ctx, const FunctionalCandidate &candidate)
 Create operand control variations for absolute functional candidates. More...
 
static FunctionalCandidate add_n_shifted_operands (const FunctionalCandidate &candidate, const std::vector< i32 > &shift_vals)
 Add n shifted operands for constant multiplication. More...
 
static hal::Result< std::vector< FunctionalCandidate > > add_selected_shifted_operand (CandidateContext &ctx, const FunctionalCandidate &candidate)
 Add shifted operands to the functional candidate based on its input output stats. More...
 
static hal::Result< std::vector< FunctionalCandidate > > add_all_shifted_operand (CandidateContext &ctx, const FunctionalCandidate &candidate)
 Add all possible variations of possible shifted operands to the functional candidate. More...
 
static hal::Result< std::vector< FunctionalCandidate > > check_output_size (CandidateContext &ctx, const FunctionalCandidate &candidate)
 Check the output size of a functional candidate. More...
 
static hal::Result< std::vector< FunctionalCandidate > > build_input_operand (CandidateContext &ctx, const FunctionalCandidate &candidate)
 Build an input operand for a functional candidate by including all external input signals of the candidate gates. More...
 

Public Attributes

module_identification::CandidateType m_candidate_type
 
std::vector< Gate * > m_gates
 
std::vector< Gate * > m_base_gates
 
StructuralCandidatem_structural_candidate
 
std::vector< std::vector< Net * > > m_operands
 
std::vector< Net * > m_control_signals
 
std::map< Net *, BooleanFunction::Valuem_control_mapping
 
std::map< u32, std::vector< Net * > > m_influence_count_to_input_nets
 
std::map< u32, std::vector< Net * > > m_input_count_to_output_nets
 
std::map< Net *, Net * > m_single_input_to_output
 
std::vector< std::pair< Net *, Net * > > m_permuted_single_pairs
 
std::vector< Net * > m_input_nets
 
std::vector< Net * > m_output_nets
 
u32 m_max_control_signals
 
u32 m_max_operands
 
std::map< std::string, std::string > m_additional_data = {}
 
Netm_ctrl_to_operand_net
 
std::vector< Net * > m_sign_nets
 
std::map< std::string, std::map< std::string, std::map< std::string, std::map< std::string, u64 > > > > m_timings
 

Detailed Description

Represents a functional candidate derived from structural candidates.

This class is used to handle functional candidates within the module identification process, providing methods for their creation, manipulation, and verification.

Definition at line 49 of file functional_candidate.h.

Constructor & Destructor Documentation

◆ FunctionalCandidate()

hal::module_identification::FunctionalCandidate::FunctionalCandidate ( StructuralCandidate sc,
u32  max_control_signal,
module_identification::CandidateType  candidate_type 
)

Member Function Documentation

◆ add_additional_data()

void hal::module_identification::FunctionalCandidate::add_additional_data ( std::string  key,
std::string  value 
)

Add additional data to the functional candidate.

Parameters
[in]key- The key for the data.
[in]value- The value for the data.

Definition at line 44 of file functional_candidate.cpp.

References m_additional_data.

Referenced by hal::module_identification::check_counter().

◆ add_all_shifted_operand()

Result< std::vector< FunctionalCandidate > > hal::module_identification::FunctionalCandidate::add_all_shifted_operand ( CandidateContext ctx,
const FunctionalCandidate candidate 
)
static

Add all possible variations of possible shifted operands to the functional candidate.

Parameters
[in]ctx- The candidate context.
[in]candidate- The functional candidate.
Returns
OK() and a vector of functional candidates on success, an error otherwise.

Definition at line 2066 of file create_functional_candidates.cpp.

References add_n_shifted_operands(), hal::utils::join(), OK, and UNUSED.

Referenced by create_candidates().

◆ add_n_shifted_operands()

FunctionalCandidate hal::module_identification::FunctionalCandidate::add_n_shifted_operands ( const FunctionalCandidate candidate,
const std::vector< i32 > &  shift_vals 
)
static

Add n shifted operands for constant multiplication.

Parameters
[in]candidate- The functional candidate.
[in]shift_vals- The shift values of the operands to add.
Returns
A new functional candidate with the shifted operands added.

Definition at line 1876 of file create_functional_candidates.cpp.

References FunctionalCandidate(), m_gates, m_operands, net, and size.

Referenced by add_all_shifted_operand(), and add_selected_shifted_operand().

◆ add_selected_shifted_operand()

Result< std::vector< FunctionalCandidate > > hal::module_identification::FunctionalCandidate::add_selected_shifted_operand ( CandidateContext ctx,
const FunctionalCandidate candidate 
)
static

Add shifted operands to the functional candidate based on its input output stats.

Parameters
[in]ctx- The candidate context.
[in]candidate- The functional candidate.
Returns
OK() and a vector of functional candidates on success, an error otherwise.

Definition at line 1920 of file create_functional_candidates.cpp.

References add_n_shifted_operands(), ERR_APPEND, hal::module_identification::CandidateContext::get_variable_nets(), index, hal::utils::join(), m_control_mapping, m_operands, m_output_nets, OK, and UNUSED.

Referenced by create_candidates().

◆ add_single_input_signals()

Result< std::vector< FunctionalCandidate > > hal::module_identification::FunctionalCandidate::add_single_input_signals ( CandidateContext ctx,
const FunctionalCandidate candidate 
)
static

Add single input signals for an adder, subtractor, or counter.

Parameters
[in]ctx- The candidate context.
[in]candidate- The functional candidate.
Returns
OK() and a vector of functional candidates on success, an error otherwise.

Definition at line 1399 of file create_functional_candidates.cpp.

References hal::module_identification::absolute, m_output_nets, m_permuted_single_pairs, OK, and UNUSED.

Referenced by create_candidates().

◆ build_input_operand()

Result< std::vector< FunctionalCandidate > > hal::module_identification::FunctionalCandidate::build_input_operand ( CandidateContext ctx,
const FunctionalCandidate candidate 
)
static

Build an input operand for a functional candidate by including all external input signals of the candidate gates.

Parameters
[in]ctx- The candidate context.
[in]candidate- The functional candidate.
Returns
OK() and a vector of functional candidates on success, an error otherwise.

Definition at line 1856 of file create_functional_candidates.cpp.

References m_input_nets, m_operands, OK, and UNUSED.

Referenced by create_candidates().

◆ build_input_operands()

Result< std::vector< FunctionalCandidate > > hal::module_identification::FunctionalCandidate::build_input_operands ( CandidateContext ctx,
const FunctionalCandidate candidate 
)
static

Build input operands for an adder, subtractor, or counter.

Parameters
[in]ctx- The candidate context.
[in]candidate- The functional candidate.
Returns
OK() and a vector of functional candidates on success, an error otherwise.

Definition at line 1055 of file create_functional_candidates.cpp.

References hal::module_identification::absolute, hal::module_identification::addition, hal::module_identification::addition_offset, hal::module_identification::constant_multiplication, hal::module_identification::constant_multiplication_offset, hal::module_identification::counter, FunctionalCandidate(), m_candidate_type, m_gates, m_influence_count_to_input_nets, m_input_count_to_output_nets, m_max_operands, m_permuted_single_pairs, net, OK, and UNUSED.

Referenced by create_candidates().

◆ check()

Result< VerifiedCandidate > hal::module_identification::FunctionalCandidate::check ( const std::vector< BooleanFunction > &  output_functions,
const std::vector< std::vector< Gate * >> &  registers 
)

Check whether a functional candidate with the given input operands and output functions is actually implementing the function specified by its type.

Parameters
[in]output_functions- The output functions.
[in]registers- The cache of gate vectors. This is used to reoder operands for commutative opreations like addition.
Returns
OK() and a verified candidate on success, an error otherwise.

Definition at line 1392 of file verifying_candidates.cpp.

References hal::module_identification::check_absolute(), hal::module_identification::check_add_sub(), hal::module_identification::check_constant_multiplication(), hal::module_identification::check_constant_multiplication_offset(), hal::module_identification::check_counter(), hal::module_identification::check_equal(), hal::module_identification::check_leq(), hal::module_identification::check_value_check(), hal::enum_to_string(), and ERR.

◆ check_output_size()

Result< std::vector< FunctionalCandidate > > hal::module_identification::FunctionalCandidate::check_output_size ( CandidateContext ctx,
const FunctionalCandidate candidate 
)
static

Check the output size of a functional candidate.

Parameters
[in]ctx- The candidate context.
[in]candidate- The functional candidate.
Returns
OK() and a vector of functional candidates on success, an error otherwise.

Definition at line 1830 of file create_functional_candidates.cpp.

References hal::module_identification::get_output_nets(), m_gates, m_output_nets, OK, and UNUSED.

Referenced by create_candidates().

◆ create_candidates()

Result< std::vector< FunctionalCandidate > > hal::module_identification::FunctionalCandidate::create_candidates ( StructuralCandidate sc,
u32  max_control_signal,
CandidateContext ctx,
module_identification::CandidateType  candidate_type,
const std::vector< std::vector< Gate * >> &  registers 
)
static

Create functional candidates from a structural candidate.

Parameters
[in]sc- A pointer to the structural candidate.
[in]max_control_signal- The maximum number of control signals.
[in]ctx- The candidate context.
[in]candidate_type- The type of the candidates to create.
[in]registers- The cache of gate vectors.
Returns
OK() and a vector of functional candidates on success, an error otherwise.

Definition at line 2089 of file create_functional_candidates.cpp.

References hal::module_identification::absolute, add_all_shifted_operand(), add_selected_shifted_operand(), add_single_input_signals(), hal::module_identification::addition, hal::module_identification::addition_offset, build_input_operand(), build_input_operands(), check_output_size(), hal::module_identification::constant_multiplication, hal::module_identification::constant_multiplication_offset, hal::module_identification::counter, create_input_extension_variants(), create_operand_control_variations(), create_output_net_variant(), create_sign_bit_variants(), create_sign_extension_variants(), discard_equal_candidate(), early_abort(), hal::enum_to_string(), hal::module_identification::equal, ERR, ERR_APPEND, find_control_signals(), FunctionalCandidate(), identify_control_signals(), hal::module_identification::less_equal, hal::module_identification::StructuralCandidate::m_gates, OK, order_input_operands(), order_output_signals(), permute_single_input_signals(), realize_control_signals(), hal::module_identification::reorder_commutative_operands(), trim_to_single_output_net(), UNUSED, update_input_output_stats(), and hal::module_identification::value_check.

Referenced by hal::module_identification::generate_functional_candidates().

◆ create_input_extension_variants()

Result< std::vector< FunctionalCandidate > > hal::module_identification::FunctionalCandidate::create_input_extension_variants ( CandidateContext ctx,
const FunctionalCandidate candidate 
)
static

Create input extension variants for an adder, subtractor, or counter.

Parameters
[in]ctx- The candidate context.
[in]candidate- The functional candidate.
Returns
OK() and a vector of functional candidates on success, an error otherwise.

Definition at line 1697 of file create_functional_candidates.cpp.

References hal::module_identification::constant_multiplication, hal::module_identification::constant_multiplication_offset, FunctionalCandidate(), m_candidate_type, hal::module_identification::CandidateContext::m_netlist, m_operands, m_output_nets, OK, and UNUSED.

Referenced by create_candidates().

◆ create_operand_control_variations()

Result< std::vector< FunctionalCandidate > > hal::module_identification::FunctionalCandidate::create_operand_control_variations ( CandidateContext ctx,
const FunctionalCandidate candidate 
)
static

Create operand control variations for absolute functional candidates.

Parameters
[in]ctx- The candidate context.
[in]candidate- The functional candidate.
Returns
OK() and a vector of functional candidates on success, an error otherwise.

Definition at line 627 of file create_functional_candidates.cpp.

References FunctionalCandidate(), m_control_signals, OK, hal::gate_library_manager::remove(), and UNUSED.

Referenced by create_candidates().

◆ create_output_net_variant()

Result< std::vector< FunctionalCandidate > > hal::module_identification::FunctionalCandidate::create_output_net_variant ( CandidateContext ctx,
const FunctionalCandidate candidate 
)
static

Create output net variants for an adder, subtractor, or counter.

Parameters
[in]ctx- The candidate context.
[in]candidate- The functional candidate.
Returns
OK() and a vector of functional candidates on success, an error otherwise.

Definition at line 1805 of file create_functional_candidates.cpp.

References FunctionalCandidate(), hal::module_identification::get_output_nets(), m_gates, m_output_nets, OK, and UNUSED.

Referenced by create_candidates().

◆ create_sign_bit_variants()

Result< std::vector< FunctionalCandidate > > hal::module_identification::FunctionalCandidate::create_sign_bit_variants ( CandidateContext ctx,
const FunctionalCandidate candidate 
)
static

Create sign bit variants for an adder, subtractor, or counter.

Parameters
[in]ctx- The candidate context.
[in]candidate- The functional candidate.
Returns
OK() and a vector of functional candidates on success, an error otherwise.

Definition at line 1640 of file create_functional_candidates.cpp.

References FunctionalCandidate(), m_operands, OK, and UNUSED.

Referenced by create_candidates().

◆ create_sign_extension_variants()

Result< std::vector< FunctionalCandidate > > hal::module_identification::FunctionalCandidate::create_sign_extension_variants ( CandidateContext ctx,
const FunctionalCandidate candidate 
)
static

Create sign extension variants of a functional candidate.

Parameters
[in]ctx- The candidate context.
[in]candidate- The functional candidate.
Returns
OK() and a vector of functional candidates on success, an error otherwise.

Definition at line 144 of file create_functional_candidates.cpp.

References ERR_APPEND, FunctionalCandidate(), hal::module_identification::CandidateContext::get_boolean_influence(), hal::BooleanFunctionNetDecorator::get_net_from(), m_control_mapping, m_gates, m_output_nets, and OK.

Referenced by create_candidates().

◆ discard_equal_candidate()

Result< std::vector< FunctionalCandidate > > hal::module_identification::FunctionalCandidate::discard_equal_candidate ( CandidateContext ctx,
const FunctionalCandidate candidate 
)
static

Discard equal candidates based on their number of input signals.

Parameters
[in]ctx- The candidate context.
[in]candidate- The functional candidate.
Returns
OK() and a vector of functional candidates on success, an error otherwise.

Definition at line 88 of file create_functional_candidates.cpp.

References ERR_APPEND, FunctionalCandidate(), hal::module_identification::CandidateContext::get_variable_names(), m_control_mapping, m_output_nets, and OK.

Referenced by create_candidates().

◆ early_abort()

Result< std::vector< FunctionalCandidate > > hal::module_identification::FunctionalCandidate::early_abort ( CandidateContext ctx,
const FunctionalCandidate candidate 
)
static

Early abort process for a functional candidate.

Parameters
[in]ctx- The candidate context.
[in]candidate- The functional candidate.
Returns
OK() and a vector of functional candidates on success, an error otherwise.

Definition at line 1421 of file create_functional_candidates.cpp.

References hal::module_identification::absolute, hal::module_identification::addition, hal::module_identification::constant_multiplication, hal::module_identification::counter, ERR_APPEND, hal::module_identification::CandidateContext::evaluate(), hal::BooleanFunctionNetDecorator::get_boolean_variable_name(), m_candidate_type, m_control_mapping, m_control_signals, m_input_nets, m_output_nets, and OK.

Referenced by create_candidates().

◆ find_control_signals()

Result< std::vector< FunctionalCandidate > > hal::module_identification::FunctionalCandidate::find_control_signals ( CandidateContext ctx,
const FunctionalCandidate candidate 
)
static

Find control signals for a functional candidate.

Parameters
[in]ctx- The candidate context.
[in]candidate- The functional candidate.
Returns
OK() and a vector of functional candidates on success, an error otherwise.

Definition at line 105 of file create_functional_candidates.cpp.

References ERR_APPEND, FunctionalCandidate(), hal::module_identification::CandidateContext::get_boolean_influence(), hal::BooleanFunctionNetDecorator::get_net_from(), m_control_mapping, m_control_signals, m_gates, m_max_control_signals, m_output_nets, and OK.

Referenced by create_candidates().

◆ get_all_additional_data()

std::map< std::string, std::string > hal::module_identification::FunctionalCandidate::get_all_additional_data ( ) const

Get all additional data of the functional candidate.

Returns
A map containing all additional data.

Definition at line 56 of file functional_candidate.cpp.

References m_additional_data.

◆ get_candidate_info()

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

Get candidate information as a string.

Returns
A string containing the candidate information.

Definition at line 61 of file functional_candidate.cpp.

References hal::enum_to_string(), hal::utils::join(), m_candidate_type, m_control_mapping, m_control_signals, m_operands, m_output_nets, and net.

◆ identify_control_signals()

Result< std::vector< FunctionalCandidate > > hal::module_identification::FunctionalCandidate::identify_control_signals ( CandidateContext ctx,
const FunctionalCandidate candidate 
)
static

Identify control signals for an adder, subtractor, or counter.

Parameters
[in]ctx- The candidate context.
[in]candidate- The functional candidate.
Returns
OK() and a vector of functional candidates on success, an error otherwise.

Definition at line 470 of file create_functional_candidates.cpp.

References hal::module_identification::absolute, hal::module_identification::counter, FunctionalCandidate(), log_error, log_warning, m_candidate_type, m_influence_count_to_input_nets, m_max_control_signals, m_max_operands, OK, hal::utils::split(), and UNUSED.

Referenced by create_candidates().

◆ order_input_operands()

Result< std::vector< FunctionalCandidate > > hal::module_identification::FunctionalCandidate::order_input_operands ( CandidateContext ctx,
const FunctionalCandidate candidate 
)
static

Order input operands for a functional candidate.

Parameters
[in]ctx- The candidate context.
[in]candidate- The functional candidate.
Returns
OK() and a vector of functional candidates on success, an error otherwise.

Definition at line 229 of file create_functional_candidates.cpp.

References ERR_APPEND, FunctionalCandidate(), hal::module_identification::CandidateContext::get_boolean_function(), hal::module_identification::CandidateContext::get_variable_nets(), hal::module_identification::has_constant_value(), m_control_mapping, m_operands, m_output_nets, m_sign_nets, net, and OK.

Referenced by create_candidates().

◆ order_output_signals()

Result< std::vector< FunctionalCandidate > > hal::module_identification::FunctionalCandidate::order_output_signals ( CandidateContext ctx,
const FunctionalCandidate candidate 
)
static

Order output signals for an adder, subtractor, or counter.

Parameters
[in]ctx- The candidate context.
[in]candidate- The functional candidate.
Returns
OK() and a vector of functional candidates on success, an error otherwise.

Definition at line 1374 of file create_functional_candidates.cpp.

References FunctionalCandidate(), m_control_mapping, OK, and UNUSED.

Referenced by create_candidates().

◆ permute_single_input_signals()

Result< std::vector< FunctionalCandidate > > hal::module_identification::FunctionalCandidate::permute_single_input_signals ( CandidateContext ctx,
const FunctionalCandidate candidate 
)
static

Permute single input signals for an adder, subtractor, or counter.

Parameters
[in]ctx- The candidate context.
[in]candidate- The functional candidate.
Returns
OK() and a vector of functional candidates on success, an error otherwise.

Definition at line 1031 of file create_functional_candidates.cpp.

References FunctionalCandidate(), m_single_input_to_output, OK, and UNUSED.

Referenced by create_candidates().

◆ realize_control_signals()

Result< std::vector< FunctionalCandidate > > hal::module_identification::FunctionalCandidate::realize_control_signals ( CandidateContext ctx,
const FunctionalCandidate candidate 
)
static

Realize control signals for an adder, subtractor, or counter by setting the control signals to concrete values.

Parameters
[in]ctx- The candidate context.
[in]candidate- The functional candidate.
Returns
OK() and a vector of functional candidates on success, an error otherwise.

Definition at line 644 of file create_functional_candidates.cpp.

References hal::module_identification::candidate_type_max_operands, FunctionalCandidate(), m_control_signals, OK, and UNUSED.

Referenced by create_candidates().

◆ trim_to_single_output_net()

Result< std::vector< FunctionalCandidate > > hal::module_identification::FunctionalCandidate::trim_to_single_output_net ( CandidateContext ctx,
const FunctionalCandidate candidate 
)
static

Trim a functional candidate to a single output net.

Parameters
[in]ctx- The candidate context.
[in]candidate- The functional candidate.
Returns
OK() and a vector of functional candidates on success, an error otherwise.

Definition at line 70 of file create_functional_candidates.cpp.

References FunctionalCandidate(), m_gates, m_output_nets, OK, and UNUSED.

Referenced by create_candidates().

◆ update_input_output_stats()

Result< std::vector< FunctionalCandidate > > hal::module_identification::FunctionalCandidate::update_input_output_stats ( CandidateContext ctx,
const FunctionalCandidate candidate 
)
static

Update input and output statistics for an adder, subtractor, or counter.

Parameters
[in]ctx- The candidate context.
[in]candidate- The functional candidate.
Returns
OK() and a vector of functional candidates on success, an error otherwise.

Definition at line 899 of file create_functional_candidates.cpp.

References hal::module_identification::absolute, hal::module_identification::addition, hal::module_identification::addition_offset, hal::module_identification::constant_multiplication, hal::module_identification::constant_multiplication_offset, hal::module_identification::counter, ERR_APPEND, FunctionalCandidate(), hal::module_identification::CandidateContext::get_variable_nets(), m_candidate_type, m_control_mapping, m_ctrl_to_operand_net, m_output_nets, and OK.

Referenced by create_candidates().

Member Data Documentation

◆ m_additional_data

std::map<std::string, std::string> hal::module_identification::FunctionalCandidate::m_additional_data = {}

Additional data for the candidate.

Definition at line 394 of file functional_candidate.h.

Referenced by add_additional_data(), FunctionalCandidate(), and get_all_additional_data().

◆ m_base_gates

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

Base gates of the candidate.

Definition at line 329 of file functional_candidate.h.

Referenced by FunctionalCandidate().

◆ m_candidate_type

module_identification::CandidateType hal::module_identification::FunctionalCandidate::m_candidate_type

◆ m_control_mapping

◆ m_control_signals

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

◆ m_ctrl_to_operand_net

Net* hal::module_identification::FunctionalCandidate::m_ctrl_to_operand_net

Special case for absolute candidates where one of the control values also applies to the operand.

Definition at line 399 of file functional_candidate.h.

Referenced by FunctionalCandidate(), and update_input_output_stats().

◆ m_gates

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

◆ m_influence_count_to_input_nets

std::map<u32, std::vector<Net*> > hal::module_identification::FunctionalCandidate::m_influence_count_to_input_nets

Mapping the count of influenced output nets to the list of input nets that influence this many outputs.

Definition at line 354 of file functional_candidate.h.

Referenced by build_input_operands(), FunctionalCandidate(), and identify_control_signals().

◆ m_input_count_to_output_nets

std::map<u32, std::vector<Net*> > hal::module_identification::FunctionalCandidate::m_input_count_to_output_nets

Mapping of input count to a list of output nets that are influenced by that many inputs.

Definition at line 359 of file functional_candidate.h.

Referenced by build_input_operands(), and FunctionalCandidate().

◆ m_input_nets

std::vector<Net*> hal::module_identification::FunctionalCandidate::m_input_nets

Input nets of the candidate.

Definition at line 374 of file functional_candidate.h.

Referenced by build_input_operand(), hal::module_identification::check_equal(), early_abort(), and FunctionalCandidate().

◆ m_max_control_signals

u32 hal::module_identification::FunctionalCandidate::m_max_control_signals

Maximum number of control signals.

Definition at line 384 of file functional_candidate.h.

Referenced by find_control_signals(), FunctionalCandidate(), and identify_control_signals().

◆ m_max_operands

u32 hal::module_identification::FunctionalCandidate::m_max_operands

Maximum number of operands.

Definition at line 389 of file functional_candidate.h.

Referenced by build_input_operands(), FunctionalCandidate(), and identify_control_signals().

◆ m_operands

◆ m_output_nets

◆ m_permuted_single_pairs

std::vector<std::pair<Net*, Net*> > hal::module_identification::FunctionalCandidate::m_permuted_single_pairs

Permuted single input-output pairs.

Definition at line 369 of file functional_candidate.h.

Referenced by add_single_input_signals(), build_input_operands(), and FunctionalCandidate().

◆ m_sign_nets

std::vector<Net*> hal::module_identification::FunctionalCandidate::m_sign_nets

Sign nets for the candidate.

Definition at line 404 of file functional_candidate.h.

Referenced by FunctionalCandidate(), and order_input_operands().

◆ m_single_input_to_output

std::map<Net*, Net*> hal::module_identification::FunctionalCandidate::m_single_input_to_output

Mapping input nets that influence a output, that is not influenced by any other input

Definition at line 364 of file functional_candidate.h.

Referenced by FunctionalCandidate(), and permute_single_input_signals().

◆ m_structural_candidate

StructuralCandidate* hal::module_identification::FunctionalCandidate::m_structural_candidate

Pointer to the parent structural candidate.

Definition at line 334 of file functional_candidate.h.

Referenced by FunctionalCandidate().

◆ m_timings


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