|
HAL
v4.5.0-251-g305763a14
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
|
#include <hal_core/netlist/gate_library/gate_type_component/lut_component.h>


Classes | |
| struct | LUTOutputConfig |
Public Member Functions | |
| ComponentType | get_type () const override |
| std::vector< GateTypeComponent * > | get_components (const std::function< bool(const GateTypeComponent *)> &filter=nullptr) const override |
| const LUTOutputConfig * | get_output_pin_config (const std::string &pin_name) const |
| const std::unordered_map< std::string, LUTOutputConfig > & | get_output_pin_configs () const |
| Result< std::string > | get_init_string (const Gate *gate, const std::string &pin_name) const |
| Result< std::string > | get_init_string (const Gate *gate, const GatePin *pin) const |
| Result< std::monostate > | set_init_string (Gate *gate, const std::string &pin_name, const std::string &hex) const |
| Result< std::monostate > | set_init_string (Gate *gate, const GatePin *pin, const std::string &hex) const |
Public Member Functions inherited from hal::GateTypeComponent | |
| virtual | ~GateTypeComponent ()=default |
| template<typename T > | |
| T * | convert_to () |
| template<typename T > | |
| const T * | convert_to () const |
| 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< LUTComponent > | create (std::unordered_map< std::string, LUTOutputConfig > configs={}) |
| static bool | is_class_of (const GateTypeComponent *component) |
| static Result< std::string > | extract_init_slice (const std::string &full_hex, u32 bit_offset, u32 bit_count) |
| static Result< std::string > | splice_init_slice (const std::string &full_hex, const std::string &slice_hex, u32 bit_offset, u32 bit_count) |
Additional Inherited Members | |
Public Types inherited from hal::GateTypeComponent | |
| enum class | ComponentType { lut , ff , latch , ram , mac , init , state , ram_port , state_table } |
A gate type component that describes a look-up table, in particular the bit-order of its initialization string.
Definition at line 44 of file lut_component.h.
|
static |
Create a new LUTComponent with the given per-output-pin configurations. Configurations with a bit_count of zero, a non-power-of-two bit_count, or empty input_pins are silently skipped.
| [in] | configs | - Map from output pin name to LUTOutputConfig. |
Definition at line 18 of file lut_component.cpp.
References log_error.
Referenced by hal::GateLibraryWizard::setComponents().
|
static |
Extract a bit slice from a full INIT hex string. Returns the slice as an uppercase hex string padded to (bit_count+3)/4 characters.
| [in] | full_hex | - Full INIT value as a hex string. |
| [in] | bit_offset | - First bit (LSB = 0) of the slice. |
| [in] | bit_count | - Number of bits in the slice; must be non-zero. |
Definition at line 70 of file lut_component.cpp.
Referenced by hal::gate_type_components_init().
|
overridevirtual |
Get the sub-components of the gate type component. A user-defined filter may be applied to the result vector, but is disabled by default.
| [in] | filter | - The user-defined filter function applied to all candidate components. |
Implements hal::GateTypeComponent.
Definition at line 51 of file lut_component.cpp.
| Result< std::string > hal::LUTComponent::get_init_string | ( | const Gate * | gate, |
| const GatePin * | pin | ||
| ) | const |
Get the INIT hex string for a specific LUT output pin on a gate instance.
| [in] | gate | - The gate instance. |
| [in] | pin | - The output pin. |
Definition at line 186 of file lut_component.cpp.
References hal::LUTComponent::LUTOutputConfig::bit_count, hal::LUTComponent::LUTOutputConfig::bit_offset, ERR, hal::BasePin< T >::get_direction(), hal::Gate::get_name(), hal::BasePin< T >::get_name(), hal::BasePin< T >::get_type(), hal::LUTComponent::LUTOutputConfig::init_identifier, and OK.
| Result< std::string > hal::LUTComponent::get_init_string | ( | const Gate * | gate, |
| const std::string & | pin_name | ||
| ) | const |
Get the INIT hex string for a specific LUT output pin on a gate instance. The pin must be of type PinType::lut and have a configured LUTOutputConfig.
| [in] | gate | - The gate instance. |
| [in] | pin_name | - The output pin name. |
Definition at line 172 of file lut_component.cpp.
References ERR, hal::GateType::get_name(), hal::GateType::get_pin_by_name(), and hal::Gate::get_type().
Referenced by hal::resynthesis::decompose_gates_of_type(), hal::resynthesis::resynthesize_gates(), and hal::xilinx_toolbox::split_lut().
| const LUTComponent::LUTOutputConfig * hal::LUTComponent::get_output_pin_config | ( | const std::string & | pin_name | ) | const |
Get the output configuration for a specific pin, or nullptr if none is set.
| [in] | pin_name | - Name of the LUT output pin. |
Definition at line 56 of file lut_component.cpp.
Referenced by hal::Gate::add_boolean_function().
| const std::unordered_map< std::string, LUTComponent::LUTOutputConfig > & hal::LUTComponent::get_output_pin_configs | ( | ) | const |
Get all per-output-pin configurations.
Definition at line 65 of file lut_component.cpp.
Referenced by hal::resynthesis::decompose_gates_of_type(), hal::verilator::converter::get_function_for_lut(), hal::resynthesis::resynthesize_gates(), and hal::LUTWizardPage::setData().
|
overridevirtual |
Get the type of the gate type component.
Implements hal::GateTypeComponent.
Definition at line 41 of file lut_component.cpp.
|
static |
Check whether a component is a LUTComponent.
| [in] | component | - The component to check. |
true if component is a LUTComponent, false otherwise. Definition at line 46 of file lut_component.cpp.
References hal::GateTypeComponent::get_type().
Referenced by hal::gate_type_components_init(), hal::verilator::converter::get_function_for_lut(), hal::LUTWizardPage::setData(), hal::GatelibraryFrameLut::update(), and hal::GatelibraryLutInit::update().
| Result< std::monostate > hal::LUTComponent::set_init_string | ( | Gate * | gate, |
| const GatePin * | pin, | ||
| const std::string & | hex | ||
| ) | const |
Set the INIT hex string for a specific LUT output pin on a gate instance.
| [in] | gate | - The gate instance. |
| [in] | pin | - The output pin. |
| [in] | hex | - Hex string (no prefix, uppercase or lowercase). |
Definition at line 233 of file lut_component.cpp.
References hal::LUTComponent::LUTOutputConfig::bit_count, hal::LUTComponent::LUTOutputConfig::bit_offset, ERR, hal::BasePin< T >::get_direction(), hal::Gate::get_name(), hal::BasePin< T >::get_name(), hal::BasePin< T >::get_type(), hal::LUTComponent::LUTOutputConfig::init_identifier, OK, and hal::DataContainer::set_parameter().
| Result< std::monostate > hal::LUTComponent::set_init_string | ( | Gate * | gate, |
| const std::string & | pin_name, | ||
| const std::string & | hex | ||
| ) | const |
Set the INIT hex string for a specific LUT output pin on a gate instance. The hex string must be exactly (bit_count + 3) / 4 hex digits with no prefix.
| [in] | gate | - The gate instance. |
| [in] | pin_name | - The output pin name. |
| [in] | hex | - Hex string (no prefix, uppercase or lowercase). |
Definition at line 219 of file lut_component.cpp.
References ERR, hal::GateType::get_name(), hal::GateType::get_pin_by_name(), and hal::Gate::get_type().
|
static |
Splice a new slice value into a full INIT hex string at [bit_offset, bit_offset+bit_count). The output preserves the digit width of full_hex; if full_hex is empty the minimum width needed to hold the splice is used.
| [in] | full_hex | - Current full INIT value as a hex string (may be empty). |
| [in] | slice_hex | - New value for the bit slice. |
| [in] | bit_offset | - First bit (LSB = 0) of the slice. |
| [in] | bit_count | - Number of bits in the slice; must be non-zero. |
Definition at line 111 of file lut_component.cpp.
Referenced by hal::gate_type_components_init().