43 #include "config_HAVE_CIRCUIT_BUILT.hpp" 94 std::string supported_types_string;
96 std::vector<std::string> types =
SplitString(supported_types_string,
"|");
97 for(
const auto&
type : types)
101 THROW_ERROR(
"wrong XML syntax for supported_types attribute: null type description in \"" +
104 std::string type_name;
105 std::vector<unsigned int> type_precs;
107 if(type_name_to_precs.size() != 2)
109 THROW_ERROR(
"wrong XML syntax for supported_types attribute around \":\" \"" +
type +
"\" [" +
112 type_name = type_name_to_precs[0];
115 THROW_ERROR(
"wrong XML syntax for supported_types attribute: missing the supported type - \"" +
type +
119 if(type_name_to_precs[1] !=
"*")
121 std::vector<std::string> precs =
SplitString(type_name_to_precs[1],
",");
123 for(
auto single_prec = precs.begin(); single_prec != precs.end() && *single_prec !=
""; ++single_prec)
125 auto type_uint =
static_cast<unsigned>(std::stoul(*single_prec));
126 type_precs.push_back(type_uint);
147 if(
CE_XVM(execution_time, Enode))
151 if(
CE_XVM(initiation_time, Enode))
159 if(
CE_XVM(stage_period, Enode))
163 bool synthesis_dependent =
false;
164 if(
CE_XVM(synthesis_dependent, Enode))
166 LOAD_XVM(synthesis_dependent, Enode);
168 if(synthesis_dependent && cycles)
170 double clock_period = GetPointer<functional_unit>(fu)->get_clock_period();
171 if(clock_period == 0.0)
175 double clock_period_resource_fraction = GetPointer<functional_unit>(fu)->get_clock_period_resource_fraction();
176 execution_time = cycles * clock_period * clock_period_resource_fraction;
179 const ControlStep ii(initiation_time);
184 for(
const auto& iter_int : list_int)
186 const auto* EnodeC = GetPointer<const xml_element>(iter_int);
213 std::string supported_types_string;
214 for(
auto it = it_begin; it != it_end; ++it)
218 supported_types_string +=
"|";
220 supported_types_string += it->first +
":";
221 if(it->second.size() == 0)
223 supported_types_string +=
"*";
227 auto prec_end = it->second.end();
228 auto prec_begin = it->second.begin();
229 for(
auto prec_it = prec_begin; prec_it != prec_end; ++prec_it)
231 if(prec_it != prec_begin)
233 supported_types_string +=
",";
235 supported_types_string +=
STR(*prec_it);
239 if(supported_types_string !=
"")
292 os << (
commutative ?
" commutative" :
" non-commutative");
293 os << (
bounded ?
" bounded" :
" unbounded") <<
"]";
312 if(!supported_type->second.empty() && std::find(supported_type->second.begin(), supported_type->second.end(),
313 type_prec) == supported_type->second.end())
322 const std::vector<unsigned long long>& )
const 324 const auto max_prec = type_prec.empty() ? 0 : *max_element(type_prec.begin(), type_prec.end());
332 for(
auto supported_type_it =
supported_types.begin(); supported_type_it != supported_type_it_end;
339 result += supported_type_it->first;
345 : logical_type(
UNKNOWN), clock_period(0), clock_period_resource_fraction(1), characterization_timestamp()
362 THROW_ASSERT(_clock_period > 0.0,
"Clock period must be greater than zero");
367 std::vector<attributeRef> content;
380 std::vector<attributeRef> content;
397 std::ostream_iterator<const technology_nodeRef>(os,
""));
404 #if HAVE_CIRCUIT_BUILT 428 #if HAVE_CIRCUIT_BUILT 434 for(
const auto& iter_int : list_int)
436 const auto* EnodeC = GetPointer<const xml_element>(iter_int);
441 if(EnodeC->get_name() ==
"name")
446 THROW_ERROR(
"name is missing for " + EnodeC->get_name());
451 else if(EnodeC->get_name() ==
"template")
470 THROW_ERROR(
"characterizing_constant_value is missing for " + EnodeC->get_name());
474 THROW_ERROR(
"characterizing_constant_value is missing for " + EnodeC->get_name());
486 THROW_ERROR(
"memory_type is missing for " + EnodeC->get_name());
490 THROW_ERROR(
"memory_type is missing for " + EnodeC->get_name());
502 THROW_ERROR(
"channels_type is missing for " + EnodeC->get_name());
506 THROW_ERROR(
"channels_type is missing for " + EnodeC->get_name());
518 THROW_ERROR(
"memory_ctrl_type is missing for " + EnodeC->get_name());
522 THROW_ERROR(
"memory_ctrl_type is missing for " + EnodeC->get_name());
534 THROW_ERROR(
"bram_load_latency is missing for " + EnodeC->get_name());
538 THROW_ERROR(
"bram_load_latency is missing for " + EnodeC->get_name());
550 THROW_ERROR(
"component_timing_alias is missing for " + EnodeC->get_name());
554 THROW_ERROR(
"component_timing_alias is missing for " + EnodeC->get_name());
561 else if(EnodeC->get_name() ==
GET_CLASS_NAME(no_constant_characterization))
564 else if(EnodeC->get_name() ==
"operation")
568 else if(EnodeC->get_name() ==
"characterization_timestamp")
573 THROW_ERROR(
"Timestamp is missing for " + EnodeC->get_name());
577 THROW_ERROR(
"Timestamp is missing for " + EnodeC->get_name());
581 #if HAVE_CIRCUIT_BUILT 582 else if(EnodeC->get_name() ==
"circuit")
593 for(
const auto& iterC : listC)
595 const auto* EnodeCC = GetPointer<const xml_element>(iterC);
602 CM->get_circ()->xload(EnodeCC, CM->get_circ(), CM);
607 else if(EnodeC->get_name() ==
"attribute")
621 THROW_ERROR(
"functional_unit - not yet supported: " + EnodeC->get_name());
625 for(
const auto& iter_int : list_int)
627 const auto* EnodeC = GetPointer<const xml_element>(iter_int);
632 if(EnodeC->get_name() ==
"operation")
635 op_curr->
xload(EnodeC, fu, Param);
744 attr->xwrite(rootnode, ordered_attribute);
786 auto xml_characterization_timestamp = rootnode->
add_child_element(
"characterization_timestamp");
792 GetPointer<operation>(*it)->xwrite(rootnode, tn, Param);
796 #if HAVE_CIRCUIT_BUILT 797 if(CM && CM->get_circ())
799 CM->xwrite(rootnode, tn);
817 for(
const auto& iter_int : list_int)
819 const auto* EnodeC = GetPointer<const xml_element>(iter_int);
829 THROW_ERROR(
"specialization identifier is missing for " + EnodeC->get_name());
839 THROW_ERROR(
"specialization identifier is missing for " + EnodeC->get_name());
849 THROW_ERROR(
"specialization identifier is missing for " + EnodeC->get_name());
859 THROW_ERROR(
"specialization identifier is missing for " + EnodeC->get_name());
869 THROW_ERROR(
"specialization identifier is missing for " + EnodeC->get_name());
879 THROW_ERROR(
"specialization identifier is missing for " + EnodeC->get_name());
virtual std::string get_kind_text() const =0
Virtual function used to get the string name of a technology_node instance.
void set_clock_period(double _clock_period)
Sets the clock period adopted for the synthesis (0 means that it has been generated with unconstraine...
std::map< std::string, std::vector< unsigned int > > supported_types
supported types and precision of the operation, in form (name, list_of_prec).
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
void add(const technology_nodeRef &curr)
Add the given operation to the current functional_unit.
Collect information about resource area.
std::string bram_load_latency
Specify the bram load latency the functional unit is compliant with.
refcount< structural_type_descriptor > structural_type_descriptorRef
RefCount type definition of the structural_type_descriptor class structure.
File containing functions and utilities to support the printing of debug messagges.
#define PRINT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
Structure representing the most relevant information about the type of a structural object...
refcount< attribute > attributeRef
#define GET_CLASS(obj)
Macro returning the actual type of an object.
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.
Dest from_strongtype_cast(Source source)
std::string fu_template_parameters
Template parameters.
std::vector< std::string > ordered_attributes
list of attributes associated to the components
const std::vector< std::string > SplitString(const std::string &input, const std::string &separators)
Function which splits a string into tokens.
std::string fu_template_name
Name of the template.
operation_vec list_of_operation
At each functional unit can be associate several operations with different performances.
void print(std::ostream &os) const override
function that prints the class functional_unit.
void set_execution_time(double execution_time, unsigned int cycles=time_info::cycles_time_DEFAULT)
std::string functional_unit_name
name of the functional unit.
std::map< std::string, technology_nodeRef > op_name_to_op
Redefinition of get_kind_text()
This class manages the circuit structures.
virtual void print(std::ostream &os) const =0
Virtual function that prints the class.
exceptions managed by PandA
double clock_period_resource_fraction
clock period resource fraction
~operation() override
Destructor.
void print(std::ostream &os) const override
function that prints the class operation.
std::string bram_load_latency
Specify the bram load latency the functional unit is compliant with.
bool get_synthesis_dependent() const
bool primary_inputs_registered
true when the primary input of the functional unit are registered
Collect information about resource performance.
time_infoRef time_m
class representing the timing information associated with this operation
std::string channels_type
Specify the type of the channel the functional unit is compliant with.
#define CE_XVM(variable, node)
Check existence XML Value Macro. Check if an XML attribute is present in the XML tree.
void xwrite(xml_element *rootnode, const technology_nodeRef tn, const ParameterConstRef Param) override
Add a functional unit to an xml tree.
ControlStep get_initiation_time() const
void xload(const xml_element *Enode, const technology_nodeRef fu, const ParameterConstRef Param) override
Load a operation node starting from an xml file.
std::string get_type_supported_string() const
Returns the supported type as a string.
xml_text_node * add_child_text(const std::string &content)
Append a new text node.
void set_resource_value(value_t val, double num)
Class specification of the manager of the technology library data structures.
std::string characterizing_constant_value
Value used during the characterization of this instance.
bool no_constant_characterization
The template will not consider constants connected to the inputs during the module characterization...
This class specifies the characteristic of a particular functional unit.
std::string portsize_parameters
comma separed string with the parameter for different portsize values.
functional_unit()
Constructor.
TimeStamp characterization_timestamp
The timestamp of the characterization of this functional unit.
std::map< std::string, attributeRef > attributes
map between the attribute keys and the corresponding values
std::string memory_type
Specify the type of memory the functional unit is compliant with.
void set_stage_period(double st_per)
std::string channels_type
Specify the type of the channel the functional unit is compliant with.
refcount< technology_node > technology_nodeRef
refcount definition of the class
unsigned int get_cycles() const
#define STR(s)
Macro which performs a lexical_cast to a string.
Auxiliary methods for manipulating string.
void set_initiation_time(const ControlStep _initiation_time)
void xload(const xml_element *node, const technology_nodeRef fu, const ParameterConstRef Param) override
Load a functional unit starting from an xml file.
xml_nodeRef XML_description
pointer to the XML description of the cell
double get_resource_value(value_t val) const
technology_node()
Constructor.
This class specifies the characteristic of a particular operation working on a given functional unit...
area_infoRef area_m
This variable stores the resource information of the component.
static const double stage_period_DEFAULT
zero means that the operation last in ceil(execution_time/clock_period)
Class specification of the data structures used to manage technology information. ...
double get_area_value() const
Return the nominal value for the area of the component.
void xwrite(xml_element *rootnode, const technology_nodeRef tn, const ParameterConstRef Param) override
Add a operation node to an xml tree.
#define LOAD_XVFM(variable, node, field)
LOAD XML Value for field Macro. Set a variable starting from an XML value. Conversion is performed if...
std::string specialized
when non empty it defines with respect what the functional unit template has been specialized ...
static const unsigned int cycles_time_DEFAULT
zero means that the operation is not pipelined
double get_execution_time() const
bool bounded
flag to determine if the operation is bounded or not
size_t get_operations_num() const
Return the number of the operations that the functional unit can handle.
std::string characterizing_constant_value
Value used during the characterization of templates.
struct definition of the field attr on function_decl, field_decl, var_decl tree node.
bool is_type_supported(const std::string &type_name) const
Checks if the specified type name is supported.
#define GET_CLASS_NAME(meth)
Macro returning the name of a class.
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
std::string memory_ctrl_type
Specify the type of memory controller the functional unit is compliant with.
refcount< structural_manager > structural_managerRef
RefCount type definition of the structural_manager class structure.
static simple_indent PP
pretty print functor object used by all print members to indent the output of the print function...
static const double execution_time_DEFAULT
static const ControlStep initiation_time_DEFAULT
#define WRITE_XNVM2(name, value, node)
WRITE XML Name Value Macro second version. Insert a value in an XML tree given the name of the attrib...
bool commutative
property of commutativity
virtual ~technology_node()
Destructor.
virtual void xwrite(xml_element *rootnode, const technology_nodeRef tn, const ParameterConstRef Param)=0
Add a technology_node to an xml tree.
Very simple pretty printer functor.
~functional_unit() override
Destructor.
This class describes all classes used to represent a structural object.
functional_unit_template()
Constructor.
static area_infoRef factory(const ParameterConstRef &Param)
Factory method.
#define WRITE_XNVM(variable, value, node)
WRITE XML Name Value Macro.
technology_nodeRef get_operation(const std::string &op_name) const
This method returns the operationRef from its name if the functional unit contains an operation of ty...
std::string memory_ctrl_type
Specify the type of memory controller the functional unit is compliant with.
virtual const std::string & get_name() const =0
Return the name of the technology node.
#define WRITE_XVM(variable, node)
WRITE XML Value Macro. Insert a value in an XML tree.
void set_area_value(const double &_area_)
Set the nominal value for the area of the component.
std::string get_content() const
Get the text of this content node.
std::string memory_type
Specify the type of memory the functional unit is compliant with.
void xload(const xml_element *Enode, const technology_nodeRef tnd, const ParameterConstRef Param) override
Load a functional unit starting from an xml file.
this class is used to manage the command-line or XML options.
#define LOAD_XVM(variable, node)
LOAD XML Value Macro. Set a variable starting from an XML value. Conversion is performed if needed...
void set_clock_period_resource_fraction(double _clock_period_resource_fraction)
Sets the clock period resource fraction adopted for the synthesis.
The type used for timestamp.
Some macro used to interface with the XML library.
node_list const & get_children()
Obtain the list of child nodes.
Class implementation of the structural_manager.
This class describes a generic component.
void xwrite(xml_element *rootnode, const technology_nodeRef tn, const ParameterConstRef Param) override
Add a functional unit to an xml tree.
void print(std::ostream &os) const override
function that prints the class functional_unit.
Class specification of the manager for each library.
int debug_level
The debug level.
double get_stage_period() 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)
technology_nodeRef FU
Functional Unit.
std::string component_timing_alias
Specify that the functional unit has the same timing per operation it has the one specified by this f...
static time_infoRef factory(const ParameterConstRef Param)
xml_element * add_child_element(const std::string &name)
Add a child element to this node.
type_t logical_type
return the logical type of the cell
double clock_period
clock period adopted for the synthesis (in ns)
void set_synthesis_dependent(bool value)
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...