PandA-2024.02
|
Class managing the register binding. More...
#include <reg_binding.hpp>
Public Types | |
using | type_t = enum { STG=0, CDFG } |
Public Member Functions | |
reg_binding (const hlsRef &HLS, const HLS_managerRef HLSMgr_) | |
Constructor. More... | |
~reg_binding () override | |
Destructor. More... | |
void | bind (unsigned int sv, unsigned int index) |
virtual std::string | GetRegisterFUName (unsigned int i) |
return the name of register to be used More... | |
unsigned int | get_used_regs () const |
returns number of used register More... | |
void | set_used_regs (unsigned int regs) |
sets number of used register More... | |
unsigned int | get_register (unsigned int sv) const |
return the register index where the storage value is stored More... | |
bool | is_all_regs_without_enable () |
return true when all registers are without write enable: pipelining comes for free More... | |
void | print_el (const_iterator &it) const override |
Function that print the register binding associated with a storage value. More... | |
generic_objRef | get (const unsigned int &r) const |
Returns reference to register object associated to a given index. More... | |
const register_obj & | operator[] (unsigned int v) |
redefinition of the [] operator More... | |
virtual void | add_to_SM (structural_objectRef clock_port, structural_objectRef reset_port) |
Add the resulting registers to the structural description of the datapath. More... | |
unsigned long long | get_bitsize (unsigned int r) const |
return bitsize More... | |
Public Member Functions inherited from variable2obj< generic_objRef > | |
variable2obj ()=default | |
Constructor. More... | |
virtual | ~variable2obj ()=default |
Destructor. More... | |
virtual void | print_el (typename variable2obj< generic_objRef >::const_iterator &it) const=0 |
Function that print the information associated with a variable. More... | |
virtual void | print () const |
Function that prints the class variable2obj. More... | |
const generic_objRef | operator() (const unsigned int &__k) const |
void | resize (Iterator left, Iterator right, int val) |
Static Public Member Functions | |
static reg_bindingRef | create_reg_binding (const hlsRef &HLS, const HLS_managerRef HLSMgr_) |
Protected Member Functions | |
void | compute_is_without_enable () |
compute the is with out enable relation More... | |
virtual void | specialise_reg (structural_objectRef ®, unsigned int r) |
Specialise a register according to the type of the variables crossing it. More... | |
Protected Attributes | |
int | debug |
level of the verbosity during the debugging More... | |
unsigned int | used_regs |
number of used register More... | |
std::map< unsigned int, generic_objRef > | unique_table |
map between register index and object More... | |
std::map< unsigned int, generic_objRef > | stall_reg_table |
map between std register index and stall register object for pipelines More... | |
std::map< unsigned int, unsigned int > | reverse_map |
bind the storage value with the register instance More... | |
std::map< unsigned int, unsigned long long > | bitsize_map |
relation between registers and their bitsize More... | |
hlsRef | HLS |
HLS data-structure. More... | |
const HLS_managerRef | HLSMgr |
information about all the HLS synthesis More... | |
std::map< unsigned int, CustomOrderedSet< unsigned int > > | reg2storage_values |
map between the register and the associated storage value More... | |
CustomOrderedSet< unsigned int > | is_without_enable |
store the set of register without enable More... | |
bool | all_regs_without_enable |
when true all registers do not require write enable: pipelining comes for free More... | |
const FunctionBehaviorConstRef | FB |
Static Protected Attributes | |
static std::string | reset_type |
Private Member Functions | |
CustomOrderedSet< unsigned int > | get_vars (const unsigned int &r) const |
Returns the set of variable associated with the register. More... | |
unsigned long long | compute_bitsize (unsigned int r) |
return and set the bitsize associated with given register More... | |
Friends | |
class | reg_binding_creator |
Class managing the register binding.
Store the register binding, that is, the mapping of operations in the behavioral description into the set of selected register elements.
Definition at line 70 of file reg_binding.hpp.
using reg_binding::type_t = enum { STG = 0, CDFG } |
Definition at line 75 of file reg_binding.hpp.
reg_binding::reg_binding | ( | const hlsRef & | HLS, |
const HLS_managerRef | HLSMgr_ | ||
) |
Constructor.
Definition at line 69 of file reg_binding.cpp.
References HLSMgr, reset_type, and ~reg_binding().
Referenced by create_reg_binding().
|
overridedefault |
|
virtual |
Add the resulting registers to the structural description of the datapath.
define boolean type for command signals
Definition at line 285 of file reg_binding.cpp.
References all_regs_without_enable, CLOCK_PORT_NAME, compute_is_without_enable(), hls::datapath, debug, DEBUG_LEVEL_VERY_PEDANTIC, FB, get_bitsize(), structural_manager::get_circ(), generic_obj::get_string(), get_used_regs(), GetRegisterFUName(), HLS, hls::HLS_D, INDENT_OUT_MEX, is_without_enable, hls::output_level, OUTPUT_LEVEL_MINIMUM, port_o_K, PRINT_DBG_MEX, RESET_PORT_NAME, generic_obj::set_structural_obj(), specialise_reg(), stall_reg_table, STR, THROW_ASSERT, and U.
Referenced by get(), and classic_datapath::InternalExec().
void reg_binding::bind | ( | unsigned int | sv, |
unsigned int | index | ||
) |
Definition at line 243 of file reg_binding.cpp.
References hls::functionId, liveness::get_live_in(), StorageValueInformation::get_storage_value_index(), liveness::get_support(), StateTransitionGraphManager::GetStg(), HLS, HLSMgr, index, insert(), reg2storage_values, reverse_map, hls::Rliv, stall_reg_table, hls::STG, hls::storage_value_information, unique_table, and used_regs.
Referenced by vertex_coloring_register::RegisterBinding(), unique_binding_register::RegisterBinding(), chordal_coloring_register::RegisterBinding(), and weighted_clique_register::RegisterBinding().
|
private |
return and set the bitsize associated with given register
r | is the register |
Definition at line 135 of file reg_binding.cpp.
References bitsize_map, hls::debug_level, DEBUG_LEVEL_VERY_PEDANTIC, FB, get_vars(), HLS, PRINT_DBG_MEX, STD_GET_SIZE, and STR.
Referenced by get(), and specialise_reg().
|
protected |
compute the is with out enable relation
Definition at line 185 of file reg_binding.cpp.
References liveness::get_live_in(), liveness::get_live_out(), liveness::get_support(), get_used_regs(), get_vars(), HLS, liveness::is_a_dummy_state(), is_without_enable, hls::Rliv, and U.
Referenced by add_to_SM().
|
static |
Definition at line 85 of file reg_binding.cpp.
References hls::functionId, hls::Param, and reg_binding().
Referenced by weighted_clique_register::Initialize(), and weighted_clique_register::RegisterBinding().
|
inline |
Returns reference to register object associated to a given index.
r | is the register index |
Definition at line 196 of file reg_binding.hpp.
References add_to_SM(), compute_bitsize(), get_bitsize(), get_vars(), and operator[]().
Referenced by mux_connection_binding::connect_to_registers(), mux_connection_binding::create_connections(), and fsm_controller::create_state_machine().
unsigned long long reg_binding::get_bitsize | ( | unsigned int | r | ) | const |
return bitsize
Definition at line 152 of file reg_binding.cpp.
References bitsize_map, and THROW_ASSERT.
Referenced by add_to_SM(), and get().
|
inline |
return the register index where the storage value is stored
sv | is the storage value |
Definition at line 175 of file reg_binding.hpp.
Referenced by mux_connection_binding::connect_to_registers(), mux_connection_binding::create_connections(), fsm_controller::create_state_machine(), estimate_muxes(), and port_swapping::InternalExec().
|
inline |
returns number of used register
Definition at line 156 of file reg_binding.hpp.
References used_regs.
Referenced by add_to_SM(), compute_is_without_enable(), mux_connection_binding::create_connections(), and fsm_controller::create_state_machine().
|
private |
Returns the set of variable associated with the register.
r | is the register |
Definition at line 122 of file reg_binding.cpp.
References StorageValueInformation::get_variable_index(), HLS, reg2storage_values, hls::storage_value_information, and THROW_ASSERT.
Referenced by compute_bitsize(), compute_is_without_enable(), and get().
|
virtual |
return the name of register to be used
i | is the id of the register |
Reimplemented in reg_binding_cs.
Definition at line 366 of file reg_binding.cpp.
References FB, is_without_enable, register_SARSE, register_SE, register_SRSE, register_STD, and reset_type.
Referenced by add_to_SM().
|
inline |
return true when all registers are without write enable: pipelining comes for free
Definition at line 181 of file reg_binding.hpp.
References all_regs_without_enable, and print_el().
Referenced by fu_binding::add_to_SM().
const register_obj & reg_binding::operator[] | ( | unsigned int | v | ) |
redefinition of the [] operator
Definition at line 279 of file reg_binding.cpp.
References THROW_ASSERT.
Referenced by get().
|
override |
Function that print the register binding associated with a storage value.
Definition at line 113 of file reg_binding.cpp.
References FB, StorageValueInformation::get_variable_index(), HLS, INDENT_OUT_MEX, hls::output_level, OUTPUT_LEVEL_VERY_PEDANTIC, hls::storage_value_information, and STR.
Referenced by is_all_regs_without_enable().
|
inline |
sets number of used register
regs | is new number of used register |
Definition at line 165 of file reg_binding.hpp.
Referenced by vertex_coloring_register::RegisterBinding(), unique_binding_register::RegisterBinding(), chordal_coloring_register::RegisterBinding(), and weighted_clique_register::RegisterBinding().
|
protectedvirtual |
Specialise a register according to the type of the variables crossing it.
reg | is the register |
r | is the id of the register |
Reimplemented in reg_binding_cs.
Definition at line 158 of file reg_binding.cpp.
References CLOCK_PORT_NAME, compute_bitsize(), hls::debug_level, DEBUG_LEVEL_VERY_PEDANTIC, structural_object::get_path(), HLS, max, offset, PRINT_DBG_MEX, RESET_PORT_NAME, STD_GET_SIZE, STR, and U.
Referenced by add_to_SM(), and reg_binding_cs::specialise_reg().
|
friend |
Definition at line 72 of file reg_binding.hpp.
|
protected |
when true all registers do not require write enable: pipelining comes for free
Definition at line 109 of file reg_binding.hpp.
Referenced by add_to_SM(), and is_all_regs_without_enable().
|
protected |
relation between registers and their bitsize
Definition at line 94 of file reg_binding.hpp.
Referenced by compute_bitsize(), and get_bitsize().
|
protected |
level of the verbosity during the debugging
Definition at line 79 of file reg_binding.hpp.
Referenced by add_to_SM().
|
protected |
Definition at line 111 of file reg_binding.hpp.
Referenced by add_to_SM(), compute_bitsize(), GetRegisterFUName(), and print_el().
|
protected |
HLS data-structure.
Definition at line 97 of file reg_binding.hpp.
Referenced by add_to_SM(), bind(), compute_bitsize(), compute_is_without_enable(), get_vars(), print_el(), reg_binding_cs::specialise_reg(), and specialise_reg().
|
protected |
information about all the HLS synthesis
Definition at line 100 of file reg_binding.hpp.
Referenced by bind(), and reg_binding().
|
protected |
store the set of register without enable
Definition at line 106 of file reg_binding.hpp.
Referenced by add_to_SM(), compute_is_without_enable(), and GetRegisterFUName().
|
protected |
map between the register and the associated storage value
Definition at line 103 of file reg_binding.hpp.
Referenced by bind(), and get_vars().
|
staticprotected |
Definition at line 113 of file reg_binding.hpp.
Referenced by GetRegisterFUName(), and reg_binding().
|
protected |
bind the storage value with the register instance
Definition at line 91 of file reg_binding.hpp.
Referenced by bind().
|
protected |
map between std register index and stall register object for pipelines
Definition at line 88 of file reg_binding.hpp.
Referenced by add_to_SM(), and bind().
|
protected |
map between register index and object
Definition at line 85 of file reg_binding.hpp.
Referenced by bind().
|
protected |
number of used register
Definition at line 82 of file reg_binding.hpp.
Referenced by bind(), and get_used_regs().