64 if(s.find_first_not_of(
"10") != std::string::npos)
72 if(one_hot_fsm_encoding)
74 const auto first_1_pos = s.find_first_of(
'1');
75 const auto last_1_pos = s.find_last_of(
'1');
76 if(first_1_pos != last_1_pos)
91 if(one_hot_fsm_encoding)
93 const auto first_1_pos = s.find_first_of(
'1');
94 return static_cast<unsigned int>(s.length() - first_1_pos - 1
U);
96 return static_cast<unsigned int>(std::stoul(s,
nullptr, 2));
110 bool one_hot_fsm_encoding)
117 return state_ids.count(
id);
142 return std::all_of(s.begin(), s.end(), [](
const char c) {
return c ==
'1'; });
156 const std::list<sig_variation>& ov,
const std::list<sig_variation>& sv,
157 unsigned int init_state_id,
unsigned long long clock_p,
159 const bool _one_hot_fsm_encoding)
160 : state(uninitialized),
162 one_hot_fsm_encoding(_one_hot_fsm_encoding),
164 is_phi(_TM->get_tree_node_const(op.op_id)->get_kind() == gimple_phi_K),
165 is_in_reg(_HLSMgr->get_HLS(op_info.stg_fun_id)
166 ->storage_value_information->is_a_storage_value(nullptr, op.ssa_name_node_id)),
169 initial_state_id(init_state_id),
171 fsm_ss_it(fv.cbegin()),
174 out_var_it(ov.cbegin()),
175 out_var_end(ov.cend()),
177 sp_var_it(sv.cbegin()),
178 sp_var_end(sv.cend()),
179 fullsigname(
std::move(signame)),
182 clock_period(clock_p),
183 exec_times_in_current_state(0),
184 consecutive_state_executions(0),
185 has_been_initialized(
false),
186 fsm_has_a_single_state(
boost::num_vertices(*_HLSMgr->get_HLS(op.stg_fun_id)->STG->CGetStg()) == 3),
187 start_state_is_initial(
false)
195 "state transition is not aligned with clock signal\n" 234 " with starting state " + fsm_es_it->value +
" which is not ending\n");
235 THROW_ASSERT(not
is_phi,
"\n/--------------------------------------------------------------------\n" 239 "| is UNBOUNDED and is a phi\n" 240 "\\--------------------------------------------------------------------\n");
263 " must be ending state\n");
358 if(state_info->is_duplicated && !state_info->isOriginalState && !state_info->all_paths)
360 for(
const auto& def_edge : gp->CGetDefEdgesList())
362 if(state_info->moved_op_def_set.find(def_edge.first->index) != state_info->moved_op_def_set.end() or
404 if(not has_been_initialized)
406 has_been_initialized =
true;
426 THROW_UNREACHABLE(
"advance() works only on suspended, uninitialized or running");
CustomOrderedSet< unsigned int > start_states
Data structure representing the entire HLS information.
CustomOrderedSet< unsigned int > exec_states
unsigned long long consecutive_state_executions
enum vcd_head_state state
This file contains the structures needed to manage a graph that will represent the state transition g...
This algorithm is to find coloring of a graph Algorithm: Let G = (V,E) be a graph with vertices v_1...
enum vcd_head_failure failed
static unsigned int compute_state_id(const std::string &s, bool one_hot_fsm_encoding)
static bool is_start(const sig_variation &state_var, const DiscrepancyOpInfo &i, bool one_hot_fsm_encoding)
unsigned long long op_start_time
vcd_trace_head(const DiscrepancyOpInfo &op_info, std::string signame, const std::list< sig_variation > &fv, const std::list< sig_variation > &ov, const std::list< sig_variation > &sv, unsigned int init_state_id, unsigned long long clock_period, const HLS_managerConstRef _HLSMgr, const tree_managerConstRef _TM, const bool one_hot_fsm_encoding)
exceptions managed by PandA
Definition of hash function for EdgeDescriptor.
static bool all_ones(const std::string &s)
std::list< sig_variation >::const_iterator out_var_it
static bool string_represents_one_of_the_states(const std::string &val, const CustomOrderedSet< unsigned int > &state_ids, bool one_hot_fsm_encoding)
const unsigned long long clock_period
const tree_managerConstRef TM
const tree_nodeConstRef CGetTreeNode(const unsigned int i) const
unsigned long long op_end_time
#define STR(s)
Macro which performs a lexical_cast to a string.
Auxiliary methods for manipulating string.
This class models a single variation of a signal in vcd.
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
void unbounded_find_end_time()
std::list< sig_variation >::const_iterator out_var_end
const HLS_managerConstRef HLSMgr
This file contains the structures needed to manage a graph that will represent the state transition g...
const bool one_hot_fsm_encoding
Classes specification of the tree_node data structures.
std::list< sig_variation >::const_iterator sp_var_end
#define THROW_ERROR(str_expr)
helper function used to throw an error in a standard way
bool fsm_has_a_single_state
void set_consecutive_state_executions()
static bool is_exec(const sig_variation &state_var, const DiscrepancyOpInfo &i, bool one_hot_fsm_encoding)
std::string value
new value of the signal.
const unsigned int initial_state_id
bool start_state_is_initial
unsigned int ssa_name_node_id
static bool var_is_later_or_equal(const sig_variation &v, const unsigned long long time)
const DiscrepancyOpInfo & op_info
CustomOrderedSet< unsigned int > end_states
static bool var_has_value_ones(const sig_variation &v)
void detect_new_start_end_times()
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
bool has_been_initialized
static bool is_valid_state_string(const std::string &s, bool one_hot_fsm_encoding)
std::list< sig_variation >::const_iterator sp_var_it
std::list< sig_variation >::const_iterator fsm_end
unsigned long long exec_times_in_current_state
std::list< sig_variation >::const_iterator fsm_ss_it
Data structure definition for high-level synthesis flow.
static bool is_binary_string_repr(const std::string &s, unsigned int id, bool one_hot_fsm_encoding)
Class specification of the manager of the tree structures extracted from the raw file.
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...