56 #include <boost/graph/sequential_vertex_coloring.hpp> 62 const DesignFlowManagerConstRef _design_flow_manager)
71 const std::vector<unsigned int>& v2)
const 80 size_t v1_size = v1.size();
87 size_t v2_size = v2.size();
100 else if(v1[index] < v2[index])
106 if(v1_size > v2_size)
128 std::vector<cg_vertex_descriptor> vertex_order(cg_num_vertices);
130 std::vector<std::vector<unsigned int>> label(cg_num_vertices);
131 std::vector<unsigned int>
seq(cg_num_vertices, NO_ORDER);
133 for(
unsigned int irev = 0; irev < cg_num_vertices; ++irev)
135 unsigned int i = cg_num_vertices - irev - 1;
137 unsigned int vx_index = 0;
140 for(
unsigned int vindex = 0; vindex < cg_num_vertices; ++vindex)
142 if(seq[vindex] == NO_ORDER)
158 vertex_order[i] = vx;
161 boost::graph_traits<conflict_graph>::adjacency_iterator adj_i, adj_e;
162 for(boost::tie(adj_i, adj_e) = boost::adjacent_vertices(vx, *
cg); adj_i != adj_e; ++adj_i)
164 long unsigned int vindex =
get(boost::vertex_index, *
cg, *adj_i);
165 if(seq[vindex] == NO_ORDER)
169 auto it_end = label[vindex].end();
170 for(
auto it = label[vindex].begin(); it != it_end &&
add; ++it)
179 label[vindex].push_back(i);
188 boost::make_iterator_property_map(vertex_order.begin(), boost::identity_property_map(),
189 boost::graph_traits<conflict_graph>::null_vertex()),
196 const auto vEnd = support.end();
197 for(
auto vIt = support.begin(); vIt != vEnd; ++vIt)
200 auto k_end = live.end();
201 for(
auto k = live.begin();
k != k_end; ++
k)
219 "-->Register binding information for function " +
220 HLSMgr->CGetFunctionBehavior(
funId)->CGetBehavioralHelper()->get_function_name() +
":");
222 std::string(
"---Register allocation algorithm obtains ") +
224 " result: " +
STR(num_colors) +
" registers" +
233 "Time to perform register binding: " +
print_cpu_time(step_time) +
" seconds");
Class specification to contain liveness information.
boost::iterator_property_map< cg_vertices_size_type *, cg_vertex_index_map, cg_vertices_size_type, cg_vertices_size_type & > color
const HLS_managerRef HLSMgr
information about all the HLS synthesis
Data structure representing the entire HLS information.
File containing functions and utilities to support the printing of debug messagges.
refcount< reg_binding > reg_bindingRef
RefCount type definition of the reg_binding class structure.
~chordal_coloring_register() override
Destructor of the class.
const int output_level
The output level.
Class managing the register binding.
boost::graph_traits< conflict_graph >::vertex_descriptor cg_vertex_descriptor
#define INDENT_OUT_MEX(outLevel, curOutLevel, mex)
void set_used_regs(unsigned int regs)
sets number of used register
const unsigned int funId
identifier of the function to be processed (0 means that it is a global step)
void create_conflict_graph()
void bind(unsigned int sv, unsigned int index)
conflict_graph * cg
conflict graph
#define OUTPUT_LEVEL_MINIMUM
minimum debugging print is performed.
Include a set of utilities used to manage CPU time measures.
#define STR(s)
Macro which performs a lexical_cast to a string.
boost::graph_traits< conflict_graph >::vertices_size_type cg_vertices_size_type
const std::list< vertex > & get_support() const
return the support set of the live in/out
#define START_TIME(time_var)
Macro used to store the start time into time_var.
Data structure used to store the register binding of variables.
StorageValueInformationRef storage_value_information
data-structure for storage values
Class specification of the register allocation algorithms based on chordal algorithm.
static const uint32_t k[]
chordal_coloring_register(const ParameterConstRef Param, const HLS_managerRef HLSMgr, unsigned int funId, const DesignFlowManagerConstRef design_flow_manager)
Constructor of the class.
#define STOP_TIME(time_var)
Macro used to store the elapsed time into time_var.
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
DesignFlowStep_Status
The status of a step.
This file collects some utility functions and macros.
reg_bindingRef Rreg
Store the refcounted register binding of the variables.
unsigned int register_lower_bound
lower bound
livenessRef Rliv
data-structure containing the variable liveness
std::string print_cpu_time(long int t)
massage a long which represents a time interval in milliseconds, into a string suitable for output ...
virtual void print() const
Function that prints the class variable2obj.
bool lex_compare_gt(const std::vector< unsigned int > &v1, const std::vector< unsigned int > &v2) const
compare lexically two vectors
void add(int accelnum, int startidx, int endidx)
#define OUTPUT_LEVEL_PEDANTIC
verbose debugging print is performed.
#define OUTPUT_LEVEL_VERY_PEDANTIC
verbose debugging print is performed.
hlsRef HLS
HLS data structure of the function to be analyzed.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
this class is used to manage the command-line or XML options.
DesignFlowStep_Status RegisterBinding() final
Chordal coloring algorithm algorithm.
Data structure definition for high-level synthesis flow.
const CustomOrderedSet< unsigned int > & get_live_in(const vertex &v) const
Get the set of variables live at the input of a vertex.
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...