ilang  1.1.4
ILAng: A Modeling and Verification Platform for SoCs
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros
tso_manual.h
Go to the documentation of this file.
1 
4 #ifndef ILANG_MCM_TSO_MANUAL_H__
5 #define ILANG_MCM_TSO_MANUAL_H__
6 
8 
9 namespace ilang {
10 
12 class TsoTraceStep : public TraceStep {
13 public:
15  typedef std::shared_ptr<TraceStep> TraceStepPtr;
16  // ------------------------- MEMBERS -------------------------------------- //
17  TraceStepPtr wfe_global; // maybe we should get away from raw pointer?
18  // ------------------------- CONSTRUCTOR/DESTRUCTOR ----------------------- //
20  TsoTraceStep(const InstrPtr& inst, ZExprVec& cstr, z3::context& ctx,
21  size_t pos);
22 }; // class TsoTraceStep
23 
25 class Tso : public MemoryModel {
26 public:
28  typedef std::shared_ptr<TsoTraceStep> TsoTraceStepPtr;
30  typedef std::set<TsoTraceStepPtr> TsoTraceStepPtrSet;
31  // -------------------------- TSO SELECTOR
32  // -------------------------------------- //
35 
36 protected:
37  TraceStepPtrSet WRITE_list;
38  TraceStepPtrSet READ_list;
39  TraceStepPtrSet FENCE_list;
40  TraceStepPtrSet RMW_list;
41  TraceStepPtrSet PureWrite_list;
42 
43 public:
46  void virtual RegisterSteps(size_t regIdx, const InstrVec& _inst_seq) override;
49  void virtual FinishRegisterSteps() override;
51  void virtual ApplyAxioms() override;
52  // HZ note: All the step should be registered through the first function:
53  // RegisterSteps
55  void virtual SetFinalProperty(const ExprPtr& property) override;
56 
58  Tso(z3::context& ctx, ZExprVec& _cstrlist, const StateNameSet& shared_states,
59  const ILANameStateNameSetMap& private_states,
60  const InstrLvlAbsPtr& global_ila_ptr)
61  : MemoryModel(ctx, _cstrlist, shared_states, private_states,
62  global_ila_ptr) {}
63 
64 private:
65  z3::expr RF(const TraceStepPtr& w, const TraceStepPtr& r);
66  z3::expr FR(const TraceStepPtr& r, const TraceStepPtr& w);
67  z3::expr CO(const TraceStepPtr& w1, const TraceStepPtr& w2);
68 
69  // ------------------------- ACCESSOR FUNCTIONs
70  // -------------------------------------- //
73  __wfe_global(const MemoryModel::TraceStepPtr& ts);
74 
75 }; // class Tso
76 
77 } // namespace ilang
78 
79 #endif // ILANG_MCM_TSO_MANUAL_H__
TraceStep::TraceStepPtrSet TraceStepPtrSet
Type of trace steps, we need to collect the set of trace steps (WRITE)
Definition: memory_model.h:206
Expr::ExprPtr ExprPtr
Pointer type for normal use of Expr.
Definition: expr.h:138
std::map< std::string, StateNameSet > ILANameStateNameSetMap
Type of map ila-name to state-set.
Definition: memory_model.h:222
virtual void RegisterSteps(size_t regIdx, const InstrVec &_inst_seq) override
The class for trace step (an instance of instruction) As in the unrolling, there may be multiple inst...
Definition: memory_model.h:28
virtual void ApplyAxioms() override
To apply the axioms, the complete program should be given.
Tso(z3::context &ctx, ZExprVec &_cstrlist, const StateNameSet &shared_states, const ILANameStateNameSetMap &private_states, const InstrLvlAbsPtr &global_ila_ptr)
Constructor.
Definition: tso_manual.h:58
std::function< MemoryModelPtr(z3::context &, ZExprVec &, const StateNameSet &, const ILANameStateNameSetMap &, const InstrLvlAbsPtr &)> MemoryModelCreator
Definition: inter_ila_unroller.h:64
z3::context & ctx() const
Return the context (for variable creation)
Definition: memory_model.h:260
TraceStep::ZExprVec ZExprVec
Type for containing a vector of z3::expr.
Definition: memory_model.h:202
Instr::InstrPtr InstrPtr
Pointer type for normal use of Instr.
Definition: instr.h:132
virtual void SetFinalProperty(const ExprPtr &property) override
Set the final property, this is implementation-specific.
InstrPtr inst() const
Return the associated instruction for facet / instruction event.
Class of TSO.
Definition: tso_manual.h:25
TraceStep::TraceStepPtr TraceStepPtr
Type of trace step shared pointers.
Definition: memory_model.h:204
std::vector< InstrPtr > InstrVec
Type of an instruction vector to represent a sequence.
Definition: memory_model.h:214
TsoTraceStep(const InstrPtr &inst, ZExprVec &cstr, z3::context &ctx, size_t pos)
To create a trace step (for inst, we don&#39;t need it for facet/init)
InstrLvlAbs::InstrLvlAbsPtr InstrLvlAbsPtr
Pointer type for normal use of InstrLvlAbs.
Definition: instr_lvl_abs.h:326
TraceStep::StateNameSet StateNameSet
Type of set of state names.
Definition: memory_model.h:210
std::shared_ptr< TsoTraceStep > TsoTraceStepPtr
Type of trace step pointer.
Definition: tso_manual.h:28
static InterIlaUnroller::MemoryModelCreator TsoModel
Declaration of memory model creator that chooses Tso.
Definition: tso_manual.h:34
z3::context & ctx()
Return the context (for variable creation)
Definition: memory_model.h:154
std::set< TsoTraceStepPtr > TsoTraceStepPtrSet
Type of trace steps, we need to collect the set of trace steps (WRITE)
Definition: tso_manual.h:30
std::shared_ptr< TraceStep > TraceStepPtr
Type of trace step pointer.
Definition: tso_manual.h:15
The base class for memory models.
Definition: memory_model.h:196
Class of TSO trace step.
Definition: tso_manual.h:12
std::shared_ptr< TraceStep > TraceStepPtr
Type of trace step pointer.
Definition: memory_model.h:38
std::vector< ZExpr > ZExprVec
Type for containing a set of z3::expr.
Definition: memory_model.h:36
virtual void FinishRegisterSteps() override