ilang  1.1.4
ILAng: A Modeling and Verification Platform for SoCs
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros
grain_inv_parse.h
1 // Hongce Zhang
6 
7 /* Example :
8 (declare-fun S_m1.id_ex_reg_wen () (_ BitVec 1))
9 (declare-fun S_m1.id_ex_op () (_ BitVec 2))
10 
11 (assert (=> (= S_m1.id_ex_op #b00) (= S_m1.id_ex_reg_wen #b0)))
12 (check-sat)
13 */
14 
15 #ifndef ILANG_VTARGET_OUT_GRAIN_INV_PARSE_H__
16 #define ILANG_VTARGET_OUT_GRAIN_INV_PARSE_H__
17 
18 #include <ilang/config.h>
19 #ifdef INVSYN_INTERFACE
20 
21 #include <ilang/smt-inout/chc_inv_in.h>
22 
23 namespace ilang {
24 namespace smt {
25 
27 class GrainInvariantParser : public SmtlibInvariantParser {
28 
29 public:
30  // -------------- CONSTRUCTOR ------------------- //
36  GrainInvariantParser(YosysSmtParser* yosys_smt_info,
37  const std::string& dut_instance_name,
38  bool discourage_outside_var = true,
39  bool outside_var_to_freevar = true);
41  GrainInvariantParser(const GrainInvariantParser&) = delete;
43  GrainInvariantParser& operator=(const GrainInvariantParser&) = delete;
44 
45  // -------------- DESTRUCTOR ------------------- //
46  virtual ~GrainInvariantParser();
47 
48 protected:
49  // -------------- MEMBER ------------------- //
50  bool convert_out_var_to_free_var;
51 
52 public:
53  // -------------- INTERFACE ------------------- //
55  bool virtual ParseInvResultFromFile(const std::string& fname) override;
56 
57  // -------------- CALLBACK FNs ------------------- //
58 
61  virtual var_type* make_sort(const std::string& name,
62  const std::vector<int>&) override;
64  void declare_function(const std::string& name, var_type* sort) override;
65 
67  // virtual void assert_formula(SmtTermInfoVlgPtr result) override; -- use the
68  // old one
69 
70  // -------------- Below are Disabled!--------------------- //
72  virtual SmtTermInfoVlgPtr push_quantifier_scope() override;
74  virtual SmtTermInfoVlgPtr pop_quantifier_scope() override;
75 
77  virtual void declare_quantified_variable(const std::string& name,
78  var_type* sort) override;
81  virtual SmtTermInfoVlgPtr
82  mk_function(const std::string& name, var_type* sort,
83  const std::vector<int>& idx,
84  const std::vector<SmtTermInfoVlgPtr>& args) override;
85 
87  // virtual SmtTermInfoVlgPtr mk_number(const std::string & rep, int width, int
88  // base) override;
89 
91  virtual SmtTermInfoVlgPtr
92  search_quantified_var_stack(const std::string& name) override;
93 
95  virtual void define_function(const std::string& func_name,
96  const std::vector<SmtTermInfoVlgPtr>& args,
97  var_type* ret_type,
98  SmtTermInfoVlgPtr func_body) override;
99 
100 }; // class GrainInvariantParser
101 
102 }; // namespace smt
103 }; // namespace ilang
104 
105 #endif // INVSYN_INTERFACE
106 
107 #endif // ILANG_VTARGET_OUT_GRAIN_INV_PARSE_H__