85 #define CONN_COLUMN_SIZE 40 91 debug_level(_parameters->get_class_debug_level(
GET_CLASS(*this))),
92 output_level(_parameters->getOption<int>(OPT_output_level)),
101 if(_parameters->isOption(OPT_context_switch))
103 auto omp_functions = GetPointer<OmpFunctions>(_HLSMgr->Rfuns);
105 if(omp_functions->kernel_functions.find(_HLS->
functionId) != omp_functions->kernel_functions.end())
109 if(omp_functions->parallelized_functions.find(_HLS->
functionId) != omp_functions->parallelized_functions.end())
113 if(omp_functions->atomic_functions.find(_HLS->
functionId) != omp_functions->atomic_functions.end())
156 const std::map<conn_binding::ConnectionTarget, conn_binding::ConnectionSources>&
231 selectors[dir][std::make_pair(elem, op)] =
233 (dir == IN ?
"IN_" :
"OUT_") + elem->
get_string() +
"_" +
236 return selectors[dir][std::make_pair(elem, op)];
250 return selectors[dir][std::make_pair(port, 0)] = port;
255 bool allconnected =
true;
256 for(
unsigned int p = 0; p < GetPointer<port_o>(port_i)->get_ports_size() && allconnected; ++p)
259 if(!GetPointer<port_o>(port_d)->find_bounded_object())
261 allconnected =
false;
279 const auto connection_type = HLS->
Param->getOption<
HLSFlowStep_Type>(OPT_datapath_interconnection_algorithm);
287 const auto circuit = SM->
get_circ();
288 std::map<unsigned long long, structural_objectRef> null_values;
289 for(
unsigned int i = 0; i < GetPointer<module>(circuit)->get_internal_objects_size(); i++)
291 auto curr_gate = GetPointer<module>(circuit)->get_internal_object(i);
292 if(!GetPointer<module>(curr_gate) || GetPointer<module>(curr_gate)->get_id() ==
"scheduler_kernel")
296 for(
unsigned int j = 0; j < GetPointer<module>(curr_gate)->get_in_port_size(); j++)
300 GetPointer<port_o>(port_i)->find_bounded_object())
310 for(
unsigned int p = 0; p < GetPointer<port_o>(port_i)->get_ports_size(); ++p)
312 const auto port_d = GetPointer<port_o>(port_i)->
get_port(p);
314 if(null_values.find(bw) == null_values.end())
317 const auto const_obj = SM->
add_constant(
"null_value_" +
STR(bw), circuit, bool_type,
STR(0));
318 null_values[bw] = const_obj;
320 if(!GetPointer<port_o>(port_d)->find_bounded_object())
329 if(null_values.find(bw) == null_values.end())
332 const auto const_obj = SM->
add_constant(
"null_value_" +
STR(bw), circuit, bool_type,
STR(0));
333 null_values[bw] = const_obj;
338 for(
unsigned int j = 0; j < GetPointer<module>(curr_gate)->get_out_port_size(); j++)
340 const auto port_out = GetPointer<module>(curr_gate)->get_out_port(j);
342 GetPointer<port_o>(port_out)->find_bounded_object())
353 for(
unsigned int p = 0; p < GetPointer<port_o>(port_out)->get_ports_size(); ++p)
355 const auto port_d = GetPointer<port_o>(port_out)->
get_port(p);
356 if(!GetPointer<port_o>(port_d)->find_bounded_object())
358 const auto name =
"null_out_signal_" + port_out->get_owner()->get_id() +
"_" + port_out->get_id() +
359 "_" + port_d->get_id();
360 const auto sign = SM->
add_sign(name, circuit, port_d->get_typeRef());
380 unsigned int operand = std::get<2>(i->first);
381 unsigned int port_index = std::get<3>(i->first);
383 "-->Creating CONNECTION between " + src->
get_string() +
" and " + tgt->get_string() +
"(" +
384 STR(operand) +
":" +
STR(port_index) +
")");
393 auto* src_obj = GetPointer<module>(src_module);
394 for(
unsigned int ind = 0; ind < src_obj->get_out_port_size(); ind++)
396 auto curr_port = src_obj->get_out_port(ind);
401 if(GetPointer<port_o>(curr_port)->get_is_memory() || GetPointer<port_o>(curr_port)->get_is_global() ||
402 GetPointer<port_o>(curr_port)->get_is_extern())
406 port_src = curr_port;
409 port_src = GetPointer<port_o>(port_src)->
get_port(GetPointer<funit_obj>(src)->get_index() %
410 GetPointer<port_o>(port_src)->get_ports_size());
417 port_src = src_module;
421 src_module->
print(std::cerr);
422 THROW_ERROR(
"source module does not have the expected return_port: " + src_module->get_id() +
" - " +
423 src_module->get_path() +
"\nCheck the module specification");
426 THROW_ASSERT(tgt_module,
"No object associated to " + tgt->get_string());
429 auto* tgt_obj = GetPointer<module>(tgt_module);
430 unsigned int num = 0;
432 for(
unsigned int ind = 0; ind < tgt_obj->get_in_port_size(); ind++)
434 auto curr_port = tgt_obj->get_in_port(ind);
440 if(GetPointer<port_o>(curr_port)->get_is_memory() || GetPointer<port_o>(curr_port)->get_is_global() ||
441 GetPointer<port_o>(curr_port)->get_is_extern())
447 port_tgt = curr_port;
450 port_tgt = GetPointer<port_o>(port_tgt)->
get_port(port_index);
454 THROW_ASSERT(port_index == 0,
"expected 0 as port index");
463 port_tgt = tgt_module;
467 tgt_module->
print(std::cerr);
468 THROW_ERROR(
"target module does not have the expected input port: " + tgt_module->
get_id() +
" - " +
469 tgt_module->
get_path() +
"\nCheck the module specification");
477 sign = SM->
add_sign(name, circuit, port_src_type);
478 THROW_ASSERT(port_src_type->size,
"size greater than one expected");
483 switch(i->second->get_type())
485 case connection_obj::DIRECT_CONN:
494 if(bits_src != bits_tgt)
516 case connection_obj::BY_MUX:
523 THROW_ERROR(
"Connection type not allowed: " +
STR(i->second->get_type()));
531 auto data_size = GetPointer<mux_obj>(mux)->get_bitsize();
532 data_size =
std::max(data_size, bits_tgt);
535 const module* mux_module = GetPointer<module>(mux_obj);
538 "---Specializing " + mux_obj->
get_path() +
": " +
STR(data_size));
550 unsigned long long bits_tgt = 0;
573 "---conn_binding::mux_allocation between " + src->
get_path() +
" and " + tgt->
get_path());
575 THROW_ASSERT(GetPointer<mux_conn>(conn),
"The connection is not implemented through multiplexers");
576 auto* mux_alloc = GetPointer<mux_conn>(conn);
577 const std::vector<std::pair<generic_objRef, unsigned int>>& mux_tree = mux_alloc->get_mux_tree();
578 THROW_ASSERT(mux_tree.size() > 0,
"no mux into a mux connection");
581 for(
const auto& i : mux_tree)
584 auto in_mux = i.second ==
T_COND ? 1u : 2u;
589 auto* mux_object = GetPointer<module>(mux);
592 auto mux_input = mux_object->get_in_port(in_mux);
593 THROW_ASSERT(mux_input,
"classic_datapath::mux_allocation - In port does not exist");
601 std::string name = i.first->get_string();
604 circuit, HLS->
HLS_D->get_technology_manager());
605 i.first->set_structural_obj(mux);
608 generic_objRef selector = GetPointer<mux_obj>(i.first)->GetSelector();
620 auto* mux_object = GetPointer<module>(mux);
623 auto mux_input = mux_object->get_in_port(in_mux);
624 THROW_ASSERT(mux_input,
"classic_datapath::mux_allocation - In port does not exist");
629 THROW_ASSERT(port_out_mux,
"classic_datapath::mux_allocation - Out port does not exist");
632 std::string sig_name =
"out_" + name;
634 i.first->set_out_sign(sign);
644 unsigned int conn_type)
649 "-->Adding datapath connections " + src->
get_path() +
"(" +
STR(bits_src) +
" bits)-->" +
653 if(bits_src == bits_tgt)
659 std::string name =
"io_signal_" + src->
get_id() +
"_" + tgt->
get_id();
686 std::string name =
"conv_" + src->
get_id() + (is_src_int ?
"_I" : (is_src_real ?
"_R" :
"")) +
"_" +
STR(bits_src) +
687 (is_tgt_int ?
"_I" : (is_tgt_real ?
"_R" :
"")) +
"_" +
STR(bits_tgt);
694 if(!is_src_int && !is_tgt_int && !is_src_real && !is_tgt_real)
699 else if(!is_src_int && !is_src_real && is_tgt_int)
704 else if(is_src_int && !is_tgt_int && !is_tgt_real)
709 else if(is_src_int && is_tgt_int)
714 else if(is_src_real && is_tgt_real)
728 " " +
STR(is_tgt_int) +
" " +
STR(is_src_real) +
" " +
STR(is_tgt_real) +
" " +
729 STR(bits_src) +
" " +
STR(bits_tgt) +
")");
734 in1->type_resize(bits_src);
751 unsigned int precision)
771 std::string resource_name, resource_instance_name;
772 unsigned int resource_index = 0;
773 unsigned long long bitsize = 0;
776 switch(component->get_type())
781 resource_instance_name = resource_name +
"_adder_" +
STR(resource_index);
782 bitsize = GetPointer<adder_conn_obj>(component)->get_bitsize();
788 resource_instance_name = resource_name +
"_uu_conv_" +
STR(resource_index);
789 bitsize = GetPointer<uu_conv_conn_obj>(component)->get_bitsize();
795 resource_instance_name = resource_name +
"_ui_conv_" +
STR(resource_index);
796 bitsize = GetPointer<ui_conv_conn_obj>(component)->get_bitsize();
802 resource_instance_name = resource_name +
"_iu_conv_" +
STR(resource_index);
803 bitsize = GetPointer<iu_conv_conn_obj>(component)->get_bitsize();
809 resource_instance_name = resource_name +
"_ii_conv_" +
STR(resource_index);
810 bitsize = GetPointer<ii_conv_conn_obj>(component)->get_bitsize();
815 bitsize = GetPointer<ff_conv_conn_obj>(component)->get_bitsize_out();
816 if(HLS->
Param->isOption(OPT_soft_float) && HLS->
Param->getOption<
bool>(OPT_soft_float))
820 GetPointer<ff_conv_conn_obj>(component)->get_bitsize_in(),
821 GetPointer<ff_conv_conn_obj>(component)->get_bitsize_out(), HLSMgr, current_fu);
827 resource_instance_name = resource_name +
"_ff_conv_" +
STR(resource_index);
833 resource_instance_name = resource_name +
"_i_assign_" +
STR(resource_index);
834 bitsize = GetPointer<i_assign_conn_obj>(component)->get_bitsize();
840 resource_instance_name = resource_name +
"_u_assign_" +
STR(resource_index);
841 bitsize = GetPointer<u_assign_conn_obj>(component)->get_bitsize();
847 resource_instance_name = resource_name +
"_f_assign_" +
STR(resource_index);
848 bitsize = GetPointer<f_assign_conn_obj>(component)->get_bitsize();
853 THROW_ERROR(
"sparse component not yet considered " + component->get_string());
858 resource_instance_name, resource_name, HLS->
HLS_D->get_technology_manager()->get_library(resource_name),
859 circuit, HLS->
HLS_D->get_technology_manager());
860 component->set_structural_obj(sparse_component);
861 auto* sparse_module = GetPointer<module>(sparse_component);
864 "---Specializing " + sparse_component->
get_path() +
": " +
STR(bitsize));
866 unsigned int shift_index = 0;
868 GetPointer<adder_conn_obj>(component)->is_align_adder())
870 sparse_module->SetParameter(
VALUE_PARAMETER,
STR(GetPointer<adder_conn_obj>(component)->get_trimmed_bits()));
872 else if(GetPointer<port_o>(sparse_module->get_in_port(shift_index)) &&
873 GetPointer<port_o>(sparse_module->get_in_port(shift_index))->get_is_clock())
877 if(!HLS->
Param->isOption(OPT_soft_float) || !HLS->
Param->getOption<
bool>(OPT_soft_float) ||
883 sparse_module->get_in_port(shift_index)
884 ->type_resize(GetPointer<ff_conv_conn_obj>(component)->get_bitsize_in());
888 sparse_module->get_in_port(shift_index)->type_resize(bitsize);
900 sparse_module->get_in_port(shift_index + 1)->type_resize(bitsize);
902 if(!HLS->
Param->isOption(OPT_soft_float) || !HLS->
Param->getOption<
bool>(OPT_soft_float) ||
905 sparse_module->get_out_port(0)->type_resize(bitsize);
916 auto op = std::get<2>(conn.first);
917 std::string
str = conn.second->get_string();
918 if(conn.second->get_type() == connection_obj::BY_MUX)
920 str =
"MUX_TREE [" +
STR(GetPointer<mux_conn>(conn.second)->get_mux_tree_size()) +
"] => " + str;
923 "---Source: " + src->
get_string() +
" Target: " + tgt->get_string() +
"(" +
STR(op) +
") " +
924 " connected by: " +
str);
933 if(!GetPointer<mux_conn>(it.second))
937 const std::vector<std::pair<generic_objRef, unsigned int>>& tree =
938 GetPointer<mux_conn>(it.second)->get_mux_tree();
939 for(
const auto& v : tree)
945 for(
const auto& m : mux)
947 bit_mux += GetPointer<mux_obj>(m)->get_bitsize();
966 for(
auto j : operations)
972 "Time model not available for operation: " +
GET_NAME(data, j));
981 auto* fu_module = GetPointer<module>(
top);
984 if(((
GET_TYPE(data, j) &
TYPE_EXTERNAL) && start_port_i) || !GetPointer<operation>(op_tn)->is_bounded() ||
994 std::map<structural_objectRef, std::list<structural_objectRef>> calls;
995 std::map<structural_objectRef, std::list<vertex>> start_to_vertex;
998 auto connection_binding_sets =
selectors.find(conn_binding::IN)->second;
999 for(
auto j = connection_binding_sets.begin(); j != connection_binding_sets.end(); ++j)
1004 auto oper = j->first.second;
1011 auto type_fu = GetPointer<funit_obj>(elem)->get_fu();
1012 std::vector<technology_nodeRef> tmp_ops_node =
1014 THROW_ASSERT(GetPointer<commandport_obj>(j->second),
"Not valid command port");
1016 SM->
add_port(
"fuselector_" + elem->
get_string() +
"_" + tmp_ops_node[oper]->get_name(), port_o::IN,
1017 circuit, boolean_port_type);
1018 (j->second)->set_structural_obj(sel_obj);
1029 THROW_ASSERT(GetPointer<port_o>(port_selector)->get_ports_size() != 0,
1030 "port not correctly initialized" + port_selector->
get_path());
1031 port_selector = GetPointer<port_o>(port_selector)
1032 ->
get_port(GetPointer<funit_obj>(elem)->get_index() %
1033 GetPointer<port_o>(port_selector)->get_ports_size());
1043 THROW_ASSERT(GetPointer<commandport_obj>(j->second),
"Not valid command port");
1045 SM->
add_port(
"wrenable_" + reg_mod->
get_id(), port_o::IN, circuit, boolean_port_type);
1046 (j->second)->set_structural_obj(sel_obj);
1056 THROW_ASSERT(GetPointer<commandport_obj>(j->second),
"Not valid command port");
1058 SM->
add_port(
"muenable_" + mu_mod->
get_id(), port_o::IN, circuit, boolean_port_type);
1059 (j->second)->set_structural_obj(sel_obj);
1068 THROW_ASSERT(GetPointer<commandport_obj>(j->second),
"Not valid command port");
1072 SM->
add_port(
"selector_" + elem->
get_string(), port_o::IN, circuit, boolean_port_type);
1073 (j->second)->set_structural_obj(sel_obj);
1075 if(GetPointer<commandport_obj>(j->second)->get_command_type() == commandport_obj::UNBOUNDED)
1077 vertex op = GetPointer<commandport_obj>(j->second)->get_vertex();
1082 calls[start].push_back(sel_obj);
1083 start_to_vertex[start].push_back(op);
1096 for(
auto& call : calls)
1099 const auto isMultipleModule = GetPointer<module>(call.first->get_owner()) &&
1100 GetPointer<module>(call.first->get_owner())->get_multi_unit_multiplicity();
1101 if(call.second.size() == 1 && !isMultipleModule)
1107 if(isMultipleModule)
1109 THROW_ASSERT(start_to_vertex.find(call.first) != start_to_vertex.end(),
"unexpected condition");
1111 std::map<structural_objectRef, std::list<structural_objectRef>> toOred;
1112 auto ports_it = call.second.begin();
1113 for(
auto v : start_to_vertex.at(call.first))
1118 const auto multiplicity = GetPointer<module>(call.first->get_owner())->get_multi_unit_multiplicity();
1120 THROW_ASSERT(multiplicity == GetPointer<port_o>(call.first)->get_ports_size(),
"unexpected condition");
1122 "unexpected condition: index: " +
STR(
index) +
", multiplicity: " +
STR(multiplicity));
1123 auto sp_i = GetPointer<port_o>(call.first)->
get_port(
index);
1124 toOred[sp_i].push_back(*ports_it);
1126 THROW_ASSERT(ports_it != call.second.end(),
"unexpected condition");
1129 for(
const auto& pp_pair : toOred)
1131 if(pp_pair.second.size() == 1)
1137 const auto TM = HLS->
HLS_D->get_technology_manager();
1138 const auto library = TM->get_library(
OR_GATE_STD);
1143 SM->
get_circ(), boolean_port_type);
1148 auto port = GetPointer<port_o>(in);
1149 port->add_n_ports(static_cast<unsigned int>(pp_pair.second.size()), in);
1150 unsigned int num = 0;
1151 for(
auto a = pp_pair.second.begin(); a != pp_pair.second.end(); ++a, ++num)
1160 const auto TM = HLS->
HLS_D->get_technology_manager();
1161 const auto library = TM->get_library(
OR_GATE_STD);
1170 auto port = GetPointer<port_o>(in);
1171 port->add_n_ports(static_cast<unsigned int>(call.second.size()), in);
1172 unsigned int num = 0;
1173 for(
auto a = call.second.begin(); a != call.second.end(); ++a, ++num)
1182 std::map<structural_objectRef, structural_objectRef> sig;
1186 auto mu = state2mu.second;
1188 auto mut = GetPointer<multi_unbounded_obj>(mu);
1189 const auto& ops = mut->get_ops();
1191 auto* port = GetPointer<port_o>(inOps);
1193 for(
const auto& op : ops)
1198 std::string sign_owner_id = done->
get_owner()->get_id();
1201 THROW_ASSERT(GetPointer<port_o>(done)->get_ports_size() != 0,
1202 "port not correctly initialized" + done->
get_path());
1203 THROW_ASSERT(GetPointer<funit_obj>(fu_unit),
"unexpected port configuration");
1204 done = GetPointer<port_o>(done)->
get_port(GetPointer<funit_obj>(fu_unit)->get_index() %
1205 GetPointer<port_o>(done)->get_ports_size());
1206 sign_owner_id = sign_owner_id +
"_P" + done->
get_id();
1209 if(sig.find(done) == sig.end())
1211 sig[done] = SM->
add_sign(
"s_done_" + sign_owner_id, SM->
get_circ(), boolean_port_type);
1214 THROW_ASSERT(port->get_port(j),
"port->get_port(j) not found");
1215 const auto& port_obj = port->get_port(j);
1227 auto connection_binding_sets =
selectors.find(conn_binding::OUT)->second;
1228 for(
auto j = connection_binding_sets.begin(); j != connection_binding_sets.end(); ++j)
1230 THROW_ASSERT(GetPointer<commandport_obj>(j->second),
"Not valid command port");
1231 if(GetPointer<commandport_obj>(j->second)->get_command_type() == commandport_obj::SWITCH)
1233 vertex op = GetPointer<commandport_obj>(j->second)->get_vertex();
1234 auto var_written = HLSMgr->get_produced_value(HLS->
functionId, op);
1238 port_o::OUT, circuit, switch_port_type);
1239 (j->second)->set_structural_obj(sel_obj);
1241 else if(GetPointer<commandport_obj>(j->second)->get_command_type() == commandport_obj::MULTIIF)
1243 vertex op = GetPointer<commandport_obj>(j->second)->get_vertex();
1244 std::vector<HLS_manager::io_binding_type> var_read = HLSMgr->get_required_values(HLS->
functionId, op);
1245 auto vect_size =
static_cast<unsigned int>(var_read.size());
1249 port_o::OUT, circuit, multiif_port_type);
1250 (j->second)->set_structural_obj(sel_obj);
1252 else if(GetPointer<commandport_obj>(j->second)->get_command_type() == commandport_obj::MULTI_UNBOUNDED)
1255 auto mu_obj = j->first.first;
1257 GetPointer<commandport_obj>(j->second)->get_string(), port_o::OUT, circuit, boolean_port_type);
1258 THROW_ASSERT(GetPointer<multi_unbounded_obj>(mu_obj),
"unexpected condition");
1259 SM->
add_connection(GetPointer<multi_unbounded_obj>(mu_obj)->get_out_sign(), alldone_command_port);
1260 (j->second)->set_structural_obj(alldone_command_port);
1265 port_o::OUT, circuit, boolean_port_type);
1266 (j->second)->set_structural_obj(sel_obj);
1268 if(GetPointer<commandport_obj>(j->second)->get_command_type() == commandport_obj::UNBOUNDED)
1270 vertex op = GetPointer<commandport_obj>(j->second)->get_vertex();
1276 std::string sign_owner_id = done->
get_owner()->get_id();
1279 THROW_ASSERT(GetPointer<port_o>(done)->get_ports_size() != 0,
1280 "port not correctly initialized" + done->
get_path());
1281 THROW_ASSERT(GetPointer<funit_obj>(fu_unit),
"unexpected port configuration");
1282 done = GetPointer<port_o>(done)->
get_port(GetPointer<funit_obj>(fu_unit)->get_index() %
1283 GetPointer<port_o>(done)->get_ports_size());
1285 sign_owner_id = sign_owner_id +
"_P" + done->
get_id();
1287 if(sig.find(done) == sig.end())
1289 sig[done] = SM->
add_sign(
"s_done_" + sign_owner_id, SM->
get_circ(), boolean_port_type);
1310 :
std::tuple<
generic_objRef, unsigned int, unsigned int>(
std::make_tuple(tgt, tgt_port, tgt_port_index))
1317 if((std::get<0>(*
this)) != (std::get<0>(other)))
1319 THROW_ASSERT(std::get<0>(*this)->get_string() != std::get<0>(other)->get_string(),
1320 "Found generic object with same name " + std::get<0>(*this)->get_string());
1321 return std::get<0>(*this)->get_string() < std::get<0>(other)->get_string();
1323 if(std::get<1>(*
this) != std::get<1>(other))
1325 return std::get<1>(*this) < std::get<1>(other);
1327 if(std::get<2>(*
this) != std::get<2>(other))
1329 return std::get<2>(*this) < std::get<2>(other);
1336 if(*(std::get<0>(x)) < *(std::get<0>(y)))
1340 if(*(std::get<0>(y)) < *(std::get<0>(x)))
1344 if(*(std::get<1>(x)) < *(std::get<1>(y)))
1348 if(*(std::get<1>(y)) < *(std::get<1>(x)))
1352 if(std::get<2>(x) < std::get<2>(y))
1356 if(std::get<2>(y) < std::get<2>(x))
1360 if(std::get<3>(x) < std::get<3>(y))
1364 if(std::get<3>(y) < std::get<3>(x))
#define IUDATA_CONVERTER_STD
void add_connection(structural_objectRef src, structural_objectRef dest)
Create a connection between a source structural object and a destination structural object...
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
a multi unbounded controller
Data structure representing the entire HLS information.
#define INDENT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
Class implementation of the connection module converting the type and the size of connection objects...
void * top(node_stack *head)
#define GET_TYPE(data, vertex_index)
Helper macro returning the type associated with a node.
an element used for connecting the resources (e.g., muxes)
definition of target of a connection
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.
Base class for all unbounded objects added to datapath.
generic_objRef get(const vertex v) const
Returns reference to funit object associated with this vertex.
#define DEBUG_LEVEL_PEDANTIC
very verbose debugging print is performed.
This file contains the structures needed to manage a graph that will represent the state transition g...
Structure representing the most relevant information about the type of a structural object...
const std::string & get_id() const
Return the identifier associated with the structural_object.
const ParameterConstRef Param
class containing all the parameters
Base class for all command ports into datapath.
unsigned int get_type() const
Return generic_obj type.
#define GET_CLASS(obj)
Macro returning the actual type of an object.
void AddConnectionCB(const generic_objRef op1, const generic_objRef op2, unsigned int operand, unsigned int port_index, connection_objRef conn)
Creates a connection between two objects.
specify the type of a connection object: UINT
const structural_objectRef get_circ() const
Get a reference to circ field.
generic_objRef bind_selector_port(direction_type dir, unsigned int mode, const vertex &cond, const OpGraphConstRef data)
#define UUDATA_CONVERTER_STD
std::map< unsigned int, generic_objRef > input_ports
map between input port variable and generic object
a data port (in/out data)
#define INDENT_OUT_MEX(outLevel, curOutLevel, mex)
virtual void add_to_SM(const HLS_managerRef HLSMgr, const hlsRef HLS, const structural_managerRef SM)
Add the interconnection to the structural representation of the datapath.
generic_objRef get_port(unsigned int var, direction_type dir)
Returns reference to generic object associated to a given variable, for a specific port direction...
unsigned int get_assign(const vertex &v) const
Returns the functional unit assigned to the vertex.
const std::map< const_param, generic_objRef > & get_constant_objs() const
#define GET_NAME(data, vertex_index)
Helper macro returning the name associated with a node.
const structural_objectRef get_out_sign() const
Gets structural_object of output signal associated to this object.
const HLS_deviceRef HLS_D
reference to the information representing the target for the synthesis
This class manages command ports into datapath.
std::tuple< std::string, std::string > const_param
definition of the key to deal with constant parameters
AllocationInformationRef allocation_information
Store the technology information.
const structural_objectRef get_in_port(unsigned int n) const
Return the ith input port.
a converter from signed to signed int
virtual structural_objectRef find_member(const std::string &id, so_kind type, const structural_objectRef owner) const =0
Return the object named id of a given type which belongs to or it is associated with the object...
generic_objRef bind_port(unsigned int var, direction_type dir)
Bind variable to a port object.
unsigned long long determine_bit_level_mux() const
Returns the number of bit-level multiplexers.
Definition of hash function for EdgeDescriptor.
virtual void print() const
Function that prints the interconnection binding.
OpVertexSet operations
Set representing the subset of operations in the specification to be implemented. ...
#define UI_ALIGN_ADDER_STD
#define WENABLE_PORT_NAME
Class specification of the manager of the technology library data structures.
ConnectionTarget(generic_objRef tgt, unsigned int tgt_port, unsigned int tgt_port_index)
Constructor.
#define ASSIGN_SIGNED_STD
refcount< conn_binding > conn_bindingRef
Refcount definition of the class.
static const std::string get_mode_string(unsigned int _mode)
generic_objRef get_constant_obj(const std::string &value, const std::string ¶m, unsigned int precision)
Class adopt to represent a mux connection.
bool check_pv_allconnected(structural_objectRef port_i)
check if a port vector has its port bounded to something
a converter from unsigned to unsigned int
std::map< unsigned int, Selectors > selectors
A set of operation vertices.
void add_data_transfer(const generic_objRef op1, const generic_objRef op2, unsigned int operand, unsigned int port_index, data_transfer data)
Adds a data transfer between two objects.
std::map< const_param, generic_objRef > constant_values
constant values
#define STR(s)
Macro which performs a lexical_cast to a string.
void add_command_ports(const HLS_managerRef HLSMgr, const hlsRef HLS, const structural_managerRef SM)
Add signals from/to controller.
Auxiliary methods for manipulating string.
s_type type
The type of the port or the signal.
Base class for all interconnection binding algorithms.
unsigned long long size
The size of the object (in bit). The objects having a size are: ports, signals, channels, data, and actions.
Base class for all resources into datapath.
#define CLOCK_PORT_NAME
standard name for ports
const structural_objectRef get_structural_obj() const
Gets structural_object associated to this object.
const OpNodeInfoConstRef CGetOpNodeInfo(const vertex node) const
Returns the info associated with a node.
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
fu_bindingRef Rfu
Store the refcounted functional unit binding of the operations.
const std::string get_string() const
Returns the name associated with the element.
s_type
Define the possible type of a structural object.
Base class for multiplexer into datapath.
Data structure used to store the interconnection binding of datapath elements.
std::map< std::pair< vertex, unsigned int >, generic_objRef > command_input_ports
map between command input port (operation vertex and command type) and generic object ...
void print(std::ostream &os) const
Prints elements into given stream.
std::map< unsigned int, generic_objRef > output_ports
map between output port variable and generic object
Class specification of the data structures used to manage technology information. ...
const std::string get_path() const
Return a unique identifier of the structural object.
#define TYPE_EXTERNAL
constant identifying the node type of a EXTERNAL operation (a function call)
static structural_objectRef add_port(const std::string &id, port_o::port_direction pdir, structural_objectRef owner, structural_type_descriptorRef type_descr, unsigned int treenode=0)
Create a new port.
const structural_objectRef get_out_port(unsigned int n) const
Return the ith output port.
a converter from real to real int
virtual void print(std::ostream &os) const
Print the structural_object (for debug purpose)
std::tuple< unsigned int, unsigned int, vertex, vertex, vertex > data_transfer
definition of the data transfer (tree_node, precision, from, to, data_transferred, current_op).
redefinition of set to manage ordered/unordered structures
static unsigned unique_id
const std::map< vertex, generic_objRef > & get_mu_ctrls() const
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
unsigned offset[NUM_VERTICES+1]
#define IIDATA_CONVERTER_STD
#define T_COND
constant used to represent control edges representing a true edge of a conditional statement...
std::map< vertex, generic_objRef > command_output_ports
map between output port variable and generic object
bool operator<(const ConnectionTarget &other) const
virtual ~conn_binding()
Destructor.
virtual enum so_kind get_kind() const =0
Virtual function used to find the real type of a structural_object instance.
Base class for all dataports into datapath.
#define FFDATA_CONVERTER_STD
static std::string NormalizeTypename(const std::string &id)
Return normalized name of types and variables.
#define UIDATA_CONVERTER_STD
primary ports of datapath.
void specialise_mux(const generic_objRef mux, unsigned int bits_tgt) const
Specialize a multiplexer according to the type of the variables crossing it.
conn_binding(const BehavioralHelperConstRef BH, const ParameterConstRef parameters)
Constructor.
void mux_connection(const hlsRef HLS, const structural_managerRef SM)
Add the mux-based interconnection.
static conn_bindingRef create_conn_binding(const HLS_managerRef _HLSMgr, const hlsRef _HLS, const BehavioralHelperConstRef _BH, const ParameterConstRef _parameters)
factory method to create the right conn_binding depending on the flow
#define THROW_ERROR(str_expr)
helper function used to throw an error in a standard way
void type_resize(unsigned long long new_bit_size)
Just resize the size of the bits of the object.
std::map< ConnectionTarget, ConnectionSources > conn_variables
map between the input of the unit and the corresponding incoming connections.
static void check_bitwidth(unsigned long long prec)
check if the maximum bitwidth used for registers, busses, muxes, etc. is compatible with prec ...
This file collects some utility functions.
std::map< vertex, std::map< unsigned int, generic_objRef > > activation_ports
map between a vertex and the corresponding activation signal
structural_objectRef add_constant(std::string id, structural_objectRef owner, structural_type_descriptorRef type, std::string value, unsigned int treenode=0)
Create a new constant;.
structural_objectRef add_module_from_technology_library(const std::string &id, const std::string &fu_name, const std::string &library_name, const structural_objectRef owner, const technology_managerConstRef TM)
Create a new object starting from a library component.
conn_implementation_map conn_implementation
map between the connection <src, tgt, tgt_port, tgt_port_index> and the corresponding object ...
bool operator()(const connection &x, const connection &y) const
Compare position of two connections.
void set_out_sign(const structural_objectRef &out_sign_)
Sets structural_object of output signal associated to this object.
std::tuple< generic_objRef, generic_objRef, unsigned int, unsigned int > connection
connection between two objects (<src, tgt, tgt_port, tgt_port_index>)
Class implementation of the adder connection module.
#define GET_TYPE_SIZE(structural_obj)
Macro returning the size of the type of a structural object.
const structural_type_descriptorRef & get_typeRef() const
Return the type descriptor of the structural_object.
#define ASSIGN_UNSIGNED_STD
static structural_objectRef add_sign(std::string id, structural_objectRef owner, structural_type_descriptorRef sign_type, unsigned int treenode=0)
Create a new signal.
const structural_objectRef get_owner() const
Return the owner.
#define OUTPUT_LEVEL_VERY_PEDANTIC
verbose debugging print is performed.
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.
const std::map< ConnectionTarget, ConnectionSources > & get_data_transfers() const
Returns the map containing all the data transfers.
void add_sparse_logic_dp(const hlsRef HLS, const structural_managerRef SM, const HLS_managerRef HLSMgr)
Add sparse logic to the datapath.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
a converter from signed to unsigned int
this class is used to manage the command-line or XML options.
void add_datapath_connection(const technology_managerRef TM, const structural_managerRef SM, const structural_objectRef src, const structural_objectRef port_tgt, unsigned int conn_type)
Add a data converter, if needed, between two objects of the structural representation of the datapath...
const BehavioralHelperConstRef BH
reference to the behavioral helper associated with the specification
CustomOrderedSet< generic_objRef, GenericObjSorter > sparse_logic
set containing all the sparse logic contained into the datapath
unsigned int functionId
this is the identifier of the function to be implemented
an adder object representation used to compute some addresses
Class implementation of the structural_manager.
StateTransitionGraphManagerRef STG
Store the refcounted state transition graph.
enum { IN=0, OUT } direction_type
direction port identifier
x
Return the smallest n such that 2^n >= _x.
This package is used by all HLS packages to manage resource constraints and characteristics.
generic_objRef bind_command_port(const vertex &ver, direction_type dir, unsigned int mode, const OpGraphConstRef g)
Bind vertex to a command port object.
virtual void mux_allocation(const hlsRef HLS, const structural_managerRef SM, structural_objectRef src, structural_objectRef tgt, connection_objRef conn)
Add multiplexers to the structural representation of the datapath.
int debug_level
control the verbosity during the debugging
Datastructure to describe functions allocation in high-level synthesis.
Base class for all register into datapath.
specify the type of a connection object: INT
#define DEBUG_LEVEL_VERBOSE
verbose debugging print is performed.
std::map< std::string, structural_objectRef > converters
data type converters
Data structure definition for high-level synthesis flow.
This class describes a generic module.
const std::string get_name() const
Returns the name of the type descriptor.
int output_level
control the output verbosity
conn_bindingRef Rconn
Store the refcounted interconnection of datapath elements.
unsigned int get_index(const vertex &v) const
Returns the index of functional unit assigned to the vertex.
a converter from unsigned to signed int
Class specification of the manager of the tree structures extracted from the raw file.
refcount< generic_obj > generic_objRef
RefCount definition for generic_obj class.
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.
This class is a specialization of generic_obj class to represent a multiplexer into the datapath...
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...