ilang  1.0.0
ILAng: A Modeling and Verification Platform for SoCs
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 
11 #include <nlohmann/json.hpp>
12 
13 using json = nlohmann::json;
14 
16 namespace ilang {
17 
19 class J2IDes {
20 public:
22  typedef std::shared_ptr<J2IDes> J2IDesPtr;
23 
24  // ------------------------- CONSTRUCTOR/DESTRUCTOR ----------------------- //
26  J2IDes();
28  ~J2IDes();
29 
30  // ------------------------- HELPERS -------------------------------------- //
33  static J2IDesPtr New();
34 
35  // ------------------------- METHODS -------------------------------------- //
37  SortPtr DesSort(const json& j_sort);
39  FuncPtr DesFunc(const json& j_func);
41  ExprPtr DesExpr(const json& j_expr);
43  InstrPtr DesInstr(const json& j_instr, const InstrLvlAbsPtr& i_host) const;
45  InstrLvlAbsPtr DesInstrLvlAbs(const json& j_global);
46 
47 private:
48  // ------------------------- MEMBERS -------------------------------------- //
50  std::unordered_map<size_t, ExprPtr> id_expr_map_;
52  std::unordered_map<size_t, FuncPtr> id_func_map_;
54  std::unordered_map<std::string, const InstrLvlAbsPtr> ila_name_ptr_map_;
55 
56  // ------------------------- METHODS -------------------------------------- //
58  ExprPtr DesExprState(const json& j_sort, const std::string& name,
59  const InstrLvlAbsPtr& i_host) const;
61  ExprPtr DesExprInput(const json& j_sort, const std::string& name,
62  const InstrLvlAbsPtr& i_host) const;
64  ExprPtr DesExprConst(const json& j_sort, const json& j_val) const;
66  ExprPtr DesExprOp(const unsigned& ast_expr_op_uid, const json& j_arg_arr,
67  const json& j_param_arr) const;
69  ExprPtr DesExprOpAppFunc(const json& j_func_id, const json& j_arg_arr) const;
70 
73  void DesVarUnit(const json& j_ila, const json& j_ast_list,
74  const InstrLvlAbsPtr& i_parent);
77  void DesVarHier(const json& j_ila, const json& j_ast_list,
78  const InstrLvlAbsPtr& i_parent);
79 
81  void DesIlaUnit(const json& j_ila);
83  void DesIlaHier(const json& j_ila);
84 
85 }; // class J2IDes
86 
89 
90 }; // namespace ilang
91 
92 #endif // ILANG_TARGET_JSON_J2I_DES_H__
~J2IDes()
Default destructor.
Expr::ExprPtr ExprPtr
Pointer type for normal use of Expr.
Definition: expr.h:133
InstrLvlAbsPtr DesInstrLvlAbs(const json &j_global)
Deserialize InstrLvlAbs from JSON.
FuncPtr DesFunc(const json &j_func)
Deserialize Func 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:76
ExprPtr DesExpr(const json &j_expr)
Deserialize Expr from JSON.
Instr::InstrPtr InstrPtr
Pointer type for normal use of Instr.
Definition: instr.h:138
Func::FuncPtr FuncPtr
Pointer type for normal use of Func.
Definition: func.h:79
InstrPtr DesInstr(const json &j_instr, const InstrLvlAbsPtr &i_host) const
Deserialize Instr from JSON.
The class for deserializing an ILA model from JSON format.
Definition: json_to_ila_deserializer.h:19
InstrLvlAbs::InstrLvlAbsPtr InstrLvlAbsPtr
Pointer type for normal use of InstrLvlAbs.
Definition: instr_lvl_abs.h:326
SortPtr DesSort(const json &j_sort)
Deserialize Sort from JSON.
std::shared_ptr< J2IDes > J2IDesPtr
Pointer type for normal use of J2IDes.
Definition: json_to_ila_deserializer.h:22
J2IDes()
Default constructor.