ilang  1.1.4
ILAng: A Modeling and Verification Platform for SoCs
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros
json_to_ila_deserializer.h
Go to the documentation of this file.
1 
4 #ifndef ILANG_TARGET_JSON_J2I_DES_H__
5 #define ILANG_TARGET_JSON_J2I_DES_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 J2IDes {
21 public:
23  typedef std::shared_ptr<J2IDes> J2IDesPtr;
24 
25  // ------------------------- CONSTRUCTOR/DESTRUCTOR ----------------------- //
27  J2IDes();
29  ~J2IDes();
30 
31  // ------------------------- HELPERS -------------------------------------- //
34  static J2IDesPtr New();
35 
36  // ------------------------- METHODS -------------------------------------- //
38  InstrLvlAbsPtr DesInstrLvlAbs(const json& j_global);
39 
40 private:
41  // ------------------------- MEMBERS -------------------------------------- //
43  std::unordered_map<size_t, ExprPtr> id_expr_map_;
45  std::unordered_map<size_t, FuncPtr> id_func_map_;
47  std::unordered_map<std::string, const InstrLvlAbsPtr> ila_name_ptr_map_;
48 
49  // ------------------------- METHODS -------------------------------------- //
51  SortPtr DesSort(const json& j_sort);
52 
54  FuncPtr DesFunc(const json& j_func);
55 
57  ExprPtr DesExpr(const json& j_expr);
59  ExprPtr DesExprState(const json& j_sort, const std::string& name,
60  const InstrLvlAbsPtr& i_host) const;
62  ExprPtr DesExprInput(const json& j_sort, const std::string& name,
63  const InstrLvlAbsPtr& i_host) const;
65  ExprPtr DesExprConst(const json& j_sort, const json& j_val) const;
67  ExprPtr DesExprOp(const unsigned& ast_expr_op_uid, const json& j_arg_arr,
68  const json& j_param_arr) const;
70  ExprPtr DesExprOpAppFunc(const json& j_func_id, const json& j_arg_arr) const;
71 
74  void DesVarUnit(const json& j_ila, const json& j_ast_list,
75  const InstrLvlAbsPtr& i_parent);
78  void DesVarHier(const json& j_ila, const json& j_ast_list,
79  const InstrLvlAbsPtr& i_parent);
80 
82  InstrPtr DesInstr(const json& j_instr, const InstrLvlAbsPtr& i_host) const;
83 
85  void DesIlaUnit(const json& j_ila);
87  void DesIlaHier(const json& j_ila);
88 
89 }; // class J2IDes
90 
93 
94 } // namespace ilang
95 
96 #endif // ILANG_TARGET_JSON_J2I_DES_H__
J2IDes::J2IDesPtr J2IDesPtr
Pointer type for normal use of J2IDes.
Definition: json_to_ila_deserializer.h:92
~J2IDes()
Default destructor.
Expr::ExprPtr ExprPtr
Pointer type for normal use of Expr.
Definition: expr.h:138
InstrLvlAbsPtr DesInstrLvlAbs(const json &j_global)
Deserialize InstrLvlAbs from JSON.
static J2IDesPtr New()
Create a new J2IDes. Used for hiding implementation specific type details.
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
The class for deserializing an ILA model from JSON format.
Definition: json_to_ila_deserializer.h:20
InstrLvlAbs::InstrLvlAbsPtr InstrLvlAbsPtr
Pointer type for normal use of InstrLvlAbs.
Definition: instr_lvl_abs.h:326
std::shared_ptr< J2IDes > J2IDesPtr
Pointer type for normal use of J2IDes.
Definition: json_to_ila_deserializer.h:23
J2IDes()
Default constructor.