PandA-2024.02
unique_binding.cpp
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  */
43 #include "unique_binding.hpp"
44 
45 #include "graph.hpp"
46 
47 #include "fu_binding.hpp"
48 #include "hls.hpp"
49 #include "schedule.hpp"
50 
51 #include "Parameter.hpp"
52 #include "constant_strings.hpp"
53 
54 #include "op_graph.hpp"
55 
56 #include "utility.hpp"
57 
60 #include "dbgPrintHelper.hpp" // for DEBUG_LEVEL_
61 
62 unique_binding::unique_binding(const ParameterConstRef _Param, const HLS_managerRef _HLSMgr, unsigned int _funId,
63  const DesignFlowManagerConstRef _design_flow_manager)
64  : fu_binding_creator(_Param, _HLSMgr, _funId, _design_flow_manager, HLSFlowStep_Type::UNIQUE_MODULE_BINDING)
65 {
66 }
67 
69 
71 {
72  const FunctionBehaviorConstRef FB = HLSMgr->CGetFunctionBehavior(funId);
74 
75  VertexIterator vIt, vItEnd;
76  std::map<unsigned int, CustomOrderedSet<unsigned int>> black_list;
77  std::map<unsigned int, std::list<std::pair<std::string, vertex>>> fu_ops;
78  for(boost::tie(vIt, vItEnd) = boost::vertices(*data); vIt != vItEnd; vIt++)
79  {
80  unsigned int fu = HLS->Rfu->get_assign(*vIt);
81  if(HLS->Rfu->get_index(*vIt) != INFINITE_UINT)
82  {
83  black_list[fu].insert(HLS->Rfu->get_index(*vIt));
84  }
86  {
87  HLS->Rfu->bind(*vIt, fu, 0);
88  }
89  else
90  {
91  fu_ops[fu].push_back(std::make_pair(GET_NAME(data, *vIt), *vIt));
92  }
93  black_list.insert(std::make_pair(fu, CustomOrderedSet<unsigned int>()));
94  }
95  for(auto& fu_op : fu_ops)
96  {
97  unsigned int fu = fu_op.first;
98  fu_op.second.sort();
99  for(auto& op : fu_op.second)
100  {
101  unsigned int idx = 0;
102  while(black_list[fu].find(idx) != black_list[fu].end())
103  {
104  idx++;
105  }
106  HLS->Rfu->bind(op.second, fu, idx);
107  black_list[fu].insert(idx);
108  }
109  }
111  {
112  HLS->Rsch->print(HLS->Rfu);
113  }
115 }
const HLS_managerRef HLSMgr
information about all the HLS synthesis
Definition: hls_step.hpp:205
bool is_vertex_bounded(const unsigned int fu_name) const
Checks if the functional unit is uniquely bounded to a vertex.
~unique_binding() override
Destructor.
File containing functions and utilities to support the printing of debug messagges.
unsigned int get_assign(const vertex &v) const
Returns the functional unit assigned to the vertex.
Definition: fu_binding.cpp:242
const unsigned int funId
identifier of the function to be processed (0 means that it is a global step)
#define GET_NAME(data, vertex_index)
Helper macro returning the name associated with a node.
Class specification of the graph structures.
AllocationInformationRef allocation_information
Store the technology information.
Definition: hls.hpp:115
DesignFlowStep_Status InternalExec() override
Performs module binding assigning each operation to a free resource.
fu_bindingRef Rfu
Store the refcounted functional unit binding of the operations.
Definition: hls.hpp:121
ScheduleRef Rsch
Store the refcounted scheduling of the operations.
Definition: hls.hpp:118
Data structure used to store the schedule of the operations.
Control flow graph.
HLSFlowStep_Type
Definition: hls_step.hpp:95
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.
Definition: fu_binding.cpp:173
boost::graph_traits< graph >::vertex_iterator VertexIterator
vertex_iterator definition.
Definition: graph.hpp:1307
DesignFlowStep_Status
The status of a step.
This package is used by all HLS packages to manage resource constraints and characteristics.
This file collects some utility functions and macros.
void print(fu_bindingRef Rfu=fu_bindingRef()) const
Function that prints the class schedule.
Definition: schedule.cpp:126
Data structure used to store the functional-unit binding of the vertexes.
const OpGraphConstRef CGetOpGraph(FunctionBehavior::graph_type gt) const
This method returns the operation graphs.
#define INFINITE_UINT
UNSIGNED INT representing infinite.
Definition: utility.hpp:70
hlsRef HLS
HLS data structure of the function to be analyzed.
Data structures used in operations graph.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Definition: refcount.hpp:94
this class is used to manage the command-line or XML options.
constant strings
bool is_memory_unit(const unsigned int fu_name) const
Returns true if the fu_name is a memory unit.
int debug_level
The debug level.
unique_binding(const ParameterConstRef Param, const HLS_managerRef HLSMgr, unsigned int funId, const DesignFlowManagerConstRef design_flow_manager)
Constructor.
#define DEBUG_LEVEL_VERBOSE
verbose debugging print is performed.
Data structure definition for high-level synthesis flow.
Class to create a unique binding.
unsigned int get_index(const vertex &v) const
Returns the index of functional unit assigned to the vertex.
Definition: fu_binding.cpp:261
Generic class managing module binding algorithms.

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