PandA-2024.02
library_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  */
45 #ifndef _LIBRARY_MANAGER_HPP
46 #define _LIBRARY_MANAGER_HPP
47 
48 #include "refcount.hpp"
49 #include <boost/lexical_cast.hpp>
50 
62 class xml_element;
64 
65 #include "custom_set.hpp"
66 #include <map>
67 #include <string>
68 #include <vector>
69 
70 struct attribute
71 {
72  public:
73  using value_t = enum { FLOAT64 = 0, BOOLEAN, INT32, STRING };
74 
75  private:
76  std::string content;
77 
78  value_t value_type{FLOAT64};
79 
80  std::vector<attributeRef> content_list;
81 
82  public:
83  attribute(const value_t _value_type, std::string _content);
84 
85  attribute(const std::string& _value_type, std::string _content);
86 
87  explicit attribute(const std::vector<attributeRef>& _content);
88 
89  std::string get_value_type_str() const;
90 
91  std::string get_content_str() const;
92 
93  bool has_list() const;
94 
95  unsigned int get_value_type() const;
96 
97  template <class G>
98  G get_content() const
99  {
100  return boost::lexical_cast<G>(content);
101  }
102 
103  const std::vector<attributeRef>& get_content_list() const
104  {
105  return content_list;
106  }
107 
108  static void xload(const xml_element* EnodeC, std::vector<std::string>& ordered_attributes,
109  std::map<std::string, attributeRef>& attributes);
110 
111  void xwrite(xml_element* xml_node, const std::string& name);
112 };
114 
119 {
120  public:
122  using fu_map_type = std::map<std::string, technology_nodeRef>;
123 
128  using info_t = enum {
130  XML,
131  };
133 
134  private:
137 
139  std::string name;
140 
143 
144  std::vector<std::string> ordered_attributes;
145 
147  std::map<std::string, attributeRef> attributes;
148 
150  std::map<unsigned int, std::string> info;
151 
153  bool is_std;
154 
158  void set_default_attributes();
159 
161 
162  public:
167  library_manager(ParameterConstRef Param, bool std = true);
169 
170  library_manager(std::string library_name, ParameterConstRef Param, bool std = true);
171 
173  ~library_manager();
175 
181  bool is_virtual() const;
182 
186  void set_dont_use(const std::string& name);
187 
191  void remove_dont_use(const std::string& name);
192 
196  CustomOrderedSet<std::string> get_dont_use_cells() const;
197 
198  size_t get_dont_use_num() const;
199 
200  void set_info(unsigned int type, const std::string& information);
201 
202  bool is_info(unsigned int type) const;
203 
204  void erase_info();
205 
206  static void xload(const xml_element* node, const library_managerRef& LM, const ParameterConstRef& Param);
207 
208  void xwrite(xml_element* rootnode);
209 
210  std::string get_library_name() const;
211 
212  void add(const technology_nodeRef& node);
213 
214  void update(const technology_nodeRef& node);
215 
216  bool is_fu(const std::string& name) const;
217 
218  technology_nodeRef get_fu(const std::string& name) const;
219 
220  void remove_fu(const std::string& name);
221 
222  size_t get_gate_count() const;
223 
230  {
231  return fu_map;
232  }
233 };
234 
237 
238 #endif
std::string get_value_type_str() const
bool has_list() const
unsigned int get_value_type() const
const std::vector< attributeRef > & get_content_list() const
std::map< std::string, attributeRef > attributes
attributes of the library
const fu_map_type & get_library_fu() const
Return the list of the resources contained into the given library.
std::vector< attributeRef > content_list
bool is_std
flag to check if the library is standard (i.e., provided in input) or virtual
std::string content
Definition of hash function for EdgeDescriptor.
Definition: graph.hpp:1321
std::string name
string identifier of the library
G get_content() const
fu_map_type fu_map
data-structure to identify the units that are contained into the library
CONSTREF_FORWARD_DECL(Parameter)
RefCount type definition of the class containing all the parameters.
unsigned int INT32
Definition: sha.h:28
void xwrite(xml_element *xml_node, const std::string &name)
redefinition of set to manage ordered/unordered structures
enum { XML, } info_t
available information for the library
CustomOrderedSet< std::string > dont_use
Template definition of refcount.
std::map< std::string, technology_nodeRef > fu_map_type
typedef for the identification of the functional units contained into the library ...
REF_FORWARD_DECL(library_manager)
RefCount type definition of the library_manager class structure.
This class manages the specific library structure.
void add(int accelnum, int startidx, int endidx)
Definition: add.c:11
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Definition: refcount.hpp:94
std::map< unsigned int, std::string > info
files that provide information about the library
std::string get_content_str() const
value_t value_type
static void xload(const xml_element *EnodeC, std::vector< std::string > &ordered_attributes, std::map< std::string, attributeRef > &attributes)
attribute(const value_t _value_type, std::string _content)
std::vector< std::string > ordered_attributes
void update(int b[SIZE], int bucket[BUCKETSIZE], int a[SIZE], int exp)
Definition: sort.c:63
Abstract pure class for the technology structure.
const ParameterConstRef Param
class containing all the parameters
enum { FLOAT64=0, BOOLEAN, INT32, STRING } value_t

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