50 #ifndef STATE_TRANSTION_GRAPH_HPP 51 #define STATE_TRANSTION_GRAPH_HPP 145 void print(std::ostream& os,
const int detail_level)
const override;
153 is_duplicated(
false),
155 isOriginalState(
false),
188 bool has_default{
false};
192 size_t epp_increment{0};
193 bool epp_incrementValid{
false};
206 void print(std::ostream& os,
const int detail_level)
const;
220 vertex get_operation()
const;
225 vertex get_ref_state()
const;
231 ST_EDGE_NORMAL = 1 << 0,
233 ST_EDGE_FEEDBACK = 1 << 1,
235 ST_EDGE_EPP = 1 << 2,
241 epp_incrementValid =
true;
245 return epp_increment;
321 THROW_ASSERT(not ExistsEdge(source, target),
"Trying to create an already existing edge");
322 return InternalAddEdge(source, target, selector, RefcountCast<EdgeInfo>(info));
380 return CGetStateInfo(GetVertex(state_id));
388 THROW_ASSERT(CGetStateTransitionGraphInfo()->state_id_to_vertex.find(state_id) !=
389 CGetStateTransitionGraphInfo()->state_id_to_vertex.end(),
390 "State ID " +
STR(state_id) +
" was not stored");
391 return CGetStateTransitionGraphInfo()->state_id_to_vertex.at(state_id);
435 void WriteDot(
const std::string& file_name,
const int detail_level = 0)
const;
468 void operator()(std::ostream& out,
const vertex& v)
const override;
495 void operator()(std::ostream& out,
const EdgeDescriptor& e)
const override;
502 : state_graph(input_state_graph),
pipeline(enable)
512 graph::in_edge_iterator in_edge, in_edge_end;
514 bool multiple_in_edges =
false;
517 for(boost::tie(in_edge, in_edge_end) = boost::in_edges(bottom, *state_graph); in_edge != in_edge_end; ++in_edge)
519 ret_v = boost::source(*in_edge, *state_graph);
520 THROW_ASSERT(not multiple_in_edges,
"A pipeline should not contain phi operations");
522 multiple_in_edges =
true;
543 graph::out_edge_iterator out_edge, out_edge_end;
545 bool multiple_out_edges =
false;
548 for(boost::tie(out_edge, out_edge_end) = boost::out_edges(state, *state_graph); out_edge != out_edge_end;
552 THROW_ASSERT(not multiple_out_edges,
"First state has multiple out edges");
554 multiple_out_edges =
true;
557 THROW_ASSERT(multiple_out_edges,
"No output edge found");
std::map< vertex, unsigned int > vertex_to_state_id
CustomOrderedSet< unsigned int > BB_ids
set of BB ids associated with the state
EdgeDescriptor AddEdge(const vertex source, const vertex target, const int selector, const TransitionInfoRef info)
Add an edge with information associated.
void * top(node_stack *head)
bool is_a_dag
true when the FSM has cycles
bool isOriginalState
flag to check if the state is duplicated and the original one
unsigned int loopId
ID of the loop this state belongs to.
std::list< vertex > starting_operations
set of operation vertices which starts in this state
unsigned int max_cycles
maximum number of cycles
StateTransitionGraphInfoRef GetStateTransitionGraphInfo()
Return the info associated with the graph.
Base class storing user data information to the whole graph.
vertex exit_node
vertex that contains exit node
vertex exit_node
this vertex represents the exit state of the state transition graph
void print(std::ostream &os, const int detail_level) const override
Implementation of print method for this kind of node.
REF_FORWARD_DECL(Parameter)
vertex entry_node
vertex that contains entry node
CustomOrderedSet< vertex > ops
bool is_dummy
flag to check if the state is dummy or not
EdgeInfoRef GetEdgeInfo(typename boost::graph_traits< graphs_collection >::vertex_descriptor source, typename boost::graph_traits< graphs_collection >::vertex_descriptor target)
Get the edge property.
Class specification of the graph structures.
TransitionInfoRef GetTransitionInfo(const EdgeDescriptor transition)
Return the info associated with a transition.
std::list< vertex > moved_ending_op
set of moved operations ending in this state
const StateTransitionGraphConstRef state_graph
This structure defines the bulk for the state transition graph.
const EdgeInfoConstRef CGetEdgeInfo(typename boost::graph_traits< graphs_collection >::vertex_descriptor source, typename boost::graph_traits< graphs_collection >::vertex_descriptor target) const
Get the edge property.
CustomOrderedSet< unsigned int > moved_op_use_set
set of ssa vars used in the state by the moved operations
const OpGraphConstRef op_function_graph
reference to operation graph
NodeInfoRef GetNodeInfo(typename boost::graph_traits< graphs_collection >::vertex_descriptor node)
FIXME: this method should become protected and called by equivalent method in subclasses Get the node...
const BehavioralHelperConstRef BH
this is the helper associated to the actual module
transition_type get_type() const
vertex operator()(vertex state)
std::list< vertex > executing_operations
set of operation vertices which require inputs in this state
#define STR(s)
Macro which performs a lexical_cast to a string.
unsigned int funId
function identifier of the function from which the state has been derived
Auxiliary methods for manipulating string.
bool get_has_default() const
void * pipeline[MAX_PIPELINE_DEPTH]
std::list< vertex > onfly_operations
set of operation vertices already in execution at the beginning of this state
Class used to describe a state transition graph.
unsigned int min_cycles
in case of a dag it is possible to compute the minimum number of cycles
Functor used to write the content of a vertex to dotty file.
const StateTransitionGraphInfoConstRef CGetStateTransitionGraphInfo() const
Return the info associated with the graph.
const NodeInfoConstRef CGetNodeInfo(typename boost::graph_traits< graphs_collection >::vertex_descriptor node) const
Get the node property.
next_unique_state(StateTransitionGraphConstRef input_state_graph)
Base class description of data information associated with each node of a graph.
OpGraphConstRef op_function_graph
pointer to graph storing information about operations
TransitionInfo(OpGraphConstRef g)
redefinition of set to manage ordered/unordered structures
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
const OpGraphConstRef op_function_graph
reference to operation graph
General class used to describe a graph in PandA.
Functor used to write the content of the edges to a dotty file and it is used to write specific edge ...
Base class storing user data information.
bool all_paths
this state is duplicated but manage of path incoming in the phis
Base class for graph property.
GraphInfoRef GetGraphInfo()
FIXME: this method should become protected and called by equivalent method in subclasses Get the grap...
CustomOrderedSet< unsigned > labels
Template definition of refcount.
Base class description of data information associated with each edge of a graph.
std::string name
string used to give a label to the state
vertex GetVertex(unsigned int state_id) const
Return the state vertex corresponding to the given id.
StateInfoRef GetStateInfo(const vertex state)
Return the info associated with a state.
Functor used to write the content of the edges to a dotty file.
const GraphInfoConstRef CGetGraphInfo() const
FIXME: this method should become protected and called by equivalent method in subclasses Get the grap...
Structure holding information about a node into graph.
StateTransitionType
Types associated with the edges of the graph.
std::list< vertex > ending_operations
set of operation vertices completing their execution in this state
size_t get_epp_increment() const
vertex clonedState
pointer to the cloned state
std::list< vertex > moved_exec_op
set of moved operations in execution
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
const CustomOrderedSet< vertex > & get_operations() const
const CustomOrderedSet< unsigned > & get_labels() const
bool is_duplicated
flag to check if the state is duplicated or not
Wrefcount< const HLS_manager > HLSMgr
Weak Reference to function behavior.
const OpGraphConstRef op_function_graph
reference to operation graph
const TransitionInfoConstRef CGetTransitionInfo(const EdgeDescriptor transition) const
Return the info associated with a transition.
unsigned int sourceBb
ID of the bb edge associated with the phi operation.
vertex entry_node
this vertex represents the entry state of the state transition graph
Class used to describe a particular graph with operations as nodes.
std::map< unsigned int, vertex > state_id_to_vertex
CustomOrderedSet< unsigned int > moved_op_def_set
set of ssa vars defined in the state by the moved operations
void set_epp_increment(size_t n)
const BehavioralHelperConstRef BH
this is the helper associated to the actual module
CONSTREF_FORWARD_DECL(BehavioralHelper)
Structure holding information about the whole graph.
const StateInfoConstRef CGetStateInfo(const vertex state) const
Return the info associated with a state.
#define NULL_VERTEX
null vertex definition
Structure holding the information about an edge into the graph.
Functor template used to write the content of the nodes to a dotty file.
const StateInfoConstRef CGetStateInfo(unsigned int state_id) const
Return the info associated with a state, given its ID is the ID of the state to be considered...
boost::graph_traits< graph >::edge_descriptor EdgeDescriptor
edge definition.
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...