HAL  v4.5.0-258-gf372a0264
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
hal::GateTypeComponent Class Referenceabstract

#include <hal_core/netlist/gate_library/gate_type_component/gate_type_component.h>

Inheritance diagram for hal::GateTypeComponent:
Inheritance graph
Collaboration diagram for hal::GateTypeComponent:
Collaboration graph

Public Types

enum class  ComponentType {
  lut , ff , latch , ram ,
  mac , init , state , ram_port ,
  state_table
}
 

Public Member Functions

virtual ~GateTypeComponent ()=default
 
virtual ComponentType get_type () const =0
 
template<typename T >
T * convert_to ()
 
template<typename T >
const T * convert_to () const
 
virtual std::vector< GateTypeComponent * > get_components (const std::function< bool(const GateTypeComponent *)> &filter=nullptr) const =0
 
GateTypeComponent * get_component (const std::function< bool(const GateTypeComponent *)> &filter=nullptr) const
 
template<typename T >
T * get_component_as (const std::function< bool(const GateTypeComponent *)> &filter=nullptr)
 

Detailed Description

A component defining additional functionality of a gate type.

Definition at line 39 of file gate_type_component.h.

Member Enumeration Documentation

◆ ComponentType

The type of a gate type component.

Enumerator
lut 

LUT component type.

ff 

Flip-flop component type.

latch 

Latch component type.

ram 

RAM component type.

mac 

MAC component type.

init 

Initialization component type.

state 

State component type.

ram_port 

RAM port component type.

state_table 

State table component type.

Definition at line 47 of file gate_type_component.h.

Constructor & Destructor Documentation

◆ ~GateTypeComponent()

virtual hal::GateTypeComponent::~GateTypeComponent ( )
virtualdefault

Member Function Documentation

◆ convert_to() [1/2]

template<typename T >
T* hal::GateTypeComponent::convert_to ( )
inline

Convert the gate type component to a component of the type specified by the template parameter. A check is performed to determine whether the conversion is legal and a nullptr is returned in case it is not.

Returns
The component converted to the target type or a nullptr.

Definition at line 74 of file gate_type_component.h.

References hal::T.

Referenced by get_component_as(), hal::GateType::get_component_as(), and hal::GateLibraryWizard::setComponents().

◆ convert_to() [2/2]

template<typename T >
const T* hal::GateTypeComponent::convert_to ( ) const
inline

Convert the gate type component to a component of the type specified by the template parameter. A check is performed to determine whether the conversion is legal and a nullptr is returned in case it is not.

Returns
The component converted to the target type or a nullptr.

Definition at line 88 of file gate_type_component.h.

References hal::T.

◆ get_component()

GateTypeComponent * hal::GateTypeComponent::get_component ( const std::function< bool(const GateTypeComponent *)> &  filter = nullptr) const

Get a single component matching the filter condition (if provided). Returns a nullptr if (i) the gate type does not contain any components, (ii) multiple components match the filter condition, or (iii) no component matches the filter condition.

Parameters
[in]filter- The filter applied to all candidate components.
Returns
The component or a nullptr.

Definition at line 16 of file gate_type_component.cpp.

References get_components().

Referenced by hal::gate_type_components_init(), and get_component_as().

◆ get_component_as()

template<typename T >
T* hal::GateTypeComponent::get_component_as ( const std::function< bool(const GateTypeComponent *)> &  filter = nullptr)
inline

Get a single sub-component of the gate type component and convert it to a component of the type specified by the template parameter. A user-defined filter may be applied to the result set, but is disabled by default. If more no or than one components match the filter condition, a nullptr is returned. A check is performed to determine whether the conversion is legal and a nullptr is returned in case it is not.

Parameters
[in]filter- The user-defined filter function applied to all candidate components.
Returns
The sub-component of the gate type component converted to the target type or a nullptr.

Definition at line 126 of file gate_type_component.h.

References convert_to(), get_component(), and hal::T.

Referenced by hal::Gate::add_boolean_function(), hal::resynthesis::decompose_gates_of_type(), hal::verilator::converter::get_function_for_ff(), hal::verilator::converter::get_function_for_latch(), hal::verilator::remove_unwanted_parameters_from_netlist(), hal::resynthesis::resynthesize_gates(), and hal::xilinx_toolbox::split_lut().

◆ get_components()

virtual std::vector<GateTypeComponent*> hal::GateTypeComponent::get_components ( const std::function< bool(const GateTypeComponent *)> &  filter = nullptr) const
pure virtual

Get all components matching the filter condition (if provided) as a vector. Returns an empty vector if (i) the gate type does not contain any components or (ii) no component matches the filter condition.

Parameters
[in]filter- The filter applied to all candidate components, disabled by default.
Returns
The components.

Implemented in hal::StateTableComponent, hal::StateComponent, hal::RAMPortComponent, hal::RAMComponent, hal::MACComponent, hal::LUTComponent, hal::LatchComponent, hal::InitComponent, and hal::FFComponent.

Referenced by hal::gate_type_components_init(), and get_component().

◆ get_type()


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