PandA-2024.02
|
#include <memory.hpp>
Public Member Functions | |
memory (const tree_managerConstRef TreeM, unsigned long long int off_base_address, unsigned int max_bram, bool null_pointer_check, bool initial_internal_address_p, unsigned long long initial_internal_address, const unsigned int &_bus_addr_bitsize) | |
Constructor. More... | |
virtual | ~memory () |
Destructor. More... | |
std::map< unsigned int, memory_symbolRef > | get_ext_memory_variables () const |
Return variables allocated out of the top module. More... | |
void | add_external_variable (unsigned int var, const std::string &var_name) |
Allocates a variable to the set of variables allocated outside to outermost function. More... | |
void | add_external_symbol (unsigned int var, const memory_symbolRef m_sym) |
Allocates a variable to the set of variables allocated outside to outermost function. More... | |
void | add_internal_variable (unsigned int funID_scope, unsigned int var, const std::string &var_name) |
Allocates a variable to the set of variables allocated internally to the given function. More... | |
void | add_internal_variable_proxy (unsigned int funID_scope, unsigned int var) |
allocate a proxy for the variable for the specified function More... | |
unsigned long long | compute_next_base_address (unsigned long long address, unsigned int var, unsigned long long int alignment) const |
Compute the new base address based on the size of the given variable and align the memory as needed. More... | |
const CustomOrderedSet< unsigned int > & | get_proxied_internal_variables (unsigned int funID_scope) const |
return the proxied internal variables associated with the function More... | |
bool | has_proxied_internal_variables (unsigned int funID_scope) const |
check if the function has proxied variables More... | |
bool | is_a_proxied_variable (unsigned int var) const |
return true if the variable is a proxied variable More... | |
void | add_read_only_variable (unsigned var) |
add a read only variable More... | |
bool | is_read_only_variable (unsigned var) const |
return true when the variable is only read More... | |
void | add_internal_symbol (unsigned int funID_scope, unsigned int var, const memory_symbolRef m_sym) |
Allocates a variable to the set of variables allocated internally to the given function. More... | |
void | add_private_memory (unsigned int var) |
add a var that safely cannot be attached to the bus More... | |
void | set_sds_var (unsigned int var, bool value) |
set if a variable is always accessed with the same data size or not More... | |
void | add_source_value (unsigned int var, unsigned int value) |
add a value to the set of values written in a given memory variable More... | |
const CustomOrderedSet< unsigned int > & | get_source_values (unsigned int var) |
return the set of values used to write a given memory variable More... | |
void | add_parameter (unsigned int funID_scope, unsigned int var, const std::string &var_name, bool is_last) |
Allocates a parameter to the set of the interface registers. More... | |
void | add_parameter_symbol (unsigned int funID_scope, unsigned int var, const memory_symbolRef m_sym) |
Allocates a parameter to the set of the interface registers. More... | |
bool | is_internal_variable (unsigned int funID_scope, unsigned int var) const |
Test if a variable is allocated into the specified function. More... | |
bool | is_external_variable (unsigned int var) const |
Test if a variable is into the set of variables out of the top function. More... | |
bool | is_private_memory (unsigned int var) const |
Return true in case the variable is private. More... | |
bool | is_sds_var (unsigned int var) const |
check if the variable is always accessed with the same data size More... | |
bool | has_sds_var (unsigned int var) const |
return true if the var has been classified in term of same data size relation More... | |
bool | is_parameter (unsigned int funID_scope, unsigned int var) const |
Test if a variable is into the set of interface registers. More... | |
const std::map< unsigned int, memory_symbolRef > | get_callSites () const |
Get call sites map. More... | |
unsigned long long | get_callSite_base_address (unsigned int var) const |
Get the current base address of the given call site. More... | |
unsigned long long int | get_internal_base_address (unsigned int var) const |
Get the current base address of the given variable. More... | |
unsigned long long | get_external_base_address (unsigned int var) const |
Get the current base address of the given variable. More... | |
unsigned long long int | get_parameter_base_address (unsigned int funId, unsigned int var) const |
Get the current base address of the given variable. More... | |
unsigned long long int | get_base_address (unsigned int var, unsigned int funId) const |
Get the current base address of the given variable. More... | |
unsigned long long | get_first_address (unsigned int funId) const |
Get the first address of the function address space. More... | |
unsigned long long | get_last_address (unsigned int funId, const application_managerRef AppM) const |
Get the last address of the function address space. More... | |
memory_symbolRef | get_symbol (unsigned int var, unsigned int funId) const |
Return the symbol associated with the given variable. More... | |
unsigned long long | get_rangesize (unsigned int var) const |
return the address space rangesize associated with the given var More... | |
bool | has_callSite_base_address (unsigned int var) const |
Check if there is a base address for the given call site. More... | |
bool | has_internal_base_address (unsigned int var) const |
Check if there is a base address for the given variable. More... | |
unsigned int | get_n_mem_operations (unsigned int var) const |
void | increment_n_mem_operations (unsigned int var) |
bool | has_external_base_address (unsigned int var) const |
Check if there is a base address for the given variable. More... | |
bool | has_parameter_base_address (unsigned int var, unsigned int funId) const |
Check if there is a base address for the given parameter. More... | |
bool | has_base_address (unsigned int var) const |
Check if there is a base address for the given variable. More... | |
bool | is_parm_decl_copied (unsigned int var) const |
return true in case the parm_decl parameter has to be copied from the caller More... | |
void | add_parm_decl_copied (unsigned int var) |
add a parm_decl to the set of parm_decl written More... | |
bool | is_parm_decl_stored (unsigned int var) const |
return true in case the parm_decl parameter has to be initialized from the formal value More... | |
void | add_parm_decl_stored (unsigned int var) |
add a parm_decl to the set of parm_decl that has to be initialized More... | |
bool | is_actual_parm_loaded (unsigned int var) const |
return true in case the actual parameter has to be initialized from a stored value More... | |
void | add_actual_parm_loaded (unsigned int var) |
add an actual parameter to the set of parameter that has to be initialized from a stored value More... | |
std::map< unsigned int, memory_symbolRef > | get_function_vars (unsigned int funID_scope) const |
Return the variables allocated within the space of a given function. More... | |
std::map< unsigned int, memory_symbolRef > | get_function_parameters (unsigned int funID_scope) const |
Return parameters allocated in register of the interface. More... | |
unsigned long long | get_memory_address () const |
Return the first memory address not yet allocated. More... | |
void | reserve_space (unsigned long long space) |
Explicitly allocate a certain space in the external memory. More... | |
void | reserve_internal_space (unsigned long long int space) |
Explicitly allocate a certain space in the internal memory. More... | |
unsigned long long | get_allocated_space () const |
Returns the amount of memory allocated internally to the module. More... | |
unsigned long long | get_allocated_parameters_memory () const |
Return the total amount of memory allocated for the memory mapped parameters. More... | |
unsigned long long int | get_allocated_internal_memory () const |
Returns the amount of memory allocated internally but not private. More... | |
unsigned long long int | get_next_internal_base_address () const |
Returns next free address of memory allocated internally but not private. More... | |
unsigned long long int | get_max_address () const |
return the maximum address allocated More... | |
void | set_bus_data_bitsize (unsigned long long bitsize) |
set the bus data bitsize More... | |
unsigned long long | get_bus_data_bitsize () const |
return the bitsize of the data bus More... | |
void | set_bus_size_bitsize (unsigned long long bitsize) |
set the bus size bitsize More... | |
unsigned long long | get_bus_size_bitsize () const |
return the bitsize of the size bus More... | |
void | set_bram_bitsize (unsigned long long bitsize) |
set the BRAM bitsize More... | |
unsigned long long | get_bram_bitsize () const |
return the BRAM bitsize More... | |
void | set_maxbram_bitsize (unsigned int bitsize) |
set the maximum BRAM bitsize More... | |
unsigned int | get_maxbram_bitsize () const |
return the BRAM bitsize More... | |
void | set_intern_shared_data (bool has_accesses) |
define if the Spec has data that can be externally accessed More... | |
bool | has_intern_shared_data () const |
return true in case the specification has data that can be externally accessed More... | |
void | set_maximum_references (unsigned int var, size_t n_refs) |
define the maximum number of references for a given variable More... | |
size_t | get_maximum_references (unsigned int var) const |
return the maximum number of references for a given variable More... | |
void | set_maximum_loads (unsigned int var, size_t n_refs) |
define the maximum number of loads for a given variable More... | |
size_t | get_maximum_loads (unsigned int var) const |
return the maximum number of loads for a given variable More... | |
void | add_need_bus (unsigned int var) |
the variable is read or written through the bus More... | |
bool | does_need_addr (unsigned int var) const |
check if a load or a store of the variable is done trough the bus More... | |
void | set_use_unknown_addresses (bool accesses) |
define if there exist an object used by the Spec with an address not known at compile time More... | |
bool | has_unknown_addresses () const |
return true in case the specification use addresses not known at compile time More... | |
void | set_unaligned_accesses (bool accesses) |
set if LOADs or STOREs perform unaligned accesses More... | |
bool | has_unaligned_accesses () const |
return true in case of unaligned accesses More... | |
void | set_all_pointers_resolved (bool resolved) |
define if all pointers have statically resolved More... | |
bool | has_all_pointers_resolved () const |
return true in case all pointers have been statically resolved More... | |
void | set_packed_vars (bool packed) |
update the the packed variables status More... | |
bool | has_packed_vars () const |
void | set_implicit_memcpy (bool cond) |
define if there exist an implicit call of memcpy More... | |
bool | has_implicit_memcpy () const |
return true in case the specification has an implicit call of memcpy More... | |
unsigned long long | get_internal_base_address_alignment () const |
return the internal base address alignment. More... | |
unsigned long long | get_parameter_alignment () const |
return the parameter alignment More... | |
void | set_internal_base_address_alignment (unsigned long long _internal_base_address_alignment) |
set the internal base address alignment More... | |
void | xwrite (xml_element *node) |
Writes the current memory allocation into an XML description. More... | |
void | xwrite2 (xml_element *node) |
Writes the current memory allocation into an XML description. More... | |
void | xwrite (const std::string &filename) |
Writes the current memory allocation into an XML description. More... | |
unsigned int | count_non_private_internal_symbols () const |
bool | notEQ (refcount< memory > ref) const |
return true in case the current memory object and the passed one are different More... | |
void | set_enable_hls_bit_value (bool value) |
bool | get_enable_hls_bit_value () |
Static Public Member Functions | |
static memoryRef | create_memory (const ParameterConstRef _parameters, const tree_managerConstRef _TreeM, unsigned long long int _off_base_address, unsigned int max_bram, bool _null_pointer_check, bool initial_internal_address_p, unsigned int initial_internal_address, const unsigned int &_address_bitsize) |
static void | propagate_memory_parameters (const structural_objectRef src, const structural_managerRef tgt) |
Propagates the memory parameters from the source (innermost) module to the target (outermost) one. More... | |
static void | add_memory_parameter (const structural_managerRef SM, const std::string &name, const std::string &value) |
Adds the given memory parameter to the corresponding object. More... | |
Private Attributes | |
const tree_managerConstRef | TreeM |
data-structure containing tree information More... | |
std::map< unsigned int, memory_symbolRef > | external |
set of variables allocated outside the top module More... | |
std::map< unsigned int, std::map< unsigned int, memory_symbolRef > > | internal |
set of variables allocated internally to the cores, classified by function id More... | |
std::map< unsigned int, CustomOrderedSet< unsigned int > > | internal_variable_proxy |
set of variable proxies accessed by a function More... | |
CustomOrderedSet< unsigned int > | proxied_variables |
is the set of proxied variables More... | |
CustomOrderedSet< unsigned int > | read_only_vars |
std::map< unsigned int, memory_symbolRef > | in_vars |
set of all the internal variables More... | |
std::map< unsigned int, unsigned long long int > | rangesize |
for each var store the address space rangesize associated with it More... | |
std::map< unsigned int, std::map< unsigned int, memory_symbolRef > > | parameter |
set of variables allocated in registers of the interface More... | |
std::map< unsigned int, memory_symbolRef > | params |
set of all the internal parameters More... | |
std::map< unsigned int, memory_symbolRef > | callSites |
set of call sites for __builtin_wait_call More... | |
CustomOrderedSet< unsigned int > | private_memories |
store the objects that does not need to be attached to the bus More... | |
std::map< unsigned int, unsigned int > | same_data_size_accesses |
store if a given variable is accessed always with the same data_size or not More... | |
std::map< unsigned int, CustomOrderedSet< unsigned int > > | source_values |
ssa_names assigned to a given memory variable More... | |
CustomOrderedSet< unsigned int > | parm_decl_copied |
parm_decl that has to be copied from the caller More... | |
CustomOrderedSet< unsigned int > | parm_decl_stored |
parm_decl storage has to be initialized from the formal parameter More... | |
CustomOrderedSet< unsigned int > | actual_parm_loaded |
actual parameter that has to be loaded from a stored value More... | |
unsigned long long int | next_base_address |
it represents the next address that is available for internal allocation More... | |
unsigned long long int | internal_base_address_start |
is the start internal address More... | |
unsigned long long int | maximum_private_memory_size |
is the maximum amount of private memory allocated More... | |
unsigned long long int | total_amount_of_private_memory |
total amount of internal memory allocated More... | |
unsigned long long int | total_amount_of_parameter_memory |
total amount of parameter memory More... | |
unsigned long long int | off_base_address |
it represents the base address of the external memory More... | |
unsigned long long int | next_off_base_address |
it represents the next address that is available to allocate a variable out of the top module More... | |
unsigned long long | bus_data_bitsize |
bus data bitsize More... | |
unsigned long long | bus_size_bitsize |
bus size bitsize More... | |
unsigned long long | bram_bitsize |
bram bitsize More... | |
unsigned int | maxbram_bitsize |
maximum bram bitsize More... | |
bool | intern_shared_data |
define if the Spec has data that can be externally accessed More... | |
bool | use_unknown_addresses |
Spec accesses data having an address unknown at compile time. More... | |
bool | unaligned_accesses |
true when LOADs or STOREs perform unaligned accesses More... | |
bool | all_pointers_resolved |
is true when all pointers are resolved statically More... | |
bool | implicit_memcpy |
when true an implicit memcpy is called More... | |
unsigned long long | internal_base_address_alignment |
internal address alignment More... | |
unsigned long long | external_base_address_alignment |
external address alignment More... | |
const unsigned long long | parameter_alignment |
parameter alignment More... | |
std::map< unsigned int, unsigned int > | n_mem_operations_per_var |
number of LOAD/STORE per var More... | |
bool | null_pointer_check |
when false object could be allocated starting from address 0 More... | |
std::map< unsigned int, size_t > | maximum_references |
define for each variable the number of references whenever it is possible More... | |
std::map< unsigned int, size_t > | maximum_loads |
define for each variable the number of loads whenever it is possible More... | |
CustomOrderedSet< unsigned int > | need_bus |
define for each variable the number of loads whenever it is possible More... | |
bool | packed_vars |
true when packed vars are used More... | |
const unsigned int & | bus_addr_bitsize |
bool | enable_hls_bit_value |
Definition at line 66 of file memory.hpp.
memory::memory | ( | const tree_managerConstRef | TreeM, |
unsigned long long int | off_base_address, | ||
unsigned int | max_bram, | ||
bool | null_pointer_check, | ||
bool | initial_internal_address_p, | ||
unsigned long long | initial_internal_address, | ||
const unsigned int & | _bus_addr_bitsize | ||
) |
Constructor.
we start to allocate from internal_base_address_alignment byte to align address to internal_base_address_alignment bits we can use address 0 in some cases but it is not safe in general.
Definition at line 89 of file memory.cpp.
References align(), external_base_address_alignment, internal_base_address_alignment, internal_base_address_start, next_base_address, null_pointer_check, U, and ~memory().
Referenced by create_memory().
|
virtualdefault |
void memory::add_actual_parm_loaded | ( | unsigned int | var | ) |
add an actual parameter to the set of parameter that has to be initialized from a stored value
Definition at line 639 of file memory.cpp.
References actual_parm_loaded.
Referenced by increment_n_mem_operations().
void memory::add_external_symbol | ( | unsigned int | var, |
const memory_symbolRef | m_sym | ||
) |
Allocates a variable to the set of variables allocated outside to outermost function.
The corresponding symbol is already provided
Definition at line 293 of file memory.cpp.
References compute_next_base_address(), external, external_base_address_alignment, in_vars, max, next_off_base_address, parameter, STR, and THROW_WARNING.
Referenced by add_external_variable().
void memory::add_external_variable | ( | unsigned int | var, |
const std::string & | var_name | ||
) |
Allocates a variable to the set of variables allocated outside to outermost function.
Definition at line 286 of file memory.cpp.
References add_external_symbol(), align(), tree_helper::get_var_alignment(), next_off_base_address, and TreeM.
void memory::add_internal_symbol | ( | unsigned int | funID_scope, |
unsigned int | var, | ||
const memory_symbolRef | m_sym | ||
) |
Allocates a variable to the set of variables allocated internally to the given function.
The corresponding symbol is already provided
Definition at line 234 of file memory.cpp.
References align(), callSites, tree_manager::CGetTreeNode(), tree_manager::CGetTreeReindex(), compute_n_bytes(), compute_next_base_address(), external, in_vars, internal_base_address_alignment, is_private_memory(), max, maximum_private_memory_size, next_base_address, parameter, rangesize, tree_helper::Size(), STR, THROW_ASSERT, THROW_WARNING, total_amount_of_private_memory, and TreeM.
Referenced by add_internal_variable().
void memory::add_internal_variable | ( | unsigned int | funID_scope, |
unsigned int | var, | ||
const std::string & | var_name | ||
) |
Allocates a variable to the set of variables allocated internally to the given function.
Definition at line 175 of file memory.cpp.
References add_internal_symbol(), align(), tree_helper::get_var_alignment(), in_vars, internal_base_address_start, is_private_memory(), next_base_address, null_pointer_check, and TreeM.
void memory::add_internal_variable_proxy | ( | unsigned int | funID_scope, |
unsigned int | var | ||
) |
allocate a proxy for the variable for the specified function
funID_scope | is the function id |
var | is the variable |
Definition at line 202 of file memory.cpp.
References internal_variable_proxy, and proxied_variables.
|
static |
Adds the given memory parameter to the corresponding object.
Definition at line 725 of file memory.cpp.
References structural_object::AddParameter(), structural_object::ExistsParameter(), structural_manager::get_circ(), structural_object::GetParameter(), MEMORY_PARAMETER, structural_object::SetParameter(), THROW_ASSERT, THROW_ERROR, and symmetry::value.
Referenced by classic_datapath::add_ports(), fu_binding::add_to_SM(), TopEntityMemoryMapped::allocate_parameters(), build_bus_interface(), WB4_interface::build_WB4_bus_interface(), get_parameter_alignment(), and fu_binding::specialize_memory_unit().
|
inline |
the variable is read or written through the bus
var | is the variable |
Definition at line 671 of file memory.hpp.
void memory::add_parameter | ( | unsigned int | funID_scope, |
unsigned int | var, | ||
const std::string & | var_name, | ||
bool | is_last | ||
) |
Allocates a parameter to the set of the interface registers.
align in case is not aligned
Definition at line 323 of file memory.cpp.
References add_parameter_symbol(), align(), internal_base_address_alignment, next_base_address, and total_amount_of_parameter_memory.
Referenced by memory_allocation::allocate_parameters(), and get_source_values().
void memory::add_parameter_symbol | ( | unsigned int | funID_scope, |
unsigned int | var, | ||
const memory_symbolRef | m_sym | ||
) |
Allocates a parameter to the set of the interface registers.
allocation of the parameters
Definition at line 336 of file memory.cpp.
References compute_next_base_address(), external, in_vars, max, next_base_address, parameter, parameter_alignment, params, STR, THROW_WARNING, and total_amount_of_parameter_memory.
Referenced by add_parameter(), and get_source_values().
void memory::add_parm_decl_copied | ( | unsigned int | var | ) |
add a parm_decl to the set of parm_decl written
Definition at line 619 of file memory.cpp.
References parm_decl_copied.
Referenced by increment_n_mem_operations().
void memory::add_parm_decl_stored | ( | unsigned int | var | ) |
add a parm_decl to the set of parm_decl that has to be initialized
Definition at line 629 of file memory.cpp.
References parm_decl_stored.
Referenced by increment_n_mem_operations().
void memory::add_private_memory | ( | unsigned int | var | ) |
add a var that safely cannot be attached to the bus
var | is var index |
Definition at line 308 of file memory.cpp.
References private_memories.
void memory::add_read_only_variable | ( | unsigned | var | ) |
add a read only variable
var | is the variable id |
Definition at line 224 of file memory.cpp.
References read_only_vars.
void memory::add_source_value | ( | unsigned int | var, |
unsigned int | value | ||
) |
add a value to the set of values written in a given memory variable
var | is the memory variable |
value | is the source value |
Definition at line 318 of file memory.cpp.
References source_values.
unsigned long long int memory::compute_next_base_address | ( | unsigned long long | address, |
unsigned int | var, | ||
unsigned long long int | alignment | ||
) | const |
Compute the new base address based on the size of the given variable and align the memory as needed.
address | is the address to be evaluated |
var | is the variable that has to be reserved |
alignment | is the address alignment |
compute the next base address
align the memory address
Definition at line 154 of file memory.cpp.
References align(), bus_addr_bitsize, tree_manager::CGetTreeReindex(), tree_helper::CGetType(), compute_n_bytes(), GET_CONST_NODE, tree_helper::Size(), and TreeM.
Referenced by add_external_symbol(), add_internal_symbol(), and add_parameter_symbol().
unsigned int memory::count_non_private_internal_symbols | ( | ) | const |
Definition at line 273 of file memory.cpp.
References in_vars, and is_private_memory().
Referenced by get_parameter_alignment().
|
static |
Definition at line 132 of file memory.cpp.
References memory().
Referenced by mem_dominator_allocation::InternalExec().
|
inline |
check if a load or a store of the variable is done trough the bus
var | is the variable |
Definition at line 681 of file memory.hpp.
unsigned long long int memory::get_allocated_internal_memory | ( | ) | const |
Returns the amount of memory allocated internally but not private.
Definition at line 599 of file memory.cpp.
References internal_base_address_start, and next_base_address.
Referenced by increment_n_mem_operations().
unsigned long long int memory::get_allocated_parameters_memory | ( | ) | const |
Return the total amount of memory allocated for the memory mapped parameters.
Definition at line 594 of file memory.cpp.
References total_amount_of_parameter_memory.
Referenced by increment_n_mem_operations().
unsigned long long int memory::get_allocated_space | ( | ) | const |
Returns the amount of memory allocated internally to the module.
Definition at line 589 of file memory.cpp.
References internal_base_address_start, next_base_address, and total_amount_of_private_memory.
Referenced by increment_n_mem_operations().
unsigned long long memory::get_base_address | ( | unsigned int | var, |
unsigned int | funId | ||
) | const |
Get the current base address of the given variable.
Definition at line 467 of file memory.cpp.
References get_callSite_base_address(), get_external_base_address(), get_internal_base_address(), get_parameter_base_address(), has_base_address(), has_callSite_base_address(), has_internal_base_address(), has_parameter_base_address(), STR, and THROW_ASSERT.
Referenced by get_callSites(), and fu_binding::write_init().
|
inline |
|
inline |
return the bitsize of the data bus
Definition at line 558 of file memory.hpp.
References bus_data_bitsize.
|
inline |
return the bitsize of the size bus
Definition at line 574 of file memory.hpp.
References bus_size_bitsize.
unsigned long long int memory::get_callSite_base_address | ( | unsigned int | var | ) | const |
Get the current base address of the given call site.
Definition at line 392 of file memory.cpp.
References callSites, and THROW_ASSERT.
Referenced by get_base_address(), and get_callSites().
|
inline |
Get call sites map.
Definition at line 371 of file memory.hpp.
References callSites, get_base_address(), get_callSite_base_address(), get_external_base_address(), get_first_address(), get_internal_base_address(), get_last_address(), get_parameter_base_address(), get_rangesize(), get_symbol(), has_callSite_base_address(), and has_internal_base_address().
|
inline |
Definition at line 825 of file memory.hpp.
References enable_hls_bit_value.
std::map< unsigned int, memory_symbolRef > memory::get_ext_memory_variables | ( | ) | const |
Return variables allocated out of the top module.
Definition at line 149 of file memory.cpp.
References external.
unsigned long long int memory::get_external_base_address | ( | unsigned int | var | ) | const |
Get the current base address of the given variable.
Definition at line 404 of file memory.cpp.
References external, and THROW_ASSERT.
Referenced by get_base_address(), and get_callSites().
unsigned long long int memory::get_first_address | ( | unsigned int | funId | ) | const |
Get the first address of the function address space.
Definition at line 485 of file memory.cpp.
References has_parameter_base_address(), is_private_memory(), min, and parameter.
Referenced by get_callSites().
std::map< unsigned int, memory_symbolRef > memory::get_function_parameters | ( | unsigned int | funID_scope | ) | const |
Return parameters allocated in register of the interface.
Definition at line 427 of file memory.cpp.
References parameter.
Referenced by get_last_address(), and increment_n_mem_operations().
std::map< unsigned int, memory_symbolRef > memory::get_function_vars | ( | unsigned int | funID_scope | ) | const |
Return the variables allocated within the space of a given function.
Definition at line 417 of file memory.cpp.
Referenced by increment_n_mem_operations().
unsigned long long int memory::get_internal_base_address | ( | unsigned int | var | ) | const |
Get the current base address of the given variable.
Definition at line 398 of file memory.cpp.
References in_vars, and THROW_ASSERT.
Referenced by get_base_address(), and get_callSites().
|
inline |
return the internal base address alignment.
Definition at line 768 of file memory.hpp.
References internal_base_address_alignment.
unsigned long long int memory::get_last_address | ( | unsigned int | funId, |
const application_managerRef | AppM | ||
) | const |
Get the last address of the function address space.
Definition at line 515 of file memory.cpp.
References tree_manager::CGetTreeReindex(), get_function_parameters(), has_base_address(), has_parameter_base_address(), is_private_memory(), max, tree_helper::Size(), and TreeM.
Referenced by get_callSites().
unsigned long long memory::get_max_address | ( | ) | const |
return the maximum address allocated
Definition at line 609 of file memory.cpp.
References internal_base_address_start, max, maximum_private_memory_size, and next_base_address.
Referenced by increment_n_mem_operations().
|
inline |
|
inline |
return the maximum number of loads for a given variable
var | is the variable |
Definition at line 662 of file memory.hpp.
|
inline |
return the maximum number of references for a given variable
var | is the variable |
Definition at line 642 of file memory.hpp.
unsigned long long int memory::get_memory_address | ( | ) | const |
Return the first memory address not yet allocated.
Definition at line 354 of file memory.cpp.
References next_off_base_address.
Referenced by increment_n_mem_operations().
|
inline |
Definition at line 435 of file memory.hpp.
unsigned long long int memory::get_next_internal_base_address | ( | ) | const |
Returns next free address of memory allocated internally but not private.
Definition at line 604 of file memory.cpp.
References next_base_address.
Referenced by increment_n_mem_operations().
|
inline |
return the parameter alignment
Definition at line 776 of file memory.hpp.
References add_memory_parameter(), count_non_private_internal_symbols(), flopoco::filename, notEQ(), parameter_alignment, propagate_memory_parameters(), set_internal_base_address_alignment(), symmetry::value, xwrite(), and xwrite2().
unsigned long long int memory::get_parameter_base_address | ( | unsigned int | funId, |
unsigned int | var | ||
) | const |
Get the current base address of the given variable.
Definition at line 410 of file memory.cpp.
References parameter, and THROW_ASSERT.
Referenced by memory_allocation::allocate_parameters(), get_base_address(), and get_callSites().
const CustomOrderedSet< unsigned int > & memory::get_proxied_internal_variables | ( | unsigned int | funID_scope | ) | const |
return the proxied internal variables associated with the function
funID_scope | is the function id |
Definition at line 208 of file memory.cpp.
References has_proxied_internal_variables(), internal_variable_proxy, STR, and THROW_ASSERT.
unsigned long long int memory::get_rangesize | ( | unsigned int | var | ) | const |
return the address space rangesize associated with the given var
var | is the variable considered |
Definition at line 571 of file memory.cpp.
References has_base_address(), rangesize, STR, and THROW_ASSERT.
Referenced by get_callSites().
|
inline |
return the set of values used to write a given memory variable
var | is the memory variable |
Definition at line 317 of file memory.hpp.
References add_parameter(), add_parameter_symbol(), has_sds_var(), is_external_variable(), is_internal_variable(), is_parameter(), is_private_memory(), and is_sds_var().
memory_symbolRef memory::get_symbol | ( | unsigned int | var, |
unsigned int | funId | ||
) | const |
Return the symbol associated with the given variable.
Definition at line 553 of file memory.cpp.
References callSites, external, has_base_address(), has_callSite_base_address(), has_internal_base_address(), has_parameter_base_address(), in_vars, parameter, STR, and THROW_ASSERT.
Referenced by get_callSites().
|
inline |
return true in case all pointers have been statically resolved
Definition at line 727 of file memory.hpp.
References all_pointers_resolved.
bool memory::has_base_address | ( | unsigned int | var | ) | const |
Check if there is a base address for the given variable.
Definition at line 461 of file memory.cpp.
References callSites, external, in_vars, and params.
Referenced by get_base_address(), get_last_address(), get_rangesize(), get_symbol(), increment_n_mem_operations(), HLS_manager::is_register_compatible(), and fu_binding::write_init().
bool memory::has_callSite_base_address | ( | unsigned int | var | ) | const |
Check if there is a base address for the given call site.
Definition at line 436 of file memory.cpp.
References callSites.
Referenced by get_base_address(), get_callSites(), and get_symbol().
bool memory::has_external_base_address | ( | unsigned int | var | ) | const |
Check if there is a base address for the given variable.
Definition at line 446 of file memory.cpp.
References external.
Referenced by increment_n_mem_operations().
|
inline |
return true in case the specification has an implicit call of memcpy
Definition at line 760 of file memory.hpp.
References implicit_memcpy.
|
inline |
return true in case the specification has data that can be externally accessed
Definition at line 622 of file memory.hpp.
References intern_shared_data.
bool memory::has_internal_base_address | ( | unsigned int | var | ) | const |
Check if there is a base address for the given variable.
Definition at line 441 of file memory.cpp.
References in_vars.
Referenced by get_base_address(), get_callSites(), and get_symbol().
|
inline |
Definition at line 744 of file memory.hpp.
References packed_vars.
bool memory::has_parameter_base_address | ( | unsigned int | var, |
unsigned int | funId | ||
) | const |
Check if there is a base address for the given parameter.
Definition at line 451 of file memory.cpp.
References parameter.
Referenced by get_base_address(), get_first_address(), get_last_address(), get_symbol(), and increment_n_mem_operations().
bool memory::has_proxied_internal_variables | ( | unsigned int | funID_scope | ) | const |
check if the function has proxied variables
funID_scope | is the function id |
Definition at line 214 of file memory.cpp.
References internal_variable_proxy.
Referenced by get_proxied_internal_variables().
bool memory::has_sds_var | ( | unsigned int | var | ) | const |
return true if the var has been classified in term of same data size relation
var | is the variable id |
Definition at line 381 of file memory.cpp.
References same_data_size_accesses.
Referenced by get_source_values(), and is_sds_var().
|
inline |
return true in case of unaligned accesses
Definition at line 711 of file memory.hpp.
References unaligned_accesses.
|
inline |
return true in case the specification use addresses not known at compile time
Definition at line 696 of file memory.hpp.
References use_unknown_addresses.
|
inline |
Definition at line 440 of file memory.hpp.
References add_actual_parm_loaded(), add_parm_decl_copied(), add_parm_decl_stored(), get_allocated_internal_memory(), get_allocated_parameters_memory(), get_allocated_space(), get_function_parameters(), get_function_vars(), get_max_address(), get_memory_address(), get_next_internal_base_address(), has_base_address(), has_external_base_address(), has_parameter_base_address(), is_actual_parm_loaded(), is_parm_decl_copied(), is_parm_decl_stored(), reserve_internal_space(), and reserve_space().
bool memory::is_a_proxied_variable | ( | unsigned int | var | ) | const |
return true if the variable is a proxied variable
var | is the id of the variable |
Definition at line 219 of file memory.cpp.
References proxied_variables.
bool memory::is_actual_parm_loaded | ( | unsigned int | var | ) | const |
return true in case the actual parameter has to be initialized from a stored value
Definition at line 634 of file memory.cpp.
References actual_parm_loaded.
Referenced by increment_n_mem_operations().
bool memory::is_external_variable | ( | unsigned int | var | ) | const |
Test if a variable is into the set of variables out of the top function.
Definition at line 365 of file memory.cpp.
References external.
Referenced by get_source_values().
bool memory::is_internal_variable | ( | unsigned int | funID_scope, |
unsigned int | var | ||
) | const |
Test if a variable is allocated into the specified function.
Definition at line 359 of file memory.cpp.
Referenced by get_source_values().
bool memory::is_parameter | ( | unsigned int | funID_scope, |
unsigned int | var | ||
) | const |
Test if a variable is into the set of interface registers.
Definition at line 386 of file memory.cpp.
References parameter.
Referenced by get_source_values().
bool memory::is_parm_decl_copied | ( | unsigned int | var | ) | const |
return true in case the parm_decl parameter has to be copied from the caller
Definition at line 614 of file memory.cpp.
References parm_decl_copied.
Referenced by increment_n_mem_operations().
bool memory::is_parm_decl_stored | ( | unsigned int | var | ) | const |
return true in case the parm_decl parameter has to be initialized from the formal value
Definition at line 624 of file memory.cpp.
References parm_decl_stored.
Referenced by increment_n_mem_operations().
bool memory::is_private_memory | ( | unsigned int | var | ) | const |
Return true in case the variable is private.
var | is the index of the variable |
Definition at line 370 of file memory.cpp.
References private_memories.
Referenced by add_internal_symbol(), add_internal_variable(), count_non_private_internal_symbols(), get_first_address(), get_last_address(), and get_source_values().
bool memory::is_read_only_variable | ( | unsigned | var | ) | const |
return true when the variable is only read
var | is the variable id |
Definition at line 229 of file memory.cpp.
References read_only_vars.
bool memory::is_sds_var | ( | unsigned int | var | ) | const |
check if the variable is always accessed with the same data size
var | is the variable id |
Definition at line 375 of file memory.cpp.
References has_sds_var(), same_data_size_accesses, STR, and THROW_ASSERT.
Referenced by get_source_values().
return true in case the current memory object and the passed one are different
Definition at line 840 of file memory.cpp.
References actual_parm_loaded, all_pointers_resolved, bram_bitsize, bus_addr_bitsize, bus_data_bitsize, bus_size_bitsize, callSites, external, external_base_address_alignment, implicit_memcpy, in_vars, intern_shared_data, internal, internal_base_address_alignment, internal_base_address_start, internal_variable_proxy, maxbram_bitsize, maximum_loads, maximum_private_memory_size, maximum_references, need_bus, next_base_address, next_off_base_address, null_pointer_check, off_base_address, packed_vars, parameter, parameter_alignment, params, parm_decl_copied, parm_decl_stored, private_memories, proxied_variables, rangesize, read_only_vars, same_data_size_accesses, total_amount_of_parameter_memory, total_amount_of_private_memory, unaligned_accesses, and use_unknown_addresses.
Referenced by get_parameter_alignment().
|
static |
Propagates the memory parameters from the source (innermost) module to the target (outermost) one.
Definition at line 654 of file memory.cpp.
References structural_object::AddParameter(), structural_object::ExistsParameter(), structural_manager::get_circ(), structural_object::GetParameter(), MEMORY_PARAMETER, structural_object::SetParameter(), and THROW_ERROR.
Referenced by fu_binding::add_to_SM(), allocation::BuildProxyWrapper(), WB4Intercon_interface::exec(), get_parameter_alignment(), cs_interface::InternalExec(), minimal_interface::InternalExec(), top_entity_parallel_cs::InternalExec(), TopEntityMemoryMapped::InternalExec(), top_entity::InternalExec(), WB4_interface::InternalExec(), and datapath_parallel_cs::InternalExec().
void memory::reserve_internal_space | ( | unsigned long long int | space | ) |
Explicitly allocate a certain space in the internal memory.
Definition at line 583 of file memory.cpp.
References align(), internal_base_address_alignment, and next_base_address.
Referenced by increment_n_mem_operations().
void memory::reserve_space | ( | unsigned long long | space | ) |
Explicitly allocate a certain space in the external memory.
Definition at line 577 of file memory.cpp.
References align(), internal_base_address_alignment, and next_off_base_address.
Referenced by increment_n_mem_operations().
|
inline |
define if all pointers have statically resolved
Definition at line 719 of file memory.hpp.
|
inline |
set the BRAM bitsize
Definition at line 582 of file memory.hpp.
|
inline |
set the bus data bitsize
Definition at line 550 of file memory.hpp.
|
inline |
set the bus size bitsize
Definition at line 566 of file memory.hpp.
|
inline |
Definition at line 820 of file memory.hpp.
References symmetry::value.
|
inline |
define if there exist an implicit call of memcpy
Definition at line 752 of file memory.hpp.
|
inline |
define if the Spec has data that can be externally accessed
Definition at line 614 of file memory.hpp.
void memory::set_internal_base_address_alignment | ( | unsigned long long | _internal_base_address_alignment | ) |
set the internal base address alignment
_internal_base_address_alignment | is the new alignment |
Definition at line 644 of file memory.cpp.
References align(), internal_base_address_alignment, internal_base_address_start, next_base_address, and THROW_ASSERT.
Referenced by get_parameter_alignment().
|
inline |
set the maximum BRAM bitsize
Definition at line 598 of file memory.hpp.
|
inline |
define the maximum number of loads for a given variable
var | is variable |
n_refs | is the number of loads |
Definition at line 652 of file memory.hpp.
|
inline |
define the maximum number of references for a given variable
var | is variable |
n_refs | is the number of references |
Definition at line 632 of file memory.hpp.
|
inline |
update the the packed variables status
packed | is true when there is at least one packed variable |
Definition at line 736 of file memory.hpp.
void memory::set_sds_var | ( | unsigned int | var, |
bool | value | ||
) |
set if a variable is always accessed with the same data size or not
var | is the variable id |
value | is true when the variable is always accessed with the same data size or false otherwise |
Definition at line 313 of file memory.cpp.
References same_data_size_accesses, and symmetry::value.
|
inline |
set if LOADs or STOREs perform unaligned accesses
Definition at line 703 of file memory.hpp.
|
inline |
define if there exist an object used by the Spec with an address not known at compile time
Definition at line 688 of file memory.hpp.
void memory::xwrite | ( | xml_element * | node | ) |
Writes the current memory allocation into an XML description.
Definition at line 751 of file memory.cpp.
References xml_child::add_child_element(), external, tree_helper::name_function(), off_base_address, parameter, STR, TreeM, WRITE_XNVM, and WRITE_XVM.
Referenced by get_parameter_alignment(), and HLS_manager::xwrite().
void memory::xwrite | ( | const std::string & | filename | ) |
Writes the current memory allocation into an XML description.
Definition at line 1088 of file memory.cpp.
References xml_document::create_root_node(), xml_document::write_to_file_formatted(), and xwrite2().
void memory::xwrite2 | ( | xml_element * | node | ) |
Writes the current memory allocation into an XML description.
Definition at line 1062 of file memory.cpp.
References xml_child::add_child_element(), external, tree_helper::name_function(), off_base_address, TreeM, WRITE_XNVM, and WRITE_XVM.
Referenced by get_parameter_alignment(), and xwrite().
|
private |
actual parameter that has to be loaded from a stored value
Definition at line 115 of file memory.hpp.
Referenced by add_actual_parm_loaded(), is_actual_parm_loaded(), and notEQ().
|
private |
is true when all pointers are resolved statically
Definition at line 160 of file memory.hpp.
Referenced by has_all_pointers_resolved(), and notEQ().
|
private |
bram bitsize
Definition at line 145 of file memory.hpp.
Referenced by get_bram_bitsize(), and notEQ().
|
private |
Definition at line 192 of file memory.hpp.
Referenced by compute_next_base_address(), and notEQ().
|
private |
bus data bitsize
Definition at line 139 of file memory.hpp.
Referenced by get_bus_data_bitsize(), and notEQ().
|
private |
bus size bitsize
Definition at line 142 of file memory.hpp.
Referenced by get_bus_size_bitsize(), and notEQ().
|
private |
set of call sites for __builtin_wait_call
Definition at line 97 of file memory.hpp.
Referenced by add_internal_symbol(), get_callSite_base_address(), get_callSites(), get_symbol(), has_base_address(), has_callSite_base_address(), and notEQ().
|
private |
Definition at line 194 of file memory.hpp.
Referenced by get_enable_hls_bit_value().
|
private |
set of variables allocated outside the top module
Definition at line 73 of file memory.hpp.
Referenced by add_external_symbol(), add_internal_symbol(), add_parameter_symbol(), get_ext_memory_variables(), get_external_base_address(), get_symbol(), has_base_address(), has_external_base_address(), is_external_variable(), notEQ(), xwrite(), and xwrite2().
|
private |
external address alignment
Definition at line 169 of file memory.hpp.
Referenced by add_external_symbol(), memory(), and notEQ().
|
private |
when true an implicit memcpy is called
Definition at line 163 of file memory.hpp.
Referenced by has_implicit_memcpy(), and notEQ().
|
private |
set of all the internal variables
Definition at line 87 of file memory.hpp.
Referenced by add_external_symbol(), add_internal_symbol(), add_internal_variable(), add_parameter_symbol(), count_non_private_internal_symbols(), get_internal_base_address(), get_symbol(), has_base_address(), has_internal_base_address(), and notEQ().
|
private |
define if the Spec has data that can be externally accessed
Definition at line 151 of file memory.hpp.
Referenced by has_intern_shared_data(), and notEQ().
|
private |
set of variables allocated internally to the cores, classified by function id
Definition at line 76 of file memory.hpp.
Referenced by notEQ().
|
private |
internal address alignment
Definition at line 166 of file memory.hpp.
Referenced by add_internal_symbol(), add_parameter(), get_internal_base_address_alignment(), memory(), notEQ(), reserve_internal_space(), reserve_space(), and set_internal_base_address_alignment().
|
private |
is the start internal address
Definition at line 121 of file memory.hpp.
Referenced by add_internal_variable(), get_allocated_internal_memory(), get_allocated_space(), get_max_address(), memory(), notEQ(), and set_internal_base_address_alignment().
|
private |
set of variable proxies accessed by a function
Definition at line 79 of file memory.hpp.
Referenced by add_internal_variable_proxy(), get_proxied_internal_variables(), has_proxied_internal_variables(), and notEQ().
|
private |
maximum bram bitsize
Definition at line 148 of file memory.hpp.
Referenced by get_maxbram_bitsize(), and notEQ().
define for each variable the number of loads whenever it is possible
Definition at line 184 of file memory.hpp.
Referenced by notEQ().
|
private |
is the maximum amount of private memory allocated
Definition at line 124 of file memory.hpp.
Referenced by add_internal_symbol(), get_max_address(), and notEQ().
define for each variable the number of references whenever it is possible
Definition at line 181 of file memory.hpp.
Referenced by notEQ().
|
private |
number of LOAD/STORE per var
Definition at line 175 of file memory.hpp.
|
private |
define for each variable the number of loads whenever it is possible
Definition at line 187 of file memory.hpp.
Referenced by notEQ().
|
private |
it represents the next address that is available for internal allocation
Definition at line 118 of file memory.hpp.
Referenced by add_internal_symbol(), add_internal_variable(), add_parameter(), add_parameter_symbol(), get_allocated_internal_memory(), get_allocated_space(), get_max_address(), get_next_internal_base_address(), memory(), notEQ(), reserve_internal_space(), and set_internal_base_address_alignment().
|
private |
it represents the next address that is available to allocate a variable out of the top module
Definition at line 136 of file memory.hpp.
Referenced by add_external_symbol(), add_external_variable(), get_memory_address(), notEQ(), and reserve_space().
|
private |
when false object could be allocated starting from address 0
Definition at line 178 of file memory.hpp.
Referenced by add_internal_variable(), memory(), and notEQ().
|
private |
it represents the base address of the external memory
Definition at line 133 of file memory.hpp.
|
private |
true when packed vars are used
Definition at line 190 of file memory.hpp.
Referenced by has_packed_vars(), and notEQ().
|
private |
set of variables allocated in registers of the interface
Definition at line 93 of file memory.hpp.
Referenced by add_external_symbol(), add_internal_symbol(), add_parameter_symbol(), get_first_address(), get_function_parameters(), get_parameter_base_address(), get_symbol(), has_parameter_base_address(), is_parameter(), notEQ(), and xwrite().
|
private |
parameter alignment
Definition at line 172 of file memory.hpp.
Referenced by add_parameter_symbol(), get_parameter_alignment(), and notEQ().
|
private |
set of all the internal parameters
Definition at line 95 of file memory.hpp.
Referenced by add_parameter_symbol(), has_base_address(), and notEQ().
|
private |
parm_decl that has to be copied from the caller
Definition at line 109 of file memory.hpp.
Referenced by add_parm_decl_copied(), is_parm_decl_copied(), and notEQ().
|
private |
parm_decl storage has to be initialized from the formal parameter
Definition at line 112 of file memory.hpp.
Referenced by add_parm_decl_stored(), is_parm_decl_stored(), and notEQ().
|
private |
store the objects that does not need to be attached to the bus
Definition at line 100 of file memory.hpp.
Referenced by add_private_memory(), is_private_memory(), and notEQ().
|
private |
is the set of proxied variables
Definition at line 82 of file memory.hpp.
Referenced by add_internal_variable_proxy(), is_a_proxied_variable(), and notEQ().
|
private |
for each var store the address space rangesize associated with it
Definition at line 90 of file memory.hpp.
Referenced by add_internal_symbol(), get_rangesize(), and notEQ().
|
private |
Definition at line 84 of file memory.hpp.
Referenced by add_read_only_variable(), is_read_only_variable(), and notEQ().
|
private |
store if a given variable is accessed always with the same data_size or not
Definition at line 103 of file memory.hpp.
Referenced by has_sds_var(), is_sds_var(), notEQ(), and set_sds_var().
|
private |
ssa_names assigned to a given memory variable
Definition at line 106 of file memory.hpp.
Referenced by add_source_value().
|
private |
total amount of parameter memory
Definition at line 130 of file memory.hpp.
Referenced by add_parameter(), add_parameter_symbol(), get_allocated_parameters_memory(), and notEQ().
|
private |
total amount of internal memory allocated
Definition at line 127 of file memory.hpp.
Referenced by add_internal_symbol(), get_allocated_space(), and notEQ().
|
private |
data-structure containing tree information
Definition at line 70 of file memory.hpp.
Referenced by add_external_variable(), add_internal_symbol(), add_internal_variable(), compute_next_base_address(), get_last_address(), xwrite(), and xwrite2().
|
private |
true when LOADs or STOREs perform unaligned accesses
Definition at line 157 of file memory.hpp.
Referenced by has_unaligned_accesses(), and notEQ().
|
private |
Spec accesses data having an address unknown at compile time.
Definition at line 154 of file memory.hpp.
Referenced by has_unknown_addresses(), and notEQ().