70 #include <boost/algorithm/string/case_conv.hpp> 78 std::string _c_val,
const unsigned int _el_idx,
79 const std::string::size_type _first_c_bit,
const std::string::size_type _c_size,
80 const unsigned int _b)
81 : op_start_time(t.op_start_time),
82 op_end_time(t.op_end_time),
84 op_id(t.op_info.op_id),
85 ssa_id(t.op_info.ssa_name_node_id),
86 fun_id(t.op_info.stg_fun_id),
87 op_start_state(t.fsm_ss_it->
value),
88 fu_name(HLSMgr->CGetFunctionBehavior(t.op_info.stg_fun_id)->CGetBehavioralHelper()->get_function_name()),
89 stmt_string(HLSMgr->get_tree_manager()->CGetTreeNode(t.op_info.op_id)->
ToString()),
90 c_val(
std::move(_c_val)),
91 vcd_val(t.out_var_it->
value),
92 fullsigname(t.fullsigname),
94 bitsize(t.op_info.bitsize),
96 first_c_bit(_first_c_bit),
105 const DesignFlowManagerConstRef _design_flow_manager)
107 TM(HLSMgr->get_tree_manager()),
108 Discr(_HLSMgr->RDiscr),
111 present_state_name(static_cast<
HDLWriter_Language>(_parameters->getOption<unsigned int>(OPT_writer_language)) ==
118 "Step " +
STR(__PRETTY_FUNCTION__) +
" should not be added without discrepancy");
126 switch(relationship_type)
134 ret.insert(std::make_tuple(
137 CBackendInformation::CB_DISCREPANCY_ANALYSIS,
138 parameters->getOption<std::string>(OPT_output_directory) +
"/simulation/discrepancy.c",
139 parameters->getOption<std::string>(OPT_output_directory) +
"/simulation/dynamic_discrepancy_stats")),
158 const std::string& scope,
const std::string& signal_name)
160 const auto scopes_end = vcd_trace.end();
161 const auto scopes_it = vcd_trace.find(scope);
162 if(scopes_it == scopes_end)
166 const auto signal_end = scopes_it->second.end();
167 const auto signal_it = scopes_it->second.find(signal_name);
168 if(signal_it == signal_end)
170 THROW_ERROR(
"cannot find signal: " + signal_name +
" in scope: " + scope);
172 return signal_it->second;
177 std::string top_scope =
Discr->unfolded_v_to_scope.at(
Discr->unfolded_root_v);
180 const std::list<sig_variation>& clock_sig_variations =
182 auto clock_var_it = clock_sig_variations.begin();
183 const auto clock_var_beg = clock_var_it;
184 const auto clock_var_end = clock_sig_variations.end();
185 const auto same_value = [clock_var_beg](
const sig_variation& v) {
return v.value == clock_var_beg->value; };
186 clock_var_it = std::find_if(std::next(clock_var_it), clock_var_end, same_value);
187 if(clock_var_it == clock_var_end)
189 THROW_ERROR(
"clock signal for top function does not complete a cycle");
191 unsigned long long clock_period = clock_var_it->time_stamp - clock_var_beg->time_stamp;
207 std::ofstream disc_stat_file;
208 std::string disc_stat_filename =
209 parameters->getOption<std::string>(OPT_output_directory) +
"/simulation/dynamic_discrepancy_stats";
210 disc_stat_file.open(disc_stat_filename, std::ofstream::app);
211 if(!disc_stat_file.is_open())
213 THROW_ERROR(
"can't open file " + disc_stat_filename);
216 std::string vcd_filename =
parameters->getOption<std::string>(OPT_output_directory) +
"/simulation/test.vcd";
218 long vcd_parse_time = 0;
233 "Parsed vcd file " + vcd_filename +
" in " +
print_cpu_time(vcd_parse_time) +
" seconds");
235 const std::string& discrepancy_data_filename =
HLSMgr->RDiscr->c_trace_filename;
237 long ctrace_parse_time = 0;
248 "Parsed C trace file " + discrepancy_data_filename +
" in " +
print_cpu_time(ctrace_parse_time) +
251 auto& c_op_trace =
Discr->c_op_trace;
252 if(c_op_trace.empty())
255 "Discrepancy Analysis: the trace of the C execution is empty. Discrepancy Analysis cannot be performed");
260 std::filesystem::remove(vcd_filename);
262 std::filesystem::remove(discrepancy_data_filename);
264 disc_stat_file <<
"Possibly lost address checks = 0 (empty trace)\n";
265 disc_stat_file <<
"Mismatched integers = 0 (empty trace)\n";
266 disc_stat_file.flush();
267 disc_stat_file.close();
271 std::map<unsigned int, std::map<std::string, struct vcd_trace_head>> op_id_to_scope_to_vcd_head;
274 long discrepancy_time = 0;
279 for(
const auto& c : c_op_trace)
282 const std::list<std::pair<uint64_t, std::string>>& optrace = c.second;
284 "can't find out signal for operation " +
STR(op_info.
op_id));
285 std::string& outsigname =
HLSMgr->RDiscr->opid_to_outsignal.at(op_info.
op_id);
293 if(!scope_set.empty())
295 op_id_to_scope_to_vcd_head[op_info.
op_id];
297 for(
const std::string& scope : scope_set)
302 std::string fullsigname = datapath_scope + outsigname;
304 const std::list<sig_variation>& op_out_vars =
get_signal_variations(vcd_trace, datapath_scope, outsigname);
306 const std::list<sig_variation>& present_state_vars =
309 const std::list<sig_variation>& start_vars =
317 const auto entry = stg_man->get_entry_state();
318 const auto stg = stg_man->CGetStg();
319 THROW_ASSERT(boost::out_degree(entry, *stg) == 1,
"Non deterministic initial state");
321 tie(oe, oend) = boost::out_edges(entry, *stg);
323 const auto initial_state_id = stg->CGetStateTransitionGraphInfo()->vertex_to_state_id.at(first_state);
325 op_id_to_scope_to_vcd_head.at(op_info.
op_id)
327 std::make_pair(scope,
vcd_trace_head(op_info, fullsigname, present_state_vars, op_out_vars, start_vars,
343 auto ct_it = optrace.begin();
344 const auto ct_end = optrace.cend();
345 while(ct_it != ct_end)
348 op_id_to_scope_to_vcd_head.at(op_info.
op_id).at(
Discr->context_to_scope.at(ct_it->first));
349 switch(vcd_head.
state)
415 "---Discrepancy analysis executed in " +
print_cpu_time(discrepancy_time) +
" seconds");
419 disc_stat_file <<
"Possibly lost address checks = ";
421 disc_stat_file <<
"Mismatched integers = ";
423 disc_stat_file.flush();
424 disc_stat_file.close();
427 "---DISCREPANCY CHECKS: " +
STR(
Discr->n_checked_operations) +
"/" +
STR(
Discr->n_total_operations));
429 bool first_discrepancy_print =
true;
434 "/====================================\\\n" 435 "| FINAL DISCREPANCY REPORT |\n" 436 "\\====================================/");
441 "/--------------------------------\\\n" 442 "| HARD DISCREPANCIES |\n" 443 "\\--------------------------------/");
453 "/--------------------------------\\\n" 454 "| SOFT DISCREPANCIES |\n" 455 "\\--------------------------------/");
461 first_discrepancy_print =
false;
464 bool persisting_warning =
false;
465 bool before_discrepancy =
false;
466 bool suspended_op_never_ends =
false;
468 for(
const auto& id_to_scope_to_head : op_id_to_scope_to_vcd_head)
470 for(
const auto& t : id_to_scope_to_head.second)
472 before_discrepancy =
discr_list.empty() || !t.second.starts_after(
discr_list.front().op_start_time);
475 t.second.consecutive_state_executions !=
476 std::numeric_limits<decltype(t.second.consecutive_state_executions)>
::max();
478 if(before_discrepancy && t.second.has_been_initialized &&
481 if(first_discrepancy_print)
485 "/====================================\\\n" 486 "| FINAL DISCREPANCY REPORT |\n" 487 "\\====================================/");
488 first_discrepancy_print =
false;
490 if(!persisting_warning)
494 "/------------------------------\\\n" 495 "| PERSISTING ERRORS |\n" 496 "\\------------------------------/");
500 persisting_warning =
true;
513 if((!
parameters->isOption(OPT_generate_vcd)) || (!
parameters->getOption<
bool>(OPT_generate_vcd)))
515 std::filesystem::remove(vcd_filename);
517 std::filesystem::remove(discrepancy_data_filename);
531 const std::string& vcd_val = t.
out_var_it->value;
532 bool is_mismatch =
false;
533 if(
parameters->isOption(OPT_discrepancy_force) &&
parameters->getOption<
bool>(OPT_discrepancy_force) &&
534 vcd_val.find_first_not_of(
"01") != std::string::npos)
555 "c_val.length() = " +
556 STR(c_val.length()) +
558 "vec_base_bitsize = " +
566 "c_val.length() = " +
567 STR(c_val.length()) +
573 STR(vcd_val.length()) +
"\n");
588 const unsigned int el_idx)
591 const std::string& vcd_val = t.
out_var_it->value;
602 "c_val.length() = " +
603 STR(c_val.length()) +
609 STR(c_elem_size) +
"\n");
616 "c_val.length() = " +
617 STR(c_val.length()) +
626 STR(vcd_val.length()) +
"\n");
628 bool is_mismatch =
false;
636 "c_val.length() = " +
637 STR(c_val.length()) +
646 STR(vcd_val.length()) +
"\n");
648 std::string::size_type part_size = c_elem_size / 2;
662 const unsigned int el_idx,
const std::string::size_type first_c_bit,
663 const std::string::size_type c_size)
665 unsigned int base_index = 0;
666 const bool resized = c_val.length() != c_size;
667 const std::string& resized_c_val = resized ? c_val.substr(first_c_bit, c_size) : c_val;
671 ": only complex or vectors are supposed to be resized for discrepancy analysis");
675 auto vcd_first_bit = first_c_bit;
676 if(vcd.size() > c_val.size())
678 vcd_first_bit += vcd.size() - c_val.size();
681 const std::string& resized_vcd_val = resized ? vcd.substr(vcd_first_bit, c_size) : vcd;
688 "address ssa cannot be real or complex: " 701 if(discrepancy_found)
709 const unsigned int el_idx,
const std::string::size_type first_c_bit,
710 const std::string::size_type c_size,
const unsigned int base_index)
712 bool hard_discrepancy =
true;
713 if(
parameters->isOption(OPT_discrepancy_permissive_ptrs) &&
716 hard_discrepancy =
false;
733 discr_list.emplace_back(
HLSMgr, t, c_context, c_val, el_idx, first_c_bit, c_size, base_index);
743 for(; soft_discr_it != soft_discr_end; soft_discr_it++)
747 soft_discr_to_remove.push_back(soft_discr_it);
751 for(
const auto& s : soft_discr_to_remove)
768 THROW_ASSERT(c_val.length() == resized_vcd_val.length(),
769 STR(c_val.length()) +
" != " +
STR(resized_vcd_val.length()));
774 } expected, computed;
777 size_t len = c_val.length();
778 for(
size_t i = 0; i < len; i++)
780 computed.b |= (resized_vcd_val.at(i) ==
'1') ? (1u << (len - i - 1)) : 0;
781 expected.b |= (c_val.at(i) ==
'1') ? (1u << (len - i - 1)) : 0;
784 float& c = computed.f;
785 float& e = expected.f;
786 if(std::isnan(c) && std::isnan(e))
790 else if(std::isinf(c) && std::isinf(e))
792 if(std::signbit(c) != std::signbit(e))
801 else if(std::isinf(c) || std::isinf(e) || std::isnan(c) || std::isnan(e))
809 ulp = std::fabs(c - e) / std::ldexp(1.0f, -(FLT_MANT_DIG - 1));
813 ulp = std::fabs(c - e) / std::ldexp(1.0f, std::ilogb(e) - (FLT_MANT_DIG - 1));
816 return static_cast<double>(ulp) >
parameters->getOption<
double>(OPT_max_ulp);
823 THROW_ASSERT(c_val.length() == resized_vcd_val.length(),
824 STR(c_val.length()) +
" != " +
STR(resized_vcd_val.length()));
828 unsigned long long b;
829 } expected, computed;
832 size_t len = c_val.length();
833 for(
size_t i = 0; i < len; i++)
835 computed.b |= (resized_vcd_val.at(i) ==
'1') ? (1ULL << (len - i - 1)) : 0;
836 expected.b |= (c_val.at(i) ==
'1') ? (1ULL << (len - i - 1)) : 0;
839 double& c = computed.f;
840 double& e = expected.f;
841 if(std::isnan(c) && std::isnan(e))
845 else if(std::isinf(c) && std::isinf(e))
847 if(std::signbit(c) != std::signbit(e))
856 else if(std::isinf(c) || std::isinf(e) || std::isnan(c) || std::isnan(e))
864 ulp = std::fabs(c - e) / std::ldexp(1.0, -(DBL_MANT_DIG - 1));
868 ulp = std::fabs(c - e) / std::ldexp(1.0, std::ilogb(e) - (DBL_MANT_DIG - 1));
871 return ulp >
parameters->getOption<
double>(OPT_max_ulp);
877 const std::string& c_val,
const std::string& vcd_val,
878 const unsigned int base_index)
const 880 const auto context_it =
Discr->c_addr_map.find(c_context);
881 THROW_ASSERT(context_it !=
Discr->c_addr_map.end(),
"no address map found for context " +
STR(c_context));
882 const auto var_id_to_base_address_it = context_it->second.find(base_index);
883 if(var_id_to_base_address_it == context_it->second.end())
888 uint64_t c_addr = std::stoull(c_val.c_str(),
nullptr, 2);
889 uint64_t c_base_addr = var_id_to_base_address_it->second;
890 bool c_offset_is_negative = c_addr < c_base_addr;
891 uint64_t c_addr_offset = c_addr - c_base_addr;
892 if(c_offset_is_negative)
894 c_addr_offset = c_base_addr - c_addr;
897 const uint64_t memory_area_bitsize =
900 "bitsize of a variable in memory must be multiple of 8 --> is " +
STR(memory_area_bitsize));
901 if(c_offset_is_negative || ((memory_area_bitsize / 8) <= (c_addr - c_base_addr)))
910 const std::string& resized_vcd_val =
911 c_val.length() < vcd_val.length() ? vcd_val.substr(vcd_val.length() - c_val.length()) : vcd_val;
915 if(resized_vcd_val.find_first_not_of(
"01") != std::string::npos)
919 uint64_t vcd_addr = std::stoull(resized_vcd_val.c_str(),
nullptr, 2);
920 uint64_t vcd_base_addr =
HLSMgr->Rmem->get_base_address(base_index, op_info.
stg_fun_id);
921 bool vcd_offset_is_negative = vcd_addr < vcd_base_addr;
922 uint64_t vcd_addr_offset = vcd_addr - vcd_base_addr;
923 if(vcd_offset_is_negative)
925 vcd_addr_offset = vcd_base_addr - vcd_addr;
928 if(vcd_offset_is_negative || ((memory_area_bitsize / 8) <= (vcd_addr - vcd_base_addr)))
934 return c_addr_offset != vcd_addr_offset;
939 const std::string& c_val,
const std::string& vcd_val,
940 unsigned int& base_index)
942 const auto* ssa = GetPointer<const ssa_name>(
TM->get_tree_node_const(op_info.
ssa_name_node_id));
944 if(base_index != 0 &&
HLSMgr->Rmem->has_base_address(base_index))
950 if(ssa->use_set->is_fully_resolved())
953 bool at_least_one_pointed_variable_is_in_scope =
false;
955 for(
const tree_nodeRef& pointed_var_decl_id : ssa->use_set->variables)
959 "opid = " +
STR(op_info.
op_id) +
" base index = " +
STR(base_index) +
" has no base address");
961 "no address map found for context " +
STR(c_context));
962 if(
Discr->c_addr_map.at(c_context).find(base_index) !=
Discr->c_addr_map.at(c_context).end())
965 at_least_one_pointed_variable_is_in_scope =
true;
973 THROW_ASSERT(at_least_one_pointed_variable_is_in_scope ==
true,
974 "no pointed variable are in scope for opid = " +
STR(op_info.
op_id));
979 const uint64_t c_addr =
static_cast<unsigned int>(std::stoull(c_val.c_str(),
nullptr, 2));
982 for(
const auto& addr :
Discr->c_addr_map.at(c_context))
984 addr2base_index[addr.second] = addr.first;
985 addrSet.insert(addr.second);
987 for(
auto it_set = addrSet.rbegin(); it_set != addrSet.rend(); ++it_set)
989 if(c_addr <= *it_set)
991 base_index = addr2base_index.at(*it_set);
1010 const std::string& vcd_val)
const 1019 "c_val.length() = " +
1020 STR(c_val.length()) +
1022 "vcd_val.length() = " +
1023 STR(vcd_val.length()) +
"\n");
1025 const bool to_resize = c_val.length() < vcd_val.length();
1026 const std::string resized_vcd_val = to_resize ? (vcd_val.substr(vcd_val.length() - c_val.length())) : vcd_val;
1028 if(c_val.length() == 32)
1030 if(resized_vcd_val.find_first_not_of(
"01") != std::string::npos)
1036 else if(c_val.length() == 64)
1038 if(resized_vcd_val.find_first_not_of(
"01") != std::string::npos)
1046 THROW_UNREACHABLE(
"only floating point with bitsize 32 or 64 are currently supported\n" 1050 "c_val.length() = " +
1051 STR(c_val.length()) +
"\n");
1057 std::string bitvalue =
1059 auto first_not_x_pos = bitvalue.find_first_not_of(
"xX");
1060 if(first_not_x_pos == std::string::npos)
1064 if(bitvalue.size() < vcd_val.size())
1066 first_not_x_pos += vcd_val.size() - bitvalue.size();
1068 const std::string vcd_trimmed_val = vcd_val.substr(first_not_x_pos);
1069 const std::string& longer = (vcd_trimmed_val.length() <= c_val.length()) ? c_val : vcd_trimmed_val;
1070 const std::string& shorter = (vcd_trimmed_val.length() <= c_val.length()) ? vcd_trimmed_val : c_val;
1071 if(longer.find_first_not_of(
"01") != std::string::npos || shorter.find_first_not_of(
"01") != std::string::npos)
1075 return shorter != longer.substr(longer.length() - shorter.length());
1081 std::string out_msg =
"\n/--------------------------------------------------------------------\n" 1082 "| ERROR in signal " +
1085 "| value in vcd: " +
1094 "| operation id: " +
1106 "| discrepancy time = " +
1109 "| failed operation starts at time " +
1112 "| when fsm state is " +
1115 "| assigned ssa id " +
1118 "| bitvalue string for ssa id is " +
1120 GetPointer<const ssa_name>(
GET_NODE(
TM->CGetTreeReindex(l.
ssa_id)))->bit_values +
"\n";
1124 out_msg +=
"| THE DISCREPANCY IS ON A SIGNAL THAT MAY REPRESENT AN ADDRESS\n";
1126 const auto context_it =
Discr->c_addr_map.find(l.
context);
1128 const auto var_id_to_base_address_it = context_it->second.find(l.
base_index);
1129 if(var_id_to_base_address_it != context_it->second.end())
1131 uint64_t c_base_addr = var_id_to_base_address_it->second;
1132 out_msg +=
"| referenced variable decl id: " +
STR(l.
base_index) +
"\n";
1134 out_msg +=
"| base address in C: " +
STR(c_base_addr) +
"\n";
1136 uint64_t c_addr = std::stoull(l.
c_val.c_str(),
nullptr, 2);
1137 out_msg +=
"| address in C: " +
STR(c_addr) +
"\n";
1139 uint64_t c_addr_offset = c_addr - c_base_addr;
1140 THROW_ASSERT(c_addr >= c_base_addr,
"discrepancies for out of range addresses should not be raised:" 1142 STR(c_addr) +
" c_base_addr = " +
STR(c_base_addr));
1143 out_msg +=
"| address offset in C: " +
STR(c_addr_offset) +
"\n";
1145 const uint64_t memory_area_bitsize =
1147 THROW_ASSERT(memory_area_bitsize % 8 == 0,
"bitsize of a variable in memory must be multiple of 8 --> is " +
1148 STR(memory_area_bitsize) +
1149 ": this should be catched by an assertion earlier");
1154 out_msg +=
"| the address is not in range for any variable in context " +
STR(l.
context) +
"\n";
1157 std::string resized_vcd_val;
1162 const std::string& vcd = resized_vcd_val.empty() ? l.
vcd_val : resized_vcd_val;
1163 if(vcd.find_first_not_of(
"01") == std::string::npos)
1166 out_msg +=
"| base address in vcd: " +
STR(vcd_base_addr) +
"\n";
1168 uint64_t vcd_addr = std::stoull(vcd.c_str(),
nullptr, 2);
1169 out_msg +=
"| address in vcd: " +
STR(vcd_addr) +
"\n";
1171 uint64_t vcd_addr_offset = vcd_addr >= vcd_base_addr ? vcd_addr - vcd_base_addr : vcd_base_addr - vcd_addr;
1172 out_msg +=
"| address offset in vcd: " + (vcd_addr >= vcd_base_addr ? std::string(
"") : std::string(
"-")) +
1173 STR(vcd_addr_offset) +
"\n";
1177 out_msg +=
"| address bits in vcd: " + vcd +
1179 "| this cannot be converted to a valid address since it contains values different from 0 and 1\n";
1184 out_msg +=
"| THE DISCREPANCY IS IN A SIGNAL REPRESENTING A VECTORIZED VARIABLE\n";
1188 out_msg +=
"| THE DISCREPANCY IS IN A COMPLEX VARIABLE\n";
1190 out_msg +=
"\\--------------------------------------------------------------------\n";
1198 std::string out_msg =
"\n/--------------------------------------------------------------------\n" 1199 "| ERROR in signal " +
1209 "| is scheduled in the initial state S_0 of a function which does not start\n" 1210 "| failed operation starts at time " +
1213 "| when fsm state is " +
1222 "| previous execution started at time " +
1225 "| when fsm state was " +
1228 "| and ended at time " +
1237 "| never reaches an end in HDL simulation\n" 1238 "| failed operation starts at time " +
1241 "| when fsm state is " +
1251 out_msg +=
"\\--------------------------------------------------------------------\n";
1256 bool one_hot_encoding)
const 1258 if(vcd_state_string.find_first_not_of(
"01") != std::string::npos)
1264 return vcd_state_string;
1267 if(one_hot_encoding)
1269 const auto first_1_pos = vcd_state_string.find_first_of(
'1');
1270 const auto last_1_pos = vcd_state_string.find_last_of(
'1');
1271 if(first_1_pos != last_1_pos)
1277 return vcd_state_string;
1279 return STR(vcd_state_string.length() - first_1_pos - 1);
1283 return STR(std::stoul(vcd_state_string.c_str(),
nullptr, 2));
#define GET_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
DiscrepancyLog(const HLS_managerConstRef HLSMgr, const vcd_trace_head &t, const uint64_t c_context, std::string _c_val, const unsigned int el_idx, const std::string::size_type _first_c_bit, const std::string::size_type _c_size, const unsigned int _b)
std::list< DiscrepancyLog > discr_list
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
const HLS_managerRef HLSMgr
information about all the HLS synthesis
vcd_utility(const ParameterConstRef parameters, const HLS_managerRef HLSMgr, const DesignFlowManagerConstRef design_flow_manager)
Constructor.
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;.
Factory class to create c backend.
std::list< DiscrepancyLog > soft_discr_list
boost::graph_traits< graph >::out_edge_iterator OutEdgeIterator
out_edge_iterator definition.
unsigned long long GetClockPeriod(const vcd_parser::vcd_trace_t &vcd_trace) const
bool detect_regular_mismatch(const vcd_trace_head &t, const std::string &c_val, const std::string &vcd_val) const
const DiscrepancyRef Discr
#define OUTPUT_LEVEL_NONE
no output print is performed.
enum vcd_head_state state
This file contains the structures needed to manage a graph that will represent the state transition g...
#define GET_CLASS(obj)
Macro returning the actual type of an object.
unsigned long long mismatched_integers
enum vcd_head_failure failed
const int output_level
The output level.
void parse_discrepancy(const std::string &c_trace_filename, DiscrepancyRef Discrepancy)
void update_discr_list(const vcd_trace_head &t, const uint64_t c_context, const std::string &c_val, const unsigned int el_idx, const std::string::size_type first_c_bit, const std::string::size_type c_size, const unsigned int base_index)
RelationshipType
The relationship type.
Source must be executed to satisfy target.
unsigned long long op_start_time
#define INDENT_OUT_MEX(outLevel, curOutLevel, mex)
bool detect_mismatch_element(const vcd_trace_head &t, const uint64_t c_context, const std::string &c_val, const unsigned int el_idx)
Definition of hash function for EdgeDescriptor.
static bool IsOneHotFSM(unsigned int function_id, const HLS_managerRef HLSMgr)
#define GET_INDEX_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
std::list< sig_variation >::const_iterator out_var_it
void print_failed_vcd_head(const vcd_trace_head &t, bool one_hot_encoding, const int verbosity) const
#define OUTPUT_LEVEL_MINIMUM
minimum debugging print is performed.
Include a set of utilities used to manage CPU time measures.
unsigned int vec_base_bitsize
std::string compute_fsm_state_from_vcd_string(const std::string &vcd_state_string, bool one_hot_encoding) const
unsigned long long op_end_time
unsigned long long op_end_time
static const std::list< sig_variation > & get_signal_variations(const vcd_parser::vcd_trace_t &vcd_trace, const std::string &scope, const std::string &signal_name)
#define THROW_WARNING(str_expr)
helper function used to throw a warning in a standard way: though it uses PRINT_DBG_MEX, the debug level used is such that the message is always printed
#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.
const std::string fullsigname
This class models a single variation of a signal in vcd.
#define CLOCK_PORT_NAME
standard name for ports
#define START_TIME(time_var)
Macro used to store the start time into time_var.
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
DesignFlowStep_Status Exec() override
Execute the step.
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.
absl::flat_hash_map< T, U, Hash, Eq, Alloc > CustomUnorderedMap
This class writes different HDL based descriptions (VHDL, Verilog, SystemC) starting from a structura...
bool ends_after(unsigned long long t) const
Classes to describe design flow graph.
Target must be reexecuted.
#define STOP_TIME(time_var)
Macro used to store the elapsed time into time_var.
unsigned long long possibly_lost_address
bool detect_fixed_address_mismatch(const DiscrepancyOpInfo &op_info, const uint64_t c_context, const std::string &c_val, const std::string &vcd_val, const unsigned int base_index) const
This file contains the structures needed to manage a graph that will represent the state transition g...
Classes specification of the tree_node data structures.
UnorderedMapStd< std::string, CustomUnorderedMapStable< std::string, std::list< sig_variation > >> vcd_trace_t
this type is the result of a parse.
const ParameterConstRef parameters
Set of input parameters.
DesignFlowStep_Status
The status of a step.
#define THROW_ERROR(str_expr)
helper function used to throw an error in a standard way
#define HIERARCHY_SEPARATOR
bool detect_address_mismatch(const DiscrepancyOpInfo &op_info, const uint64_t c_context, const std::string &c_val, const std::string &vcd_val, unsigned int &base_index)
This file collects some utility functions.
enum discrepancy_type_mask type
bool detect_mismatch(const vcd_trace_head &t, const uint64_t c_context, const std::string &c_val)
std::string print_cpu_time(long int t)
massage a long which represents a time interval in milliseconds, into a string suitable for output ...
std::string present_state_name
The name of the present state signal.
unsigned int ssa_name_node_id
const DiscrepancyOpInfo & op_info
Class specification of the tree_reindex support class.
void print_discrepancy(const DiscrepancyLog &l, bool one_hot_encoding, const int verbosity) const
vcd_trace_t parse_vcd(const std::string &vcd_file_to_parse, const vcd_parser::vcd_filter_t &selected_signals)
parses a file selecting only a predefined set of signals.
std::string op_start_state
bool HasToBeExecuted() const override
Check if this step has actually to be executed.
const CustomUnorderedSet< std::tuple< HLSFlowStep_Type, HLSFlowStepSpecializationConstRef, HLSFlowStep_Relationship > > ComputeHLSRelationships(const DesignFlowStep::RelationshipType relationship_type) const override
Return the set of analyses in relationship with this design step.
unsigned long long op_start_time
This class contains the methods to create a frontend flow step.
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.
bool detect_binary_double_mismatch(const std::string &c_val, const std::string &resized_vcd_val) const
this class is used to manage the command-line or XML options.
static unsigned int get_base_index(const tree_managerConstRef &TM, const unsigned int index)
Retrun the base address of a memory access.
Class implementation of the structural_manager.
bool detect_binary_float_mismatch(const std::string &c_val, const std::string &resized_vcd_val) const
int debug_level
The debug level.
#define OUTPUT_LEVEL_VERBOSE
verbose debugging print is performed.
refcount< const HLSFlowStepSpecialization > HLSFlowStepSpecializationConstRef
const refcount definition of the class
Utility managing CPU statistics.
unsigned long long exec_times_in_current_state
std::list< sig_variation >::const_iterator fsm_ss_it
bool more_executions_in_this_hw_state() const
Data structure definition for high-level synthesis flow.
This class contains the base representation for a generic frontend flow step which works on the whole...
enum discrepancy_type_mask type
bool detect_mismatch_simple(const vcd_trace_head &t, const uint64_t c_context, const std::string &c_val, const unsigned int el_idx, const std::string::size_type first_c_bit, const std::string::size_type c_size)
Datastructure to represent memory information in high-level synthesis.
Class specification of the manager of the tree structures extracted from the raw file.
HLS specialization of generic_device.
A brief description of the C++ Header File.
unsigned int base_index
valid only if type is DISCR_ADDR.
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...