47 #include "config_HAVE_CIRCUIT_BUILT.hpp" 48 #include "config_HAVE_EXPERIMENTAL.hpp" 69 if(_value_type ==
"float64")
73 else if(_value_type ==
"boolean")
77 else if(_value_type ==
"int32")
81 else if(_value_type ==
"string")
87 THROW_ERROR(
"Not supported attribute type: " + _value_type);
140 std::map<std::string, attributeRef>& attributes)
144 std::vector<attributeRef> _content;
145 for(
const auto& iter_int : list_att)
147 const auto* EnodeC1 = GetPointer<const xml_element>(iter_int);
155 if(std::find(ordered_attributes.begin(), ordered_attributes.end(), att_name->
get_value()) ==
156 ordered_attributes.end())
158 ordered_attributes.push_back(att_name->
get_value());
160 if(!_content.empty())
212 int debug_level = Param->get_class_debug_level(
"library_manager");
214 auto output_level = Param->getOption<
int>(OPT_output_level);
216 for(
const auto& iter_int : list_int)
218 const auto* EnodeC = GetPointer<const xml_element>(iter_int);
223 if(EnodeC->get_name() ==
"information")
226 if(EnodeC->get_name() ==
"name")
231 else if(EnodeC->get_name() ==
"attribute")
235 else if(EnodeC->get_name() ==
"operating_conditions")
238 else if(EnodeC->get_name() ==
"wire_load")
241 else if(EnodeC->get_name() ==
"power_lut_template")
244 else if(EnodeC->get_name() ==
"lu_table_template")
247 else if(EnodeC->get_name() ==
"output_current_template")
250 else if(EnodeC->get_name() ==
"cell")
253 fu_curr->
xload(EnodeC, fu_curr, Param);
255 const auto cell_name = fu_curr->
get_name();
261 else if(EnodeC->get_name() ==
"template")
264 fut_curr->
xload(EnodeC, fut_curr, Param);
270 THROW_WARNING(
"library_manager - not yet supported: " + EnodeC->get_name());
277 unsigned int combinational = 0;
278 unsigned int others = 0;
279 unsigned int total = 0;
285 if(GetPointer<functional_unit>(l.second) ==
nullptr && GetPointer<functional_unit_template>(l.second))
290 if(GetPointer<functional_unit>(l.second)->logical_type == functional_unit::COMBINATIONAL)
317 attr->xwrite(library, ordered_attribute);
323 if(GetPointer<functional_unit>(f.second))
331 f.second->xwrite(xml_cell, f.second,
Param);
344 std::string _name = node->
get_name();
352 std::string _name = fu_node->
get_name();
355 if(!GetPointer<functional_unit>(node))
357 node = GetPointer<functional_unit_template>(node)->FU;
359 auto* current_fu = GetPointer<functional_unit>(fu);
362 current_fu = GetPointer<functional_unit>(GetPointer<functional_unit_template>(fu)->FU);
365 current_fu->ordered_attributes = GetPointer<functional_unit>(node)->
ordered_attributes;
366 current_fu->attributes = GetPointer<functional_unit>(node)->
attributes;
367 if(GetPointer<functional_unit>(node)->area_m)
369 current_fu->area_m = GetPointer<functional_unit>(node)->area_m;
372 for(
const auto& o : operations)
374 const operation* op = GetPointer<operation>(o);
379 GetPointer<operation>(op_fu)->time_m = op->
time_m;
381 if(GetPointer<functional_unit_template>(fu_node))
385 if(GetPointer<functional_unit_template>(fu_node))
389 GetPointer<operation>(op_fu)->bounded = op->
bounded;
390 #
if HAVE_EXPERIMENTAL
392 GetPointer<operation>(op_fu)->power_m = op->power_m;
396 #if HAVE_CIRCUIT_BUILT 397 if(GetPointer<functional_unit>(node) && GetPointer<functional_unit>(node)->CM)
400 current_fu->CM = GetPointer<functional_unit>(node)->CM;
403 if(GetPointer<functional_unit_template>(fu_node) &&
404 !GetPointer<functional_unit_template>(fu_node)->specialized.empty())
406 GetPointer<functional_unit_template>(fu)->specialized =
407 GetPointer<functional_unit_template>(fu_node)->specialized;
409 if((GetPointer<functional_unit>(node) && !GetPointer<functional_unit>(node)->fu_template_name.empty()) ||
410 GetPointer<functional_unit_template>(fu_node))
412 current_fu->fu_template_name = GetPointer<functional_unit>(node)->fu_template_name;
414 if((GetPointer<functional_unit>(node) && !GetPointer<functional_unit>(node)->fu_template_parameters.empty()) ||
415 GetPointer<functional_unit_template>(fu_node))
417 current_fu->fu_template_parameters = GetPointer<functional_unit>(node)->fu_template_parameters;
419 if((GetPointer<functional_unit>(node) &&
420 !GetPointer<functional_unit>(node)->characterizing_constant_value.empty()) ||
421 GetPointer<functional_unit_template>(fu_node))
423 current_fu->characterizing_constant_value = GetPointer<functional_unit>(node)->characterizing_constant_value;
425 if((GetPointer<functional_unit>(node) && !GetPointer<functional_unit>(node)->memory_type.empty()) ||
426 GetPointer<functional_unit_template>(fu_node))
428 current_fu->memory_type = GetPointer<functional_unit>(node)->memory_type;
430 if((GetPointer<functional_unit>(node) && !GetPointer<functional_unit>(node)->channels_type.empty()) ||
431 GetPointer<functional_unit_template>(fu_node))
433 current_fu->channels_type = GetPointer<functional_unit>(node)->channels_type;
435 if((GetPointer<functional_unit>(node) && !GetPointer<functional_unit>(node)->memory_ctrl_type.empty()) ||
436 GetPointer<functional_unit_template>(fu_node))
438 current_fu->memory_ctrl_type = GetPointer<functional_unit>(node)->memory_ctrl_type;
440 if((GetPointer<functional_unit>(node) && !GetPointer<functional_unit>(node)->bram_load_latency.empty()) ||
441 GetPointer<functional_unit_template>(fu_node))
443 current_fu->bram_load_latency = GetPointer<functional_unit>(node)->bram_load_latency;
446 THROW_ASSERT(current_fu->characterization_timestamp <= GetPointer<functional_unit>(node)->characterization_timestamp,
447 STR(current_fu->characterization_timestamp) +
" vs " +
448 STR(GetPointer<functional_unit>(node)->characterization_timestamp));
449 current_fu->characterization_timestamp = GetPointer<functional_unit>(node)->characterization_timestamp;
454 return fu_map.count(_name);
465 return static_cast<unsigned int>(
fu_map.size());
480 return info.find(type) !=
info.end();
514 return static_cast<unsigned int>(
dont_use.size());
std::string get_value_type_str() const
Input function used to read the technology data structures.
std::string get_value() const
Get the value of this attribute.
void remove_dont_use(const std::string &name)
Set a cell to be used.
unsigned int get_value_type() const
Collect information about resource area.
std::map< std::string, attributeRef > attributes
attributes of the library
File containing functions and utilities to support the printing of debug messagges.
std::vector< attributeRef > content_list
refcount< attribute > attributeRef
bool is_std
flag to check if the library is standard (i.e., provided in input) or virtual
std::string pipe_parameters
comma separated string with the parameter for the different implementation of the pipeline...
std::string operation_name
name of the operation mappen on a given functional unit.
void remove_fu(const std::string &name)
technology_nodeRef get_fu(const std::string &name) const
void set_info(unsigned int type, const std::string &information)
bool is_virtual() const
Check if the library is virtual or not.
exceptions managed by PandA
static void xload(const xml_element *node, const library_managerRef &LM, const ParameterConstRef &Param)
void xwrite(xml_element *rootnode)
time_infoRef time_m
class representing the timing information associated with this operation
Definition of hash function for EdgeDescriptor.
xml_text_node * add_child_text(const std::string &content)
Append a new text node.
This class specifies the characteristic of a particular functional unit.
std::string portsize_parameters
comma separed string with the parameter for different portsize values.
void add(const technology_nodeRef &node)
std::string name
string identifier of the library
#define OUTPUT_LEVEL_MINIMUM
minimum debugging print is performed.
refcount< technology_node > technology_nodeRef
refcount definition of the class
#define THROW_WARNING(str_expr)
helper function used to throw a warning in a standard way: though it uses PRINT_DBG_MEX, the debug level used is such that the message is always printed
#define STR(s)
Macro which performs a lexical_cast to a string.
void update(const technology_nodeRef &node)
fu_map_type fu_map
data-structure to identify the units that are contained into the library
void set_dont_use(const std::string &name)
Set a cell to be not used.
This class specifies the characteristic of a particular operation working on a given functional unit...
Class specification of the data structures used to manage technology information. ...
void xwrite(xml_element *xml_node, const std::string &name)
bool bounded
flag to determine if the operation is bounded or not
size_t get_dont_use_num() const
~library_manager()
Destructor.
CustomOrderedSet< std::string > dont_use
xml_attribute * get_attribute(const std::string &name) const
Obtain the attribute with this name.
struct definition of the field attr on function_decl, field_decl, var_decl tree node.
std::list< xml_nodeRef > node_list
type for list of xml nodes
#define THROW_ERROR(str_expr)
helper function used to throw an error in a standard way
CustomOrderedSet< std::string > get_dont_use_cells() const
Return the cells not to be used for the synthesis.
This class describe a functional unit template.
bool is_fu(const std::string &name) const
virtual const std::string & get_name() const =0
Return the name of the technology node.
xml_text_node * get_child_text()
Get the first child text content node.
std::string get_content() const
Get the text of this content node.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
void set_default_attributes()
Set the default attributes for the library.
std::map< unsigned int, std::string > info
files that provide information about the library
library_manager(ParameterConstRef Param, bool std=true)
Constructor.
this class is used to manage the command-line or XML options.
std::string get_content_str() const
node_list const & get_children()
Obtain the list of child nodes.
std::string get_library_name() const
Class specification of the manager for each library.
#define PRINT_OUT_MEX(profLevel, curprofLevel, mex)
#define OUTPUT_LEVEL_VERBOSE
verbose debugging print is performed.
std::vector< technology_nodeRef > operation_vec
Type definition of a vector of functional_unit.
bool is_info(unsigned int type) const
virtual void xload(const xml_element *Enode, const technology_nodeRef owner, const ParameterConstRef Param)=0
Load a technology_node starting from an xml file.
static void convert_escaped(std::string &ioString)
Convert escaped characters.
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)
#define DEBUG_LEVEL_VERBOSE
verbose debugging print is performed.
std::vector< std::string > ordered_attributes
xml_element * add_child_element(const std::string &name)
Add a child element to this node.
size_t get_gate_count() const
xml_attribute * set_attribute(const std::string &name, const std::string &value)
Set the value of the attribute with this name, and optionally with this namespace.
const ParameterConstRef Param
class containing all the parameters
enum { FLOAT64=0, BOOLEAN, INT32, STRING } value_t
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...