PandA-2024.02
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Friends
reg_binding Class Reference

Class managing the register binding. More...

#include <reg_binding.hpp>

Inheritance diagram for reg_binding:
Inheritance graph
[legend]
Collaboration diagram for reg_binding:
Collaboration graph
[legend]

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_objoperator[] (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 &reg, 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_objRefunique_table
 map between register index and object More...
 
std::map< unsigned int, generic_objRefstall_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
 

Detailed Description

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.

Member Typedef Documentation

◆ type_t

using reg_binding::type_t = enum { STG = 0, CDFG }

Definition at line 75 of file reg_binding.hpp.

Constructor & Destructor Documentation

◆ reg_binding()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~reg_binding()

reg_binding::~reg_binding ( )
overridedefault

Destructor.

Referenced by reg_binding().

Here is the caller graph for this function:

Member Function Documentation

◆ add_to_SM()

void reg_binding::add_to_SM ( structural_objectRef  clock_port,
structural_objectRef  reset_port 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bind()

void reg_binding::bind ( unsigned int  sv,
unsigned int  index 
)

◆ compute_bitsize()

unsigned long long reg_binding::compute_bitsize ( unsigned int  r)
private

return and set the bitsize associated with given register

Parameters
ris the register
Returns
the bitsize of register r

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ compute_is_without_enable()

void reg_binding::compute_is_without_enable ( )
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_reg_binding()

reg_bindingRef reg_binding::create_reg_binding ( const hlsRef HLS,
const HLS_managerRef  HLSMgr_ 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get()

generic_objRef reg_binding::get ( const unsigned int &  r) const
inline

Returns reference to register object associated to a given index.

Parameters
ris the register index
Returns
the associated reference

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_bitsize()

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().

Here is the caller graph for this function:

◆ get_register()

unsigned int reg_binding::get_register ( unsigned int  sv) const
inline

return the register index where the storage value is stored

Parameters
svis the storage value
Returns
the index of the register assigned to 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().

Here is the caller graph for this function:

◆ get_used_regs()

unsigned int reg_binding::get_used_regs ( ) const
inline

returns number of used register

Returns
the 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().

Here is the caller graph for this function:

◆ get_vars()

CustomOrderedSet< unsigned int > reg_binding::get_vars ( const unsigned int &  r) const
private

Returns the set of variable associated with the register.

Parameters
ris the register
Returns
the set of associated variables

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetRegisterFUName()

std::string reg_binding::GetRegisterFUName ( unsigned int  i)
virtual

return the name of register to be used

Parameters
iis the id of the register
Returns
std::string The FU name for the given 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().

Here is the caller graph for this function:

◆ is_all_regs_without_enable()

bool reg_binding::is_all_regs_without_enable ( )
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator[]()

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().

Here is the caller graph for this function:

◆ print_el()

void reg_binding::print_el ( const_iterator &  it) const
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_used_regs()

void reg_binding::set_used_regs ( unsigned int  regs)
inline

sets number of used register

Parameters
regsis 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().

Here is the caller graph for this function:

◆ specialise_reg()

void reg_binding::specialise_reg ( structural_objectRef reg,
unsigned int  r 
)
protectedvirtual

Specialise a register according to the type of the variables crossing it.

Parameters
regis the register
ris 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().

Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ reg_binding_creator

friend class reg_binding_creator
friend

Definition at line 72 of file reg_binding.hpp.

Field Documentation

◆ all_regs_without_enable

bool reg_binding::all_regs_without_enable
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().

◆ bitsize_map

std::map<unsigned int, unsigned long long> reg_binding::bitsize_map
protected

relation between registers and their bitsize

Definition at line 94 of file reg_binding.hpp.

Referenced by compute_bitsize(), and get_bitsize().

◆ debug

int reg_binding::debug
protected

level of the verbosity during the debugging

Definition at line 79 of file reg_binding.hpp.

Referenced by add_to_SM().

◆ FB

const FunctionBehaviorConstRef reg_binding::FB
protected

Definition at line 111 of file reg_binding.hpp.

Referenced by add_to_SM(), compute_bitsize(), GetRegisterFUName(), and print_el().

◆ HLS

hlsRef reg_binding::HLS
protected

◆ HLSMgr

const HLS_managerRef reg_binding::HLSMgr
protected

information about all the HLS synthesis

Definition at line 100 of file reg_binding.hpp.

Referenced by bind(), and reg_binding().

◆ is_without_enable

CustomOrderedSet<unsigned int> reg_binding::is_without_enable
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().

◆ reg2storage_values

std::map<unsigned int, CustomOrderedSet<unsigned int> > reg_binding::reg2storage_values
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().

◆ reset_type

std::string reg_binding::reset_type
staticprotected

Definition at line 113 of file reg_binding.hpp.

Referenced by GetRegisterFUName(), and reg_binding().

◆ reverse_map

std::map<unsigned int, unsigned int> reg_binding::reverse_map
protected

bind the storage value with the register instance

Definition at line 91 of file reg_binding.hpp.

Referenced by bind().

◆ stall_reg_table

std::map<unsigned int, generic_objRef> reg_binding::stall_reg_table
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().

◆ unique_table

std::map<unsigned int, generic_objRef> reg_binding::unique_table
protected

map between register index and object

Definition at line 85 of file reg_binding.hpp.

Referenced by bind().

◆ used_regs

unsigned int reg_binding::used_regs
protected

number of used register

Definition at line 82 of file reg_binding.hpp.

Referenced by bind(), and get_used_regs().


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

Generated on Mon Feb 12 2024 13:04:02 for PandA-2024.02 by doxygen 1.8.13