ilang  1.1.4
ILAng: A Modeling and Verification Platform for SoCs
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros
cex_extract.h
1 // ---Hongce Zhang
3 
4 #ifndef ILANG_VTARGET_OUT_CEX_EXTRACT_H__
5 #define ILANG_VTARGET_OUT_CEX_EXTRACT_H__
6 
7 #include <functional>
8 #include <map>
9 #include <set>
10 #include <string>
11 
12 namespace ilang {
13 
15 class CexExtractor {
16 public:
17  // -------------------- TYPES ------------------ //
19  typedef std::string vlg_val;
21  typedef std::map<std::string, vlg_val> cex_t;
23  typedef std::map<std::string, bool> cex_is_reg_t;
26  typedef std::function<bool(const std::string&)> is_reg_t;
27 
28 protected:
36  void virtual parse_from(const std::string& vcd_file_name,
37  const std::string& scope, is_reg_t is_reg,
38  bool reg_only);
39 
40 public:
41  // -------------------- CONSTRUCTOR ------------------ //
45  CexExtractor(const std::string& vcd_file_name, const std::string& scope,
46  is_reg_t is_reg, bool reg_only);
47 
49  CexExtractor(const std::string& fin);
50 
51  // -------------------- MEMBERS ------------------ //
54  std::string GenInvAssert(
55  const std::string& prefix,
56  const std::set<std::string>& focus_name = std::set<std::string>()) const;
58  const cex_t& GetCex() const;
59  // save to file
60  static void StoreCexToFile(const std::string& fn, const cex_t& c);
61  // save to file (invoke within)
62  void StoreCexToFile(const std::string& fn) const;
63  // generalize cex
64  void DropStates(const std::vector<std::string>& vnames);
65 
66 }; // class CexExtractor
67 
68 }; // namespace ilang
69 
70 #endif // ILANG_VTARGET_OUT_CEX_EXTRACT_H__
std::string GenInvAssert(const std::string &prefix, const std::set< std::string > &focus_name=std::set< std::string >()) const
std::map< std::string, vlg_val > cex_t
val_name -&gt; val
Definition: cex_extract.h:21
virtual void parse_from(const std::string &vcd_file_name, const std::string &scope, is_reg_t is_reg, bool reg_only)
const cex_t & GetCex() const
allow direct access to the counterexample
cex_t cex
the stored cex
Definition: cex_extract.h:30
std::function< bool(const std::string &)> is_reg_t
Definition: cex_extract.h:26
CexExtractor(const std::string &vcd_file_name, const std::string &scope, is_reg_t is_reg, bool reg_only)
to specify the input vcd name and also the scope name (the submodule instance name) to look at ...
std::string vlg_val
a uniform value type (any radix/bool/bv should be fine)
Definition: cex_extract.h:19
std::map< std::string, bool > cex_is_reg_t
when generating cex, will only use the regs
Definition: cex_extract.h:23
cex_is_reg_t cex_is_reg
whether each var is reg or not
Definition: cex_extract.h:32
the class to extract counterexample from a vcd file
Definition: cex_extract.h:15