![]() |
PandA-2024.02
|
Data structure used to store all the HLS constraints. More...
#include <hls_constraints.hpp>

Public Member Functions | |
| HLS_constraints (const ParameterConstRef &Param, std::string _fun_name) | |
| Constructor. More... | |
| std::string | get_function_name () const |
| Gets the name of the function which the constraints are associated with. More... | |
| void | add_builtin_constraints () |
| Adds the builtin constraints. More... | |
| void | read_HLS_constraints_File (const std::string &f) |
| Reads an XML file describing the structural data structures. More... | |
| void | write_HLS_constraints_File (const std::string &f) |
| Writes an XML file describing the high level synthesis constraints data structure. More... | |
| void | set_number_fu (const std::string &name, const std::string &library, unsigned int n_resources=std::numeric_limits< unsigned int >::max()) |
| Sets the maximum number of resources available in the design. More... | |
| unsigned int | get_number_fu (const std::string &name, const std::string &library) const |
| This method returns the maximum number of functional units available for the design. More... | |
| unsigned int | get_number_fu (const std::string &combined) const |
| This method returns the maximum number of functional units available for the design. More... | |
| void | bind_vertex_to_fu (const std::string &vertex_name, const std::string &fu_name, const std::string &fu_library, const unsigned int fu_index) |
| Binds a vertex to a functional unit. More... | |
| bool | has_binding_to_fu (const std::string &vertex_name) const |
| Binds a vertex to a functional unit. More... | |
| void | set_scheduling_priority (const std::string &vertex_name, int Priority) |
| Stores the priority value for an operation vertex. More... | |
| CustomMap< std::string, int > | get_scheduling_priority () const |
| Returns the data structure containing scheduling priority constraints. More... | |
| void | set_clock_period (double period) |
| Sets the clock period. More... | |
| double | get_clock_period () const |
| Gets the clock period. More... | |
| double | get_clock_period_resource_fraction () const |
| Gets the resource fraction of the clock period. More... | |
| void | set_max_registers (unsigned int n_resources) |
| Sets the number of registers present in the function. More... | |
| unsigned int | get_max_registers () const |
| Returns the number of registers available. More... | |
| void | xload (const xml_element *Enode) |
| Loads a set of HLS constraints starting from an XML node. More... | |
| void | xwrite (xml_element *rootnode) |
| Writes the HLS constraints into an XML tree. More... | |
| void | xwriteHLSConstraints (xml_element *Enode, bool forDump=false) |
| Writes the generic synthesis constraints. More... | |
| void | xwriteFUConstraints (xml_element *Enode, const std::string &fu_name, const std::string &fu_library, unsigned int number_fu, bool forDump=false) |
| Writes the constraints on the functional units. More... | |
| void | xwriteBindingConstraints (xml_element *Enode, const std::string &vertex_name, const std::string &fu_name, const std::string &fu_library, unsigned int fu_index) |
| Writes the binding constraints (i.e., functional unit, instance and library) associated with an operation. More... | |
| void | xwriteSchedulingConstraints (xml_element *Enode, const std::string &vertex_name, int priority) |
| Writes the scheduling constraints (i.e., priority value) associated with an operation. More... | |
| void | print (std::ostream &os) const |
| Function that prints the class HLS_constraints. More... | |
| std::string | get_kind_text () const |
| definition of the get_kind_text method More... | |
Private Attributes | |
| CustomMap< std::string, unsigned int > | tech_constraints |
| For each functional unit tech_constraints stores the number of resources. More... | |
| CustomMap< std::string, std::pair< std::string, std::pair< std::string, unsigned int > > > | binding_constraints |
| put into relation the vertex name with the functional unit, its library and the functional unit index this map can be used to define a binding for a vertex. More... | |
| CustomMap< std::string, int > | scheduling_constraints |
| map between an operation vertex and its given scheduling priority value More... | |
| double | clock_period |
| Clock period in ns. More... | |
| double | clock_period_resource_fraction |
| current value of the resource fraction More... | |
| unsigned int | registers |
| Variable storing the number of registers. More... | |
| std::string | fun_name |
| name of the function which the constraints are associated with; emtpy string means that they are global constraints More... | |
| const ParameterConstRef | parameters |
| The set of input parameters. More... | |
Friends | |
| class | allocation |
| class that can directly access More... | |
| std::ostream & | operator<< (std::ostream &os, const HLS_constraints &s) |
| Friend definition of the << operator. More... | |
Data structure used to store all the HLS constraints.
Definition at line 72 of file hls_constraints.hpp.
| HLS_constraints::HLS_constraints | ( | const ParameterConstRef & | Param, |
| std::string | _fun_name | ||
| ) |
Constructor.
add the general builtin constraints
add user defined constraints
the command-line values overwrite the ones written into the XML file
Definition at line 74 of file hls_constraints.cpp.
References add_builtin_constraints(), CE_XVM, clock_period, clock_period_resource_fraction, DEBUG_LEVEL_MINIMUM, DEBUG_LEVEL_PEDANTIC, DEBUG_LEVEL_VERBOSE, XMLDomParser::Exec(), fun_name, xml_child::get_children(), GET_CLASS_NAME, XMLDomParser::get_document(), GetPath(), LOAD_XVM, parameters, test_panda::parser, PRINT_DBG_MEX, read_HLS_constraints_File(), THROW_ERROR, write_HLS_constraints_File(), and xload().

| void HLS_constraints::add_builtin_constraints | ( | ) |
Adds the builtin constraints.
Load default constraints on default resources
Definition at line 456 of file hls_constraints.cpp.
References XMLDomParser::Exec(), xml_child::get_children(), GET_CLASS_NAME, XMLDomParser::get_document(), parameters, test_panda::parser, THROW_ERROR, and xload().
Referenced by HLS_constraints().


| void HLS_constraints::bind_vertex_to_fu | ( | const std::string & | vertex_name, |
| const std::string & | fu_name, | ||
| const std::string & | fu_library, | ||
| const unsigned int | fu_index | ||
| ) |
Binds a vertex to a functional unit.
| vertex_name | is the name of the vertex. |
| fu_name | is the name of the functional unit. |
| fu_library | is the name of the library where the functional unit fu_name is contained. |
| fu_index | is the ith functional unit instance. |
Definition at line 212 of file hls_constraints.cpp.
References binding_constraints.
|
inline |
Gets the clock period.
Definition at line 194 of file hls_constraints.hpp.
References clock_period.
|
inline |
Gets the resource fraction of the clock period.
Definition at line 203 of file hls_constraints.hpp.
References clock_period_resource_fraction, and set_max_registers().

| std::string HLS_constraints::get_function_name | ( | ) | const |
Gets the name of the function which the constraints are associated with.
Definition at line 185 of file hls_constraints.cpp.
References fun_name.
|
inline |
definition of the get_kind_text method
Definition at line 286 of file hls_constraints.hpp.
Referenced by xwrite().

|
inline |
Returns the number of registers available.
Definition at line 218 of file hls_constraints.hpp.
References print(), registers, xload(), xwrite(), xwriteBindingConstraints(), xwriteFUConstraints(), xwriteHLSConstraints(), and xwriteSchedulingConstraints().

| unsigned int HLS_constraints::get_number_fu | ( | const std::string & | name, |
| const std::string & | library | ||
| ) | const |
This method returns the maximum number of functional units available for the design.
| name | is the name of the functional unit. |
| library | is the library of name. |
Definition at line 195 of file hls_constraints.cpp.
References ENCODE_FU_LIB.
| unsigned int HLS_constraints::get_number_fu | ( | const std::string & | combined | ) | const |
This method returns the maximum number of functional units available for the design.
| combined | is the name of the functional unit in the form <unit_name>:<library_name> |
Definition at line 200 of file hls_constraints.cpp.
References INFINITE_UINT, and tech_constraints.
| CustomMap< std::string, int > HLS_constraints::get_scheduling_priority | ( | ) | const |
Returns the data structure containing scheduling priority constraints.
Definition at line 451 of file hls_constraints.cpp.
References scheduling_constraints.
| bool HLS_constraints::has_binding_to_fu | ( | const std::string & | vertex_name | ) | const |
Binds a vertex to a functional unit.
| vertex_name | is the name of the operation vertex |
Definition at line 218 of file hls_constraints.cpp.
References binding_constraints.
| void HLS_constraints::print | ( | std::ostream & | os | ) | const |
Function that prints the class HLS_constraints.
| os | is the output stream. |
Definition at line 265 of file hls_constraints.cpp.
References binding_constraints, clock_period, INFINITE_UINT, registers, scheduling_constraints, and tech_constraints.
Referenced by get_max_registers().

| void HLS_constraints::read_HLS_constraints_File | ( | const std::string & | f | ) |
Reads an XML file describing the structural data structures.
| f | the input file name |
Definition at line 512 of file hls_constraints.cpp.
References XMLDomParser::Exec(), xml_child::get_children(), GET_CLASS_NAME, XMLDomParser::get_document(), test_panda::parser, and xload().
Referenced by HLS_constraints().


| void HLS_constraints::set_clock_period | ( | double | period | ) |
Sets the clock period.
| period | is the clock period (in ns) |
Definition at line 223 of file hls_constraints.cpp.
References clock_period.
| void HLS_constraints::set_max_registers | ( | unsigned int | n_resources | ) |
Sets the number of registers present in the function.
| n_resources | is the maximum number of registers available |
Definition at line 228 of file hls_constraints.cpp.
References max, min, registers, and THROW_ERROR.
Referenced by get_clock_period_resource_fraction().

| void HLS_constraints::set_number_fu | ( | const std::string & | name, |
| const std::string & | library, | ||
| unsigned int | n_resources = std::numeric_limits<unsigned int>::max() |
||
| ) |
Sets the maximum number of resources available in the design.
| name | is the name of the functional unit. |
| library | is the library of name. |
| n_resources | is the maximum number of fu available (default is infinite). |
Definition at line 190 of file hls_constraints.cpp.
References ENCODE_FU_LIB, and tech_constraints.
Referenced by xload().

| void HLS_constraints::set_scheduling_priority | ( | const std::string & | vertex_name, |
| int | Priority | ||
| ) |
Stores the priority value for an operation vertex.
| vertex_name | is the operation name |
| Priority | is the priority value related to the operation vertex |
Definition at line 446 of file hls_constraints.cpp.
References scheduling_constraints.
| void HLS_constraints::write_HLS_constraints_File | ( | const std::string & | f | ) |
Writes an XML file describing the high level synthesis constraints data structure.
| f | the output file name |
Definition at line 554 of file hls_constraints.cpp.
References xml_document::create_root_node(), GET_CLASS_NAME, xml_document::write_to_file_formatted(), and xwrite().
Referenced by HLS_constraints().


| void HLS_constraints::xload | ( | const xml_element * | Enode | ) |
Loads a set of HLS constraints starting from an XML node.
| Enode | is a node of the XML tree where the constraints are stored. |
Definition at line 305 of file hls_constraints.cpp.
References binding_constraints, CE_XVM, clock_period, xml_child::get_children(), LIBRARY_STD, LOAD_XVM, registers, scheduling_constraints, set_number_fu(), and THROW_ASSERT.
Referenced by add_builtin_constraints(), get_max_registers(), HLS_constraints(), and read_HLS_constraints_File().


| void HLS_constraints::xwrite | ( | xml_element * | rootnode | ) |
Writes the HLS constraints into an XML tree.
| Enode | is the root node which the XML representation of the constraints is attached. |
Definition at line 413 of file hls_constraints.cpp.
References xml_child::add_child_element(), binding_constraints, DECODE_FU_LIB(), get_kind_text(), scheduling_constraints, tech_constraints, xwriteBindingConstraints(), xwriteFUConstraints(), xwriteHLSConstraints(), and xwriteSchedulingConstraints().
Referenced by get_max_registers(), and write_HLS_constraints_File().


| void HLS_constraints::xwriteBindingConstraints | ( | xml_element * | Enode, |
| const std::string & | vertex_name, | ||
| const std::string & | fu_name, | ||
| const std::string & | fu_library, | ||
| unsigned int | fu_index | ||
| ) |
Writes the binding constraints (i.e., functional unit, instance and library) associated with an operation.
| Enode | is the node of the XML tree where the constraint will be stored. |
| vertex_name | is the operation name |
| fu_name | is the name of the functional unit |
| fu_library | is the name of the library where the functional unit fu_name is contained. |
Definition at line 392 of file hls_constraints.cpp.
References xml_child::add_child_element(), LIBRARY_STD, and WRITE_XVM.
Referenced by get_max_registers(), and xwrite().


| void HLS_constraints::xwriteFUConstraints | ( | xml_element * | Enode, |
| const std::string & | fu_name, | ||
| const std::string & | fu_library, | ||
| unsigned int | number_fu, | ||
| bool | forDump = false |
||
| ) |
Writes the constraints on the functional units.
| Enode | is the node of the XML tree where the constraint will be stored. |
| fu_name | is the name of the functional unit |
| number_fu | is the number of the functional unit instances |
| fu_library | is the name of the library where the functional unit fu_name is contained. |
| fu_index | is the ith functional unit instance. |
Definition at line 367 of file hls_constraints.cpp.
References xml_child::add_child_element(), INFINITE_UINT, LIBRARY_STD, and WRITE_XVM.
Referenced by get_max_registers(), and xwrite().


| void HLS_constraints::xwriteHLSConstraints | ( | xml_element * | Enode, |
| bool | forDump = false |
||
| ) |
Writes the generic synthesis constraints.
| Enode | is the node of the XML tree where the constraints will be stored. |
Definition at line 383 of file hls_constraints.cpp.
References clock_period, INFINITE_UINT, registers, and WRITE_XVM.
Referenced by get_max_registers(), and xwrite().

| void HLS_constraints::xwriteSchedulingConstraints | ( | xml_element * | Enode, |
| const std::string & | vertex_name, | ||
| int | priority | ||
| ) |
Writes the scheduling constraints (i.e., priority value) associated with an operation.
| Enode | is the node of the XML tree where the constraint will be stored. |
| vertex_name | is the operation name |
| priority | is the priority value for the scheduling |
Definition at line 406 of file hls_constraints.cpp.
References xml_child::add_child_element(), and WRITE_XVM.
Referenced by get_max_registers(), and xwrite().


|
friend |
class that can directly access
Definition at line 102 of file hls_constraints.hpp.
|
friend |
Friend definition of the << operator.
Definition at line 279 of file hls_constraints.hpp.
|
private |
put into relation the vertex name with the functional unit, its library and the functional unit index this map can be used to define a binding for a vertex.
Definition at line 79 of file hls_constraints.hpp.
Referenced by bind_vertex_to_fu(), has_binding_to_fu(), print(), xload(), and xwrite().
|
private |
Clock period in ns.
Definition at line 85 of file hls_constraints.hpp.
Referenced by get_clock_period(), HLS_constraints(), print(), set_clock_period(), xload(), and xwriteHLSConstraints().
|
private |
current value of the resource fraction
Definition at line 88 of file hls_constraints.hpp.
Referenced by get_clock_period_resource_fraction(), and HLS_constraints().
|
private |
name of the function which the constraints are associated with; emtpy string means that they are global constraints
Definition at line 95 of file hls_constraints.hpp.
Referenced by get_function_name(), and HLS_constraints().
|
private |
The set of input parameters.
Definition at line 98 of file hls_constraints.hpp.
Referenced by add_builtin_constraints(), and HLS_constraints().
|
private |
Variable storing the number of registers.
Definition at line 91 of file hls_constraints.hpp.
Referenced by get_max_registers(), print(), set_max_registers(), xload(), and xwriteHLSConstraints().
|
private |
map between an operation vertex and its given scheduling priority value
Definition at line 82 of file hls_constraints.hpp.
Referenced by get_scheduling_priority(), print(), set_scheduling_priority(), xload(), and xwrite().
|
private |
For each functional unit tech_constraints stores the number of resources.
Definition at line 75 of file hls_constraints.hpp.
Referenced by get_number_fu(), print(), set_number_fu(), and xwrite().
1.8.13