1 #ifndef __ABSTRACTION_HPP_DEFINED__ 2 #define __ABSTRACTION_HPP_DEFINED__ 4 #include <boost/python.hpp> 44 typedef std::map<std::string, uabstraction_t>
uabs_map_t;
58 std::map<std::string, state_t>
names;
214 void exportListToFile(
const py::list& l,
const std::string& fileName)
const;
227 const std::string& topModName)
const;
264 void toBoogie(
const std::string& filename);
315 if (pos ==
names.end())
318 return pos->second ==
INP;
324 const std::string& nodeName);
329 const nptr_t& expr, PyObject* pyfun);
340 nmap_t::const_iterator
findInMap(
const std::string&
name)
const;
345 nmap_t::const_iterator
MapEnd()
const;
346 nmap_t::iterator
MapEnd();
363 bool doHier =
false)
const;
387 return abs->addInp(name, width);
395 return abs->addReg(name, width);
400 return abs->addMem(name, addrW, dataW);
405 return abs->addFun(name, retW, l);
432 return abs->getIpred(name);
442 return abs->getNextI(name, i);
447 return abs->addUAbs(name, valid);
451 return abs->getUAbs(name);
455 abs->connectUInst(name, uabs->
abs);
460 return abs->bvConstLong(l, width);
468 return abs->bvConstInt(l, width);
525 return abs->synthesizeReg(name, fun);
531 return abs->synthesizeElement(name, expr, fun);
536 abs->exportOneToFile(node, fileName);
541 abs->exportListToFile(l, fileName);
546 abs->exportAllToFile(fileName);
550 abs->generateVerilogToFile(fileName);
553 const std::string& modName)
const {
554 abs->generateVerilogToFile(fileName, modName);
559 return abs->importOneFromFile(fileName);
564 return abs->importListFromFile(fileName);
569 abs->importAllFromFile(fileName);
574 abs->generateSimToFile(fileName);
578 abs->generateSimToDir(dirName);
582 abs->generateCbmcCtoFile(fileName);
586 abs->generateCbmcCtoDir(dirName);
591 return abs->areEqual(left, right);
596 return abs->areEqualAssump(assump, left, right);
601 return abs->areEqualUnrolled(n, reg, exp);
628 const std::string& n1,
const std::string& n2) {
633 const std::string& n2) {
638 const std::string& n1,
const std::string& n2,
644 const std::string& n2,
658 abs->hornifyNode(node, rule);
662 abs->generateHornMapping(type);
666 abs->exportHornToFile(fileName);
674 abs->addHornInstr(i, d);
678 abs->addHornNext(i, s, n);
682 abs->addHornChild(c, i, d);
690 abs->vlgExpConfig._extMem = extMem;
691 abs->vlgExpConfig._fmodule = fAsM;
void setDecodeExpressions(const py::list &l)
Definition: abstraction.hpp:509
void setEnParamSyn(int en)
Definition: abstraction.hpp:687
void exportListToFile(const py::list &l, const std::string &fileName) const
Definition: abstraction.hpp:540
void addHornNext(const std::string &i, const std::string &s, NodeRef *n)
void forEachAssump(assump_visitor_i &i) const
NodeRef * boolConstI(int b)
Definition: abstraction.hpp:481
Definition: VerilogExport.hpp:14
void synthesizeAll(PyObject *fun)
const nmap_t & getBits() const
Definition: abstraction.hpp:707
Definition: abstraction.hpp:302
void generateCbmcCtoFile(const std::string &fileName) const
Definition: abstraction.hpp:581
void setNext(const std::string &name, NodeRef *n)
Definition: abstraction.hpp:436
int paramSyn
Definition: abstraction.hpp:92
void addHornChild(const std::string &c, const std::string &i, NodeRef *d)
Definition: abstraction.hpp:681
static bool EqCheck(MicroUnroller *m1, MicroUnroller *m2, const std::string &n1, const std::string &n2)
bool isInput(const std::string &name) const
Definition: abstraction.hpp:313
nmap_t mems
Definition: abstraction.hpp:67
CppSimGen * generateSim(bool hier) const
void exportAllToFile(const std::string &fileName) const
Definition: abstraction.hpp:545
nptr_vec_t decodeExprs
Definition: abstraction.hpp:76
void setFetchExpr(NodeRef *expr)
Definition: abstraction.hpp:500
static NodeRef * boolConstBStatic(bool b)
Definition: abstraction.hpp:476
NodeRef * getInp(const std::string &name)
Definition: abstraction.hpp:27
void generateHornMapping(const std::string &type)
Definition: abstraction.hpp:661
NodeRef * addInp(const std::string &name, int width)
Definition: abstraction.hpp:386
void setVlgExpConfig(bool extMem, bool fAsM)
Definition: abstraction.hpp:689
static NodeRef * boolConstIStatic(int b)
Definition: abstraction.hpp:482
NodeRef * importOneFromFile(const std::string &fileName)
nptr_t getFetchValidNode() const
NodeRef * memConst(const MemValues &mv)
Definition: abstraction.hpp:491
void exportAllToStream(std::ofstream &out) const
bool areEqual(NodeRef *left, NodeRef *right) const
static int objCnt
Definition: abstraction.hpp:47
assump_collector_t(nptr_vec_t &v)
Definition: abstraction.hpp:304
NodeRef * synthesizeElement(const std::string &name, NodeRef *expr, PyObject *fun)
NodeRef * getFetchValid() const
Definition: abstraction.hpp:503
void extractModelValues(Z3ExprAdapter &c, z3::model &m, py::dict &result)
void useAssump(const nptr_t &a)
bool areEqualAssump(NodeRef *assump, NodeRef *left, NodeRef *right)
const nmap_t & getInps() const
Definition: abstraction.hpp:288
void addHornInstr(const std::string &i, NodeRef *d)
bool areEqualUnrolled(unsigned n, NodeRef *reg, NodeRef *exp)
Definition: abstraction.hpp:600
Definition: abstraction.hpp:34
std::map< std::string, uabstraction_t > uabs_map_t
Definition: abstraction.hpp:44
bool areEqual(NodeRef *left, NodeRef *right) const
Definition: abstraction.hpp:590
NodeRef * addReg(const std::string &name, int width)
Definition: abstraction.hpp:34
NodeRef * bvConstInt(unsigned int l, int width)
Definition: abstraction.hpp:467
CVerifGen * generateCBMCC(bool hier) const
void generateVerilogModule(const std::string &fileName, const std::string &modName) const
Definition: abstraction.hpp:552
void setUpdateToFunction(CppSimGen *gen, CppFun *fun, nptr_t valid, bool doHier=false) const
void importAllFromFile(const std::string &fileName)
const nptr_vec_t & getDecodeNodes() const
NodeRef * addInp(const std::string &name, int width)
void generateSimToDir(const std::string &dirName) const
Definition: abstraction.hpp:577
Definition: abstraction.hpp:34
VlgExportConfig vlgExpConfig
Definition: abstraction.hpp:94
NodeRef * getBit(const std::string &name)
std::vector< nptr_t > nptr_vec_t
Definition: node.hpp:27
NodeRef * importOneFromFile(const std::string &fileName)
Definition: abstraction.hpp:558
Definition: boogie.hpp:23
NodeRef * getInit(const std::string &name) const
nmap_t inps
Definition: abstraction.hpp:61
bool bmcInit(NodeRef *assertion, unsigned n, bool init)
Definition: abstraction.hpp:603
static MicroUnroller * NewUnroller(AbstractionWrapper *Abs, AbstractionWrapper *Uabs, bool InitCond)
void generateSimToDir(const std::string &dirName) const
abstraction_ptr_t abs
Definition: abstraction.hpp:370
NodeRef * getMem(const std::string &name)
Definition: abstraction.hpp:418
static bool EQcheckSimple(Abstraction *a1, Abstraction *a2)
void addHornChild(const std::string &c, const std::string &i, NodeRef *d)
int getReduceWhenImport() const
Definition: abstraction.hpp:694
AbstractionWrapper * getUAbs(const std::string &name)
Definition: abstraction.hpp:450
NodeRef * getInp(const std::string &name)
Definition: abstraction.hpp:409
Definition: abstraction.hpp:34
nptr_t _synthesize(const std::string &name, const nptr_vec_t &assumps, const nptr_t &expr, PyObject *pyfun)
std::map< std::string, npair_t > nmap_t
Definition: node.hpp:53
nptr_t getFetchValidRef() const
Definition: abstraction.hpp:310
Definition: abstraction.hpp:31
void hornifyBvAsInt(bool bvAsInt)
Definition: abstraction.hpp:671
Definition: funcReduct.hpp:13
AbstractionWrapper * getUAbs(const std::string &name)
const nmap_t & getInps() const
Definition: abstraction.hpp:703
void hornifyNode(NodeRef *node, const std::string &rule)
Definition: abstraction.hpp:657
nmap_t bits
Definition: abstraction.hpp:65
AbstractionWrapper(const std::string &name)
Definition: abstraction.hpp:373
Definition: genCBMC.hpp:130
void setNext(const std::string &name, NodeRef *n)
NodeRef * synthesizeElement(const std::string &name, NodeRef *expr, PyObject *fun)
Definition: abstraction.hpp:529
static NodeRef * boolConstB(bool b)
NodeRef * getNext(const std::string &name) const
void exportOneToFile(NodeRef *node, const std::string &fileName) const
Definition: abstraction.hpp:535
void addAssumption(NodeRef *expr)
Definition: abstraction.hpp:515
void setFetchValid(NodeRef *expr)
Definition: abstraction.hpp:506
void toBoogie(const std::string &name)
Definition: abstraction.hpp:653
void generateSimToFile(const std::string &fileName) const
NodeRef * getBit(const std::string &name)
Definition: abstraction.hpp:412
void initMap(nmap_t &from_m, nmap_t &to_m)
nptr_t fetchValid
Definition: abstraction.hpp:73
boost::shared_ptr< Node > nptr_t
Definition: node.hpp:24
void synthesizeReg(const std::string &name, PyObject *fun)
Definition: abstraction.hpp:524
NodeRef * getStage(const std::string &name)
static bool EQcheckSimple(AbstractionWrapper *a1, AbstractionWrapper *a2)
Definition: abstraction.hpp:620
Definition: synthesizer.hpp:156
nmap_t::const_iterator findInMapNoExcept(const std::string &name) const
const nmap_t & getFuns() const
Definition: abstraction.hpp:709
static NodeRef * memConst(const MemValues &mv)
py::list importListFromFile(const std::string &fileName)
NodeRef * getReg(const std::string &name)
NodeRef * getNext(const std::string &name) const
Definition: abstraction.hpp:438
NodeRef * boolConstL(py::long_ b)
Definition: abstraction.hpp:485
std::string getName() const
Definition: abstraction.hpp:698
static void EqOffline(const std::string &fileName, MicroUnroller *m1, MicroUnroller *m2, const std::string &n1, const std::string &n2)
NodeRef * getFetchExpr() const
Definition: abstraction.hpp:497
void hornifyAll(const std::string &name)
Definition: abstraction.hpp:655
friend unsigned DetermineUnrollBound(Abstraction *pAbs, const std::string &nodeName)
static NodeRef * boolConstL(py::long_ b)
Definition: cppsimgen.hpp:77
~AbstractionWrapper()
Definition: abstraction.hpp:383
NodeRef * getMem(const std::string &name)
void setIpred(const std::string &name, NodeRef *n)
AbstractionWrapper(Abstraction *parent, const std::string &name)
Definition: abstraction.hpp:376
static void EQcheckExport(const std::string &fn, MicroUnroller *m1, MicroUnroller *m2, const std::string &n1, const std::string &n2)
Definition: abstraction.hpp:631
bool doesNextExist(const nmap_t &m) const
NodeRef * bvConstLong(py::long_ l, int width)
Definition: abstraction.hpp:459
void generateVerilogToFile(const std::string &fileName) const
Definition: abstraction.hpp:549
NodeRef * getFun(const std::string &name)
Definition: abstraction.hpp:421
NodeRef * getFun(const std::string &name)
const std::string name
Definition: abstraction.hpp:55
state_t
Definition: abstraction.hpp:34
Definition: memvalues.hpp:20
static bool EQcheckWithAssump(MicroUnroller *m1, MicroUnroller *m2, const std::string &n1, const std::string &n2, py::list &assumps)
Definition: abstraction.hpp:637
void addHornNext(const std::string &i, const std::string &s, NodeRef *n)
Definition: abstraction.hpp:677
nptr_vec_t & vec
Definition: abstraction.hpp:303
NodeRef * getFetchExpr() const
static NodeRef * bvConstIntStatic(unsigned int l, int width)
Definition: abstraction.hpp:470
Definition: abstraction.hpp:21
void exportAllToFile(const std::string &fileName) const
nmap_t::const_iterator findInMap(const std::string &name) const
bool checkAndInsertName(state_t st, const std::string &name)
static void EQcheckWithAssumpExport(const std::string &fn, MicroUnroller *m1, MicroUnroller *m2, const std::string &n1, const std::string &n2, py::list &assumps)
Definition: abstraction.hpp:642
NodeRef * addFun(const std::string &name, int retW, const py::list &l)
Definition: abstraction.hpp:404
NodeRef * getNextI(const std::string &name, int i) const
void hornifyNode(NodeRef *node, const std::string &ruleName)
void exportHornToFile(const std::string &fileName)
Definition: abstraction.hpp:665
py::list getAllAssumptions() const
Definition: abstraction.hpp:518
void importAllFromFile(const std::string &fileName)
Definition: abstraction.hpp:568
void synthesizeReg(const std::string &name, PyObject *fun)
int MAX_SYN_ITER
Definition: abstraction.hpp:48
NodeRef * getInit(const std::string &name) const
Definition: abstraction.hpp:426
py::list getAllAssumptions() const
nptr_vec_t getDecodeExprs() const
Definition: abstraction.hpp:311
NodeRef * getVar(const nmap_t &m, const std::string &name)
void generateVerilogToFile(const std::string &fileName) const
void hornifyIteAsNode(bool iteAsNode)
void connectUInst(const std::string &name, const AbstractionWrapper *uabs)
Definition: abstraction.hpp:454
void connectUInst(const std::string &name, const abstraction_ptr_t &uabs)
bool areEqualUnrolled(unsigned n, NodeRef *reg, NodeRef *exp)
void toBoogie(const std::string &filename)
const std::string & getName() const
Definition: abstraction.hpp:106
Abstraction(const std::string &name)
void setFetchValid(NodeRef *expr)
bool areEqualAssump(NodeRef *assump, NodeRef *left, NodeRef *right)
Definition: abstraction.hpp:595
void hornifyBvAsInt(bool bvAsInt)
const nmap_t & getMems() const
Definition: abstraction.hpp:701
NodeRef * addBit(const std::string &name)
Definition: abstraction.hpp:391
void addVar(state_t st, nmap_t &m, nptr_t &n)
std::map< std::string, state_t > names
Definition: abstraction.hpp:58
void generateSimToFile(const std::string &fileName) const
Definition: abstraction.hpp:573
const nmap_t & getMems() const
Definition: abstraction.hpp:286
static NodeRef * boolConstLStatic(py::long_ b)
Definition: abstraction.hpp:486
void exportListToFile(const py::list &l, const std::string &fileName) const
AbstractionWrapper(const abstraction_ptr_t &a)
Definition: abstraction.hpp:380
nptr_vec_t assumps
Definition: abstraction.hpp:79
void addAssumption(NodeRef *expr)
NodeRef * boolConstB(bool b)
Definition: abstraction.hpp:475
nptr_t getFetchExprRef() const
Definition: abstraction.hpp:309
static NodeRef * bvConstLongStatic(py::long_ l, int width)
Definition: abstraction.hpp:462
void setInit(const std::string &name, NodeRef *n)
Definition: abstraction.hpp:424
Definition: abstraction.hpp:34
abstraction_ptr_t abs
Definition: abstraction.hpp:40
void generateHornMapping(const std::string &type)
void importAllFromStream(std::ifstream &in, bool Clear)
void synthesizeAll(PyObject *fun)
Definition: abstraction.hpp:521
void exportHornToFile(const std::string &fileName)
virtual void useAssump(const nptr_t &a)=0
NodeRef * getNextI(const std::string &name, int i) const
Definition: abstraction.hpp:441
NodeRef * addMem(const std::string &name, int addrW, int dataW)
void setReduceWhenImport(int en)
Definition: abstraction.hpp:696
Definition: abstraction.hpp:369
void hornifyAll(const std::string &fileName)
nmap_t funs
Definition: abstraction.hpp:69
void addHornInstr(const std::string &i, NodeRef *d)
Definition: abstraction.hpp:673
nptr_t fetchExpr
Definition: abstraction.hpp:72
static bool bmc(unsigned n1, AbstractionWrapper *a1, NodeRef *r1, unsigned n2, AbstractionWrapper *a2, NodeRef *r2)
Definition: abstraction.hpp:612
NodeRef * addReg(const std::string &name, int width)
Definition: abstraction.hpp:394
Definition: cppsimgen.hpp:113
void exportOneToFile(NodeRef *node, const std::string &fileName) const
const nmap_t & getBits() const
Definition: abstraction.hpp:292
const nmap_t & getRegs() const
Definition: abstraction.hpp:290
HornTranslator * _ht
Definition: abstraction.hpp:354
Definition: abstraction.hpp:36
static NodeRef * boolConstI(int b)
const nmap_t & getRegs() const
Definition: abstraction.hpp:705
nmap_t::const_iterator MapEnd() const
py::list importListFromFile(const std::string &fileName)
Definition: abstraction.hpp:563
void addVarToSimulator(CppSimGen *gen) const
void generateCbmcCtoDir(const std::string &dirName) const
py::list getDecodeExpressions() const
Definition: abstraction.hpp:512
NodeRef * getIpred(const std::string &name) const
bool bmcCond(NodeRef *assertion, unsigned n, NodeRef *assumpt)
Definition: abstraction.hpp:607
MicroUnroller * newUnroller(AbstractionWrapper *uILA, bool initCondition)
Definition: abstraction.hpp:649
void hornifyIteAsNode(bool iteAsNode)
Definition: abstraction.hpp:669
void setFetchExpr(NodeRef *expr)
nmap_t regs
Definition: abstraction.hpp:63
static NodeRef * memConstStatic(const MemValues &mv)
Definition: abstraction.hpp:492
NodeRef * getFetchValid() const
py::list getDecodeExpressions() const
void generateCbmcCtoDir(const std::string &dirName) const
Definition: abstraction.hpp:585
boost::shared_ptr< Abstraction > abstraction_ptr_t
Definition: abstraction.hpp:24
NodeRef * addBit(const std::string &name)
const nmap_t & getFuns() const
Definition: abstraction.hpp:294
FuncReduction funcReducer
Definition: abstraction.hpp:352
static bool bmc(unsigned n, Abstraction *a, NodeRef *r, bool init, NodeRef *initAssump)
AbstractionWrapper * addUAbs(const std::string &name, NodeRef *valid)
uabs_map_t uabs
Definition: abstraction.hpp:82
void generateCbmcCtoFile(const std::string &fileName) const
NodeRef * getIpred(const std::string &name) const
Definition: abstraction.hpp:431
AbstractionWrapper * addUAbs(const std::string &name, NodeRef *valid)
Definition: abstraction.hpp:446
NodeRef * getReg(const std::string &name)
Definition: abstraction.hpp:415
void setIpred(const std::string &name, NodeRef *n)
Definition: abstraction.hpp:429
void setDecodeExpressions(const py::list &l)
const npair_t * getMapEntry(const std::string &name) const
int reduceWhenImport
Definition: abstraction.hpp:93
static bool EQcheck(MicroUnroller *m1, MicroUnroller *m2, const std::string &n1, const std::string &n2)
Definition: abstraction.hpp:627
Abstraction * parent
Definition: abstraction.hpp:52
nmap_t * getMap(const std::string &name, NodeRef *n)
static NodeRef * bvConstInt(unsigned int l, int width)
void setInit(const std::string &name, NodeRef *n)
nptr_t valid
Definition: abstraction.hpp:38
NodeRef * addFun(const std::string &name, int retW, const py::list &l)
Definition: MicroUnroller.hpp:22
int getEnParamSyn() const
Definition: abstraction.hpp:685
NodeRef * addMem(const std::string &name, int addrW, int dataW)
Definition: abstraction.hpp:399
static NodeRef * bvConstLong(py::long_ l, int width)