PandA-2024.02
functions.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  */
44 #ifndef FUNCTIONS_HPP
45 #define FUNCTIONS_HPP
46 
47 #include "refcount.hpp"
48 
50 
51 #include "custom_map.hpp"
52 #include "custom_set.hpp"
53 
54 class functions
55 {
57  std::map<unsigned int, CustomOrderedSet<std::string>> shared_function_proxy;
58 
60  std::map<std::string, unsigned int> proxied_functions;
61 
63  std::map<unsigned int, CustomOrderedSet<std::string>> shared_functions;
64 
65  public:
69  functions();
70 
74  virtual ~functions();
75 
81  void map_shared_function(unsigned int funID_scope, const std::string& fun);
82 
88  const CustomOrderedSet<std::string>& get_shared_functions(unsigned int funID_scope) const;
89 
95  bool has_shared_functions(unsigned int funID_scope) const;
96 
103  bool is_a_shared_function(unsigned int funID_scope, const std::string& fun) const;
104 
110  void add_shared_function_proxy(unsigned int funID_scope, const std::string& fun);
111 
117  const CustomOrderedSet<std::string>& get_proxied_shared_functions(unsigned int funID_scope) const;
118 
124  bool has_proxied_shared_functions(unsigned int funID_scope) const;
125 
132  bool is_a_proxied_shared_function(unsigned int funID_scope, const std::string& fun) const;
133 
139  bool is_a_proxied_function(const std::string& fun) const;
140 
146  unsigned int get_proxy_mapping(const std::string& fun) const;
147 
154  static std::string GetFUName(const std::string& fname, const HLS_managerRef HLSMgr);
155 
156  static std::string GetFUName(unsigned funID, const HLS_managerRef HLSMgr);
157 };
160 
161 #endif
const CustomOrderedSet< std::string > & get_shared_functions(unsigned int funID_scope) const
return the set of shared functions allocated in a given function.
Definition: functions.cpp:70
bool is_a_shared_function(unsigned int funID_scope, const std::string &fun) const
return true if a given function is a shared function allocated in a given function scope ...
Definition: functions.cpp:81
bool has_proxied_shared_functions(unsigned int funID_scope) const
check if the function has proxy shared functions
Definition: functions.cpp:97
redefinition of map to manage ordered/unordered structures
const CustomOrderedSet< std::string > & get_proxied_shared_functions(unsigned int funID_scope) const
return the proxied internal functions associated with the function
Definition: functions.cpp:91
std::map< std::string, unsigned int > proxied_functions
define where the proxied functions are mapped
Definition: functions.hpp:60
functions()
Constructor.
void map_shared_function(unsigned int funID_scope, const std::string &fun)
allocate a shared function in a specified function.
Definition: functions.cpp:62
redefinition of set to manage ordered/unordered structures
static std::string GetFUName(const std::string &fname, const HLS_managerRef HLSMgr)
Return FU used to implement given function.
Definition: functions.cpp:118
virtual ~functions()
Destructor.
Template definition of refcount.
unsigned int get_proxy_mapping(const std::string &fun) const
in case the function is a proxy function, it returns where the function is actually instantiated ...
Definition: functions.cpp:112
bool is_a_proxied_shared_function(unsigned int funID_scope, const std::string &fun) const
return true if a given function is a shared function allocated in a given function scope ...
Definition: functions.cpp:102
void add_shared_function_proxy(unsigned int funID_scope, const std::string &fun)
allocate a proxy for the function referred within a given function
Definition: functions.cpp:86
REF_FORWARD_DECL(HLS_manager)
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Definition: refcount.hpp:94
bool is_a_proxied_function(const std::string &fun) const
return true if the function is a proxied function
Definition: functions.cpp:107
std::map< unsigned int, CustomOrderedSet< std::string > > shared_function_proxy
set of function proxies called by a function
Definition: functions.hpp:57
int fun(float *A, float *invA, float *b, float *x, float *I)
bool has_shared_functions(unsigned int funID_scope) const
return true in case there are shared functions allocated in a given function.
Definition: functions.cpp:76
std::map< unsigned int, CustomOrderedSet< std::string > > shared_functions
reverse map of proxied_functions
Definition: functions.hpp:63

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