PandA-2024.02
hls_manager.hpp
Go to the documentation of this file.
1 /*
2  *
3  * _/_/_/ _/_/ _/ _/ _/_/_/ _/_/
4  * _/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/
5  * _/_/_/ _/_/_/_/ _/ _/_/ _/ _/ _/_/_/_/
6  * _/ _/ _/ _/ _/ _/ _/ _/ _/
7  * _/ _/ _/ _/ _/ _/_/_/ _/ _/
8  *
9  * ***********************************************
10  * PandA Project
11  * URL: http://panda.dei.polimi.it
12  * Politecnico di Milano - DEIB
13  * System Architectures Group
14  * ***********************************************
15  * Copyright (C) 2004-2024 Politecnico di Milano
16  *
17  * This file is part of the PandA framework.
18  *
19  * The PandA framework is free software; you can redistribute it and/or modify
20  * it under the terms of the GNU General Public License as published by
21  * the Free Software Foundation; either version 3 of the License, or
22  * (at your option) any later version.
23  *
24  * This program is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27  * GNU General Public License for more details.
28  *
29  * You should have received a copy of the GNU General Public License
30  * along with this program. If not, see <http://www.gnu.org/licenses/>.
31  *
32  */
43 #ifndef HLS_MANAGER_HPP
44 #define HLS_MANAGER_HPP
45 
46 #include "application_manager.hpp"
47 #include "custom_map.hpp"
48 
49 #include "config_HAVE_TASTE.hpp"
50 
51 #include <boost/preprocessor/seq/for_each.hpp>
52 
53 #include <map>
54 #include <string>
55 
64 
65 #define ENUM_ID(r, data, elem) elem,
66 #define FUNC_ARCH_ATTR_ENUM (func_symbol)(func_name)(func_inline)(func_dataflow)(func_pipeline_style)(func_pipeline_ii)
67 #define FUNC_ARCH_PARM_ATTR_ENUM \
68  (parm_port)(parm_index)(parm_bundle)(parm_offset)(parm_includes)(parm_typename)(parm_original_typename)( \
69  parm_elem_count)(parm_size_in_bytes)
70 #define FUNC_ARCH_IFACE_ATTR_ENUM \
71  (iface_name)(iface_mode)(iface_direction)(iface_bitwidth)(iface_alignment)(iface_depth)(iface_register)( \
72  iface_cache_ways)(iface_cache_line_count)(iface_cache_line_size)(iface_cache_num_write_outstanding)( \
73  iface_cache_rep_policy)(iface_cache_bus_size)(iface_cache_write_policy)
74 
76 
78 {
79  public:
80  enum func_attr
81  {
83  };
84  static enum func_attr to_func_attr(const std::string& attr);
85 
86  enum parm_attr
87  {
89  };
90  static enum parm_attr to_parm_attr(const std::string& attr);
91 
93  {
95  };
96  static enum iface_attr to_iface_attr(const std::string& attr);
97 
98  using func_attrs = std::map<enum func_attr, std::string>;
99  using parm_attrs = std::map<enum parm_attr, std::string>;
100  using iface_attrs = std::map<enum iface_attr, std::string>;
101 
103  std::map<std::string, parm_attrs> parms;
104  std::map<std::string, iface_attrs> ifaces;
105 };
106 
109 {
110  public:
111  using FunctionArchitectures = std::map<std::string, FunctionArchitectureRef>;
112 
113  private:
115 
116  public:
117  ModuleArchitecture(const std::string& filename);
119 
120  FunctionArchitectures::const_iterator cbegin() const
121  {
122  return _funcArchs.cbegin();
123  }
124 
125  FunctionArchitectures::const_iterator cend() const
126  {
127  return _funcArchs.cend();
128  }
129 
130  FunctionArchitectures::const_iterator begin() const
131  {
132  return _funcArchs.begin();
133  }
134 
135  FunctionArchitectures::const_iterator end() const
136  {
137  return _funcArchs.end();
138  }
139 
140  FunctionArchitectures::iterator erase(FunctionArchitectures::const_iterator it)
141  {
142  return _funcArchs.erase(it);
143  }
144 
145  void AddArchitecture(const std::string& symbol, FunctionArchitectureRef arch);
146 
147  FunctionArchitectureRef GetArchitecture(const std::string& funcSymbol) const;
148 
149  void RemoveArchitecture(const std::string& funcSymbol);
150 };
151 
153 {
154  public:
157  using io_binding_type = std::tuple<unsigned int, unsigned int>;
158 
159  private:
162 
164  std::map<unsigned int, hlsRef> hlsMap;
165 
168 
170  unsigned int memory_version;
171 
172  public:
174  unsigned long long int base_address;
175 
178 
181 
184 
187 
190 
192  std::list<std::string> aux_files;
193 
195  std::list<std::string> hdl_files;
196 
197 #if HAVE_TASTE
198  const AadlInformationRef aadl_information;
200 #endif
201 
202  ModuleArchitectureRef module_arch;
203 
206  std::map<std::string, std::map<unsigned, std::map<std::string, std::list<unsigned>>>> design_interface_io;
207 
209  std::map<std::pair<std::string, std::string>, std::pair<unsigned, unsigned>> global_resource_constraints;
210 
214  HLS_manager(const ParameterConstRef Param, const HLS_deviceRef HLS_D);
215 
219  ~HLS_manager() override;
220 
224  hlsRef get_HLS(unsigned int funId) const;
225 
229  static hlsRef create_HLS(const HLS_managerRef HLSMgr, unsigned int functionId);
230 
234  HLS_deviceRef get_HLS_device() const;
235 
239  const BackendFlowRef get_backend_flow();
240 
244  std::string get_constant_string(unsigned int node, unsigned long long precision);
245 
249  void xwrite(const std::string& filename);
250 
254  std::vector<io_binding_type> get_required_values(unsigned int fun_id, const vertex& v) const;
255 
261  bool is_register_compatible(unsigned int var) const;
262 
268  bool is_reading_writing_function(unsigned funID) const;
269 
273  CustomOrderedSet<hlsRef> GetAllImplementations() const;
274 
278  bool IsSingleWriteMemory() const;
279 
284  unsigned int GetMemVersion() const;
285 
290  unsigned int UpdateMemVersion();
291 
293  static void check_bitwidth(unsigned long long prec);
294 };
298 
299 #endif
SimulationInformationRef RSim
information about the simulation
std::map< std::pair< std::string, std::string >, std::pair< unsigned, unsigned > > global_resource_constraints
global resource constraints
FunctionArchitectures::const_iterator end() const
CustomMap< std::string, double > evaluations
Evaluations.
std::string filename
#define FUNC_ARCH_PARM_ATTR_ENUM
Definition: hls_manager.hpp:67
Definition of the class representing a generic C application.
std::map< enum parm_attr, std::string > parm_attrs
Definition: hls_manager.hpp:99
BackendFlowRef back_flow
reference to the data-structure implementing the backend flow
std::map< enum iface_attr, std::string > iface_attrs
std::list< std::string > hdl_files
The HDL files.
CustomOrderedMap< T, U > CustomMap
Definition: custom_map.hpp:167
static enum func_attr to_func_attr(const std::string &attr)
redefinition of map to manage ordered/unordered structures
std::tuple< unsigned int, unsigned int > io_binding_type
tuple set used to represent the required values or the constant default value associated with the inp...
std::map< std::string, std::map< unsigned, std::map< std::string, std::list< unsigned > > > > design_interface_io
store the design interface read/write references of parameters: function_name->bb_index->parameter_na...
HLS_deviceRef HLS_D
information about the target device/technology for the synthesis
unsigned int memory_version
The version of memory representation on which this step was applied.
#define FUNC_ARCH_IFACE_ATTR_ENUM
Definition: hls_manager.hpp:70
memoryRef Rmem
information about memory allocation
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
Definition: graph.hpp:1303
FunctionArchitectures::const_iterator cend() const
struct definition of the field attr on function_decl, field_decl, var_decl tree node.
Definition: tree_node.hpp:774
#define ENUM_ID(r, data, elem)
Definition: hls_manager.hpp:65
std::map< std::string, parm_attrs > parms
unsigned long long int base_address
base address for memory space addressing
FunctionArchitectures::const_iterator begin() const
static enum iface_attr to_iface_attr(const std::string &attr)
#define FUNC_ARCH_ATTR_ENUM
Definition: hls_manager.hpp:66
std::map< std::string, iface_attrs > ifaces
REF_FORWARD_DECL(AadlInformation)
std::map< unsigned int, hlsRef > hlsMap
map between the function id and the corresponding HLS data-structure
FunctionArchitectures::iterator erase(FunctionArchitectures::const_iterator it)
std::list< std::string > aux_files
The auxiliary files.
FunctionArchitectures::const_iterator cbegin() const
Data structure that contains all information about high level synthesis process.
Definition: hls.hpp:83
long HLS_execution_time
HLS execution time.
ModuleArchitectureRef module_arch
FunctionArchitectures _funcArchs
static enum parm_attr to_parm_attr(const std::string &attr)
functionsRef Rfuns
information about function allocation
std::map< enum func_attr, std::string > func_attrs
Definition: hls_manager.hpp:98
std::map< std::string, FunctionArchitectureRef > FunctionArchitectures

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