73 std::map<unsigned int, memory_symbolRef>
external;
76 std::map<unsigned int, std::map<unsigned int, memory_symbolRef>>
internal;
87 std::map<unsigned int, memory_symbolRef>
in_vars;
90 std::map<unsigned int, unsigned long long int>
rangesize;
93 std::map<unsigned int, std::map<unsigned int, memory_symbolRef>>
parameter;
95 std::map<unsigned int, memory_symbolRef>
params;
201 bool null_pointer_check,
bool initial_internal_address_p,
unsigned long long initial_internal_address,
202 const unsigned int& _bus_addr_bitsize);
210 unsigned long long int _off_base_address,
unsigned int max_bram,
211 bool _null_pointer_check,
bool initial_internal_address_p,
212 unsigned int initial_internal_address,
const unsigned int& _address_bitsize);
250 unsigned long long int alignment)
const;
319 return source_values[var];
325 void add_parameter(
unsigned int funID_scope,
unsigned int var,
const std::string& var_name,
bool is_last);
366 bool is_parameter(
unsigned int funID_scope,
unsigned int var)
const;
399 unsigned long long int get_base_address(
unsigned int var,
unsigned int funId)
const;
437 return n_mem_operations_per_var.find(var)->second;
442 if(n_mem_operations_per_var.find(var) == n_mem_operations_per_var.end())
444 n_mem_operations_per_var[var] = 1;
448 ++n_mem_operations_per_var[var];
500 std::map<unsigned int, memory_symbolRef>
get_function_vars(
unsigned int funID_scope)
const;
552 bus_data_bitsize = bitsize;
568 bus_size_bitsize = bitsize;
584 bram_bitsize = bitsize;
600 maxbram_bitsize = bitsize;
616 intern_shared_data = has_accesses;
634 maximum_references[var] = n_refs;
644 return maximum_references.find(var) != maximum_references.end() ? maximum_references.find(var)->second : 0;
654 maximum_loads[var] = n_refs;
664 return maximum_loads.find(var) != maximum_loads.end() ? maximum_loads.find(var)->second : 0;
673 need_bus.insert(var);
683 return need_bus.find(var) != need_bus.end();
690 use_unknown_addresses = accesses;
705 unaligned_accesses = accesses;
721 all_pointers_resolved = resolved;
738 packed_vars = packed_vars || packed;
754 implicit_memcpy = cond;
822 enable_hls_bit_value =
value;
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...
unsigned long long int off_base_address
it represents the base address of the external memory
unsigned long long int next_base_address
it represents the next address that is available for internal allocation
void reserve_space(unsigned long long space)
Explicitly allocate a certain space in the external memory.
void xwrite(xml_element *node)
Writes the current memory allocation into an XML description.
unsigned int count_non_private_internal_symbols() const
unsigned long long int get_next_internal_base_address() const
Returns next free address of memory allocated internally but not private.
bool null_pointer_check
when false object could be allocated starting from address 0
void set_bram_bitsize(unsigned long long bitsize)
set the BRAM bitsize
std::map< unsigned int, memory_symbolRef > external
set of variables allocated outside the top module
std::map< unsigned int, memory_symbolRef > get_function_parameters(unsigned int funID_scope) const
Return parameters allocated in register of the interface.
void set_bus_size_bitsize(unsigned long long bitsize)
set the bus size bitsize
unsigned int get_maxbram_bitsize() const
return the BRAM bitsize
std::map< unsigned int, memory_symbolRef > callSites
set of call sites for __builtin_wait_call
bool is_parameter(unsigned int funID_scope, unsigned int var) const
Test if a variable is into the set of interface registers.
void set_implicit_memcpy(bool cond)
define if there exist an implicit call of memcpy
unsigned long long int get_parameter_base_address(unsigned int funId, unsigned int var) const
Get the current base address of the given variable.
bool get_enable_hls_bit_value()
unsigned long long external_base_address_alignment
external address alignment
bool does_need_addr(unsigned int var) const
check if a load or a store of the variable is done trough the bus
void add_parm_decl_stored(unsigned int var)
add a parm_decl to the set of parm_decl that has to be initialized
This class manages the tree structures extracted from the raw file.
bool has_sds_var(unsigned int var) const
return true if the var has been classified in term of same data size relation
bool implicit_memcpy
when true an implicit memcpy is called
std::map< unsigned int, unsigned long long int > rangesize
for each var store the address space rangesize associated with it
This class manages the circuit structures.
bool notEQ(refcount< memory > ref) const
return true in case the current memory object and the passed one are different
const CustomOrderedSet< unsigned int > & get_source_values(unsigned int var)
return the set of values used to write a given memory variable
CustomOrderedSet< unsigned int > private_memories
store the objects that does not need to be attached to the bus
unsigned long long get_parameter_alignment() const
return the parameter alignment
bool is_read_only_variable(unsigned var) const
return true when the variable is only read
void set_sds_var(unsigned int var, bool value)
set if a variable is always accessed with the same data size or not
bool has_external_base_address(unsigned int var) const
Check if there is a base address for the given variable.
bool has_packed_vars() const
unsigned long long get_allocated_space() const
Returns the amount of memory allocated internally to the module.
const tree_managerConstRef TreeM
data-structure containing tree information
std::map< unsigned int, CustomOrderedSet< unsigned int > > source_values
ssa_names assigned to a given memory variable
unsigned long long get_bus_size_bitsize() const
return the bitsize of the size bus
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.
size_t get_maximum_references(unsigned int var) const
return the maximum number of references for a given variable
CustomOrderedSet< unsigned int > parm_decl_copied
parm_decl that has to be copied from the caller
virtual ~memory()
Destructor.
bool has_implicit_memcpy() const
return true in case the specification has an implicit call of memcpy
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.
bool has_intern_shared_data() const
return true in case the specification has data that can be externally accessed
const CustomOrderedSet< unsigned int > & get_proxied_internal_variables(unsigned int funID_scope) const
return the proxied internal variables associated with the function
unsigned long long int get_base_address(unsigned int var, unsigned int funId) const
Get the current base address of the given variable.
unsigned long long get_external_base_address(unsigned int var) const
Get the current base address of the given variable.
CustomOrderedSet< unsigned int > actual_parm_loaded
actual parameter that has to be loaded from a stored value
redefinition of map to manage ordered/unordered structures
bool is_external_variable(unsigned int var) const
Test if a variable is into the set of variables out of the top function.
bool is_a_proxied_variable(unsigned int var) const
return true if the variable is a proxied variable
const unsigned int & bus_addr_bitsize
std::map< unsigned int, memory_symbolRef > in_vars
set of all the internal variables
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.
unsigned long long get_callSite_base_address(unsigned int var) const
Get the current base address of the given call site.
CustomOrderedSet< unsigned int > parm_decl_stored
parm_decl storage has to be initialized from the formal parameter
void set_bus_data_bitsize(unsigned long long bitsize)
set the bus data bitsize
bool enable_hls_bit_value
unsigned long long get_allocated_parameters_memory() const
Return the total amount of memory allocated for the memory mapped parameters.
unsigned long long get_first_address(unsigned int funId) const
Get the first address of the function address space.
REF_FORWARD_DECL(application_manager)
void set_all_pointers_resolved(bool resolved)
define if all pointers have statically resolved
bool all_pointers_resolved
is true when all pointers are resolved statically
unsigned long long get_rangesize(unsigned int var) const
return the address space rangesize associated with the given var
void add_read_only_variable(unsigned var)
add a read only variable
void increment_n_mem_operations(unsigned int var)
void add_private_memory(unsigned int var)
add a var that safely cannot be attached to the bus
memory_symbolRef get_symbol(unsigned int var, unsigned int funId) const
Return the symbol associated with the given variable.
void xwrite2(xml_element *node)
Writes the current memory allocation into an XML description.
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)
unsigned long long int total_amount_of_parameter_memory
total amount of parameter memory
const unsigned long long parameter_alignment
parameter alignment
std::map< unsigned int, size_t > maximum_loads
define for each variable the number of loads whenever it is possible
const std::map< unsigned int, memory_symbolRef > get_callSites() const
Get call sites map.
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 ...
unsigned long long get_bus_data_bitsize() const
return the bitsize of the data bus
void set_maximum_loads(unsigned int var, size_t n_refs)
define the maximum number of loads for a given variable
unsigned long long internal_base_address_alignment
internal address alignment
std::map< unsigned int, memory_symbolRef > params
set of all the internal parameters
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.
redefinition of set to manage ordered/unordered structures
unsigned int maxbram_bitsize
maximum bram bitsize
unsigned long long int get_internal_base_address(unsigned int var) const
Get the current base address of the given variable.
bool has_unaligned_accesses() const
return true in case of unaligned accesses
bool has_parameter_base_address(unsigned int var, unsigned int funId) const
Check if there is a base address for the given parameter.
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 ...
bool is_parm_decl_copied(unsigned int var) const
return true in case the parm_decl parameter has to be copied from the caller
std::map< unsigned int, CustomOrderedSet< unsigned int > > internal_variable_proxy
set of variable proxies accessed by a function
unsigned long long bus_data_bitsize
bus data bitsize
bool is_private_memory(unsigned int var) const
Return true in case the variable is private.
void set_unaligned_accesses(bool accesses)
set if LOADs or STOREs perform unaligned accesses
void set_packed_vars(bool packed)
update the the packed variables status
void set_maximum_references(unsigned int var, size_t n_refs)
define the maximum number of references for a given variable
void set_enable_hls_bit_value(bool value)
bool has_unknown_addresses() const
return true in case the specification use addresses not known at compile time
unsigned long long get_bram_bitsize() const
return the BRAM bitsize
bool has_all_pointers_resolved() const
return true in case all pointers have been statically resolved
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.
Template definition of refcount.
std::map< unsigned int, size_t > maximum_references
define for each variable the number of references whenever it is possible
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...
unsigned long long bus_size_bitsize
bus size bitsize
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.
void add_source_value(unsigned int var, unsigned int value)
add a value to the set of values written in a given memory variable
void add_parm_decl_copied(unsigned int var)
add a parm_decl to the set of parm_decl written
bool has_base_address(unsigned int var) const
Check if there is a base address for the given variable.
void set_intern_shared_data(bool has_accesses)
define if the Spec has data that can be externally accessed
bool is_sds_var(unsigned int var) const
check if the variable is always accessed with the same data size
CustomOrderedSet< unsigned int > read_only_vars
unsigned long long int get_max_address() const
return the maximum address allocated
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 ...
unsigned long long get_memory_address() const
Return the first memory address not yet allocated.
unsigned long long get_internal_base_address_alignment() const
return the internal base address alignment.
bool use_unknown_addresses
Spec accesses data having an address unknown at compile time.
CustomOrderedSet< unsigned int > need_bus
define for each variable the number of loads whenever it is possible
unsigned long long int maximum_private_memory_size
is the maximum amount of private memory allocated
unsigned int get_n_mem_operations(unsigned int var) const
std::map< unsigned int, unsigned int > n_mem_operations_per_var
number of LOAD/STORE per var
bool has_internal_base_address(unsigned int var) const
Check if there is a base address for the given variable.
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.
CustomOrderedSet< unsigned int > proxied_variables
is the set of proxied variables
unsigned long long int get_allocated_internal_memory() const
Returns the amount of memory allocated internally but not private.
unsigned long long int total_amount_of_private_memory
total amount of internal memory allocated
unsigned long long get_last_address(unsigned int funId, const application_managerRef AppM) const
Get the last address of the function address space.
bool packed_vars
true when packed vars are used
unsigned long long int internal_base_address_start
is the start internal address
void set_maxbram_bitsize(unsigned int bitsize)
set the maximum BRAM bitsize
bool is_actual_parm_loaded(unsigned int var) const
return true in case the actual parameter has to be initialized from a stored value ...
bool is_internal_variable(unsigned int funID_scope, unsigned int var) const
Test if a variable is allocated into the specified function.
unsigned long long bram_bitsize
bram bitsize
bool intern_shared_data
define if the Spec has data that can be externally accessed
void reserve_internal_space(unsigned long long int space)
Explicitly allocate a certain space in the internal memory.
bool has_callSite_base_address(unsigned int var) const
Check if there is a base address for the given call site.
bool has_proxied_internal_variables(unsigned int funID_scope) const
check if the function has proxied variables
std::map< unsigned int, memory_symbolRef > get_ext_memory_variables() const
Return variables allocated out of the top module.
void set_internal_base_address_alignment(unsigned long long _internal_base_address_alignment)
set the internal base address alignment
void add_need_bus(unsigned int var)
the variable is read or written through the bus
Base object for all the structural objects.
bool unaligned_accesses
true when LOADs or STOREs perform unaligned accesses
std::map< unsigned int, std::map< unsigned int, memory_symbolRef > > parameter
set of variables allocated in registers of the interface
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.
CONSTREF_FORWARD_DECL(tree_manager)
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.
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 ...
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
size_t get_maximum_loads(unsigned int var) const
return the maximum number of loads for a given variable
void add_internal_variable_proxy(unsigned int funID_scope, unsigned int var)
allocate a proxy for the variable for the specified function