ilang  1.1.4
ILAng: A Modeling and Verification Platform for SoCs
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros
inv_obj.h
1 // Hongce Zhang
4 
5 #ifndef ILANG_VTARGET_OUT_INV_OBJ_H__
6 #define ILANG_VTARGET_OUT_INV_OBJ_H__
7 
8 #include <ilang/config.h>
9 
10 #include <ilang/smt-inout/yosys_smt_parser.h>
11 #include <ilang/vtarget-out/inv-syn/inv_cnf.h>
12 
13 #include <string>
14 #include <tuple>
15 #include <vector>
16 
17 namespace ilang {
18 
20 class InvariantInCnf;
21 
24 public:
25  // ----------- TYPE DEFs ---------- //
27  typedef std::vector<std::string> inv_vec_t;
29  typedef std::vector<std::tuple<std::string, std::string, int>>
32  typedef std::map<std::string, int> extra_free_var_def_vec_t;
34  typedef std::vector<std::string> smt_formula_vec_t;
35  // ----------- CONSTRUCTOR ---------- //
39 
40 #ifdef INVSYN_INTERFACE
41 
43  bool AddInvariantFromChcResultFile(
44  smt::YosysSmtParser& design_info, const std::string& tag,
45  const std::string& chc_result_fn, bool flatten_datatype,
46  bool flatten_hierarchy, bool discourage_outside_var_referral = true);
47 
49  void
50  AddInvariantFromGrainResultFile(smt::YosysSmtParser& design_info,
51  const std::string& tag,
52  const std::string& chc_result_fn,
53  bool discourage_outside_var_referral = true,
54  bool change_outside_var = true);
55 
57  bool AddInvariantFromAbcResultFile(
58  const std::string& blif_fname, const std::string& abc_fname,
59  bool warning_outside_var, bool replace_outside_var,
60  const std::string& gla_map_fname, bool useAiger,
61  const std::string& aiger_map_name, InvariantInCnf& inv_cnf,
62  const InvariantInCnf& ref_cnf);
63 
64 #endif // INVSYN_INTERFACE
65 
67  void AddInvariantFromVerilogExpr(const std::string& tag,
68  const std::string& vlg_in);
70  const inv_vec_t& GetVlgConstraints() const;
72  const extra_var_def_vec_t& GetExtraVarDefs() const;
76  const smt_formula_vec_t& GetSmtFormulae() const;
78  void set_dut_inst_name(const std::string& name);
80  void ClearAllInvariants();
82  void ExportToFile(const std::string& fn,
83  bool export_smt_encoding = true) const;
85  void ImportFromFile(const std::string& fn);
89  size_t NumInvariant() const;
91  void RemoveInvByIdx(size_t idx);
92 
93 protected:
95  std::vector<std::string> inv_vlg_exprs;
103  std::string dut_inst_name;
104 };
105 
106 }; // namespace ilang
107 
108 #endif // ILANG_VTARGET_OUT_INV_OBJ_H__
void ImportFromFile(const std::string &fn)
import invariants that has been previous exported
size_t NumInvariant() const
the number of invariants
std::vector< std::string > inv_vec_t
the vector of multiple invariants
Definition: inv_obj.h:27
std::string dut_inst_name
the buffered dut instance name
Definition: inv_obj.h:103
void InsertFromAnotherInvObj(const InvariantObject &r)
this is to support making candidate invariant as confirmed
const inv_vec_t & GetVlgConstraints() const
generate invariants
InvariantObject()
empty invariants
std::vector< std::string > smt_formula_vec_t
the vector of original smt-formula for datapoint attempt
Definition: inv_obj.h:34
std::vector< std::tuple< std::string, std::string, int > > extra_var_def_vec_t
the vector of extra_var defs exprs
Definition: inv_obj.h:30
void AddInvariantFromVerilogExpr(const std::string &tag, const std::string &vlg_in)
copy constructor = default
void ClearAllInvariants()
clear all stored invariants
the invariant object, it needs smt-info to parse
Definition: inv_obj.h:23
const extra_free_var_def_vec_t & GetExtraFreeVarDefs() const
get the free vars
std::vector< std::string > inv_vlg_exprs
the expressions
Definition: inv_obj.h:95
to parse an smt file this will only work on the yosys&#39;s generated smt and not on the assembled CHC ...
Definition: yosys_smt_parser.h:22
smt_formula_vec_t smt_formula_vec
the original smt formula
Definition: inv_obj.h:101
extra_var_def_vec_t inv_extra_vlg_vars
the extra variables that are needed to ...
Definition: inv_obj.h:97
extra_free_var_def_vec_t inv_extra_free_vars
the extra free variables // there might be repetition // check it
Definition: inv_obj.h:99
void set_dut_inst_name(const std::string &name)
called by the target generator?
std::map< std::string, int > extra_free_var_def_vec_t
the vector of free var defs exprs
Definition: inv_obj.h:32
const extra_var_def_vec_t & GetExtraVarDefs() const
get the vars
const smt_formula_vec_t & GetSmtFormulae() const
get the smt formula
void ExportToFile(const std::string &fn, bool export_smt_encoding=true) const
export invariants to a file
void RemoveInvByIdx(size_t idx)
remove an invariant by its index