ilasynth  1.0
ILASynth: Template-based ILA Synthesis Engine
mem.hpp
Go to the documentation of this file.
1 #ifndef __AST_MEM_HPP_DEFINED__
2 #define __AST_MEM_HPP_DEFINED__
3 
4 #include <utility>
5 #include <vector>
6 
7 #include <boost/multiprecision/cpp_int.hpp>
8 #include <ilasynth/ast.hpp>
9 #include <ilasynth/ast/node.hpp>
10 #include <ilasynth/memvalues.hpp>
11 
12 namespace ilasynth {
13 class Abstraction;
14 class FuncReduction;
15 
16 // ---------------------------------------------------------------------- //
17 // base class for all memory expressions.
18 class MemExpr : public Node {
19 public:
20  // constructor.
21  MemExpr(int addrWidth, int dataWidth);
22  // constructor for ChoiceExpr.
23  MemExpr(NodeType t);
24  // destructor.
25  virtual ~MemExpr();
26 };
27 
28 // ---------------------------------------------------------------------- //
29 // memory variables.
30 class MemVar : public MemExpr {
31 public:
32  // constructor.
33  MemVar(const std::string& n, int addrWidth, int dataWidth);
34  // destructor.
35  virtual ~MemVar();
36  // clone.
37  virtual Node* clone() const;
38  // equality method.
39  virtual bool equal(const Node* that) const;
40  // stream output.
41  virtual std::ostream& write(std::ostream& out) const;
42 };
43 
44 // ---------------------------------------------------------------------- //
45 // bitvector constants.
46 struct MemConst : public MemExpr {
47  // fields.
49 
50  // constructor with longs.
51  MemConst(const MemValues& mv);
52  // copy constructor.
53  MemConst(const MemConst& that);
54  // destructor.
55  virtual ~MemConst();
56 
57  // clone
58  virtual Node* clone() const;
59  // equality method.
60  virtual bool equal(const Node* that) const;
61  // stream output.
62  virtual std::ostream& write(std::ostream& out) const;
63 };
64 
65 // ---------------------------------------------------------------------- //
66 // write to memory operator.
67 class MemOp : public MemExpr {
68 public:
71  static const std::string operatorNames[];
72 
73 protected:
74  // data members //
76 
77 public:
78  // constructor
79  MemOp(Op op, const nptr_t& a0, const nptr_t& a1, const nptr_t& a2);
80  // constructor for store block.
81  MemOp(Op op, const nptr_t& mem, const nptr_t& addr, const nptr_t& data,
82  endianness_t e);
83  // copy constructor.
84  MemOp(const MemOp& that);
85  // almost a copy constructor.
86  MemOp(const MemOp* that, const nptr_vec_t& args);
87  // destructor.
88  virtual ~MemOp();
89 
90  Op getOp() const { return op; }
91 
92  // clone.
93  virtual Node* clone() const;
94  // equality.
95  virtual bool equal(const Node* that) const;
96  // stream output.
97  virtual std::ostream& write(std::ostream& out) const;
98 
99  // number of operands.
100  virtual unsigned nArgs() const;
101  // operand i.
102  virtual boost::shared_ptr<Node> arg(unsigned i) const;
103 
104  friend class FuncReduction;
105 };
106 
107 } // namespace ilasynth
108 #endif
virtual boost::shared_ptr< Node > arg(unsigned i) const
virtual std::ostream & write(std::ostream &out) const
enum ilasynth::MemOp::Op op
virtual ~MemOp()
virtual bool equal(const Node *that) const
virtual ~MemExpr()
MemExpr(int addrWidth, int dataWidth)
MemValues memvalues
Definition: mem.hpp:48
MemOp(Op op, const nptr_t &a0, const nptr_t &a1, const nptr_t &a2)
Definition: type.hpp:11
std::vector< nptr_t > nptr_vec_t
Definition: node.hpp:27
virtual Node * clone() const
virtual std::ostream & write(std::ostream &out) const
virtual ~MemVar()
Definition: mem.hpp:46
Definition: funcReduct.hpp:13
Definition: mem.hpp:69
nptr_vec_t args
Definition: mem.hpp:75
virtual bool equal(const Node *that) const
boost::shared_ptr< Node > nptr_t
Definition: node.hpp:24
virtual Node * clone() const
Definition: mem.hpp:18
virtual unsigned nArgs() const
virtual std::ostream & write(std::ostream &out) const
Definition: memvalues.hpp:20
Op getOp() const
Definition: mem.hpp:90
Definition: abstraction.hpp:21
Definition: node.hpp:55
virtual bool equal(const Node *that) const
Definition: mem.hpp:30
Definition: mem.hpp:69
MemConst(const MemValues &mv)
static const std::string operatorNames[]
Definition: mem.hpp:71
endianness_t endian
Definition: mem.hpp:70
endianness_t
Definition: common.hpp:10
Definition: mem.hpp:69
Definition: mem.hpp:67
Op
Definition: mem.hpp:69
Definition: mem.hpp:69
MemVar(const std::string &n, int addrWidth, int dataWidth)
virtual Node * clone() const