ilang  1.1.4
ILAng: A Modeling and Verification Platform for SoCs
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros
vtarget_gen.h
1 // --- Hongce Zhang
4 
5 #ifndef ILANG_VTARGET_OUT_VTARGET_GEN_H__
6 #define ILANG_VTARGET_OUT_VTARGET_GEN_H__
7 
8 #include <ilang/config.h>
11 #include <ilang/vtarget-out/inv-syn/cex_extract.h>
12 #include <ilang/vtarget-out/inv-syn/inv_obj.h>
13 
14 namespace ilang {
15 
18  // ----------------------- Type Definition ----------------------- //
19 public:
22  struct ex_info_t {
23  std::string range;
24  ex_info_t(const std::string& r) : range(r) {}
25  };
26 
27  // ----------- Verification Settings -------------- //
30  // YOSYS is for invariant synthesis use
31  typedef enum {
32  NONE = 0,
33  COSA = 1,
34  JASPERGOLD = 2,
35  YOSYS = 128, // 10000000
36  CHC = YOSYS + 8, // 10001000
37  Z3PDR = CHC + 1, // 10001001
38  ELD_CEGAR = CHC + 2, // 10001010
39  GRAIN_SYGUS = CHC + 4, // 10001100
40  ABCPDR = YOSYS + 16, // 10010000
41  BTOR_GENERIC = YOSYS + 32,// 10100000
42  RELCHC = YOSYS + 64 // 11000000
45  typedef enum {
46  Z3 = Z3PDR ^ YOSYS,
47  GRAIN = GRAIN_SYGUS ^ YOSYS,
48  ABC = ABCPDR ^ YOSYS,
49  ELDERICA = ELD_CEGAR ^ YOSYS,// 0001010
50  NOSYN = BTOR_GENERIC ^ YOSYS // 1000000
53  enum _chc_target_t { CEX, INVCANDIDATE, GENERAL_PROPERTY };
55  typedef struct _vtg_config {
57  std::string WrapperPreheader;
59  enum { INST, INV, BOTH } target_select;
65  bool InstructionNoReset; // true
74  bool IteUnknownAutoIgnore; // false
81  NOINV,
82  CANDIDATE,
83  CONFIRMED,
84  ALL
85  } ValidateSynthesizedInvariant;
86 
87  // ----------- Options for CoSA settings -------------- //
89  bool PerVariableProblemCosa; // true
91  bool MemAbsReadAbstraction; // false
95  enum { AUTO = 0, NEW = 1, OLD = 2 } PortDeclStyle;
109  NOTIFY_PANIC = 0,
110  NOTIFY_WARNING = 1,
111  NOTIFY_IGNORE = 2
112  } CosaDotReferenceNotify;
113  // The bound of BMC, default 127
114  unsigned MaxBound;
116  bool OnlyAssumeUpdatedVarsEq; // should be false
117 
118 
119  // ----------- Options for CoSA script -------------- //
121  std::string CosaPath;
123  std::string CosaPyEnvironment;
125  std::string CosaSolver;
132 
133  // ----------- Options for Yosys SMT-LIB2 Generator -------------- //
135  std::string YosysPath;
151  typedef enum {
152  UnintepretedFunc /*not supported*/,
153  Datatypes, /*by default*/
154  BitVec /*optional for property check, not inv-syn*/
155  } _state_sort_t;
156  _state_sort_t YosysSmtStateSort;
166 
167  // ----------- Options for CHC Solver -------------- //
176 
177  // ----------- Options for Btor Output -------------- //
180  std::string BtorGenericCmdline;
185 
186  // ----------- Options for Z3/Grain/ABC Solver -------------- //
188  std::string Z3Path;
190  std::string GrainPath;
192  std::vector<std::string> GrainOptions;
196  std::string AbcPath;
197 
198  // ----------- Extended Options for ABC Solver -------------- //
200  bool AbcUseGla;
202  unsigned AbcGlaTimeLimit;
212  typedef enum _abc_assumption_style_t {
213  AigMiterExtraOutput =
214  0, // Use AIG's extra output to represent, cannot use with GLA
215  AssumptionRegister =
216  1 // Use extra register, may have issues in interpreting the invariant
218  AbcAssumptionStyle_t AbcAssumptionStyle;
219 
220  // ----------- Extended Options for Grain -------------- //
221 
226  IteUnknownAutoIgnore(false),
228  ValidateSynthesizedInvariant(ALL),
229 
230  // ----------- Options for CoSA settings -------------- //
232  ForceInstCheckReset(false), PortDeclStyle(AUTO),
233  CosaGenJgTesterScript(false), CosaFullTrace(false), CosaAddKeep(true),
234  CosaDotReferenceNotify(CosaDotReferenceNotify_t::NOTIFY_PANIC),
235  MaxBound(127), OnlyAssumeUpdatedVarsEq(false),
236 
237  // ----------- Options for CoSA script -------------- //
238  CosaPath(""), CosaPyEnvironment(""), CosaSolver(""),
241 
242  // ----------- Options for Yosys SMT-LIB2 Generator -------------- //
246  YosysSmtStateSort(Datatypes), InvariantSynthesisKeepMemory(true),
249 
250  // ----------- Options for CHCs -------------- //
253 
254  // ----------- Options for Btor Output -------------- //
256  BtorSingleProperty(true),
259 
260  // ----------- Options for Z3/Grain/ABC Solver -------------- //
261  GrainHintsUseCnfStyle(true),
262 
263  // ----------- Options for ABC -------------- //
264  AbcUseGla(false), AbcGlaTimeLimit(500), AbcGlaFrameLimit(200),
265  AbcUseCorr(false), AbcUseAiger(true), AbcMinimizeInv(false),
266  AbcAssumptionStyle(_abc_assumption_style_t::AigMiterExtraOutput)
267 
268  {}
269  } vtg_config_t;
270 
275  typedef struct _adv_parameters {
284  : _inv_obj_ptr(NULL), _candidate_inv_ptr(NULL), _cex_obj_ptr(NULL) {}
286  virtual ~_adv_parameters(){};
288 
289 public:
290  // ----------------------- Constructor/Destructor ----------------------- //
291  // constructor : do nothing
292  VlgVerifTgtGenBase() {}
293  // destructor : do nothing (make it virtual !!!)
294  virtual ~VlgVerifTgtGenBase() {}
296  static bool isValidVerifBackend(backend_selector vbackend);
297 
298 private:
299  // avoid instantiation
300  virtual void do_not_instantiate(void) = 0;
301 }; // class VlgVerifTgtGenBase
302 
304 public:
312 
313 public:
314  // --------------------- CONSTRUCTOR ---------------------------- //
326  const std::vector<std::string>& implementation_include_path,
327  const std::vector<std::string>& implementation_srcs,
328  const std::string& implementation_top_module,
329  const std::string& refinement_variable_mapping,
330  const std::string& refinement_conditions, const std::string& output_path,
331  const InstrLvlAbsPtr& ila_ptr, backend_selector backend,
332  const vtg_config_t& vtg_config = vtg_config_t(),
333  const VerilogGenerator::VlgGenConfig& config =
335  // --------------------- DECONSTRUCTOR ---------------------------- //
337 
339  void GenerateTargets(void);
341  bool in_bad_state(void) const;
343  std::string GetVlgModuleInstanceName(void) const;
344 
345 private:
347  VlgVerifTgtGenBase* _generator;
348 
349 }; // VerilogVerificationTargetGenerator
350 
351 }; // namespace ilang
352 
353 #endif // ILANG_VTARGET_OUT_VTARGET_GEN_H__
std::string GrainPath
The path to Grain, if &quot;grain&quot; is not in the PATH, default empty.
Definition: vtarget_gen.h:190
bool MemAbsReadAbstraction
Whether to abstract the memory read.
Definition: vtarget_gen.h:91
std::string CosaPath
If not empty, the generated script will include the path of Cosa.
Definition: vtarget_gen.h:121
Definition: vtarget_gen.h:303
bool YosysSmtFlattenDatatype
Whether to flatten the datatypes.
Definition: vtarget_gen.h:143
static bool isValidVerifBackend(backend_selector vbackend)
check if a backend selector is valid
bool IteUnknownAutoIgnore
Definition: vtarget_gen.h:74
bool AbcUseGla
ABC option : whether to use gate-level abstraction.
Definition: vtarget_gen.h:200
bool OnlyAssumeUpdatedVarsEq
Only enforce var eq on updated vars, should not be used.
Definition: vtarget_gen.h:116
bool YosysSmtFlattenHierarchy
Whether to flatten the module hierarchy.
Definition: vtarget_gen.h:141
bool InvariantCheckKeepMemory
for invariant check, do we keep memory abstraction in Verilog
Definition: vtarget_gen.h:161
enum ilang::VlgVerifTgtGenBase::_vtg_config::@0 target_select
Set the targets: instructions/invariants/both.
std::string BtorGenericCmdline
Definition: vtarget_gen.h:180
bool AbcMinimizeInv
ABC option : whether to minimize invariant.
Definition: vtarget_gen.h:210
struct ilang::VlgVerifTgtGenBase::_adv_parameters advanced_parameters_t
Definition: vtarget_gen.h:22
bool BtorAddCommentsInOutputs
CHC, whether to force assumption on the init.
Definition: vtarget_gen.h:184
the invariant object, it needs smt-info to parse
Definition: inv_obj.h:23
bool AbcUseAiger
ABC option : whether to pass aiger to ABC.
Definition: vtarget_gen.h:208
std::string CosaSolver
A choice of solver (in the script)
Definition: vtarget_gen.h:125
std::string CosaOtherSolverOptions
other CoSA options
Definition: vtarget_gen.h:131
bool InvariantSynthesisReachableCheckKeepOldInvariant
Definition: vtarget_gen.h:165
enum ilang::VlgVerifTgtGenBase::_vtg_config::@1 PortDeclStyle
For COSA target generator : whether to force NEW/OLD port declaration.
backend_selector
Definition: vtarget_gen.h:31
bool ChcAssumptionEnd
CHC, whether to force assumption on the end T.
Definition: vtarget_gen.h:175
InvariantObject * _candidate_inv_ptr
candidate invariants object
Definition: vtarget_gen.h:279
std::string WrapperPreheader
Preheader Content : will use in all targets.
Definition: vtarget_gen.h:57
the structure to configure the verilog generator
Definition: verilog_gen.h:150
_abc_assumption_style_t
ABC option : the way to handle assumptions.
Definition: vtarget_gen.h:212
struct ilang::VlgVerifTgtGenBase::_vtg_config vtg_config_t
Verilog Target Generation Configuration.
CosaDotReferenceNotify_t
Definition: vtarget_gen.h:108
bool YosysUndrivenNetAsInput
Definition: vtarget_gen.h:139
virtual ~_adv_parameters()
virtual destructor
Definition: vtarget_gen.h:286
_vtg_config()
The default constructor for default values.
Definition: vtarget_gen.h:223
CexExtractor * _cex_obj_ptr
counterexample object
Definition: vtarget_gen.h:281
bool ChcWordBlastArray
CHC, whether to turn array into individual registers.
Definition: vtarget_gen.h:169
std::string CosaPyEnvironment
If not empty, the generated script will include sourcing a script.
Definition: vtarget_gen.h:123
bool YosysSmtArrayForRegFile
Definition: vtarget_gen.h:148
bool ChcAssumptionsReset
CHC, whether to force assumption on the init.
Definition: vtarget_gen.h:171
bool VerificationSettingAvoidIssueStage
whether to remove the extra issue cycle and starts from reset
Definition: vtarget_gen.h:76
enum ilang::VlgVerifTgtGenBase::_vtg_config::_abc_assumption_style_t AbcAssumptionStyle_t
ABC option : the way to handle assumptions.
InstrLvlAbs::InstrLvlAbsPtr InstrLvlAbsPtr
Pointer type for normal use of InstrLvlAbs.
Definition: instr_lvl_abs.h:326
bool CosaGenTraceVcd
Whether the Solver should generate vcd trace.
Definition: vtarget_gen.h:127
VlgVerifTgtGenBase::vtg_config_t vtg_config_t
Type of configuration.
Definition: vtarget_gen.h:311
unsigned AbcGlaFrameLimit
ABC option : gate-level abstraction frame limit.
Definition: vtarget_gen.h:204
bool BtorSingleProperty
CHC, whether to turn array into individual registers.
Definition: vtarget_gen.h:182
bool CosaAssumptionOverlyConstrainedCheck
Assumption overly constrained check.
Definition: vtarget_gen.h:129
std::string CheckThisInstructionOnly
If not an empty string, then only check for that instruction.
Definition: vtarget_gen.h:61
std::string AbcPath
The path to ABC, if &quot;abc&quot; is not in the PATH, default empty.
Definition: vtarget_gen.h:196
std::string GetVlgModuleInstanceName(void) const
get vlg-module instance name
bool ForceInstCheckReset
Whether to force the instruction check to start from reset state.
Definition: vtarget_gen.h:93
bool CosaAddKeep
Definition: vtarget_gen.h:102
_chc_target_t
Type of the chc target.
Definition: vtarget_gen.h:53
unsigned AbcGlaTimeLimit
ABC option : gate-level abstraction time limit.
Definition: vtarget_gen.h:202
bool in_bad_state(void) const
return true if the generator&#39;s in a bad state and cannot proceed.
std::string YosysPath
The path to yosys, if yosys is not in the PATH, default empty.
Definition: vtarget_gen.h:135
_validate_synthesized_inv
Definition: vtarget_gen.h:80
std::vector< std::string > GrainOptions
Grain Configuration Options.
Definition: vtarget_gen.h:192
synthesis_backend_selector
Type of invariant synthesis backend.
Definition: vtarget_gen.h:45
bool CosaGenJgTesterScript
Generate a jg script to help validate cosa?
Definition: vtarget_gen.h:97
_adv_parameters()
The default constructor for default values.
Definition: vtarget_gen.h:283
bool GrainHintsUseCnfStyle
FreqHorn style (cocistyple, cnfstyle)
Definition: vtarget_gen.h:194
void GenerateTargets(void)
export all targets
Verilog Target Generation Configuration.
Definition: vtarget_gen.h:55
VerilogVerificationTargetGenerator(const std::vector< std::string > &implementation_include_path, const std::vector< std::string > &implementation_srcs, const std::string &implementation_top_module, const std::string &refinement_variable_mapping, const std::string &refinement_conditions, const std::string &output_path, const InstrLvlAbsPtr &ila_ptr, backend_selector backend, const vtg_config_t &vtg_config=vtg_config_t(), const VerilogGenerator::VlgGenConfig &config=VerilogGenerator::VlgGenConfig())
bool OnlyCheckInstUpdatedVars
Definition: vtarget_gen.h:68
std::string Z3Path
The path to Z3, if &quot;z3&quot; is not in the PATH, default empty.
Definition: vtarget_gen.h:188
VlgVerifTgtGenBase: do nothing, should not instantiate.
Definition: vtarget_gen.h:17
InvariantObject * _inv_obj_ptr
invariant object
Definition: vtarget_gen.h:277
bool CosaFullTrace
generate the trace for all variables? or just the relevent variables
Definition: vtarget_gen.h:99
bool InstructionNoReset
Definition: vtarget_gen.h:65
Definition: vtarget_gen.h:275
bool ChcAssumptionNextState
CHC, whether to force assumption on the next T.
Definition: vtarget_gen.h:173
bool PerVariableProblemCosa
Do we set separate problems for different var map (CoSA only)
Definition: vtarget_gen.h:89
bool AbcUseCorr
ABC option : whether to use correlation analysis.
Definition: vtarget_gen.h:206
_state_sort_t
Definition: vtarget_gen.h:151
the class to extract counterexample from a vcd file
Definition: cex_extract.h:15
bool InvariantSynthesisKeepMemory
Definition: vtarget_gen.h:159
bool YosysPropertyCheckShowProof
when used in property verification, show prove?
Definition: vtarget_gen.h:145