ilang  1.1.4
ILAng: A Modeling and Verification Platform for SoCs
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros
ila_to_json_serializer.h
Go to the documentation of this file.
1 
4 #ifndef ILANG_TARGET_JSON_I2J_SER_H__
5 #define ILANG_TARGET_JSON_I2J_SER_H__
6 
7 #include <memory>
8 #include <unordered_map>
9 
10 #include <nlohmann/json.hpp>
11 
13 
14 using json = nlohmann::json;
15 
17 namespace ilang {
18 
20 class I2JSer {
21 public:
23  typedef std::shared_ptr<I2JSer> I2JSerPtr;
24 
25  // ------------------------- CONSTRUCTOR/DESTRUCTOR ----------------------- //
27  I2JSer();
29  ~I2JSer();
30 
31  // ------------------------- HELPERS -------------------------------------- //
34  static I2JSerPtr New();
35 
36  // ------------------------- METHODS -------------------------------------- //
38  json SerInstrLvlAbs(const InstrLvlAbsPtr& i_ila);
39 
40 private:
41  // ------------------------- MEMBERS -------------------------------------- //
43  std::unordered_map<size_t, size_t> id_idx_map_;
45  std::unordered_map<size_t, size_t> func_id_idx_map_;
47  json j_expr_arr_;
49  json j_func_arr_;
50 
51  // ------------------------- METHODS -------------------------------------- //
53  json SerSort(const SortPtr& i_sort) const;
55  json SerFunc(const FuncPtr& i_func);
57  json SerExpr(const ExprPtr& i_expr);
59  json SerConstVal(const ExprPtr& i_expr) const;
61  json SerExprUnit(const ExprPtr& i_expr);
63  json SerInstr(const InstrPtr& i_instr);
65  json SerInstrLvlAbsNoAst(const InstrLvlAbsPtr& i_ila);
66 
67 }; // class I2JSer
68 
71 
72 } // namespace ilang
73 
74 #endif // ILANG_TARGET_JSON_I2J_SER_H__
~I2JSer()
Default destructor.
Expr::ExprPtr ExprPtr
Pointer type for normal use of Expr.
Definition: expr.h:138
static I2JSerPtr New()
Create a new I2JSer. Used for hiding implementation specific type details.
json SerInstrLvlAbs(const InstrLvlAbsPtr &i_ila)
Serialize InstrLvlAbs, including its children, to JSON.
Sort::SortPtr SortPtr
Pointer type for storing/passing Sort.
Definition: sort.h:82
Instr::InstrPtr InstrPtr
Pointer type for normal use of Instr.
Definition: instr.h:132
Func::FuncPtr FuncPtr
Pointer type for normal use of Func.
Definition: func.h:83
I2JSer()
Default constructor.
I2JSer::I2JSerPtr I2JSerPtr
Pointer type for normal use of I2JSer.
Definition: ila_to_json_serializer.h:70
InstrLvlAbs::InstrLvlAbsPtr InstrLvlAbsPtr
Pointer type for normal use of InstrLvlAbs.
Definition: instr_lvl_abs.h:326
The class for serializing an ILA model to JSON format.
Definition: ila_to_json_serializer.h:20
std::shared_ptr< I2JSer > I2JSerPtr
Pointer type for normal use of I2JSer.
Definition: ila_to_json_serializer.h:23