![]() |
HAL
|
#include <gate_type_component.h>
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 |
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) |
Static Public Member Functions | |
static std::unique_ptr< GateTypeComponent > | create_lut_component (std::unique_ptr< GateTypeComponent > component, bool init_ascending) |
static std::unique_ptr< GateTypeComponent > | create_ff_component (std::unique_ptr< GateTypeComponent > component, const BooleanFunction &next_state_bf, const BooleanFunction &clock_bf) |
static std::unique_ptr< GateTypeComponent > | create_latch_component (std::unique_ptr< GateTypeComponent > component) |
static std::unique_ptr< GateTypeComponent > | create_ram_component (std::unique_ptr< GateTypeComponent > component, const u32 bit_size) |
static std::unique_ptr< GateTypeComponent > | create_mac_component () |
static std::unique_ptr< GateTypeComponent > | create_init_component (const std::string &init_category, const std::vector< std::string > &init_identifiers) |
static std::unique_ptr< GateTypeComponent > | create_state_component (std::unique_ptr< GateTypeComponent > component, const std::string &state_identifier, const std::string &neg_state_identifier) |
static std::unique_ptr< 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) |
A component defining additional functionality of a gate type.
Definition at line 39 of file gate_type_component.h.
|
strong |
The type of a gate type component.
Definition at line 47 of file gate_type_component.h.
|
virtualdefault |
|
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.
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().
|
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.
Definition at line 167 of file gate_type_component.h.
References hal::T.
|
static |
Create a new FFComponent with given child component and tzhe Boolean functions describing the next state and the clock signal.
[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. |
Definition at line 34 of file gate_type_component.cpp.
References hal::BooleanFunction::clone().
Referenced by hal::GateLibraryWizard::setComponents().
|
static |
Create a new InitComponent with given child component, the category and a vector of identifiers pointing to the initialization data.
[in] | init_category | - The data category. |
[in] | init_identifiers | - The data identifiers. |
Definition at line 60 of file gate_type_component.cpp.
Referenced by hal::GateLibraryWizard::setComponents().
|
static |
Create a new LatchComponent with given child component and the Boolean functions describing the data input and the enable signal.
[in] | component | - Another component to be added as a child component. |
Definition at line 39 of file gate_type_component.cpp.
Referenced by hal::GateLibraryWizard::setComponents().
|
static |
Create a new LUTComponent with given child component and bit-order.
[in] | component | - Another component to be added as a child component. |
[in] | init_ascending | - True if ascending bit-order, false otherwise. |
Definition at line 24 of file gate_type_component.cpp.
Referenced by hal::GateLibraryWizard::setComponents().
|
static |
Create a new MACComponent.
Definition at line 54 of file gate_type_component.cpp.
|
static |
Create a new RAMComponent with given child component.
[in] | component | - Another component to be added as a child component. |
[in] | bit_size | - The size of the RAM in bits. |
Definition at line 44 of file gate_type_component.cpp.
Referenced by hal::GateLibraryWizard::setComponents().
|
static |
Create a new RAMPortComponent with given child component, the write/read data/address pin groups, and the write/read clock/enable functions.
[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. |
Definition at line 71 of file gate_type_component.cpp.
References hal::BooleanFunction::clone().
Referenced by hal::GateLibraryWizard::setComponents().
|
static |
Create a new StateComponent with given child component and the internal state identifiers.
[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. |
Definition at line 66 of file gate_type_component.cpp.
Referenced by hal::GateLibraryWizard::setComponents().
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.
[in] | filter | - The filter applied to all candidate components. |
Definition at line 81 of file gate_type_component.cpp.
References get_components().
Referenced by hal::gate_type_components_init(), and get_component_as().
|
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.
[in] | filter | - The user-defined filter function applied to all candidate components. |
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().
|
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.
[in] | filter | - The filter applied to all candidate components, disabled by default. |
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().
|
pure virtual |
Get the type of the gate type component.
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(), hal::GateType::has_component_of_type(), hal::FFComponent::is_class_of(), hal::InitComponent::is_class_of(), hal::LatchComponent::is_class_of(), hal::LUTComponent::is_class_of(), hal::MACComponent::is_class_of(), hal::RAMComponent::is_class_of(), hal::RAMPortComponent::is_class_of(), and hal::StateComponent::is_class_of().