1 #ifndef __CPPSIMGEN_HPP_DEFINED 2 #define __CPPSIMGEN_HPP_DEFINED 4 #include <boost/shared_ptr.hpp> 44 CppVar(
const Node* node,
const std::string& name =
"");
48 CppVar(
const std::string& name,
const std::string& val);
56 std::string
def()
const;
58 std::string
refDef()
const;
62 std::string
vType()
const;
64 std::string
use()
const;
82 std::vector<const CppVar*>
_args;
86 std::vector<std::pair<CppVar*, CppVar*>>
_updates;
90 CppFun(
const std::string& name);
100 void addBody(
const std::string& code);
104 void dumpDec(std::ostream& out,
const std::string& modelName,
105 const int& indent)
const;
107 void dumpVarDec(std::ostream& out,
const int& indent)
const;
109 void dumpCode(std::ostream& out,
const int& indent)
const;
165 CppFun*
addFun(
const std::string& name,
bool ms =
false);
206 void genModel(std::ostream& out)
const;
249 void checkAndInsert(std::map<std::string, T*>& mp,
const std::string& name,
250 T* var,
bool force =
false);
std::string _val
Definition: cppsimgen.hpp:35
std::vector< std::pair< CppVar *, CppVar * > > _updates
Definition: cppsimgen.hpp:86
Definition: bitvec.hpp:83
CppVar * _ret
Definition: cppsimgen.hpp:85
bool retSet()
Definition: cppsimgen.hpp:94
CppVar * findVar(CppVarMap &mp, const std::string &name)
std::map< CppFun *, CppVarMap * > _varInFun
Definition: cppsimgen.hpp:142
std::vector< std::string > _varList
Definition: cppsimgen.hpp:84
void setMemConst(std::ostream &out) const
static std::string voidStr
Definition: cppsimgen.hpp:30
void depthFirstTraverse(nptr_t n)
CppVar * addInput(const std::string &name, nptr_t node, bool ms=false)
std::vector< const CppVar * > _args
Definition: cppsimgen.hpp:82
CppVar * getMemOpCpp(const MemOp *n)
void setFunReturn(CppFun *f, nptr_t nptr)
void createCommon(std::ostream &out) const
static int varCnt
Definition: cppsimgen.hpp:25
CppVar * getBvConstCpp(const BitvectorConst *n)
CppVar(nptr_t nptr, const std::string &name="")
std::map< std::string, CppFun * > CppFunMap
Definition: cppsimgen.hpp:117
int _width
Definition: cppsimgen.hpp:36
static std::string bvStr
Definition: cppsimgen.hpp:28
std::string vType() const
CppVarMap * _curVarMap
Definition: cppsimgen.hpp:148
CppFun(const std::string &name)
CppVar * getBoolOpCpp(const BoolOp *n)
CppVar * getBoolConstCpp(const BoolConst *n)
CppVarMap _unitpFuncVarMap
Definition: cppsimgen.hpp:131
CppVar * addFuncVar(const std::string &name, nptr_t node, bool ms=false)
static std::string boolStr
Definition: cppsimgen.hpp:27
CppVar * getBvVarCpp(const BitvectorVar *n)
boost::multiprecision::cpp_int mp_int_t
Definition: common.hpp:9
std::map< CppVar *, const MemConst * > _memConst
Definition: cppsimgen.hpp:136
std::string _name
Definition: cppsimgen.hpp:81
std::string getSignedCppCode(CppVar *var)
void checkAndInsert(std::map< std::string, T *> &mp, const std::string &name, T *var, bool force=false)
void buildFun(CppFun *f, nptr_t nptr)
CppFunMap _funMap
Definition: cppsimgen.hpp:128
std::string ctorDef() const
std::vector< std::string > _codeList
Definition: cppsimgen.hpp:83
void addArg(const CppVar *arg)
boost::shared_ptr< Node > nptr_t
Definition: node.hpp:24
CppSimGen(const std::string &prefix)
CppVar * appFun(CppFun *appFun, CppFun *envFun)
void dumpDec(std::ostream &out, const std::string &modelName, const int &indent) const
std::string exactUse() const
CppVarMap _states
Definition: cppsimgen.hpp:124
Definition: cppsimgen.hpp:77
std::string _type
Definition: cppsimgen.hpp:33
void genModel(std::ostream &out) const
std::string _modelName
Definition: cppsimgen.hpp:121
CppVar * _curVar
Definition: cppsimgen.hpp:146
Definition: abstraction.hpp:21
void addFunUpdate(CppFun *f, nptr_t lhs, nptr_t rhs)
void dumpVarDec(std::ostream &out, const int &indent) const
CppVar * getBoolVarCpp(const BoolVar *n)
Definition: bitvec.hpp:38
CppFun * addFun(const std::string &name, bool ms=false)
std::string _name
Definition: cppsimgen.hpp:34
void operator()(const Node *n)
CppVar * getBvOpCpp(const BitvectorOp *n)
void exportAllToDir(const std::string &dirName) const
void addBody(const std::string &code)
mp_int_t cppBvType
Definition: cppsimgen.hpp:22
bool _isConst
Definition: cppsimgen.hpp:38
int _idxwidth
Definition: cppsimgen.hpp:37
CppVarMap _masks
Definition: cppsimgen.hpp:139
void defUnitpFunc(std::ostream &out) const
CppFunMap _unitpFuncMap
Definition: cppsimgen.hpp:133
std::string castUse() const
std::map< std::string, CppVar * > CppVarMap
Definition: cppsimgen.hpp:116
void dumpCode(std::ostream &out, const int &indent) const
void defMemClass(std::ostream &out) const
Definition: cppsimgen.hpp:113
std::string signedUse() const
CppVarMap _inputs
Definition: cppsimgen.hpp:126
CppVar * addState(const std::string &name, nptr_t node, bool ms=false)
CppVar * getFuncVarCpp(const FuncVar *n)
Definition: bitvec.hpp:54
CppVar * getMemVarCpp(const MemVar *n)
CppFun * _curFun
Definition: cppsimgen.hpp:144
std::string refDef() const
static std::string memStr
Definition: cppsimgen.hpp:29
CppVar * getMemConstCpp(const MemConst *n)
Definition: cppsimgen.hpp:17
void exportAllToFile(const std::string &fileName) const