ilang  1.1.4
ILAng: A Modeling and Verification Platform for SoCs
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros
transition.h
Go to the documentation of this file.
1 
4 #ifndef ILANG_ILA_TRANSITION_H__
5 #define ILANG_ILA_TRANSITION_H__
6 
7 #include <ilang/ila/instr.h>
8 
10 namespace ilang {
11 
17 public:
19  typedef std::shared_ptr<InstrTranEdge> ItEdgePtr;
20 
21  // ------------------------- CONSTRUCTOR/DESTRUCTOR ----------------------- //
23  InstrTranEdge(const InstrPtr& src, const InstrPtr& dst, const ExprPtr& cnd);
26 
27  // ------------------------- ACCESSORS/MUTATORS --------------------------- //
29  const InstrPtr src() const;
31  const InstrPtr dst() const;
33  const ExprPtr cnd() const;
34 
35 private:
37  InstrPtr src_;
39  InstrPtr dst_;
41  ExprPtr cnd_;
42 
43 }; // class InstrTranEdge
44 
48 public:
50  typedef std::shared_ptr<InstrTranNode> ItNodePtr;
51 
52  // ------------------------- CONSTRUCTOR/DESTRUCTOR ----------------------- //
57 
58  // ------------------------- ACCESSORS/MUTATORS --------------------------- //
60  const InstrPtr instr() const;
61 
63  size_t next_num() const;
65  size_t prev_num() const;
66 
68  const ItNodePtr next(const size_t& i) const;
70  const ItNodePtr prev(const size_t& i) const;
71 
72  // ------------------------- METHODS -------------------------------------- //
74  void AddNext(const ItNodePtr& next);
76  void AddPrev(const ItNodePtr& prev);
77 
78 private:
79  // ------------------------- MEMBERS -------------------------------------- //
81  InstrPtr instr_;
83  std::vector<ItNodePtr> next_;
85  std::vector<ItNodePtr> prev_;
86 
87 }; // class InstrTranNode
88 
94 class InstrSeq {
95 public:
97  typedef std::shared_ptr<InstrSeq> InstrSeqPtr;
98 
99  // ------------------------- CONSTRUCTOR/DESTRUCTOR ----------------------- //
101  InstrSeq();
103  ~InstrSeq();
104 
105  // ------------------------- ACCESSORS/MUTATORS --------------------------- //
107  void clear();
108 
109  // ------------------------- HELPERS -------------------------------------- //
111  static InstrSeqPtr New();
112 
113  // ------------------------- METHODS -------------------------------------- //
115  void AddTran(const InstrPtr& src, const InstrPtr& dst, const ExprPtr& cnd);
116 
118  void set_root(const InstrPtr& i);
119 
121  InstrPtr root() const { return root_; }
122 
123 private:
125  typedef InstrTranEdge::ItEdgePtr ItEdgePtr;
127  typedef InstrTranNode::ItNodePtr ItNodePtr;
128 
129  // ------------------------- MEMBERS -------------------------------------- //
131  InstrPtr root_ = nullptr;
133  std::set<ItEdgePtr> edges_;
135  std::map<InstrPtr, ItNodePtr> nodes_;
136 
137 }; // class InstrSeq
138 
141 
142 } // namespace ilang
143 
144 #endif // ILANG_ILA_TRANSITION_H__
~InstrTranNode()
Default destructir.
std::shared_ptr< InstrTranNode > ItNodePtr
Pointer type for ITNode.
Definition: transition.h:50
Expr::ExprPtr ExprPtr
Pointer type for normal use of Expr.
Definition: expr.h:138
std::shared_ptr< InstrTranEdge > ItEdgePtr
Pointer type for passing around the InstrTran.
Definition: transition.h:19
Instruction Sequencing does:
Definition: transition.h:94
const InstrPtr src() const
Return the source instruction.
size_t prev_num() const
Return the number of in-comming node.
void AddTran(const InstrPtr &src, const InstrPtr &dst, const ExprPtr &cnd)
Add one transition to the set.
const InstrPtr dst() const
Return the target instruction.
Node for instruction-transition node, each node represent an instruction.
Definition: transition.h:47
~InstrTranEdge()
Default destructor.
Instr::InstrPtr InstrPtr
Pointer type for normal use of Instr.
Definition: instr.h:132
Instruction transition edge, includeing:
Definition: transition.h:16
void set_root(const InstrPtr &i)
Set the root node (entry instruction).
void AddPrev(const ItNodePtr &prev)
Update the set of in-comming node.
const ExprPtr cnd() const
Return the guarded transition condition.
InstrPtr root() const
Return the root node (entry instruction).
Definition: transition.h:121
void clear()
Reset all stored sequences.
InstrTranEdge(const InstrPtr &src, const InstrPtr &dst, const ExprPtr &cnd)
Constructor with all components.
InstrSeq::InstrSeqPtr InstrSeqPtr
Pointer type for passing around InstrSeq.
Definition: transition.h:140
~InstrSeq()
Default destructor.
InstrSeq()
Default constructor.
static InstrSeqPtr New()
Create a new ITG, used for hiding implementation specific types.
InstrTranNode(const InstrPtr &instr)
Default constructor.
const ItNodePtr prev(const size_t &i) const
Access the i-th in-comming node.
std::shared_ptr< InstrSeq > InstrSeqPtr
Pointer type for passing around InstrSeq.
Definition: transition.h:97
const ItNodePtr next(const size_t &i) const
Access the i-th out-going node.
void AddNext(const ItNodePtr &next)
Update the set of out-going node.
size_t next_num() const
Return the number of out-going node.
const InstrPtr instr() const
Return the represented instruction.