HAL
hal::GateTypeComponent Class Referenceabstract

#include <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
}
 

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
 
GateTypeComponentget_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)
 

Static Public Member Functions

static std::unique_ptr< GateTypeComponentcreate_lut_component (std::unique_ptr< GateTypeComponent > component, bool init_ascending)
 
static std::unique_ptr< GateTypeComponentcreate_ff_component (std::unique_ptr< GateTypeComponent > component, const BooleanFunction &next_state_bf, const BooleanFunction &clock_bf)
 
static std::unique_ptr< GateTypeComponentcreate_latch_component (std::unique_ptr< GateTypeComponent > component)
 
static std::unique_ptr< GateTypeComponentcreate_ram_component (std::unique_ptr< GateTypeComponent > component, const u32 bit_size)
 
static std::unique_ptr< GateTypeComponentcreate_mac_component ()
 
static std::unique_ptr< GateTypeComponentcreate_init_component (const std::string &init_category, const std::vector< std::string > &init_identifiers)
 
static std::unique_ptr< GateTypeComponentcreate_state_component (std::unique_ptr< GateTypeComponent > component, const std::string &state_identifier, const std::string &neg_state_identifier)
 
static std::unique_ptr< GateTypeComponentcreate_ram_port_component (std::unique_ptr< GateTypeComponent > component, const std::string &data_group, const std::string &addr_group, const BooleanFunction &clock_bf, const BooleanFunction &enable_bf, bool is_write)
 

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.

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 153 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 167 of file gate_type_component.h.

References hal::T.

◆ create_ff_component()

std::unique_ptr< GateTypeComponent > hal::GateTypeComponent::create_ff_component ( std::unique_ptr< GateTypeComponent component,
const BooleanFunction next_state_bf,
const BooleanFunction clock_bf 
)
static

Create a new FFComponent with given child component and tzhe Boolean functions describing the next state and the clock signal.

Parameters
[in]component- Another component to be added as a child component.
[in]next_state_bf- The function describing the internal state.
[in]clock_bf- The function describing the clock input.
Returns
The FFComponent.

Definition at line 34 of file gate_type_component.cpp.

References hal::BooleanFunction::clone().

Referenced by hal::GateLibraryWizard::setComponents().

◆ create_init_component()

std::unique_ptr< GateTypeComponent > hal::GateTypeComponent::create_init_component ( const std::string &  init_category,
const std::vector< std::string > &  init_identifiers 
)
static

Create a new InitComponent with given child component, the category and a vector of identifiers pointing to the initialization data.

Parameters
[in]init_category- The data category.
[in]init_identifiers- The data identifiers.
Returns
The InitComponent.

Definition at line 60 of file gate_type_component.cpp.

Referenced by hal::GateLibraryWizard::setComponents().

◆ create_latch_component()

std::unique_ptr< GateTypeComponent > hal::GateTypeComponent::create_latch_component ( std::unique_ptr< GateTypeComponent component)
static

Create a new LatchComponent with given child component and the Boolean functions describing the data input and the enable signal.

Parameters
[in]component- Another component to be added as a child component.
Returns
The LatchComponent.

Definition at line 39 of file gate_type_component.cpp.

Referenced by hal::GateLibraryWizard::setComponents().

◆ create_lut_component()

std::unique_ptr< GateTypeComponent > hal::GateTypeComponent::create_lut_component ( std::unique_ptr< GateTypeComponent component,
bool  init_ascending 
)
static

Create a new LUTComponent with given child component and bit-order.

Parameters
[in]component- Another component to be added as a child component.
[in]init_ascending- True if ascending bit-order, false otherwise.
Returns
The LUTComponent.

Definition at line 24 of file gate_type_component.cpp.

Referenced by hal::GateLibraryWizard::setComponents().

◆ create_mac_component()

std::unique_ptr< GateTypeComponent > hal::GateTypeComponent::create_mac_component ( )
static

Create a new MACComponent.

Returns
The MACComponent.

Definition at line 54 of file gate_type_component.cpp.

◆ create_ram_component()

std::unique_ptr< GateTypeComponent > hal::GateTypeComponent::create_ram_component ( std::unique_ptr< GateTypeComponent component,
const u32  bit_size 
)
static

Create a new RAMComponent with given child component.

Parameters
[in]component- Another component to be added as a child component.
[in]bit_size- The size of the RAM in bits.
Returns
The RAMComponent.

Definition at line 44 of file gate_type_component.cpp.

Referenced by hal::GateLibraryWizard::setComponents().

◆ create_ram_port_component()

std::unique_ptr< GateTypeComponent > hal::GateTypeComponent::create_ram_port_component ( std::unique_ptr< GateTypeComponent component,
const std::string &  data_group,
const std::string &  addr_group,
const BooleanFunction clock_bf,
const BooleanFunction enable_bf,
bool  is_write 
)
static

Create a new RAMPortComponent with given child component, the write/read data/address pin groups, and the write/read clock/enable functions.

Parameters
[in]component- Another component to be added as a child component.
[in]data_group- The name of the read or write data pin group.
[in]addr_group- The name of the read or write address pin group.
[in]clock_bf- The read or write clock's Boolean function.
[in]enable_bf- The read or write enable's Boolean function.
[in]is_write- Set true for write port, false for read port.
Returns
The RAMPortComponent.

Definition at line 71 of file gate_type_component.cpp.

References hal::BooleanFunction::clone().

Referenced by hal::GateLibraryWizard::setComponents().

◆ create_state_component()

std::unique_ptr< GateTypeComponent > hal::GateTypeComponent::create_state_component ( std::unique_ptr< GateTypeComponent component,
const std::string &  state_identifier,
const std::string &  neg_state_identifier 
)
static

Create a new StateComponent with given child component and the internal state identifiers.

Parameters
[in]component- Another component to be added as a child component.
[in]state_identifier- The identifier of the internal state.
[in]neg_state_identifier- The identifier of the negated internal state.
Returns
The StateComponent.

Definition at line 66 of file gate_type_component.cpp.

Referenced by hal::GateLibraryWizard::setComponents().

◆ 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 81 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 205 of file gate_type_component.h.

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

Referenced by hal::Gate::add_boolean_function(), hal::Gate::get_init_data(), and hal::Gate::set_init_data().

◆ 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::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: