74 std::map<std::string, unsigned int>& resources);
84 : functionId(_function_id),
85 operations(
std::move(_operations)),
88 allocation_information(),
89 registered_inputs(
false),
90 registered_done_port(
false),
93 debug_level(_Param->getOption<int>(OPT_debug_level)),
94 output_level(_Param->getOption<int>(OPT_output_level)),
108 unsigned int tot_cstep = 0;
110 std::map<std::string, vertex> String2Vertex;
111 std::map<std::pair<std::string, std::string>, std::list<unsigned int>> String2Id;
124 for(
const auto& iter : list)
126 const auto* Enode = GetPointer<const xml_element>(iter);
127 if(!Enode || Enode->get_name() !=
"scheduling")
132 for(
const auto& iter1 : list1)
134 const auto* EnodeC = GetPointer<const xml_element>(iter1);
139 if(EnodeC->get_name() ==
"scheduling_constraints")
141 std::string vertex_name;
142 unsigned int cstep = 0u;
144 THROW_ASSERT(vertex_name !=
"",
"bad formed xml file: vertex_name expected in a hls specification");
151 THROW_ERROR(
"bad formed xml file: cstep expected in a hls specification for operation " + vertex_name);
153 if(cstep > tot_cstep)
158 unsigned int fu_index;
164 if(
CE_XVM(library, EnodeC))
168 unsigned int fu_type;
172 fu_type = String2Id[std::make_pair(fu_name, library)].front();
173 String2Id[std::make_pair(fu_name, library)].pop_front();
177 fu_type = String2Id[std::make_pair(fu_name, library)].front();
180 sch->
set_execution(String2Vertex[vertex_name], ControlStep(cstep));
181 fu.
bind(String2Vertex[vertex_name], fu_type, fu_index);
205 std::string fu_name, library;
219 std::map<std::string, unsigned int> resources;
222 for(
auto& resource : resources)
225 std::string name = resource.first;
226 unsigned int number = resource.second;
234 std::map<std::string, unsigned int>& resources)
236 const module*
mod = GetPointer<module>(circ);
245 if(c->get_id() ==
"Controller_i" || c->get_id() ==
"Datapath_i")
259 processResources(obj);
265 std::vector<std::string> ip_cores_list = string_to_container<std::vector<std::string>>(ip_cores,
",");
266 for(
const auto& ip_core : ip_cores_list)
268 std::vector<std::string> ip_core_vec = string_to_container<std::vector<std::string>>(ip_core,
":");
269 if(ip_core_vec.size() < 1 or ip_core_vec.size() > 2)
271 THROW_ERROR(
"Malformed IP component definition \"" + ip_core +
"\"");
273 std::string library, component_name;
274 if(ip_core_vec.size() == 2)
276 library = ip_core_vec[0];
277 component_name = ip_core_vec[1];
281 component_name = ip_core_vec[0];
288 core_cir = GetPointer<functional_unit>(tn)->CM->get_circ();
291 GetPointer<functional_unit>(GetPointer<functional_unit_template>(tn)->FU))
293 core_cir = GetPointer<functional_unit>(GetPointer<functional_unit_template>(tn)->FU)->CM->get_circ();
299 processResources(core_cir);
307 std::map<std::string, unsigned int> resources;
315 for(
auto r = resources.begin(); r != resources.end(); ++r)
File containing functions and utilities to support the printing of debug messagges.
const structural_objectRef get_internal_object(unsigned int n) const
Return the ith internal objects.
structural_managerRef datapath
Store the datapath description.
technology_nodeRef get_fu(const std::string &fu_name, const std::string &Library) const
Return the reference to a component given its name.
const ParameterConstRef Param
class containing all the parameters
static void computeResources(const structural_objectRef circ, const technology_managerRef TM, std::map< std::string, unsigned int > &resources)
const structural_objectRef get_circ() const
Get a reference to circ field.
AbsControlStep get_cstep(const vertex &op) const
Returns the clock cycle where the given operation has been scheduled.
#define INDENT_OUT_MEX(outLevel, curOutLevel, mex)
std::string get_NP_functionality(NP_functionaly_type type) const
Return the description provided the type.
unsigned int get_assign(const vertex &v) const
Returns the functional unit assigned to the vertex.
void set_csteps(ControlStep cs)
This method sets the number of control steps.
#define GET_NAME(data, vertex_index)
Helper macro returning the name associated with a node.
const HLS_deviceRef HLS_D
reference to the information representing the target for the synthesis
exceptions managed by PandA
AllocationInformationRef allocation_information
Store the technology information.
#define CE_XVM(variable, node)
Check existence XML Value Macro. Check if an XML attribute is present in the XML tree.
Definition of hash function for EdgeDescriptor.
OpVertexSet operations
Set representing the subset of operations in the specification to be implemented. ...
void xwrite(xml_element *rootnode, const OpGraphConstRef data)
Writes current HLS results to XML node.
unsigned int get_internal_objects_size() const
Return the number of internal objects.
Class specification of the manager of the technology library data structures.
#define OUTPUT_LEVEL_MINIMUM
minimum debugging print is performed.
A set of operation vertices.
#define STR(s)
Macro which performs a lexical_cast to a string.
hls(const ParameterConstRef Param, unsigned int function_id, OpVertexSet operations, const HLS_deviceRef HLS_D, const HLS_constraintsRef HLS_C)
fu_bindingRef Rfu
Store the refcounted functional unit binding of the operations.
ScheduleRef Rsch
Store the refcounted scheduling of the operations.
Data structure used to store the register binding of variables.
This class specifies the characteristic of a particular operation working on a given functional unit...
Data structure used to store the interconnection binding of datapath elements.
Data structure used to store the schedule of the operations.
Class specification of the data structures used to manage technology information. ...
const NP_functionalityRef & get_NP_functionality() const
Return the alternative functionalities.
int output_level
verbosity level of the class
void bind(const vertex &v, unsigned int unit, unsigned int index=std::numeric_limits< unsigned int >::max())
Binds an operation vertex to a functional unit.
#define LIBRARY_STD
standard library where all built-in ports are defined.
This file collects some utility functions and macros.
Definition of the class to create the structural description of the component.
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
Data structure definition for HLS constraints.
std::string id_type
Original type id of the structural object.
#define OUTPUT_LEVEL_PEDANTIC
verbose debugging print is performed.
Data structure used to store the functional-unit binding of the vertexes.
#define WORK_LIBRARY
working library.
#define WRITE_XVM(variable, node)
WRITE XML Value Macro. Insert a value in an XML tree.
Data structures used in operations graph.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
void xload(const xml_element *rootnode, const OpGraphConstRef data)
Loads previous HLS results from XML node.
void PrintResources() const
Prints the summary of allocated resources.
#define LOAD_XVM(variable, node)
LOAD XML Value Macro. Set a variable starting from an XML value. Conversion is performed if needed...
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.
Class managing the functional-unit binding.
const HLS_constraintsRef HLS_C
store the HLS constraints
bool exist_NP_functionality(NP_functionaly_type type) const
Return true in case there exist a functionaly of the given type.
Data structure definition for high-level synthesis flow.
This class describes a generic module.
void set_execution(const vertex &op, ControlStep c_step)
Sets the starting clock cycle for the given operation.
xml_element * add_child_element(const std::string &name)
Add a child element to this node.
#define PROXY_LIBRARY
proxy library
unsigned int get_index(const vertex &v) const
Returns the index of functional unit assigned to the vertex.
HLS specialization of generic_device.
std::string get_library(const std::string &Name) const
Return the higher priority library where the given component is stored.
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...