ilang  1.1.4
ILAng: A Modeling and Verification Platform for SoCs
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros
vtarget_gen_yosys.h
1 // ---Hongce Zhang
8 
9 #ifndef VTARGET_GEN_YOSYS_H__
10 #define VTARGET_GEN_YOSYS_H__
11 
12 #include <ilang/config.h>
13 
15 #include <ilang/smt-inout/yosys_smt_parser.h>
16 #include <ilang/vtarget-out/vlg_mod.h>
17 #include <ilang/vtarget-out/vtarget_gen_impl.h>
18 #include <iostream>
19 #include <memory>
20 #include <string>
21 #include <vector>
22 
23 namespace ilang {
24 
25 class VlgSglTgtGen_Yosys;
26 
29  friend class VlgSglTgtGen_Yosys;
31  typedef std::vector<std::string> prop_t;
34  typedef struct {
35  // the name in [??]
36  // std::string problem_name;
38  prop_t exprs;
39  } problem_t;
41  typedef std::map<std::string, problem_t> problemset_t;
42 
43 protected:
45  problemset_t assumptions;
47  problemset_t assertions;
48 
49 }; // Yosys_problem
50 
53 
54 public:
65 
66 public:
67  // --------------------- CONSTRUCTOR ---------------------------- //
82  const std::string& output_path, // will be a sub directory of the
83  // output_path of its parent
84  const InstrPtr& instr_ptr, // which could be an empty pointer, and it will
85  // be used to verify invariants
86  const InstrLvlAbsPtr& ila_ptr,
87  const VerilogGenerator::VlgGenConfig& config, nlohmann::json& _rf_vmap,
88  nlohmann::json& _rf_cond, VlgTgtSupplementaryInfo& _sup_info,
89  VerilogInfo* _vlg_info_ptr, const std::string& vlg_mod_inst_name,
90  const std::string& ila_mod_inst_name, const std::string& wrapper_name,
91  const std::vector<std::string>& implementation_srcs,
92  const std::vector<std::string>& include_dirs,
93  const vtg_config_t& vtg_config, backend_selector vbackend,
94  const target_type_t& target_tp, advanced_parameters_t* adv_ptr,
96 
97  // --------------------- Destructor ---------------------------- //
99  virtual ~VlgSglTgtGen_Yosys();
100 
101 protected:
105  std::string prob_fname;
107  std::string run_script_name;
111  std::shared_ptr<smt::YosysSmtParser> design_smt_info;
116 
117 protected:
119  virtual void add_a_direct_assumption(const std::string& aspt,
120  const std::string& dspt) override;
122  virtual void add_a_direct_assertion(const std::string& asst,
123  const std::string& dspt) override;
124 
126  void virtual PreExportProcess() override;
128  virtual void Export_script(const std::string& script_name) override;
130  virtual void Export_problem(const std::string& extra_name) override;
134  virtual void Export_mem(const std::string& mem_name) override;
136  virtual void Export_modify_verilog() override;
137 
138 private:
140  void convert_smt_to_chc_datatype(const std::string& smt_fname,
141  const std::string& chc_fname);
143  void convert_smt_to_chc_bitvec(const std::string& smt_fname,
144  const std::string& chc_fname,
145  const std::string& wrapper_mod_name);
147  void design_only_gen_smt(const std::string& smt_name,
148  const std::string& ys_script_name);
150  void design_only_gen_btor(const std::string& btor_name,
151  const std::string& ys_script_name);
153  void generate_aiger(const std::string& blif_name,
154  const std::string& aiger_name,
155  const std::string& map_name,
156  const std::string& ys_script_name);
157 
158 public:
160  void virtual ExportAll(const std::string& wrapper_name,
161  const std::string& ila_vlg_name,
162  const std::string& script_name,
163  const std::string& extra_name,
164  const std::string& mem_name) override;
166  std::shared_ptr<smt::YosysSmtParser> GetDesignSmtInfo() const;
168  virtual void do_not_instantiate(void) override{};
169 
170 }; // class VlgVerifTgtGenYosys
171 
172 }; // namespace ilang
173 
174 #endif // VTARGET_GEN_YOSYS_H__
virtual void Export_mem(const std::string &mem_name) override
VlgSglTgtGen_Yosys(const std::string &output_path, const InstrPtr &instr_ptr, const InstrLvlAbsPtr &ila_ptr, const VerilogGenerator::VlgGenConfig &config, nlohmann::json &_rf_vmap, nlohmann::json &_rf_cond, VlgTgtSupplementaryInfo &_sup_info, VerilogInfo *_vlg_info_ptr, const std::string &vlg_mod_inst_name, const std::string &ila_mod_inst_name, const std::string &wrapper_name, const std::vector< std::string > &implementation_srcs, const std::vector< std::string > &include_dirs, const vtg_config_t &vtg_config, backend_selector vbackend, const target_type_t &target_tp, advanced_parameters_t *adv_ptr, _chc_target_t chc_target)
virtual void PreExportProcess() override
Pre export work : add assume and asssert to the top level.
virtual ~VlgSglTgtGen_Yosys()
do nothing
std::tuple< long, std::string, bool > info_t
a tuple to store all related info for modification
Definition: vlg_mod.h:29
VerilogModifier::info_t info_t
a tuple to store all related info for modification
Definition: vtarget_gen_yosys.h:58
virtual void Export_script(const std::string &script_name) override
export the script to run the verification
std::shared_ptr< smt::YosysSmtParser > GetDesignSmtInfo() const
accessor of the design info
a class to interface w. Yosys
Definition: vtarget_gen_yosys.h:52
std::string run_script_name
Yosys script &#39;run.sh&#39; name.
Definition: vtarget_gen_yosys.h:107
std::string prob_fname
Yosys problem file name.
Definition: vtarget_gen_yosys.h:105
problemset_t assumptions
assumptions are not shared (unlike CoSA)
Definition: vtarget_gen_yosys.h:45
a class to store (and generate) the problem for Yosys
Definition: vtarget_gen_yosys.h:28
struct ilang::VlgVerifTgtGenBase::_adv_parameters advanced_parameters_t
virtual void Export_modify_verilog() override
For jasper, this means do nothing, for chc, you need to add (keep)
virtual void do_not_instantiate(void) override
It is okay to instantiation.
Definition: vtarget_gen_yosys.h:168
virtual void Export_problem(const std::string &extra_name) override
export extra things: the chc script, the smt template
backend_selector
Definition: vtarget_gen.h:31
Instr::InstrPtr InstrPtr
Pointer type for normal use of Instr.
Definition: instr.h:132
the structure to configure the verilog generator
Definition: verilog_gen.h:150
virtual void add_a_direct_assumption(const std::string &aspt, const std::string &dspt) override
Add a direct assumption – needed by base class.
target_type_t
Type of the target.
Definition: vtarget_gen_impl.h:40
Generating a target (just the invairant or for an instruction)
Definition: vtarget_gen_impl.h:36
the class to hold supplementary information
Definition: supplementary_info.h:16
Yosys_problem _problems
Yosys problem generate.
Definition: vtarget_gen_yosys.h:103
virtual void add_a_direct_assertion(const std::string &asst, const std::string &dspt) override
Add a direct assertion – needed by base class.
std::map< std::string, std::vector< info_t > > fn_l_map_t
filename -&gt; (lineno, varname, is_port_sig) vec
Definition: vlg_mod.h:33
VerilogModifier::fn_l_map_t fn_l_map_t
filename -&gt; (lineno, varname, is_port_sig) vec
Definition: vtarget_gen_yosys.h:60
virtual void ExportAll(const std::string &wrapper_name, const std::string &ila_vlg_name, const std::string &script_name, const std::string &extra_name, const std::string &mem_name) override
overwrite the Export
problemset_t assertions
problems are splitted into items
Definition: vtarget_gen_yosys.h:47
InstrLvlAbs::InstrLvlAbsPtr InstrLvlAbsPtr
Pointer type for normal use of InstrLvlAbs.
Definition: instr_lvl_abs.h:326
_chc_target_t
Type of the chc target.
Definition: vtarget_gen.h:53
synthesis_backend_selector s_backend
the synthesis backend
Definition: vtarget_gen_yosys.h:109
synthesis_backend_selector
Type of invariant synthesis backend.
Definition: vtarget_gen.h:45
std::shared_ptr< smt::YosysSmtParser > design_smt_info
the smt info of the design
Definition: vtarget_gen_yosys.h:111
bool generate_proof
whether to require a proof
Definition: vtarget_gen_yosys.h:113
The class that invoke the analyzer.
Definition: verilog_analysis_wrapper.h:173
_chc_target_t chc_target
what are the targets
Definition: vtarget_gen_yosys.h:115
Verilog Target Generation Configuration.
Definition: vtarget_gen.h:55
Definition: vtarget_gen.h:275