87 #define USE_ALIGNMENT_INFO 1 122 const DesignFlowManagerConstRef _design_flow_manager)
172 "-->Connection Binding Information for function " +
173 HLSMgr->CGetFunctionBehavior(
funId)->CGetBehavioralHelper()->get_function_name() +
":");
175 "---Number of allocated multiplexers (2-to-1 equivalent): " + std::to_string(mux));
182 "Time to perform interconnection binding: " +
print_cpu_time(step_time) +
" seconds");
200 generic_objRef fu_obj,
unsigned int port_num,
unsigned int port_index,
201 unsigned int tree_var,
unsigned int precision,
bool is_not_a_phi)
204 for(
const auto state : running_states)
206 if(GetPointer<register_obj>(fu_obj) && !is_not_a_phi)
209 if(state_info && state_info->is_duplicated && !state_info->all_paths)
211 bool found_branch =
false;
215 for(
const auto& def_edge : gp->CGetDefEdgesList())
217 auto bbID = def_edge.second;
218 if(!state_info->isOriginalState && bbID != state_info->sourceBb)
222 else if(state_info->isOriginalState && bbID == state_info->sourceBb)
226 else if(state_info->moved_op_def_set.find(
cur_phi_tree_var) != state_info->moved_op_def_set.end())
246 for(
const auto stateIn : states_in)
252 " - add data transfer from " 254 << std::to_string(port_num) <<
":" << std::to_string(port_index) <<
" from state " 258 HLSMgr->CGetFunctionBehavior(
funId)->CGetBehavioralHelper()->PrintVariable(tree_var)) :
260 generic_objRef enable_obj = GetPointer<register_obj>(fu_obj)->get_wr_enable();
261 GetPointer<commandport_obj>(enable_obj)
264 GetPointer<commandport_obj>(enable_obj)->set_phi_write_enable();
266 " - write enable for " + fu_obj->
get_string() +
" from state " 276 " - add data transfer from " 277 << fu_obj_src->
get_string() <<
" to " << fu_obj->
get_string() <<
" port " << std::to_string(port_num)
278 <<
":" << std::to_string(port_index) <<
" in state " 282 HLSMgr->CGetFunctionBehavior(
funId)->CGetBehavioralHelper()->PrintVariable(tree_var)) :
294 const auto gm = GetPointer<const gimple_assign>(node);
295 bool right_addr_expr =
false;
298 right_addr_expr =
true;
306 if(var &&
HLSMgr->Rmem->is_private_memory(var))
308 unsigned long long int max_addr =
310 unsigned int address_bitsize;
311 for(address_bitsize = 1; max_addr > (1ull << address_bitsize); ++address_bitsize)
315 return address_bitsize;
328 if(GetPointer<integer_cst>(tn))
339 generic_objRef fu_obj,
unsigned int port_num,
unsigned int port_index,
341 unsigned int alignment)
344 auto tree_var = std::get<0>(_var);
345 unsigned long long int constant_value = std::get<1>(_var);
346 auto bus_addr_bitsize =
HLSMgr->get_address_bitsize();
347 bus_addr_bitsize =
std::min(precision, bus_addr_bitsize);
359 auto* ae = GetPointer<addr_expr>(tn);
362 auto* gm = GetPointer<const gimple_assign>(node);
366 #if USE_ALIGNMENT_INFO 373 alignment = GetPointer<const type_node>(
GET_CONST_NODE(type))->algn;
377 if(gm && gm->temporary_address)
380 auto local_precision = bus_addr_bitsize;
383 unsigned long long int max_addr =
386 for(local_precision = 1; max_addr > (1ull << local_precision); ++local_precision)
392 port_index, data, local_precision, alignment);
397 port_index, data, precision, alignment);
403 auto* mr = GetPointer<mem_ref>(tn);
414 #if USE_ALIGNMENT_INFO 415 const auto cost_val =
offset;
416 alignment =
std::min(static_cast<unsigned int>(8 * (cost_val & -cost_val)), alignment);
419 GetPointer<adder_conn_obj>(current_operand)->add_bitsize(local_precision);
426 local_precision, alignment);
428 local_precision, alignment);
430 create_single_conn(data, op, current_operand, fu_obj, port_num, port_index, 0, local_precision,
436 local_precision, alignment);
449 if(
HLSMgr->Rmem->has_base_address(tree_var))
454 precision = bus_addr_bitsize;
459 case function_decl_K:
461 m_sym =
HLSMgr->Rmem->get_symbol(tree_var, tree_var);
462 constant_value =
HLSMgr->Rmem->get_base_address(tree_var, tree_var);
464 precision = bus_addr_bitsize;
468 case realpart_expr_K:
469 case imagpart_expr_K:
471 case view_convert_expr_K:
472 case bit_field_ref_K:
474 case misaligned_indirect_ref_K:
482 case cleanup_point_expr_K:
484 case component_ref_K:
487 case fix_ceil_expr_K:
488 case fix_floor_expr_K:
489 case fix_round_expr_K:
490 case fix_trunc_expr_K:
495 case non_lvalue_expr_K:
497 case reference_expr_K:
498 case reinterpret_cast_expr_K:
500 case static_cast_expr_K:
502 case truth_not_expr_K:
505 case reduc_max_expr_K:
506 case reduc_min_expr_K:
507 case reduc_plus_expr_K:
508 case vec_unpack_hi_expr_K:
509 case vec_unpack_lo_expr_K:
510 case vec_unpack_float_hi_expr_K:
511 case vec_unpack_float_lo_expr_K:
517 case ceil_div_expr_K:
518 case ceil_mod_expr_K:
520 case compound_expr_K:
521 case eh_filter_expr_K:
523 case exact_div_expr_K:
525 case floor_div_expr_K:
526 case floor_mod_expr_K:
529 case goto_subroutine_K:
541 case mult_highpart_expr_K:
546 case pointer_plus_expr_K:
547 case postdecrement_expr_K:
548 case postincrement_expr_K:
549 case predecrement_expr_K:
550 case preincrement_expr_K:
553 case round_div_expr_K:
554 case round_mod_expr_K:
558 case target_mem_ref_K:
559 case target_mem_ref461_K:
560 case trunc_div_expr_K:
561 case trunc_mod_expr_K:
562 case truth_and_expr_K:
563 case truth_andif_expr_K:
564 case truth_or_expr_K:
565 case truth_orif_expr_K:
566 case truth_xor_expr_K:
567 case try_catch_expr_K:
575 case unordered_expr_K:
576 case widen_sum_expr_K:
577 case widen_mult_expr_K:
578 case with_size_expr_K:
579 case vec_lshift_expr_K:
580 case vec_rshift_expr_K:
581 case widen_mult_hi_expr_K:
582 case widen_mult_lo_expr_K:
583 case vec_cond_expr_K:
584 case vec_pack_trunc_expr_K:
585 case vec_pack_sat_expr_K:
586 case vec_pack_fix_trunc_expr_K:
587 case vec_perm_expr_K:
588 case vec_extracteven_expr_K:
589 case vec_extractodd_expr_K:
590 case vec_interleavehigh_expr_K:
591 case vec_interleavelow_expr_K:
596 case namespace_decl_K:
598 case translation_unit_decl_K:
602 case template_decl_K:
605 case aggr_init_expr_K:
606 case case_label_expr_K:
611 case identifier_node_K:
612 case statement_list_K:
615 case array_range_ref_K:
618 case dot_prod_expr_K:
619 case ternary_plus_expr_K:
620 case ternary_pm_expr_K:
621 case ternary_mp_expr_K:
622 case ternary_mm_expr_K:
625 case bit_ior_concat_expr_K:
629 case with_cleanup_expr_K:
630 case extract_bit_expr_K:
631 case sat_plus_expr_K:
632 case sat_minus_expr_K:
633 case extractvalue_expr_K:
634 case insertvalue_expr_K:
635 case extractelement_expr_K:
636 case insertelement_expr_K:
646 THROW_ASSERT(precision,
"a precision greater than 0 is expected");
650 std::string param_name;
653 param_name = m_sym->get_symbol_name();
655 string_value =
STR(m_sym->get_address());
658 create_single_conn(data, op, C_obj, fu_obj, port_num, port_index, 0, precision, is_not_a_phi);
662 if(BH->is_a_constant(tree_var))
664 THROW_ASSERT(precision,
"a precision greater than 0 is expected: " +
STR(precision));
665 const auto C_value =
HLSMgr->get_constant_string(tree_var, precision);
669 create_single_conn(data, op, C_obj, fu_obj, port_num, port_index, tree_var, precision, is_not_a_phi);
672 connect_to_registers(op, data, fu_obj, port_num, port_index, tree_var, precision, is_not_a_phi);
677 unsigned int base_index;
679 if(GetPointer<parm_decl>(node))
681 base_index = tree_var;
685 auto* sn = GetPointer<ssa_name>(node);
692 unsigned int port_num,
unsigned int port_index,
unsigned int tree_var,
693 unsigned long long precision,
const bool is_not_a_phi)
695 THROW_ASSERT(tree_var,
"a non-null tree var is expected");
699 HLSMgr->CGetFunctionBehavior(
funId)->is_simple_pipeline());
701 for(
const auto state : running_states)
703 unsigned int tree_var_state_in;
707 "A pipelined function should not contain any phi operations");
709 if(state_info && state_info->is_duplicated && !state_info->all_paths)
711 bool found_branch =
false;
714 for(
const auto& def_edge : gp->CGetDefEdgesList())
716 auto bbID = def_edge.second;
717 if(!state_info->isOriginalState && bbID != state_info->sourceBb)
721 else if(state_info->isOriginalState && bbID == state_info->sourceBb)
725 else if(state_info->moved_op_def_set.find(
cur_phi_tree_var) != state_info->moved_op_def_set.end())
729 else if(state_info->moved_op_use_set.find(gp->res->index) != state_info->moved_op_use_set.end())
749 tree_var_state_in = tree_var;
752 " no state in for @" +
STR(tree_var_state_in) +
" - " + (is_not_a_phi ?
" not a phi" :
"phi") +
755 for(
const auto stateIn : states_in)
762 "A pipelined function should not contain any phi operations");
763 vertex srcState = stateIn;
767 std::swap(srcState, lstate);
778 " - add data transfer from primary input " 780 << std::to_string(port_num) <<
":" << std::to_string(port_index) <<
" from state " 782 HLSMgr->CGetFunctionBehavior(
funId)->CGetBehavioralHelper()->PrintVariable(tree_var));
790 if(def_op_ending_states.find(srcState) != def_op_ending_states.end())
797 " - add data transfer from " 799 << std::to_string(port_num) <<
":" << std::to_string(port_index) <<
" from state " 801 HLSMgr->CGetFunctionBehavior(
funId)->CGetBehavioralHelper()->PrintVariable(
808 fetch_previous(srcState, lstate), tree_var);
813 << r_index <<
" from " 815 HLSMgr->CGetFunctionBehavior(
funId)->CGetBehavioralHelper()->PrintVariable(
818 if(reg_obj != fu_obj)
824 " - add data transfer from " 825 << reg_obj->get_string() <<
" to " << fu_obj->
get_string() <<
" port " 826 << std::to_string(port_num) <<
":" << std::to_string(port_index) <<
" from state " 829 HLSMgr->CGetFunctionBehavior(
funId)->CGetBehavioralHelper()->PrintVariable(
837 HLSMgr->CGetFunctionBehavior(
funId)->CGetBehavioralHelper()->PrintVariable(tree_var));
844 "it has to be a register");
846 fetch_previous(srcState, lstate), tree_var);
851 << r_index <<
" from " 853 HLSMgr->CGetFunctionBehavior(
funId)->CGetBehavioralHelper()->PrintVariable(tree_var));
855 if(reg_obj != fu_obj)
861 " - add data transfer from " 862 << reg_obj->get_string() <<
" to " << fu_obj->
get_string() <<
" port " 863 << std::to_string(port_num) <<
":" << std::to_string(port_index) <<
" from state " 865 HLSMgr->CGetFunctionBehavior(
funId)->CGetBehavioralHelper()->PrintVariable(
870 if(GetPointer<register_obj>(fu_obj) && reg_obj != fu_obj)
872 generic_objRef enable_obj = GetPointer<register_obj>(fu_obj)->get_wr_enable();
873 GetPointer<commandport_obj>(enable_obj)
877 GetPointer<commandport_obj>(enable_obj)->set_phi_write_enable();
879 " - write enable for " + fu_obj->
get_string() +
" from state " 885 vertex tgt_state = stateIn;
896 " - add data transfer from primary input " 898 << std::to_string(port_num) <<
":" << std::to_string(port_index) <<
" from state " 900 HLSMgr->CGetFunctionBehavior(
funId)->CGetBehavioralHelper()->PrintVariable(tree_var));
906 unsigned int storage_value;
907 unsigned int r_index;
908 auto tgt_port = port_num;
909 auto tgt_index = port_index;
917 "The chain of registers propagating a primary input is broken");
922 data_transfer(tree_var, precision, previous, tgt_state, op));
925 " - add data transfer from " 926 << reg_obj->
get_string() <<
" to " << tgt_obj->get_string() <<
" port " 927 << std::to_string(tgt_port) <<
":" << std::to_string(tgt_index) <<
" from state " 930 HLSMgr->CGetFunctionBehavior(
funId)->CGetBehavioralHelper()->PrintVariable(
932 THROW_ASSERT(reg_obj != tgt_obj,
"There is a loop in the propagation chain");
933 tgt_state = previous;
944 data_transfer(tree_var, precision, previous, tgt_state, op));
947 " - add data transfer from primary input " 948 << fu_src_obj->
get_string() <<
" to " << tgt_obj->get_string() <<
" port " 949 << std::to_string(tgt_port) <<
":" << std::to_string(port_index) <<
" from state " 951 HLSMgr->CGetFunctionBehavior(
funId)->CGetBehavioralHelper()->PrintVariable(tree_var));
961 if(def_op_ending_states.find(state) != def_op_ending_states.end())
968 " - add data transfer from " 970 << std::to_string(port_num) <<
":" << std::to_string(port_index) <<
" from state " 972 HLSMgr->CGetFunctionBehavior(
funId)->CGetBehavioralHelper()->PrintVariable(
979 fetch_previous(state, tgt_state), tree_var);
984 << r_index <<
" from " 986 HLSMgr->CGetFunctionBehavior(
funId)->CGetBehavioralHelper()->PrintVariable(
990 not(reg_obj == fu_obj &&
HLSMgr->GetFunctionBehavior(
HLS->
functionId)->is_simple_pipeline()),
991 "There can be no direct forwarding in pipelining");
992 if(reg_obj != fu_obj)
998 " - add data transfer from " 999 << reg_obj->get_string() <<
" to " << fu_obj->
get_string() <<
" port " 1000 << std::to_string(port_num) <<
":" << std::to_string(port_index) <<
" from state " 1003 HLSMgr->CGetFunctionBehavior(
funId)->CGetBehavioralHelper()->PrintVariable(
1011 HLSMgr->get_tree_manager()->get_tree_node_const(tree_var)->ToString());
1014 else if(state_info && state_info->is_duplicated && state_info->clonedState !=
NULL_VERTEX &&
1015 !state_info->all_paths && def_op_ending_states.find(state) != def_op_ending_states.end() &&
1016 std::find(state_info->moved_exec_op.begin(), state_info->moved_exec_op.end(), op) ==
1017 state_info->moved_exec_op.end())
1019 const auto gp = GetPointer<const gimple_phi>(
1021 bool phi_postponed =
false;
1022 unsigned int tree_temp = 0;
1023 for(
const auto& def_edge : gp->CGetDefEdgesList())
1025 auto bbID = def_edge.second;
1026 tree_temp = def_edge.first->index;
1027 if(bbID != state_info->sourceBb)
1031 else if(state_info->moved_op_def_set.find(tree_temp) != state_info->moved_op_def_set.end())
1033 phi_postponed =
true;
1036 else if(state_info->moved_op_use_set.find(tree_var) != state_info->moved_op_use_set.end())
1038 phi_postponed =
true;
1047 "Is phi postponed? " + (phi_postponed ? std::string(
"YES") : std::string(
"NO")));
1052 if(state_info->moved_op_use_set.find(tree_var) != state_info->moved_op_use_set.end() &&
1053 state_info->moved_op_def_set.find(tree_temp) == state_info->moved_op_def_set.end())
1056 fetch_previous(state, tgt_state), tree_temp);
1069 " - add data transfer from " 1071 << std::to_string(port_num) <<
":" << std::to_string(port_index) <<
" from state " 1073 HLSMgr->CGetFunctionBehavior(
funId)->CGetBehavioralHelper()->PrintVariable(
1080 "it has to be a register");
1082 fetch_previous(state, tgt_state), tree_var);
1087 << r_index <<
" from " 1089 HLSMgr->CGetFunctionBehavior(
funId)->CGetBehavioralHelper()->PrintVariable(
1092 if(reg_obj != fu_obj)
1098 " - add data transfer from " 1099 << reg_obj->get_string() <<
" to " << fu_obj->
get_string() <<
" port " 1100 << std::to_string(port_num) <<
":" << std::to_string(port_index) <<
" from state " 1103 HLSMgr->CGetFunctionBehavior(
funId)->CGetBehavioralHelper()->PrintVariable(
1112 "it has to be a register");
1114 fetch_previous(state, tgt_state), tree_var);
1119 << r_index <<
" from " 1121 HLSMgr->CGetFunctionBehavior(
funId)->CGetBehavioralHelper()->PrintVariable(tree_var));
1123 if(reg_obj != fu_obj)
1129 " - add data transfer from " 1130 << reg_obj->get_string() <<
" to " << fu_obj->
get_string() <<
" port " 1131 << std::to_string(port_num) <<
":" << std::to_string(port_index) <<
" from state " 1133 HLSMgr->CGetFunctionBehavior(
funId)->CGetBehavioralHelper()->PrintVariable(
1140 if(
HLSMgr->CGetFunctionBehavior(
funId)->is_simple_pipeline())
1146 unsigned int origin_idx;
1147 unsigned int target_idx;
1148 unsigned int origin_reg_idx;
1149 unsigned int target_reg_idx;
1153 for(
auto& var : in_vars)
1159 "A pipelined operation has more than one ending state");
1161 THROW_ASSERT(target != top,
"State defining a variable cannot have it as a live in variable");
1163 "There is a live in variable without any register");
1164 while(previous != top)
1167 "There is a live in variable without any register");
1169 "The variable is not in live-in");
1171 "The variable is not in live-out");
1183 " - add data transfer from " 1185 << std::to_string(0) <<
":" << std::to_string(0) <<
" from state " 1187 HLSMgr->CGetFunctionBehavior(
funId)->CGetBehavioralHelper()->PrintVariable(tree_var));
1197 unsigned long long form_par_bitsize,
unsigned int port_index,
1211 THROW_ASSERT(((inIP || inUP) && (outIP || outUP)) || (!inIP && !inUP && !outIP && !outUP),
"unexpected conversion");
1212 if(((inIP || inUP) && (outIP || outUP)) && (form_par_bitsize != size_tree_var))
1216 auto out_bitsize =
static_cast<unsigned>(form_par_bitsize);
1222 else if(inIP && outIP)
1226 else if(inUP && outIP)
1230 auto key = std::make_tuple(out_bitsize, ctype, varObj);
1236 GetPointer<iu_conv_conn_obj>(conv_port)->add_bitsize(out_bitsize);
1238 else if(inIP && outIP)
1241 GetPointer<ii_conv_conn_obj>(conv_port)->add_bitsize(out_bitsize);
1243 else if(inUP && outUP)
1246 GetPointer<uu_conv_conn_obj>(conv_port)->add_bitsize(out_bitsize);
1248 else if(inUP && outIP)
1251 GetPointer<ui_conv_conn_obj>(conv_port)->add_bitsize(out_bitsize);
1270 create_single_conn(data, op, conv_port, fu_obj, num, port_index, tree_var, out_bitsize, is_not_a_phi);
1272 else if(form_par_bitsize != size_tree_var)
1282 auto out_bitsize =
static_cast<unsigned>(form_par_bitsize);
1284 GetPointer<ff_conv_conn_obj>(conv_port)->add_bitsize_in(static_cast<unsigned>(size_tree_var));
1285 GetPointer<ff_conv_conn_obj>(conv_port)->add_bitsize_out(out_bitsize);
1288 create_single_conn(data, op, conv_port, fu_obj, num, port_index, tree_var, out_bitsize, is_not_a_phi);
1293 determine_connection(op, varObj, fu_obj, num, port_index, data, static_cast<unsigned>(size_tree_var));
1299 const auto TreeM =
HLSMgr->get_tree_manager();
1300 const auto FB =
HLSMgr->CGetFunctionBehavior(
funId);
1301 const auto BH = FB->CGetBehavioralHelper();
1303 const auto bus_addr_bitsize =
HLSMgr->get_address_bitsize();
1305 if(
parameters->getOption<
int>(OPT_memory_banks_number) > 1 && !
parameters->isOption(OPT_context_switch))
1318 const auto& mu = state2mu.second;
1319 const auto mu_mod = mu->get_structural_obj();
1320 const auto mut = GetPointer<multi_unbounded_obj>(mu);
1321 const auto en_port =
1323 mut->set_mu_enable(en_port);
1327 for(
auto r = 0
U; r < num_regs; r++)
1331 GetPointer<register_obj>(reg_obj)->set_wr_enable(sel_port);
1337 for(
unsigned int fu_num = 0; fu_num < num; fu_num++)
1340 const auto tmp_Fu =
HLS->
Rfu->
get(i, fu_num);
1341 std::vector<technology_nodeRef> tmp_ops_node =
1344 if(tmp_ops_node.size() > 1)
1347 for(
unsigned int oper = 0; oper < tmp_ops_node.size(); oper++)
1349 const auto sel_port =
1351 GetPointer<funit_obj>(tmp_Fu)->add_selector_op(sel_port, tmp_ops_node.at(oper)->get_name());
1360 BOOST_FOREACH(
vertex op, boost::vertices(*data))
1372 unsigned int port_index = n_channels < 2 ? 0 : idx % n_channels;
1374 " * Operation: " +
GET_NAME(data, op) <<
" " + data->CGetOpNodeInfo(op)->GetOperation());
1380 const auto tmp_ops_node_size =
1382 if(tmp_ops_node_size > 1
U)
1384 if(!GetPointer<funit_obj>(
HLS->
Rfu->
get(fu, idx)))
1387 " does not have an instance " +
STR(idx));
1389 const auto selector_obj =
1390 GetPointer<funit_obj>(
HLS->
Rfu->
get(fu, idx))->GetSelector_op(data->CGetOpNodeInfo(op)->GetOperation());
1394 " does not have selector " + data->CGetOpNodeInfo(op)->GetOperation() +
"(" +
STR(idx) +
1395 ") Operation: " +
STR(data->CGetOpNodeInfo(op)->GetNodeId()));
1398 for(
const auto state : running_states)
1400 bool is_starting_operation = std::find(astg->CGetStateInfo(state)->starting_operations.begin(),
1401 astg->CGetStateInfo(state)->starting_operations.end(),
1402 op) != astg->CGetStateInfo(state)->starting_operations.end();
1405 GetPointer<commandport_obj>(selector_obj)
1409 " - add activation for " + selector_obj->get_string() +
" in state " 1416 std::vector<HLS_manager::io_binding_type> var_read =
HLSMgr->get_required_values(
HLS->
functionId, op);
1418 unsigned int index = 0;
1420 for(
auto& num : var_read)
1422 if(std::get<0>(num) == 0)
1425 " - " << index <<
". Read: " +
STR(std::get<1>(num)));
1430 " - " << index <<
". Read: " + BH->PrintVariable(std::get<0>(num)));
1438 auto node_id = data->CGetOpNodeInfo(op)->GetNodeId();
1439 const tree_nodeRef node = TreeM->get_tree_node_const(node_id);
1440 auto* gm = GetPointer<gimple_assign>(node);
1441 THROW_ASSERT(gm,
"only gimple_assign's are allowed as memory operations");
1446 unsigned int alignment = 0;
1448 unsigned int size_var;
1450 unsigned int var_node_idx;
1451 unsigned long long Prec = 0;
1465 unsigned int algn = 0;
1474 #if USE_ALIGNMENT_INFO 1482 size_var = std::get<0>(var_read[0]);
1491 const auto IR_var_bitsize =
static_cast<unsigned int>(
1493 unsigned int var_bitsize;
1494 if(Prec != algn && Prec % algn)
1497 var_bitsize =
static_cast<unsigned int>(Prec);
1502 var_bitsize = IR_var_bitsize;
1505 auto varObj = var_read[0];
1508 auto key = std::make_tuple(var_bitsize,
iu_conv, varObj);
1517 GetPointer<iu_conv_conn_obj>(conv_port)->add_bitsize(var_bitsize);
1527 auto key = std::make_tuple(var_bitsize,
uu_conv, varObj);
1536 GetPointer<uu_conv_conn_obj>(conv_port)->add_bitsize(var_bitsize);
1544 create_single_conn(data, op, conv_port, fu_obj, 0, port_index, size_var, var_bitsize,
true);
1550 determine_connection(op, var_read[0], fu_obj, 0, port_index, data, static_cast<unsigned>(prec));
1561 if(var_node->
get_kind() == ssa_name_K)
1564 "only complex objects are considered");
1568 auto port_offset = [&](
unsigned pi) ->
unsigned int {
1585 THROW_ASSERT(var_node->
get_kind() == mem_ref_K,
"MEMORY REFERENCE/LOAD-STORE type not supported: " +
1590 port_index, data, bus_addr_bitsize, alignment);
1592 if(Prec != algn && Prec % algn)
1603 unsigned int var_bitsize;
1604 var_bitsize =
static_cast<unsigned int>(IR_var_bitsize);
1618 for(
unsigned int num = 0; num < var_read.size(); num++)
1631 THROW_ASSERT(var_read.size() == 2,
"unexpected condition");
1632 std::swap(var_read[0], var_read[1]);
1634 for(
unsigned int port_num = 0; port_num < var_read.size(); port_num++)
1636 const auto tree_var = std::get<0>(var_read[port_num]);
1637 const auto tree_var_node = tree_var == 0 ? nullptr : TreeM->CGetTreeReindex(tree_var);
1638 const auto& node = data->CGetOpNodeInfo(op)->node;
1641 const auto OperationType = data->CGetOpNodeInfo(op)->GetOperation();
1642 if(tree_var && !first_valid)
1644 first_valid = tree_var_node;
1646 if((OperationType ==
"cond_expr" || OperationType ==
"vec_cond_expr") && port_num != 0 && tree_var)
1648 first_valid = tree_var_node;
1654 " - " << port_num <<
". Read: " +
STR(std::get<1>(var_read[port_num])));
1659 " - " << port_num <<
". Read: " + BH->PrintVariable(tree_var));
1665 if(tree_var &&
HLSMgr->Rmem->is_actual_parm_loaded(tree_var))
1667 THROW_ERROR(
"LOADING of actual parameter not yet implemented");
1669 else if(form_par_type && tree_var &&
1678 add_conversion(port_num, op, form_par_type->index, size_form_par, port_index, fu_obj, data, TreeM,
1681 else if(first_valid && tree_var && first_valid->index != tree_var_node->index && !form_par_type &&
1682 OperationType !=
"rshift_expr" && OperationType !=
"lshift_expr" &&
1683 OperationType !=
"extract_bit_expr" && OperationType !=
"rrotate_expr" &&
1684 OperationType !=
"lrotate_expr" &&
1692 add_conversion(port_num, op, first_valid->index, size_form_par, port_index, fu_obj, data, TreeM,
1700 static_cast<unsigned>(prec));
1713 HLS->
STG->
GetStg()->CGetStateInfo(*ending_states.begin())->is_duplicated,
1714 "phis cannot run in more than one state");
1715 for(
const auto estate : ending_states)
1720 GetPointer<const gimple_phi>(TreeM->get_tree_node_const(data->CGetOpNodeInfo(op)->GetNodeId()));
1721 for(
const auto& def_edge : gp->CGetDefEdgesList())
1723 auto tree_temp = def_edge.first->index;
1725 "Pre-Managing phi operation " +
GET_NAME(data, op) +
" ending in state " +
1727 (tree_temp ?
" for variable " + def_edge.first->ToString() :
""));
1728 bool phi_postponed =
false;
1729 if(state_info && state_info->is_duplicated && !state_info->all_paths)
1731 auto bbID = def_edge.second;
1732 if(!state_info->isOriginalState && bbID != state_info->sourceBb)
1737 else if(state_info->isOriginalState && bbID == state_info->sourceBb)
1742 else if(state_info->moved_op_def_set.find(tree_temp) != state_info->moved_op_def_set.end())
1744 phi_postponed =
true;
1746 else if(state_info->moved_op_use_set.find(var_written) != state_info->moved_op_use_set.end())
1748 phi_postponed =
true;
1752 "Is phi postponed? " + (phi_postponed ? std::string(
"YES") : std::string(
"NO")));
1755 if(source_already_analyzed.find(tree_temp) == source_already_analyzed.end())
1757 source_already_analyzed.insert(tree_temp);
1766 "Pre-Managing phi operation2 " +
GET_NAME(data, op) +
" ending in state " +
1771 "phi cannot manage memory objects: @" +
STR(tree_temp));
1773 "phi cannot manage memory objects: @" +
STR(var_written));
1774 THROW_ASSERT(TreeM->CGetTreeNode(tree_temp)->get_kind() != array_ref_K,
"unexpected phi use");
1775 THROW_ASSERT(TreeM->CGetTreeNode(tree_temp)->get_kind() != indirect_ref_K,
"unexpected phi use");
1776 THROW_ASSERT(TreeM->CGetTreeNode(tree_temp)->get_kind() != misaligned_indirect_ref_K,
1777 "unexpected phi use");
1780 "Managing phi operation " +
GET_NAME(data, op) +
" ending in state " +
1794 "conversion required");
1799 if(in_bitsize != out_bitsize)
1807 GetPointer<u_assign_conn_obj>(conv_port)->add_bitsize(static_cast<unsigned>(in_bitsize));
1810 state_info->moved_op_use_set.find(var_written) != state_info->moved_op_use_set.end() &&
1812 state_info->moved_op_def_set.end())
1814 auto src_storage_value =
1826 for(
const auto state_out : states_out)
1830 static_cast<unsigned>(in_bitsize), estate,
1834 static_cast<unsigned>(in_bitsize), estate,
1837 " - add data transfer from " 1838 << fu_src_obj->get_string() <<
" to " << conv_port->
get_string()
1839 <<
" port 0:0 from state " 1843 ->CGetBehavioralHelper()
1845 generic_objRef enable_obj = GetPointer<register_obj>(tgt_reg_obj)->get_wr_enable();
1846 GetPointer<commandport_obj>(enable_obj)
1851 " - write enable for " + tgt_reg_obj->
get_string() +
" from " 1861 GetPointer<i_assign_conn_obj>(conv_port)->add_bitsize(static_cast<unsigned>(in_bitsize));
1864 state_info->moved_op_use_set.find(var_written) != state_info->moved_op_use_set.end() &&
1866 state_info->moved_op_def_set.end())
1868 auto src_storage_value =
1882 for(
auto s_out_it = states_out.begin(); s_out_it != s_out_it_end; ++s_out_it)
1886 static_cast<unsigned>(in_bitsize), estate,
1890 static_cast<unsigned>(in_bitsize), estate,
1893 " - add data transfer from " 1894 << fu_src_obj->get_string() <<
" to " << conv_port->
get_string()
1895 <<
" port 0:0 from state " 1899 ->CGetBehavioralHelper()
1901 generic_objRef enable_obj = GetPointer<register_obj>(tgt_reg_obj)->get_wr_enable();
1902 GetPointer<commandport_obj>(enable_obj)
1907 " - write enable for " + tgt_reg_obj->
get_string() +
" from " 1917 GetPointer<f_assign_conn_obj>(conv_port)->add_bitsize(static_cast<unsigned>(in_bitsize));
1920 state_info->moved_op_use_set.find(var_written) != state_info->moved_op_use_set.end() &&
1922 state_info->moved_op_def_set.end())
1924 auto src_storage_value =
1938 for(
auto s_out_it = states_out.begin(); s_out_it != s_out_it_end; ++s_out_it)
1942 static_cast<unsigned>(in_bitsize), estate,
1946 static_cast<unsigned>(in_bitsize), estate,
1949 " - add data transfer from " 1950 << fu_src_obj->get_string() <<
" to " << conv_port->
get_string()
1951 <<
" port 0:0 from state " 1955 ->CGetBehavioralHelper()
1957 generic_objRef enable_obj = GetPointer<register_obj>(tgt_reg_obj)->get_wr_enable();
1958 GetPointer<commandport_obj>(enable_obj)
1963 " - write enable for " + tgt_reg_obj->
get_string() +
" from " 1972 STR(out_bitsize) +
" " +
1973 TreeM->get_tree_node_const(data->CGetOpNodeInfo(op)->GetNodeId())->
ToString());
1980 state_info->moved_op_use_set.find(var_written) != state_info->moved_op_use_set.end() &&
1981 state_info->moved_op_def_set.find(
cur_phi_tree_var) == state_info->moved_op_def_set.end())
1983 auto src_storage_value =
1996 for(
auto s_out_it = states_out.begin(); s_out_it != s_out_it_end; ++s_out_it)
2000 static_cast<unsigned>(in_bitsize), estate,
2004 " - add data transfer from " 2006 <<
" port 0:0 from state " 2009 HLSMgr->CGetFunctionBehavior(
funId)->CGetBehavioralHelper()->PrintVariable(
2011 generic_objRef enable_obj = GetPointer<register_obj>(tgt_reg_obj)->get_wr_enable();
2012 GetPointer<commandport_obj>(enable_obj)
2016 " - write enable for " + tgt_reg_obj->
get_string() +
" from " 2025 if(in_bitsize != out_bitsize)
2028 out_bitsize, 0, tgt_reg_obj, data, TreeM, tree_temp);
2033 static_cast<unsigned>(in_bitsize));
2053 auto node_id = data->CGetOpNodeInfo(op)->GetNodeId();
2054 std::vector<HLS_manager::io_binding_type> var_read =
HLSMgr->get_required_values(
HLS->
functionId, op);
2058 for(
const auto estate : ending_states)
2063 " - add data transfer from " 2066 GetPointer<commandport_obj>(TargetPort)
2070 " - add activation for " + TargetPort->
get_string() +
" in state " 2074 else if(var_written == 0)
2084 for(
const auto estate : ending_states)
2091 " - add data transfer from " << fu_obj->
get_string() <<
" to " 2094 GetPointer<commandport_obj>(TargetPort)
2098 " - add activation for " + TargetPort->
get_string() +
" in state " 2108 for(
const auto estate : ending_states)
2116 " - add data transfer from " 2119 HLSMgr->CGetFunctionBehavior(
funId)->CGetBehavioralHelper()->PrintVariable(var_written));
2120 GetPointer<commandport_obj>(TargetPort)
2124 " - add activation for " + TargetPort->
get_string() +
" in state " 2132 for(
const auto estate : ending_states)
2138 for(
auto s_out_it = states_out.begin(); s_out_it != s_out_it_end; ++s_out_it)
2140 auto storage_value =
2147 estate, *s_out_it, op));
2150 " - add data transfer from " 2153 HLSMgr->CGetFunctionBehavior(
funId)->CGetBehavioralHelper()->PrintVariable(
2155 generic_objRef enable_obj = GetPointer<register_obj>(tgt_reg_obj)->get_wr_enable();
2156 GetPointer<commandport_obj>(enable_obj)
2160 " - write enable for " + tgt_reg_obj->
get_string() +
" from " 2182 unsigned int allocated_mux = 0;
2183 unsigned int iteration = 0;
2188 auto operand = std::get<1>(connection.first);
2189 auto port_index = std::get<2>(connection.first);
2191 "Unit: " + unit->
get_string() +
"(" + std::to_string(operand) +
":" + std::to_string(port_index) +
2192 "): " + std::to_string(connection.second.size()) +
" connections");
2193 allocated_mux +=
input_logic(connection.second, unit, operand, port_index, iteration);
2197 return allocated_mux;
2201 unsigned int op,
unsigned int port_index,
unsigned int iteration)
2203 static unsigned int used_mux = 0;
2204 unsigned int starting_value = used_mux;
2207 if(srcs.size() == 1)
2215 ":" +
STR(port_index) +
")");
2220 std::map<generic_objRef, std::vector<std::pair<generic_objRef, unsigned int>>> src_mux_tree;
2223 std::map<data_transfer, generic_objRef> var2obj;
2225 std::map<generic_objRef, std::list<data_transfer>> obj2var;
2227 std::map<data_transfer, generic_objRef> var2src;
2230 std::map<std::pair<vertex, vertex>,
generic_objRef> check_sources;
2233 std::list<generic_objRef> to_allocate;
2235 for(
const auto& src : srcs)
2239 THROW_ASSERT(vars.size(),
"A connection should contain at least one data-transfer");
2240 for(
const auto& var : vars)
2245 " - var: (bool) from. " +
HLS->
Rliv->
get_name(std::get<2>(var)) +
" to " +
2248 else if(std::get<0>(var) != 0)
2253 HLSMgr->CGetFunctionBehavior(
funId)->CGetBehavioralHelper()->PrintVariable(std::get<0>(var)) +
2254 " of size " +
STR(std::get<1>(var)) +
" from. " +
HLS->
Rliv->
get_name(std::get<2>(var)) +
" to " +
2260 " - size: " +
STR(std::get<1>(var)) +
" from. " +
2264 var2obj[var] = src.first;
2265 var2src[var] = src.first;
2266 obj2var[src.first].push_back(var);
2268 if(check_sources.find(std::make_pair(std::get<2>(var), std::get<3>(var))) != check_sources.end() &&
2269 check_sources.find(std::make_pair(std::get<2>(var), std::get<3>(var)))->second != src.first)
2271 THROW_ERROR(
"two different sources for the same transition: from. " +
2273 " source 1 " + src.first->get_string() +
" source 2 " +
2274 check_sources.find(std::make_pair(std::get<2>(var), std::get<3>(var)))->second->get_string());
2276 else if(check_sources.find(std::make_pair(std::get<2>(var), std::get<3>(var))) == check_sources.end())
2278 check_sources[std::make_pair(std::get<2>(var), std::get<3>(var))] = src.first;
2284 to_allocate.push_back(src.first);
2288 to_allocate.push_front(src.first);
2293 if(to_allocate.size() > 1)
2295 unsigned int level = 0;
2296 std::map<unsigned int, unsigned int> level_map;
2301 to_allocate.pop_front();
2303 to_allocate.pop_front();
2305 if(GetPointer<mux_obj>(first))
2307 level = GetPointer<mux_obj>(first)->get_level() + 1;
2310 std::string mux_name =
2311 "MUX_" +
STR(iteration) +
"_" + tgt_string +
"_" +
STR(level) +
"_" +
STR(level_map[level]++);
2317 GetPointer<mux_obj>(mux)->set_selector(sel_port);
2319 to_allocate.push_back(mux);
2321 std::list<data_transfer>::iterator v;
2324 for(v = obj2var[first].begin(); v != obj2var[first].end(); ++v)
2326 if(GetPointer<mux_obj>(var2obj[*v]))
2328 GetPointer<mux_obj>(var2obj[*v])->set_target(mux);
2332 obj2var[mux].push_back(*v);
2334 if(std::find(src_mux_tree[var2src[*v]].begin(), src_mux_tree[var2src[*v]].end(),
2335 std::make_pair(mux,
T_COND)) == src_mux_tree[var2src[*v]].end())
2337 src_mux_tree[var2src[*v]].push_back(std::make_pair(mux,
T_COND));
2340 GetPointer<mux_obj>(mux)->add_bitsize(std::get<1>(*v));
2342 GetPointer<commandport_obj>(sel_port)->add_activation(
2346 " - add mux activation for " + sel_port->
get_string() +
" from state " 2351 for(v = obj2var[second].begin(); v != obj2var[second].end(); ++v)
2353 if(GetPointer<mux_obj>(var2obj[*v]))
2355 GetPointer<mux_obj>(var2obj[*v])->set_target(mux);
2359 obj2var[mux].push_back(*v);
2361 if(std::find(src_mux_tree[var2src[*v]].begin(), src_mux_tree[var2src[*v]].end(),
2362 std::make_pair(mux,
F_COND)) == src_mux_tree[var2src[*v]].end())
2364 src_mux_tree[var2src[*v]].push_back(std::make_pair(mux,
F_COND));
2367 GetPointer<mux_obj>(mux)->add_bitsize(std::get<1>(*v));
2369 " - FALSE input for " + sel_port->
get_string() +
" from state " 2373 }
while(to_allocate.size() > 1);
2376 for(
const auto& src : srcs)
2388 return used_mux - starting_value;
2394 const auto first = std::get<0>(obj);
2395 const auto second = std::get<1>(obj);
2399 const auto bus_addr_bitsize =
HLSMgr->get_address_bitsize();
2404 return bus_addr_bitsize;
2416 for(count = 1; second >= (1u << count); ++count)
#define GET_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
static bool IsSameType(const tree_nodeConstRef &tn0, const tree_nodeConstRef &tn1)
Given two nodes tells if they have same base type (const is not considered: const double == double) ...
#define TYPE_SWITCH
constant identifying the node type of a SWITCH operation.
void Initialize() override
Initialize the step (i.e., like a constructor, but executed just before exec.
Class specification to contain liveness information.
Generic class managing interconnection binding algorithms.
static tree_nodeConstRef GetFormalIth(const tree_nodeConstRef &obj, unsigned int parm_index)
Return the type of the ith formal parameter in case index_obj is a call_expr.
unsigned int get_register(unsigned int sv) const
return the register index where the storage value is stored
This class is used to specify the type of a connection object: UINT.
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
static bool IsUnionType(const tree_nodeConstRef &type)
Return if treenode is an union.
const HLS_managerRef HLSMgr
information about all the HLS synthesis
Data structure representing the entire HLS information.
std::pair< unsigned int, vertex > data_operation_pair
#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.
File containing functions and utilities to support the printing of debug messagges.
Base class for all unbounded objects added to datapath.
#define PRINT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
generic_objRef get(const vertex v) const
Returns reference to funit object associated with this vertex.
static bool is_int(const tree_managerConstRef &TM, const unsigned int index)
Return true if the treenode is of integer type.
#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...
const CustomOrderedSet< vertex > & get_state_where_end(vertex op) const
return in which support vertex the operation is ending
Base class for all command ports into datapath.
#define TYPE_MULTIIF
constant identifying the a multi-way if
#define TYPE_VPHI
constant string identifying an operation node of type virtual phi-nodes
const tree_nodeRef CGetTreeReindex(const unsigned int i) const
Return a tree_reindex wrapping the i-th tree_node.
#define GET_CLASS(obj)
Macro returning the actual type of an object.
CustomOrderedSet< vertex > noswap_computed_table
store the operations for which a port swapping is not beneficial
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.
static bool is_unsigned(const tree_managerConstRef &TM, const unsigned int index)
Return true if the treenode is of unsigned integer type.
This class is used to represent a connection through multiplexers.
#define TYPE_IF
constant identifying the node type of an IF operation.
const int output_level
The output level.
vertex get_entry_state() const
Gets vertex that represents state that contains entry node.
generic_objRef bind_selector_port(direction_type dir, unsigned int mode, const vertex &cond, const OpGraphConstRef data)
This class is used to specify the type of a connection object: REAL.
bool get_ports_are_swapped(vertex v) const
Check if vertex v has its ports swapped or not.
static bool is_real(const tree_managerConstRef &TM, const unsigned int index)
Return true if the treenode is of real type.
std::map< resource_id_type, std::map< unsigned int, CustomOrderedSet< unsigned int > > > regs_in
store the registers for each resource and for each port
unsigned long long object_bitsize(const tree_managerRef TreeM, const HLS_manager::io_binding_type &obj) const
Compute the bitsize given a io_binding type.
Datastructure to represent a memory symbol in HLS.
#define INDENT_OUT_MEX(outLevel, curOutLevel, mex)
unsigned int get_assign(const vertex &v) const
Returns the functional unit assigned to the vertex.
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.
static bool is_parameter(const tree_managerConstRef &TM, const unsigned int index)
return true in case the index corresponds to a parameter in ssa form or not
AllocationInformationRef allocation_information
Store the technology information.
Class adopted to represent direct connections inside the datapath.
unsigned int extract_parm_decl(unsigned int tree_var, const tree_managerRef TreeM)
unsigned long long determine_bit_level_mux() const
Returns the number of bit-level multiplexers.
DesignFlowStep_Status InternalExec() override
Execute the step.
const CustomOrderedSet< vertex > & get_state_in(vertex state, vertex op, unsigned int var) const
given a variable and a state it returns the set of states from which the variable may come ...
virtual void print() const
Function that prints the interconnection binding.
#define GET_INDEX_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
std::map< std::tuple< unsigned int, cacheType, const HLS_manager::io_binding_type >, generic_objRef > connCache
connection cache
bool has_state_out(vertex state, vertex op, unsigned int var) const
return true in case the variable for a given op and a given state has a state out ...
void determine_connection(const vertex &op, const HLS_manager::io_binding_type &var, generic_objRef fu_obj, unsigned int port_num, unsigned int port_index, const OpGraphConstRef data, unsigned int precision, unsigned int alignment=0)
Determine the actual interconnection.
This class is used to convert unsigned into unsigned int.
This class is used to convert unsigned into signed int.
refcount< conn_binding > conn_bindingRef
Refcount definition of the class.
bool isConstantObj(unsigned int tree_index, const tree_managerRef TreeM)
#define OUTPUT_LEVEL_MINIMUM
minimum debugging print is performed.
This class is used to convert signed into signed int.
generic_objRef get_constant_obj(const std::string &value, const std::string ¶m, unsigned int precision)
Class adopt to represent a mux connection.
std::tuple< unsigned int, unsigned int > io_binding_type
tuple set used to represent the required values or the constant default value associated with the inp...
Include a set of utilities used to manage CPU time measures.
#define TYPE_LOAD
Constant string identifying a memory load operation.
const tree_nodeConstRef CGetTreeNode(const unsigned int i) const
#define TYPE_PHI
constant string identifying an operation node of type PHI
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.
virtual enum kind get_kind() const =0
Virtual function returning the type of the actual class.
#define STR(s)
Macro which performs a lexical_cast to a string.
Auxiliary methods for manipulating string.
std::string ToString(ActorGraphBackend_Type actor_graph_backend_type)
Header include.
static bool IsUnsignedIntegerType(const tree_nodeConstRef &type)
Return true if the treenode is of unsigned integer type.
const tree_nodeRef get_tree_node_const(unsigned int i) const
Return the reference to the i-th tree_node Constant version of get_tree_node.
static bool IsSignedIntegerType(const tree_nodeConstRef &type)
Return true if the treenode is of integer type.
const OpNodeInfoConstRef CGetOpNodeInfo(const vertex node) const
Returns the info associated with a node.
static bool IsArrayType(const tree_nodeConstRef &type)
Return true if treenode is an array.
std::string convert_to_binary(G _value, unsigned long long precision)
void create_connections()
Creates the connections inside the architecture.
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
#define START_TIME(time_var)
Macro used to store the start time into time_var.
fu_bindingRef Rfu
Store the refcounted functional unit binding of the operations.
virtual std::string get_kind_text() const =0
Virtual function returning the name of the actual class.
const std::string get_string() const
Returns the name associated with the element.
This class is used to convert signed into unsigned int.
refcount< connection_obj > connection_objRef
RefCount definition for connection_obj class.
Data structure used to store the register binding of variables.
static unsigned long long Size(const tree_nodeConstRef &tn)
Return the size of a tree object.
StorageValueInformationRef storage_value_information
data-structure for storage values
Base class for multiplexer into datapath.
static bool IsBooleanType(const tree_nodeConstRef &type)
Return true if the treenode is of bool type.
unsigned int get_number(unsigned int unit) const
Returns number of functional unit allocated.
Data structure used to store the interconnection binding of datapath elements.
refcount< const StateInfo > StateInfoConstRef
std::map< unsigned int, generic_objRef > input_ports
map between input port variable and generic object
Class specification of the data structures used to manage technology information. ...
unsigned int address_precision(unsigned int precision, const vertex &op, const OpGraphConstRef data, const tree_managerRef TreeM)
generic_objRef get(const unsigned int &r) const
Returns reference to register object associated to a given index.
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).
#define STOP_TIME(time_var)
Macro used to store the elapsed time into time_var.
const std::map< vertex, generic_objRef > & get_mu_ctrls() const
#define TYPE_STORE
Constant string identifying a memory store operation.
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
Base class for all register into datapath.
unsigned offset[NUM_VERTICES+1]
#define T_COND
constant used to represent control edges representing a true edge of a conditional statement...
This file contains the structures needed to manage a graph that will represent the state transition g...
#define GET_CONST_NODE(t)
const CustomOrderedSet< unsigned int > & get_live_out(const vertex &v) const
Get the set of variables live at the output of a vertex.
const BehavioralHelperConstRef CGetBehavioralHelper() const
Returns the helper associated with the function.
const ParameterConstRef parameters
Set of input parameters.
DesignFlowStep_Status
The status of a step.
This file collects some utility functions and macros.
std::map< resource_id_type, std::map< unsigned int, CustomOrderedSet< unsigned int > > > chained_in
store the chained storage values for each resource and for each port
static bool is_a_pointer(const tree_managerConstRef &TM, const unsigned int index)
Return if treenode index is a pointer.
reg_bindingRef Rreg
Store the refcounted register binding of the variables.
std::list< unsigned int > get_allocation_list() const
Returns the set of allocated unit.
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
This class is used to specify the type of a connection object: INT.
const StateTransitionGraphConstRef CGetAstg() const
Returns pointer to state transition graph created.
livenessRef Rliv
data-structure containing the variable liveness
static void check_bitwidth(unsigned long long prec)
check if the maximum bitwidth used for registers, busses, muxes, etc. is compatible with prec ...
#define CASE_TYPE_NODES
This macro collects all case labels for type objects.
This file collects some utility functions.
std::map< generic_objRef, CustomOrderedSet< data_transfer >, GenericObjSorter > ConnectionSources
definition of sources of a connection
tree_nodeRef GetTreeNode(const unsigned int index) const
Return the index-th tree_node (modifiable version)
Data structure used to store the interconnection binding of datapath elements when parallel memory co...
std::string print_cpu_time(long int t)
massage a long which represents a time interval in milliseconds, into a string suitable for output ...
Class implementation of the adder connection module.
void create_single_conn(const OpGraphConstRef data, const vertex &op, generic_objRef fu_obj_src, generic_objRef fu_obj, unsigned int port_num, unsigned int port_index, unsigned int tree_var, unsigned int precision, const bool is_not_a_phi)
create the connection object and update the unique table
CustomOrderedSet< vertex > swap_computed_table
store the operations for which a port swapping is beneficial
const CustomOrderedSet< vertex > & get_state_out(vertex state, vertex op, unsigned int var) const
given a variable and a state it returns the set of destination states where the variable may be used ...
void add_conversion(unsigned int num, vertex op, unsigned int form_par_type, unsigned long long form_par_bitsize, unsigned int port_index, const generic_objRef fu_obj, const OpGraphConstRef data, const tree_managerRef TreeM, unsigned int tree_var)
static tree_nodeConstRef GetBaseVariable(const tree_nodeConstRef &mem)
Retrun the base variable of a memory access.
bool has_state_in(vertex state, vertex op, unsigned int var) const
return true in case the variable for a given op and a given state has a state in
#define OUTPUT_LEVEL_PEDANTIC
verbose debugging print is performed.
Data flow graph with feedback.
Class to represent direct connections.
Class specification of the tree_reindex support class.
#define CASE_FAKE_NODES
This macro collects all case labels for fake or empty nodes.
Data structure used to store the functional-unit binding of the vertexes.
#define INFINITE_UINT
UNSIGNED INT representing infinite.
bool is_variable_mem(unsigned int node_id) const
Checks if a variable has been allocated in memory.
const CustomOrderedSet< vertex > & get_state_where_run(vertex op) const
return in which support vertex the operation is running
hlsRef HLS
HLS data structure of the function to be analyzed.
std::map< resource_id_type, std::map< unsigned int, CustomOrderedSet< resource_id_type > > > module_in
store the resource in IN for each resource and for each port
const std::map< ConnectionTarget, ConnectionSources > & get_data_transfers() const
Returns the map containing all the data transfers.
void Initialize() override
Initialize the step (i.e., like a constructor, but executed just before exec.
Data structures used in operations graph.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
static tree_nodeConstRef CGetType(const tree_nodeConstRef &node)
Return the treenode of the type of node.
This class is used to convert real into real.
static bool IsStructType(const tree_nodeConstRef &type)
Return true if treenode is a record.
unsigned int get_used_regs() const
returns number of used register
this class is used to manage the command-line or XML options.
#define CASE_CPP_NODES
This macro collects all case labels for cpp nodes.
static bool is_bool(const tree_managerConstRef &TM, const unsigned int index)
Return true if the treenode is of bool type.
static unsigned int align_to_trimmed_bits(unsigned int algn)
#define F_COND
constant used to represent control edges representing a false edge of a conditional statement...
StateTransitionGraphRef GetStg()
Returns pointer to state transition graph created.
unsigned int functionId
this is the identifier of the function to be implemented
std::tuple< vertex, vertex, data_operation_pair > transition
describe a transition from a source state to the target state plus the tree_node of the data transfer...
StateTransitionGraphManagerRef STG
Store the refcounted state transition graph.
Class to manage mux-based interconnections based on the FSM controller.
#define CASE_GIMPLE_NODES
This macro collects all cases labels for gimple nodes.
static integer_cst_t GetConstValue(const tree_nodeConstRef &tn, bool is_signed=true)
Get value from integer constant.
int debug_level
The debug level.
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.
mux_connection_binding(const ParameterConstRef _parameters, const HLS_managerRef HLSMgr, unsigned int funId, const DesignFlowManagerConstRef design_flow_manager)
Main constructor.
#define GET_INDEX_CONST_NODE(t)
vertex get_op_where_defined(unsigned int var) const
return which operation defines the variable
Base class for all register into datapath.
void connect_to_registers(vertex op, const OpGraphConstRef data, generic_objRef fu_obj, unsigned int port_num, unsigned int port_index, unsigned int tree_var, unsigned long long precision, const bool is_not_a_phi)
connect the fu_obj with the associated registers.
#define DEBUG_LEVEL_VERBOSE
verbose debugging print is performed.
static bool IsPointerType(const tree_nodeConstRef &type)
Return true if treenode index is a pointer.
Data structure definition for high-level synthesis flow.
conn_bindingRef Rconn
Store the refcounted interconnection of datapath elements.
void add_sparse_logic(const generic_objRef so)
#define NULL_VERTEX
null vertex definition
unsigned int cur_phi_tree_var
store the current phi use. Used during the analysis of phi nodes
Datastructure to represent memory information in high-level synthesis.
const std::string & get_name(vertex v) const
return the name of the given state
#define MULTI_READ_COND
constant string identifying the operation performed by a MULTI_READ_COND.
unsigned int get_index(const vertex &v) const
Returns the index of functional unit assigned to the vertex.
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.
A brief description of the C++ Header File.
unsigned int input_logic(const conn_binding::ConnectionSources &src, const generic_objRef tgt, unsigned int op, unsigned int port_index, unsigned int iteration)
Computes logic for inputs.
This class is used when pointers arithmetic is implicitly performed.
static bool IsRealType(const tree_nodeConstRef &type)
Return true if the treenode is of real type.
const CustomOrderedSet< unsigned int > & get_live_in(const vertex &v) const
Get the set of variables live at the input of a vertex.
This class is a specialization of generic_obj class to represent a multiplexer into the datapath...
~mux_connection_binding() override
Destructor.
#define CASE_PRAGMA_NODES
This macro collects all case labels for pragma objects.
void add_parameter_ports()
Add ports representing parameter values.
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...
unsigned int mux_interconnection()
Performs specialization of interconnections using mux architecture.