4 #ifndef ILANG_ILA_MNGR_U_UNROLLER_H__
5 #define ILANG_ILA_MNGR_U_UNROLLER_H__
31 Unroller(z3::context& ctx,
const std::string& suffix);
93 ZExpr UnrollAssn(
const size_t& len,
const int& pos,
bool cache =
false);
114 std::string extra_suff_ =
"";
121 std::map<int, IExprVec> s_pred_;
135 inline z3::context& ctx()
const {
return ctx_; }
143 void BootStrap(
const int& pos,
bool cache =
false);
147 const std::string& suffix);
153 void IExprToZExpr(
const IExprVec& i_expr_src,
const std::string& suffix,
157 void IExprToZExpr(
const IExprVec& i_expr_src,
const std::string& suffix,
168 inline std::string SuffCurr(
const int& t)
const {
169 return std::to_string(t) +
"_" + extra_suff_;
172 inline std::string SuffNext(
const int& t)
const {
173 return std::to_string(t) +
"_" + extra_suff_ +
".nxt";
186 PathUnroll(z3::context& ctx,
const std::string& suff =
"");
194 ZExpr PathSubs(
const std::vector<InstrPtr>& seq,
const int& pos = 0);
200 ZExpr PathAssn(
const std::vector<InstrPtr>& seq,
const int& pos = 0);
206 ZExpr PathNone(
const std::vector<InstrPtr>& seq,
const int& pos = 0);
236 MonoUnroll(z3::context& ctx,
const std::string& suff =
"");
294 #endif // ILANG_ILA_MNGR_U_UNROLLER_H__
ZExpr NextState(const ExprPtr &v, const int &t)
Return the z3::expr representing the next state at the time.
Base class for unrolling ILA execution in different settings.
Definition: u_unroller.h:19
Application class for unrolling a path of instruction sequence.
Definition: u_unroller.h:179
IExprVec k_pred_
The set of predicates to be asserted of each step.
Definition: u_unroller.h:71
ZExpr CurrState(const ExprPtr &v, const int &t)
Return the z3::expr representing the current state at the time.
void AddGlobPred(const ExprPtr &p)
Add a predicate that should be asserted globally.
static ExprPtr NewFreeVar(const ExprPtr &var, const std::string &name)
Create a new free variable (with same sort) under the same host.
void Transition(const int &idx)
[Application-specific] Define next state update functions.
void ClearPred()
Clear all predicates.
Expr::ExprPtr ExprPtr
Pointer type for normal use of Expr.
Definition: expr.h:138
~MonoUnroll()
Default destructor.
ZExpr UnrollAssn(const size_t &len, const int &pos, bool cache=false)
Unroll without substituting internal expression.
z3::expr_vector ZExprVec
Type for containing a set of z3::expr.
Definition: u_unroller.h:24
z3::expr ZExpr
Type alias for z3::expr.
Definition: u_unroller.h:22
ZExpr PathSubs(const std::vector< InstrPtr > &seq, const int &pos=0)
Unroll a sequence of instructions with internal states substituted.
ZExpr MonoSubs(const InstrLvlAbsPtr &top, const int &length, const int &pos=0)
Unroll the ILA with internal states substituted.
Unroller(z3::context &ctx, const std::string &suffix)
Default constructor.
Application class for unrolling the ILA as a monolithic transition system.
Definition: u_unroller.h:232
void AddInitPred(const ExprPtr &p)
Add a predicate that should be asserted in the initial condition.
PathUnroll(z3::context &ctx, const std::string &suff="")
Default constructor.
void DefineDepVar()
[Application-specific] Define dependant state variables.
ZExpr MonoAssn(const InstrLvlAbsPtr &top, const int &length, const int &pos=0)
Unroll the ILA while asserting states are equal between each step.
void AddStepPred(const ExprPtr &p, const int &k)
Add a predicate that should be asserted at the k-th step.
IExprVec vars_
The set of dependant state variables.
Definition: u_unroller.h:69
ZExpr PathNone(const std::vector< InstrPtr > &seq, const int &pos=0)
Unroll a sequence of instructions without asserting states relations between steps. "N(var_i) == var_i.nxt_suff".
Instr::InstrPtr InstrPtr
Pointer type for normal use of Instr.
Definition: instr.h:132
ZExpr UnrollSubs(const size_t &len, const int &pos)
Unroll while substituting internal expression.
MonoUnroll(z3::context &ctx, const std::string &suff="")
Default constructor.
Func::FuncPtr FuncPtr
Pointer type for normal use of Func.
Definition: func.h:83
static ExprPtr StateUpdCmpl(const InstrPtr &instr, const ExprPtr &var)
Return the state update function (unchanged if not defined).
std::vector< InstrPtr > InstrVec
Type of a list of instruction sequence.
Definition: u_unroller.h:182
ZExpr MonoNone(const InstrLvlAbsPtr &top, const int &length, const int &pos=0)
Unroll the ILA without asserting states relations between steps.
static ExprPtr DecodeCmpl(const InstrPtr &instr)
Return the decode function (true if not defined).
virtual void Transition(const int &idx)=0
[Application-specific] Define next state update functions.
~PathUnroll()
Default destructor.
void Transition(const int &idx)
[Application-specific] Define next state update functions.
void ClearStepPred()
Clear the step-specific predicates.
ExprPtrVec IExprVec
Type alias for a set of ExprPtr.
Definition: u_unroller.h:26
Expr::ExprPtrVec ExprPtrVec
Type for storing a set of Expr.
Definition: expr.h:140
InstrLvlAbs::InstrLvlAbsPtr InstrLvlAbsPtr
Pointer type for normal use of InstrLvlAbs.
Definition: instr_lvl_abs.h:326
virtual void DefineDepVar()=0
[Application-specific] Define dependant state variables.
ZExpr MonoIncr(const InstrLvlAbsPtr &top, const int &length, const int &pos)
Incrementally unrolling the ILA using MonoAssn (with transition relation being cached).
void DefineDepVar()
[Application-specific] Define dependant state variables.
virtual ~Unroller()
Default virtual destructor.
ZExpr PathAssn(const std::vector< InstrPtr > &seq, const int &pos=0)
Unroll a sequence of instructions while asserting states are equal between each step.
ZExpr Equal(const ExprPtr &va, const int &ta, const ExprPtr &vb, const int &tb)
Return the z3::expr representing a and b are equal at their time.
IExprVec k_next_
The set of state update functions of each step.
Definition: u_unroller.h:73
void ClearInitPred()
Clear the initial predicates.
void ClearGlobPred()
Clear the global predicates.
The class for generating z3 expression from an ILA.
Definition: z3_expr_adapter.h:20
ZExpr UnrollNone(const size_t &len, const int &pos)
Unroll without asserting state equality between each step.
ZExpr GetZ3Expr(const ExprPtr &e, const int &t)
Return the z3::expr representing the current-based Expr at the time.
z3::func_decl GetZ3FuncDecl(const FuncPtr &f) const
Return the z3::func_decl representing f.