├── src ├── io │ ├── .depend.mak │ ├── Makefile │ ├── .extheader.mak │ ├── v3NtkParser.h │ └── v3NtkWriter.h ├── alg │ ├── .depend.mak │ ├── Makefile │ ├── v3AlgCmd.h │ ├── v3AlgSim.h │ ├── .extheader.mak │ └── v3AlgType.h ├── dfx │ ├── .depend.mak │ ├── Makefile │ ├── .extheader.mak │ ├── v3DfxCmd.h │ ├── v3DfxSimplify.h │ └── v3DfxTrace.h ├── ext │ ├── .depend.mak │ ├── Makefile │ ├── .extheader.mak │ ├── v3ExtUtil.h │ ├── v3ExtType.h │ ├── v3LTLFormula.h │ ├── v3Formula.h │ ├── v3NtkElaborate.h │ ├── v3Property.cpp │ └── v3LTLFormula.cpp ├── main │ ├── .depend.mak │ ├── .extheader.mak │ ├── Makefile │ └── main.cpp ├── stg │ ├── .depend.mak │ ├── Makefile │ ├── .extheader.mak │ ├── v3StgCmd.h │ └── v3StgSDG.h ├── svr │ ├── .depend.mak │ ├── Makefile │ ├── v3SvrHandler.h │ ├── .extheader.mak │ ├── v3SvrType.h │ ├── v3SvrHandler.cpp │ ├── v3SvrBoolector.h │ └── v3SvrMiniSat.h ├── v3mc │ ├── .depend.mak │ ├── Makefile │ ├── .extheader.mak │ ├── v3MCCmd.h │ ├── v3MCEngine.h │ └── v3MCReport.cpp ├── eng │ ├── minisat │ ├── quteRTL │ └── boolector ├── util │ ├── .depend.mak │ ├── Makefile │ ├── v3IntType.h │ ├── v3StrUtil.h │ ├── .extheader.mak │ ├── v3HashUtil.h │ ├── v3NumUtil.h │ ├── v3FileUtil.h │ ├── v3Msg.h │ └── v3StrUtil.cpp ├── adt │ ├── .depend.mak │ ├── Makefile │ ├── v3List.h │ ├── v3Vec.h │ ├── v3Queue.h │ ├── v3Stack.h │ ├── v3Set.h │ ├── v3Map.h │ ├── .extheader.mak │ ├── v3Hash.h │ └── v3Misc.h ├── cmd │ ├── Makefile │ ├── .depend.mak │ ├── .extheader.mak │ └── v3CmdComm.h ├── trans │ ├── Makefile │ ├── v3TransCmd.h │ ├── v3NtkMiter.h │ ├── .extheader.mak │ ├── v3NtkFlatten.h │ ├── v3NtkExpand.h │ ├── v3BvBlastBv.h │ ├── v3BvBlastAig.h │ └── .depend.mak ├── Makefile.lib ├── ntk │ ├── Makefile │ ├── v3NtkSimplify.h │ ├── v3NtkInput.h │ ├── .extheader.mak │ ├── v3NtkCmd.h │ ├── v3NtkHash.h │ ├── v3NtkStrash.h │ ├── v3NtkSimplify.cpp │ ├── v3NtkRewrite.h │ ├── v3NtkInput.cpp │ ├── v3Type.h │ └── v3NtkUtil.h ├── vrf │ ├── Makefile │ ├── v3VrfSIM.h │ ├── v3VrfBMC.h │ ├── v3VrfCmd.h │ ├── v3VrfResult.h │ ├── .extheader.mak │ ├── v3VrfKLive.h │ ├── v3VrfUMC.h │ ├── v3VrfSEC.h │ └── v3VrfShared.h └── Makefile.in ├── lib └── .makeitnonempty ├── include ├── v3Map.h ├── v3Ntk.h ├── v3Set.h ├── v3Vec.h ├── Alg.h ├── Map.h ├── Rnd.h ├── Vec.h ├── v3Graph.h ├── v3Hash.h ├── v3List.h ├── v3MCCmd.h ├── v3Misc.h ├── v3Msg.h ├── v3Queue.h ├── v3Stack.h ├── v3Type.h ├── v3Usage.h ├── Alloc.h ├── Dimacs.h ├── Heap.h ├── IntMap.h ├── Makefile ├── Queue.h ├── Solver.h ├── Sort.h ├── System.h ├── XAlloc.h ├── v3AlgCmd.h ├── v3AlgSim.h ├── v3AlgType.h ├── v3BitVec.h ├── v3Bucket.h ├── v3CmdComm.h ├── v3CmdMgr.h ├── v3DfxCmd.h ├── v3DfxTrace.h ├── v3ExtType.h ├── v3ExtUtil.h ├── v3Formula.h ├── v3IntType.h ├── v3MCMain.h ├── v3NtkCmd.h ├── v3NtkHash.h ├── v3NtkInput.h ├── v3NtkUtil.h ├── v3NumUtil.h ├── v3Property.h ├── v3StgCmd.h ├── v3StgFSM.h ├── v3StgSDG.h ├── v3StrUtil.h ├── v3SvrBase.h ├── v3SvrType.h ├── v3VrfBMC.h ├── v3VrfBase.h ├── v3VrfCITP.h ├── v3VrfCmd.h ├── v3VrfFITP.h ├── v3VrfIPDR.h ├── v3VrfKLive.h ├── v3VrfMPDR.h ├── v3VrfSEC.h ├── v3VrfSIM.h ├── v3VrfUMC.h ├── IntTypes.h ├── Options.h ├── quteRTL.h ├── v3BvBlastBv.h ├── v3FileUtil.h ├── v3HashUtil.h ├── v3LTLFormula.h ├── v3MCEngine.h ├── v3NtkExpand.h ├── v3NtkHandler.h ├── v3NtkMiter.h ├── v3NtkParser.h ├── v3NtkRewrite.h ├── v3NtkStrash.h ├── v3NtkWriter.h ├── v3StgExtract.h ├── v3SvrHandler.h ├── v3SvrMiniSat.h ├── v3TransCmd.h ├── v3VrfResult.h ├── v3VrfShared.h ├── ParseUtils.h ├── SolverTypes.h ├── boolector.h ├── v3AlgGeneralize.h ├── v3AlgSimulate.h ├── v3BvBlastAig.h ├── v3DfxSimplify.h ├── v3NtkElaborate.h ├── v3NtkFlatten.h ├── v3NtkSimplify.h ├── v3SvrBoolector.h ├── v3SvrSatHelper.h └── v3BvBlastAigHelper.h ├── design ├── alu │ ├── clean.sh │ ├── alu.aig │ ├── run.sh │ ├── rtl.dofile │ ├── aiger.dofile │ ├── btor.dofile │ ├── alu.btor │ └── alu.v ├── quteTK6280 │ ├── clean.sh │ ├── quteTK6280.aig │ └── run.sh ├── philosopher │ ├── clean.sh │ ├── run.sh │ ├── aiger.dofile │ ├── rtl.dofile │ └── philosopher.v ├── traffic │ ├── clean.sh │ ├── run.sh │ ├── settings.dofile │ ├── aiger.dofile │ ├── rtl.dofile │ └── traffic.v └── vending │ ├── clean.sh │ ├── run.sh │ ├── rtl.dofile │ └── aiger.dofile ├── doc ├── manual.pdf └── tutorials.pdf ├── img └── v3Logo.png ├── engine ├── quteRTL-V3-1.2.tar.gz ├── quteRTL.script ├── boolector.script ├── minisat.script └── minisat.mk ├── INSTALL ├── COPYING └── Makefile /src/io/.depend.mak: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/.makeitnonempty: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/alg/.depend.mak: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/dfx/.depend.mak: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/ext/.depend.mak: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/main/.depend.mak: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/stg/.depend.mak: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/svr/.depend.mak: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/v3mc/.depend.mak: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /include/v3Map.h: -------------------------------------------------------------------------------- 1 | ../src/adt/v3Map.h -------------------------------------------------------------------------------- /include/v3Ntk.h: -------------------------------------------------------------------------------- 1 | ../src/ntk/v3Ntk.h -------------------------------------------------------------------------------- /include/v3Set.h: -------------------------------------------------------------------------------- 1 | ../src/adt/v3Set.h -------------------------------------------------------------------------------- /include/v3Vec.h: -------------------------------------------------------------------------------- 1 | ../src/adt/v3Vec.h -------------------------------------------------------------------------------- /src/main/.extheader.mak: -------------------------------------------------------------------------------- 1 | .d: 2 | -------------------------------------------------------------------------------- /include/Alg.h: -------------------------------------------------------------------------------- 1 | ../src/eng/minisat/Alg.h -------------------------------------------------------------------------------- /include/Map.h: -------------------------------------------------------------------------------- 1 | ../src/eng/minisat/Map.h -------------------------------------------------------------------------------- /include/Rnd.h: -------------------------------------------------------------------------------- 1 | ../src/eng/minisat/Rnd.h -------------------------------------------------------------------------------- /include/Vec.h: -------------------------------------------------------------------------------- 1 | ../src/eng/minisat/Vec.h -------------------------------------------------------------------------------- /include/v3Graph.h: -------------------------------------------------------------------------------- 1 | ../src/adt/v3Graph.h -------------------------------------------------------------------------------- /include/v3Hash.h: -------------------------------------------------------------------------------- 1 | ../src/adt/v3Hash.h -------------------------------------------------------------------------------- /include/v3List.h: -------------------------------------------------------------------------------- 1 | ../src/adt/v3List.h -------------------------------------------------------------------------------- /include/v3MCCmd.h: -------------------------------------------------------------------------------- 1 | ../src/v3mc/v3MCCmd.h -------------------------------------------------------------------------------- /include/v3Misc.h: -------------------------------------------------------------------------------- 1 | ../src/adt/v3Misc.h -------------------------------------------------------------------------------- /include/v3Msg.h: -------------------------------------------------------------------------------- 1 | ../src/util/v3Msg.h -------------------------------------------------------------------------------- /include/v3Queue.h: -------------------------------------------------------------------------------- 1 | ../src/adt/v3Queue.h -------------------------------------------------------------------------------- /include/v3Stack.h: -------------------------------------------------------------------------------- 1 | ../src/adt/v3Stack.h -------------------------------------------------------------------------------- /include/v3Type.h: -------------------------------------------------------------------------------- 1 | ../src/ntk/v3Type.h -------------------------------------------------------------------------------- /include/v3Usage.h: -------------------------------------------------------------------------------- 1 | ../src/util/v3Usage.h -------------------------------------------------------------------------------- /include/Alloc.h: -------------------------------------------------------------------------------- 1 | ../src/eng/minisat/Alloc.h -------------------------------------------------------------------------------- /include/Dimacs.h: -------------------------------------------------------------------------------- 1 | ../src/eng/minisat/Dimacs.h -------------------------------------------------------------------------------- /include/Heap.h: -------------------------------------------------------------------------------- 1 | ../src/eng/minisat/Heap.h -------------------------------------------------------------------------------- /include/IntMap.h: -------------------------------------------------------------------------------- 1 | ../src/eng/minisat/IntMap.h -------------------------------------------------------------------------------- /include/Makefile: -------------------------------------------------------------------------------- 1 | ../src/eng/minisat/Makefile -------------------------------------------------------------------------------- /include/Queue.h: -------------------------------------------------------------------------------- 1 | ../src/eng/minisat/Queue.h -------------------------------------------------------------------------------- /include/Solver.h: -------------------------------------------------------------------------------- 1 | ../src/eng/minisat/Solver.h -------------------------------------------------------------------------------- /include/Sort.h: -------------------------------------------------------------------------------- 1 | ../src/eng/minisat/Sort.h -------------------------------------------------------------------------------- /include/System.h: -------------------------------------------------------------------------------- 1 | ../src/eng/minisat/System.h -------------------------------------------------------------------------------- /include/XAlloc.h: -------------------------------------------------------------------------------- 1 | ../src/eng/minisat/XAlloc.h -------------------------------------------------------------------------------- /include/v3AlgCmd.h: -------------------------------------------------------------------------------- 1 | ../src/alg/v3AlgCmd.h -------------------------------------------------------------------------------- /include/v3AlgSim.h: -------------------------------------------------------------------------------- 1 | ../src/alg/v3AlgSim.h -------------------------------------------------------------------------------- /include/v3AlgType.h: -------------------------------------------------------------------------------- 1 | ../src/alg/v3AlgType.h -------------------------------------------------------------------------------- /include/v3BitVec.h: -------------------------------------------------------------------------------- 1 | ../src/adt/v3BitVec.h -------------------------------------------------------------------------------- /include/v3Bucket.h: -------------------------------------------------------------------------------- 1 | ../src/adt/v3Bucket.h -------------------------------------------------------------------------------- /include/v3CmdComm.h: -------------------------------------------------------------------------------- 1 | ../src/cmd/v3CmdComm.h -------------------------------------------------------------------------------- /include/v3CmdMgr.h: -------------------------------------------------------------------------------- 1 | ../src/cmd/v3CmdMgr.h -------------------------------------------------------------------------------- /include/v3DfxCmd.h: -------------------------------------------------------------------------------- 1 | ../src/dfx/v3DfxCmd.h -------------------------------------------------------------------------------- /include/v3DfxTrace.h: -------------------------------------------------------------------------------- 1 | ../src/dfx/v3DfxTrace.h -------------------------------------------------------------------------------- /include/v3ExtType.h: -------------------------------------------------------------------------------- 1 | ../src/ext/v3ExtType.h -------------------------------------------------------------------------------- /include/v3ExtUtil.h: -------------------------------------------------------------------------------- 1 | ../src/ext/v3ExtUtil.h -------------------------------------------------------------------------------- /include/v3Formula.h: -------------------------------------------------------------------------------- 1 | ../src/ext/v3Formula.h -------------------------------------------------------------------------------- /include/v3IntType.h: -------------------------------------------------------------------------------- 1 | ../src/util/v3IntType.h -------------------------------------------------------------------------------- /include/v3MCMain.h: -------------------------------------------------------------------------------- 1 | ../src/v3mc/v3MCMain.h -------------------------------------------------------------------------------- /include/v3NtkCmd.h: -------------------------------------------------------------------------------- 1 | ../src/ntk/v3NtkCmd.h -------------------------------------------------------------------------------- /include/v3NtkHash.h: -------------------------------------------------------------------------------- 1 | ../src/ntk/v3NtkHash.h -------------------------------------------------------------------------------- /include/v3NtkInput.h: -------------------------------------------------------------------------------- 1 | ../src/ntk/v3NtkInput.h -------------------------------------------------------------------------------- /include/v3NtkUtil.h: -------------------------------------------------------------------------------- 1 | ../src/ntk/v3NtkUtil.h -------------------------------------------------------------------------------- /include/v3NumUtil.h: -------------------------------------------------------------------------------- 1 | ../src/util/v3NumUtil.h -------------------------------------------------------------------------------- /include/v3Property.h: -------------------------------------------------------------------------------- 1 | ../src/ext/v3Property.h -------------------------------------------------------------------------------- /include/v3StgCmd.h: -------------------------------------------------------------------------------- 1 | ../src/stg/v3StgCmd.h -------------------------------------------------------------------------------- /include/v3StgFSM.h: -------------------------------------------------------------------------------- 1 | ../src/stg/v3StgFSM.h -------------------------------------------------------------------------------- /include/v3StgSDG.h: -------------------------------------------------------------------------------- 1 | ../src/stg/v3StgSDG.h -------------------------------------------------------------------------------- /include/v3StrUtil.h: -------------------------------------------------------------------------------- 1 | ../src/util/v3StrUtil.h -------------------------------------------------------------------------------- /include/v3SvrBase.h: -------------------------------------------------------------------------------- 1 | ../src/svr/v3SvrBase.h -------------------------------------------------------------------------------- /include/v3SvrType.h: -------------------------------------------------------------------------------- 1 | ../src/svr/v3SvrType.h -------------------------------------------------------------------------------- /include/v3VrfBMC.h: -------------------------------------------------------------------------------- 1 | ../src/vrf/v3VrfBMC.h -------------------------------------------------------------------------------- /include/v3VrfBase.h: -------------------------------------------------------------------------------- 1 | ../src/vrf/v3VrfBase.h -------------------------------------------------------------------------------- /include/v3VrfCITP.h: -------------------------------------------------------------------------------- 1 | ../src/vrf/v3VrfCITP.h -------------------------------------------------------------------------------- /include/v3VrfCmd.h: -------------------------------------------------------------------------------- 1 | ../src/vrf/v3VrfCmd.h -------------------------------------------------------------------------------- /include/v3VrfFITP.h: -------------------------------------------------------------------------------- 1 | ../src/vrf/v3VrfFITP.h -------------------------------------------------------------------------------- /include/v3VrfIPDR.h: -------------------------------------------------------------------------------- 1 | ../src/vrf/v3VrfIPDR.h -------------------------------------------------------------------------------- /include/v3VrfKLive.h: -------------------------------------------------------------------------------- 1 | ../src/vrf/v3VrfKLive.h -------------------------------------------------------------------------------- /include/v3VrfMPDR.h: -------------------------------------------------------------------------------- 1 | ../src/vrf/v3VrfMPDR.h -------------------------------------------------------------------------------- /include/v3VrfSEC.h: -------------------------------------------------------------------------------- 1 | ../src/vrf/v3VrfSEC.h -------------------------------------------------------------------------------- /include/v3VrfSIM.h: -------------------------------------------------------------------------------- 1 | ../src/vrf/v3VrfSIM.h -------------------------------------------------------------------------------- /include/v3VrfUMC.h: -------------------------------------------------------------------------------- 1 | ../src/vrf/v3VrfUMC.h -------------------------------------------------------------------------------- /src/eng/minisat: -------------------------------------------------------------------------------- 1 | ../../engine/minisat/v3_src -------------------------------------------------------------------------------- /src/eng/quteRTL: -------------------------------------------------------------------------------- 1 | ../../engine/quteRTL/v3_src -------------------------------------------------------------------------------- /include/IntTypes.h: -------------------------------------------------------------------------------- 1 | ../src/eng/minisat/IntTypes.h -------------------------------------------------------------------------------- /include/Options.h: -------------------------------------------------------------------------------- 1 | ../src/eng/minisat/Options.h -------------------------------------------------------------------------------- /include/quteRTL.h: -------------------------------------------------------------------------------- 1 | ../src/eng/quteRTL/quteRTL.h -------------------------------------------------------------------------------- /include/v3BvBlastBv.h: -------------------------------------------------------------------------------- 1 | ../src/trans/v3BvBlastBv.h -------------------------------------------------------------------------------- /include/v3FileUtil.h: -------------------------------------------------------------------------------- 1 | ../src/util/v3FileUtil.h -------------------------------------------------------------------------------- /include/v3HashUtil.h: -------------------------------------------------------------------------------- 1 | ../src/util/v3HashUtil.h -------------------------------------------------------------------------------- /include/v3LTLFormula.h: -------------------------------------------------------------------------------- 1 | ../src/ext/v3LTLFormula.h -------------------------------------------------------------------------------- /include/v3MCEngine.h: -------------------------------------------------------------------------------- 1 | ../src/v3mc/v3MCEngine.h -------------------------------------------------------------------------------- /include/v3NtkExpand.h: -------------------------------------------------------------------------------- 1 | ../src/trans/v3NtkExpand.h -------------------------------------------------------------------------------- /include/v3NtkHandler.h: -------------------------------------------------------------------------------- 1 | ../src/ntk/v3NtkHandler.h -------------------------------------------------------------------------------- /include/v3NtkMiter.h: -------------------------------------------------------------------------------- 1 | ../src/trans/v3NtkMiter.h -------------------------------------------------------------------------------- /include/v3NtkParser.h: -------------------------------------------------------------------------------- 1 | ../src/io/v3NtkParser.h -------------------------------------------------------------------------------- /include/v3NtkRewrite.h: -------------------------------------------------------------------------------- 1 | ../src/ntk/v3NtkRewrite.h -------------------------------------------------------------------------------- /include/v3NtkStrash.h: -------------------------------------------------------------------------------- 1 | ../src/ntk/v3NtkStrash.h -------------------------------------------------------------------------------- /include/v3NtkWriter.h: -------------------------------------------------------------------------------- 1 | ../src/io/v3NtkWriter.h -------------------------------------------------------------------------------- /include/v3StgExtract.h: -------------------------------------------------------------------------------- 1 | ../src/stg/v3StgExtract.h -------------------------------------------------------------------------------- /include/v3SvrHandler.h: -------------------------------------------------------------------------------- 1 | ../src/svr/v3SvrHandler.h -------------------------------------------------------------------------------- /include/v3SvrMiniSat.h: -------------------------------------------------------------------------------- 1 | ../src/svr/v3SvrMiniSat.h -------------------------------------------------------------------------------- /include/v3TransCmd.h: -------------------------------------------------------------------------------- 1 | ../src/trans/v3TransCmd.h -------------------------------------------------------------------------------- /include/v3VrfResult.h: -------------------------------------------------------------------------------- 1 | ../src/vrf/v3VrfResult.h -------------------------------------------------------------------------------- /include/v3VrfShared.h: -------------------------------------------------------------------------------- 1 | ../src/vrf/v3VrfShared.h -------------------------------------------------------------------------------- /src/eng/boolector: -------------------------------------------------------------------------------- 1 | ../../engine/boolector/v3_src -------------------------------------------------------------------------------- /include/ParseUtils.h: -------------------------------------------------------------------------------- 1 | ../src/eng/minisat/ParseUtils.h -------------------------------------------------------------------------------- /include/SolverTypes.h: -------------------------------------------------------------------------------- 1 | ../src/eng/minisat/SolverTypes.h -------------------------------------------------------------------------------- /include/boolector.h: -------------------------------------------------------------------------------- 1 | ../src/eng/boolector/boolector.h -------------------------------------------------------------------------------- /include/v3AlgGeneralize.h: -------------------------------------------------------------------------------- 1 | ../src/alg/v3AlgGeneralize.h -------------------------------------------------------------------------------- /include/v3AlgSimulate.h: -------------------------------------------------------------------------------- 1 | ../src/alg/v3AlgSimulate.h -------------------------------------------------------------------------------- /include/v3BvBlastAig.h: -------------------------------------------------------------------------------- 1 | ../src/trans/v3BvBlastAig.h -------------------------------------------------------------------------------- /include/v3DfxSimplify.h: -------------------------------------------------------------------------------- 1 | ../src/dfx/v3DfxSimplify.h -------------------------------------------------------------------------------- /include/v3NtkElaborate.h: -------------------------------------------------------------------------------- 1 | ../src/ext/v3NtkElaborate.h -------------------------------------------------------------------------------- /include/v3NtkFlatten.h: -------------------------------------------------------------------------------- 1 | ../src/trans/v3NtkFlatten.h -------------------------------------------------------------------------------- /include/v3NtkSimplify.h: -------------------------------------------------------------------------------- 1 | ../src/ntk/v3NtkSimplify.h -------------------------------------------------------------------------------- /include/v3SvrBoolector.h: -------------------------------------------------------------------------------- 1 | ../src/svr/v3SvrBoolector.h -------------------------------------------------------------------------------- /include/v3SvrSatHelper.h: -------------------------------------------------------------------------------- 1 | ../src/svr/v3SvrSatHelper.h -------------------------------------------------------------------------------- /include/v3BvBlastAigHelper.h: -------------------------------------------------------------------------------- 1 | ../src/trans/v3BvBlastAigHelper.h -------------------------------------------------------------------------------- /design/alu/clean.sh: -------------------------------------------------------------------------------- 1 | echo "Removing outputs ..." 2 | rm -f v3_* *.result; 3 | -------------------------------------------------------------------------------- /design/quteTK6280/clean.sh: -------------------------------------------------------------------------------- 1 | echo "Removing outputs ..." 2 | rm -f *.result; 3 | -------------------------------------------------------------------------------- /doc/manual.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengyinwu/V3/HEAD/doc/manual.pdf -------------------------------------------------------------------------------- /img/v3Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengyinwu/V3/HEAD/img/v3Logo.png -------------------------------------------------------------------------------- /src/util/.depend.mak: -------------------------------------------------------------------------------- 1 | v3StrUtil.o: v3StrUtil.cpp v3StrUtil.h v3IntType.h 2 | -------------------------------------------------------------------------------- /design/philosopher/clean.sh: -------------------------------------------------------------------------------- 1 | echo "Removing outputs ..." 2 | rm -f *.result; 3 | -------------------------------------------------------------------------------- /doc/tutorials.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengyinwu/V3/HEAD/doc/tutorials.pdf -------------------------------------------------------------------------------- /design/alu/alu.aig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengyinwu/V3/HEAD/design/alu/alu.aig -------------------------------------------------------------------------------- /src/adt/.depend.mak: -------------------------------------------------------------------------------- 1 | v3BitVec.o: v3BitVec.cpp v3BitVec.h ../../include/v3IntType.h 2 | -------------------------------------------------------------------------------- /design/traffic/clean.sh: -------------------------------------------------------------------------------- 1 | echo "Removing outputs ..." 2 | rm -f *.result *.pattern *.vcd; 3 | -------------------------------------------------------------------------------- /design/vending/clean.sh: -------------------------------------------------------------------------------- 1 | echo "Removing outputs ..." 2 | rm -f aiger-vending.v *.result *.output *.vcd; 3 | -------------------------------------------------------------------------------- /engine/quteRTL-V3-1.2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengyinwu/V3/HEAD/engine/quteRTL-V3-1.2.tar.gz -------------------------------------------------------------------------------- /design/quteTK6280/quteTK6280.aig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengyinwu/V3/HEAD/design/quteTK6280/quteTK6280.aig -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | QUICK INSTALL: 2 | cd engine; ./minisat.script; ./boolector.script; ./quteRTL.script; cd ..; make clean; make; 3 | -------------------------------------------------------------------------------- /src/cmd/Makefile: -------------------------------------------------------------------------------- 1 | PKGFLAG = 2 | EXTHDRS = v3CmdComm.h v3CmdMgr.h 3 | 4 | include ../Makefile.in 5 | include ../Makefile.lib 6 | -------------------------------------------------------------------------------- /src/io/Makefile: -------------------------------------------------------------------------------- 1 | PKGFLAG = 2 | EXTHDRS = v3NtkParser.h v3NtkWriter.h 3 | 4 | include ../Makefile.in 5 | include ../Makefile.lib 6 | -------------------------------------------------------------------------------- /src/v3mc/Makefile: -------------------------------------------------------------------------------- 1 | PKGFLAG = 2 | EXTHDRS = v3MCCmd.h v3MCEngine.h v3MCMain.h 3 | 4 | include ../Makefile.in 5 | include ../Makefile.lib 6 | -------------------------------------------------------------------------------- /src/dfx/Makefile: -------------------------------------------------------------------------------- 1 | PKGFLAG = 2 | EXTHDRS = v3DfxCmd.h v3DfxSimplify.h v3DfxTrace.h 3 | 4 | include ../Makefile.in 5 | include ../Makefile.lib 6 | -------------------------------------------------------------------------------- /src/stg/Makefile: -------------------------------------------------------------------------------- 1 | PKGFLAG = 2 | EXTHDRS = v3StgCmd.h v3StgExtract.h v3StgFSM.h v3StgSDG.h 3 | 4 | include ../Makefile.in 5 | include ../Makefile.lib 6 | -------------------------------------------------------------------------------- /src/alg/Makefile: -------------------------------------------------------------------------------- 1 | PKGFLAG = 2 | EXTHDRS = v3AlgCmd.h v3AlgGeneralize.h v3AlgSim.h v3AlgSimulate.h v3AlgType.h 3 | 4 | include ../Makefile.in 5 | include ../Makefile.lib 6 | -------------------------------------------------------------------------------- /src/util/Makefile: -------------------------------------------------------------------------------- 1 | PKGFLAG = 2 | EXTHDRS = v3FileUtil.h v3HashUtil.h v3IntType.h v3Msg.h v3NumUtil.h v3StrUtil.h v3Usage.h 3 | 4 | include ../Makefile.in 5 | include ../Makefile.lib 6 | -------------------------------------------------------------------------------- /src/ext/Makefile: -------------------------------------------------------------------------------- 1 | PKGFLAG = 2 | EXTHDRS = v3ExtType.h v3ExtUtil.h v3Formula.h v3LTLFormula.h v3NtkElaborate.h v3Property.h 3 | 4 | include ../Makefile.in 5 | include ../Makefile.lib 6 | -------------------------------------------------------------------------------- /src/svr/Makefile: -------------------------------------------------------------------------------- 1 | PKGFLAG = 2 | EXTHDRS = v3SvrBase.h v3SvrBoolector.h v3SvrHandler.h v3SvrMiniSat.h v3SvrSatHelper.h v3SvrType.h 3 | 4 | include ../Makefile.in 5 | include ../Makefile.lib 6 | -------------------------------------------------------------------------------- /src/trans/Makefile: -------------------------------------------------------------------------------- 1 | PKGFLAG = 2 | EXTHDRS = v3BvBlastAig.h v3BvBlastAigHelper.h v3BvBlastBv.h v3NtkExpand.h v3NtkFlatten.h v3NtkMiter.h v3TransCmd.h 3 | 4 | include ../Makefile.in 5 | include ../Makefile.lib 6 | -------------------------------------------------------------------------------- /src/adt/Makefile: -------------------------------------------------------------------------------- 1 | PKGFLAG = 2 | EXTHDRS = v3BitVec.h v3Graph.h v3Hash.h v3Map.h v3Queue.h v3Stack.h v3Bucket.h v3List.h v3Misc.h v3Set.h v3Vec.h 3 | 4 | include ../Makefile.in 5 | include ../Makefile.lib 6 | -------------------------------------------------------------------------------- /src/Makefile.lib: -------------------------------------------------------------------------------- 1 | LIBNAME = lib$(PKGNAME).a 2 | TARGET = $(LIBDIR)/$(LIBNAME) 3 | 4 | target: $(TARGET) 5 | 6 | $(TARGET): $(COBJS) 7 | @echo "Building $(LIBNAME)..." 8 | @$(AR) $@ $(COBJS) 9 | @touch $(LIBDEP) 10 | -------------------------------------------------------------------------------- /src/ntk/Makefile: -------------------------------------------------------------------------------- 1 | PKGFLAG = 2 | EXTHDRS = v3NtkCmd.h v3NtkHandler.h v3NtkInput.h v3NtkSimplify.h v3NtkUtil.h v3Ntk.h v3NtkHash.h v3NtkRewrite.h v3NtkStrash.h v3Type.h 3 | 4 | 5 | include ../Makefile.in 6 | include ../Makefile.lib 7 | -------------------------------------------------------------------------------- /src/vrf/Makefile: -------------------------------------------------------------------------------- 1 | PKGFLAG = 2 | EXTHDRS = v3VrfBase.h v3VrfCmd.h v3VrfIPDR.h v3VrfMPDR.h v3VrfKLive.h v3VrfSIM.h v3VrfCITP.h v3VrfFITP.h v3VrfResult.h v3VrfSEC.h v3VrfUMC.h v3VrfBMC.h v3VrfShared.h 3 | 4 | include ../Makefile.in 5 | include ../Makefile.lib 6 | -------------------------------------------------------------------------------- /src/cmd/.depend.mak: -------------------------------------------------------------------------------- 1 | v3CmdComm.o: v3CmdComm.cpp ../../include/v3StrUtil.h \ 2 | ../../include/v3IntType.h ../../include/v3Usage.h ../../include/v3Msg.h \ 3 | ../../include/v3Msg.h v3CmdComm.h v3CmdMgr.h 4 | v3CmdMgr.o: v3CmdMgr.cpp ../../include/v3StrUtil.h \ 5 | ../../include/v3IntType.h v3CmdMgr.h ../../include/v3Msg.h 6 | -------------------------------------------------------------------------------- /design/philosopher/run.sh: -------------------------------------------------------------------------------- 1 | echo "Running aiger.dofile ..." 2 | if [ "$1" == "-stdout" ]; then 3 | ../../v3 -f aiger.dofile 4 | else 5 | ../../v3 -f aiger.dofile > aiger.result 6 | fi 7 | 8 | echo "Running rtl.dofile ..." 9 | if [ "$1" == "-stdout" ]; then 10 | ../../v3 -f rtl.dofile 11 | else 12 | ../../v3 -f rtl.dofile > rtl.result 13 | fi 14 | -------------------------------------------------------------------------------- /design/vending/run.sh: -------------------------------------------------------------------------------- 1 | echo "Running aiger.dofile ..." 2 | if [ "$1" == "-stdout" ]; then 3 | ../../v3 -f aiger.dofile 4 | else 5 | ../../v3 -f aiger.dofile > aiger.result 6 | fi 7 | 8 | echo "Running rtl.dofile ..." 9 | if [ "$1" == "-stdout" ]; then 10 | ../../v3 -f rtl.dofile 11 | else 12 | ../../v3 -f rtl.dofile > rtl.result 13 | fi 14 | -------------------------------------------------------------------------------- /src/cmd/.extheader.mak: -------------------------------------------------------------------------------- 1 | cmd.d: ../../include/v3CmdComm.h ../../include/v3CmdMgr.h 2 | ../../include/v3CmdComm.h: v3CmdComm.h 3 | @rm -f ../../include/v3CmdComm.h 4 | @ln -fs ../src/cmd/v3CmdComm.h ../../include/v3CmdComm.h 5 | ../../include/v3CmdMgr.h: v3CmdMgr.h 6 | @rm -f ../../include/v3CmdMgr.h 7 | @ln -fs ../src/cmd/v3CmdMgr.h ../../include/v3CmdMgr.h 8 | -------------------------------------------------------------------------------- /design/quteTK6280/run.sh: -------------------------------------------------------------------------------- 1 | echo "Running aiger.dofile ..." 2 | if [ "$1" == "-stdout" ]; then 3 | ../../v3 -f aiger.dofile 4 | else 5 | ../../v3 -f aiger.dofile > aiger.result 6 | fi 7 | 8 | echo "Running btor.dofile ..." 9 | if [ "$1" == "-stdout" ]; then 10 | ../../v3 -f btor.dofile 11 | else 12 | ../../v3 -f btor.dofile > btor.result 13 | fi 14 | -------------------------------------------------------------------------------- /src/io/.extheader.mak: -------------------------------------------------------------------------------- 1 | io.d: ../../include/v3NtkParser.h ../../include/v3NtkWriter.h 2 | ../../include/v3NtkParser.h: v3NtkParser.h 3 | @rm -f ../../include/v3NtkParser.h 4 | @ln -fs ../src/io/v3NtkParser.h ../../include/v3NtkParser.h 5 | ../../include/v3NtkWriter.h: v3NtkWriter.h 6 | @rm -f ../../include/v3NtkWriter.h 7 | @ln -fs ../src/io/v3NtkWriter.h ../../include/v3NtkWriter.h 8 | -------------------------------------------------------------------------------- /src/main/Makefile: -------------------------------------------------------------------------------- 1 | PKGFLAG = 2 | EXTHDRS = 3 | 4 | include ../Makefile.in 5 | 6 | TARGET = ../../$(EXEC) 7 | 8 | target: $(TARGET) 9 | 10 | $(TARGET): $(COBJS) $(LIBDEP) 11 | @echo "> building $(EXEC)..." 12 | @$(CC) $(CFLAGS) -I$(INCDIR) $(COBJS) -L$(LIBDIR) $(EXTLIB) -static -lpthread -o $@ 13 | # @$(CC) $(CFLAGS) -I$(INCDIR) $(COBJS) -L$(LIBDIR) $(EXTLIB) -lpthread -o $@ 14 | -------------------------------------------------------------------------------- /design/alu/run.sh: -------------------------------------------------------------------------------- 1 | echo "Running aiger.dofile ..." 2 | if [ "$1" == "-stdout" ]; then 3 | ../../v3 -f aiger.dofile 4 | else 5 | ../../v3 -f aiger.dofile > aiger.result 6 | fi 7 | 8 | echo "Running btor.dofile ..." 9 | if [ "$1" == "-stdout" ]; then 10 | ../../v3 -f btor.dofile 11 | else 12 | ../../v3 -f btor.dofile > btor.result 13 | fi 14 | 15 | echo "Running rtl.dofile ..." 16 | if [ "$1" == "-stdout" ]; then 17 | ../../v3 -f rtl.dofile 18 | else 19 | ../../v3 -f rtl.dofile > rtl.result 20 | fi 21 | -------------------------------------------------------------------------------- /src/v3mc/.extheader.mak: -------------------------------------------------------------------------------- 1 | v3mc.d: ../../include/v3MCCmd.h ../../include/v3MCEngine.h ../../include/v3MCMain.h 2 | ../../include/v3MCCmd.h: v3MCCmd.h 3 | @rm -f ../../include/v3MCCmd.h 4 | @ln -fs ../src/v3mc/v3MCCmd.h ../../include/v3MCCmd.h 5 | ../../include/v3MCEngine.h: v3MCEngine.h 6 | @rm -f ../../include/v3MCEngine.h 7 | @ln -fs ../src/v3mc/v3MCEngine.h ../../include/v3MCEngine.h 8 | ../../include/v3MCMain.h: v3MCMain.h 9 | @rm -f ../../include/v3MCMain.h 10 | @ln -fs ../src/v3mc/v3MCMain.h ../../include/v3MCMain.h 11 | -------------------------------------------------------------------------------- /design/alu/rtl.dofile: -------------------------------------------------------------------------------- 1 | // V3 DOFILE for the user tutorial "Read and Write Designs". 2 | // BE SURE to execute this script under the directory that contains it. 3 | 4 | // 1. Read the Verilog design 5 | read rtl alu.v 6 | // 2. Write the network in Verilog 7 | write rtl v3_alu.v -s 8 | // 3. Write the network in BTOR 9 | write btor v3_alu.btor -s 10 | // 4. Report network information 11 | print ntk -primary 12 | print ntk -verbose 13 | // 5. Plot network topology 14 | plot ntk -png v3_depth.png -d 2 15 | // Quit the program 16 | quit -f 17 | -------------------------------------------------------------------------------- /design/traffic/run.sh: -------------------------------------------------------------------------------- 1 | echo "Running aiger.dofile ..." 2 | if [ "$1" == "-stdout" ]; then 3 | ../../v3 -f aiger.dofile 4 | else 5 | ../../v3 -f aiger.dofile > aiger.result 6 | fi 7 | 8 | echo "Running rtl.dofile ..." 9 | if [ "$1" == "-stdout" ]; then 10 | ../../v3 -f rtl.dofile 11 | else 12 | ../../v3 -f rtl.dofile > rtl.result 13 | fi 14 | 15 | echo "Running settings.dofile ..." 16 | if [ "$1" == "-stdout" ]; then 17 | ../../v3 -f settings.dofile 18 | else 19 | ../../v3 -f settings.dofile > settings.result 20 | fi 21 | -------------------------------------------------------------------------------- /design/alu/aiger.dofile: -------------------------------------------------------------------------------- 1 | // V3 DOFILE for the user tutorial "Read and Write Designs". 2 | // BE SURE to execute this script under the directory that contains it. 3 | 4 | // 1. Read the AIGER design 5 | read aig alu.aig -s 6 | // 2. Write the network in AIGER 7 | write aig v3_alu.aig -s 8 | // 3. Write the network in Verilog 9 | write rtl v3_alu.v -s 10 | // 4. Report network information 11 | print ntk -primary 12 | print ntk -verbose 13 | // 5. Plot network topology 14 | plot ntk -png v3_level.png -l 5 15 | // Quit the program 16 | quit -f 17 | -------------------------------------------------------------------------------- /design/alu/btor.dofile: -------------------------------------------------------------------------------- 1 | // V3 DOFILE for the user tutorial "Read and Write Designs". 2 | // BE SURE to execute this script under the directory that contains it. 3 | 4 | // 1. Read the BTOR design 5 | read btor alu.btor -s 6 | // 2. Write the network in BTOR 7 | write btor v3_alu.btor -s 8 | // 3. Write the network in Verilog 9 | write rtl v3_alu.v -s 10 | // 4. Report network information 11 | print ntk -primary 12 | print ntk -verbose 13 | // 5. Plot network topology 14 | plot ntk -png v3_depth.png -d 2 15 | // Quit the program 16 | quit -f 17 | -------------------------------------------------------------------------------- /src/dfx/.extheader.mak: -------------------------------------------------------------------------------- 1 | dfx.d: ../../include/v3DfxCmd.h ../../include/v3DfxSimplify.h ../../include/v3DfxTrace.h 2 | ../../include/v3DfxCmd.h: v3DfxCmd.h 3 | @rm -f ../../include/v3DfxCmd.h 4 | @ln -fs ../src/dfx/v3DfxCmd.h ../../include/v3DfxCmd.h 5 | ../../include/v3DfxSimplify.h: v3DfxSimplify.h 6 | @rm -f ../../include/v3DfxSimplify.h 7 | @ln -fs ../src/dfx/v3DfxSimplify.h ../../include/v3DfxSimplify.h 8 | ../../include/v3DfxTrace.h: v3DfxTrace.h 9 | @rm -f ../../include/v3DfxTrace.h 10 | @ln -fs ../src/dfx/v3DfxTrace.h ../../include/v3DfxTrace.h 11 | -------------------------------------------------------------------------------- /src/adt/v3List.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3List.h ] 3 | PackageName [ v3/src/adt ] 4 | Synopsis [ Abstract Data Type for List. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_ADT_LIST_H 10 | #define V3_ADT_LIST_H 11 | 12 | #include 13 | 14 | template 15 | struct V3List { 16 | typedef std::list List; 17 | }; 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /src/adt/v3Vec.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3Vec.h ] 3 | PackageName [ v3/src/adt ] 4 | Synopsis [ Abstract Data Type for Vec. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_ADT_VEC_H 10 | #define V3_ADT_VEC_H 11 | 12 | #include 13 | 14 | template 15 | struct V3Vec { 16 | typedef std::vector Vec; 17 | }; 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /src/adt/v3Queue.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3Queue.h ] 3 | PackageName [ v3/src/adt ] 4 | Synopsis [ Abstract Data Type for Queue. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_ADT_QUEUE_H 10 | #define V3_ADT_QUEUE_H 11 | 12 | #include 13 | 14 | template 15 | struct V3Queue { 16 | typedef std::queue Queue; 17 | }; 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /src/adt/v3Stack.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3Stack.h ] 3 | PackageName [ v3/src/adt ] 4 | Synopsis [ Abstract Data Type for Stack. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_ADT_STACK_H 10 | #define V3_ADT_STACK_H 11 | 12 | #include 13 | 14 | template 15 | struct V3Stack { 16 | typedef std::stack Stack; 17 | }; 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /src/alg/v3AlgCmd.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3AlgCmd.h ] 3 | PackageName [ v3/src/alg ] 4 | Synopsis [ Alg Commands. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_ALG_CMD_H 10 | #define V3_ALG_CMD_H 11 | 12 | #include "v3CmdMgr.h" 13 | 14 | V3_COMMAND(V3SimNtkCmd, CMD_TYPE_SIMULATE); 15 | V3_COMMAND(V3PlotTraceCmd, CMD_TYPE_SIMULATE); 16 | 17 | #endif 18 | 19 | -------------------------------------------------------------------------------- /design/vending/rtl.dofile: -------------------------------------------------------------------------------- 1 | // V3 DOFILE for the user tutorial "Design Simulation". 2 | // BE SURE to execute this script under the directory that contains it. 3 | 4 | // 1. Read the Verilog design 5 | read rtl vending.v 6 | // 2. Report network information 7 | print ntk -primary 8 | print ntk -verbose 9 | // 3. Simulate pattern file 10 | sim ntk -input input.pattern -output rtl-sim.output 11 | // 4. Turn on event-driven simulation 12 | sim ntk -input input.pattern -output rtl-event.output -e 13 | // 5. Dump simulation results into waveform file 14 | plot trace input.pattern rtl-vending.vcd 15 | // Quit the program 16 | quit -f 17 | -------------------------------------------------------------------------------- /src/adt/v3Set.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3Set.h ] 3 | PackageName [ v3/src/adt ] 4 | Synopsis [ Abstract Data Type for Set. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_ADT_SET_H 10 | #define V3_ADT_SET_H 11 | 12 | #include 13 | 14 | template, class Alloc = std::allocator > 15 | struct V3Set { 16 | typedef std::set Set; 17 | }; 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /design/alu/alu.btor: -------------------------------------------------------------------------------- 1 | 1 const 1 0 2 | 2 var 1 rst 3 | 3 var 8 a 4 | 4 var 2 inst 5 | 5 var 16 out 6 | 6 const 16 0000000000000000 7 | 7 const 8 00000000 8 | 8 slice 8 5 7 0 9 | 9 and 8 8 3 10 | 10 and 8 9 9 11 | 11 concat 16 7 10 12 | 12 and 16 11 11 13 | 13 concat 16 7 3 14 | 14 and 16 13 13 15 | 15 mul 16 5 14 16 | 16 and 16 15 15 17 | 17 const 2 10 18 | 18 eq 1 4 17 19 | 19 cond 16 18 16 12 20 | 20 sub 16 5 14 21 | 21 and 16 20 20 22 | 22 const 2 01 23 | 23 eq 1 4 22 24 | 24 cond 16 23 21 19 25 | 25 add 16 5 14 26 | 26 and 16 25 25 27 | 27 const 2 00 28 | 28 eq 1 4 27 29 | 29 cond 16 28 26 24 30 | 30 and 1 -2 -2 31 | 31 cond 16 30 6 29 32 | 32 next 16 5 31 33 | 33 root 16 5 out 34 | -------------------------------------------------------------------------------- /src/stg/.extheader.mak: -------------------------------------------------------------------------------- 1 | stg.d: ../../include/v3StgCmd.h ../../include/v3StgExtract.h ../../include/v3StgFSM.h ../../include/v3StgSDG.h 2 | ../../include/v3StgCmd.h: v3StgCmd.h 3 | @rm -f ../../include/v3StgCmd.h 4 | @ln -fs ../src/stg/v3StgCmd.h ../../include/v3StgCmd.h 5 | ../../include/v3StgExtract.h: v3StgExtract.h 6 | @rm -f ../../include/v3StgExtract.h 7 | @ln -fs ../src/stg/v3StgExtract.h ../../include/v3StgExtract.h 8 | ../../include/v3StgFSM.h: v3StgFSM.h 9 | @rm -f ../../include/v3StgFSM.h 10 | @ln -fs ../src/stg/v3StgFSM.h ../../include/v3StgFSM.h 11 | ../../include/v3StgSDG.h: v3StgSDG.h 12 | @rm -f ../../include/v3StgSDG.h 13 | @ln -fs ../src/stg/v3StgSDG.h ../../include/v3StgSDG.h 14 | -------------------------------------------------------------------------------- /design/philosopher/aiger.dofile: -------------------------------------------------------------------------------- 1 | // V3 DOFILE for the user tutorial "Design Verification -- Part 1". 2 | // BE SURE to execute this script under the directory that contains it. 3 | 4 | // 1. Read the Verilog design 5 | read rtl ph64.v 6 | // 2. Flatten the design 7 | flatten ntk 8 | // 3. Blast into Boolean-level network 9 | blast ntk 10 | // 4. Set a safety property p1: G(!output0) 11 | set safety 0 12 | // 5. Verify p1 using UMC / ITP / PDR 13 | verify umc p1 14 | verify itp p1 15 | verify pdr p1 16 | // 6. Set a liveness property p2: F(!output1) 17 | set liveness -invc PO[1] 18 | // 7. Verify p2 using UMC / ITP / PDR 19 | verify umc p2 20 | verify itp p2 21 | verify pdr p2 22 | // Quit the program 23 | quit -f 24 | -------------------------------------------------------------------------------- /src/adt/v3Map.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3Map.h ] 3 | PackageName [ v3/src/adt ] 4 | Synopsis [ Abstract Data Type for Map. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_ADT_MAP_H 10 | #define V3_ADT_MAP_H 11 | 12 | #include 13 | 14 | template, class Alloc = std::allocator > > 15 | struct V3Map { 16 | typedef std::map Map; 17 | }; 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /src/util/v3IntType.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3IntType.h ] 3 | PackageName [ v3/src/util ] 4 | Synopsis [ V3 Integer Types ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_INT_TYPE_H 10 | #define V3_INT_TYPE_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | // Constants 19 | const uint32_t V3IntMAX = UINT_MAX; 20 | const double V3DblMAX = DBL_MAX; 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /design/philosopher/rtl.dofile: -------------------------------------------------------------------------------- 1 | // V3 DOFILE for the user tutorial "Design Verification -- Part 1". 2 | // BE SURE to execute this script under the directory that contains it. 3 | 4 | // 1. Read the Verilog design 5 | read rtl ph64.v 6 | // 2. Flatten the design 7 | flatten ntk 8 | // 3. Blast PI/PIO/FF into Bits 9 | blast ntk -primary 10 | // 4. Set a safety property p1: G(!output0) 11 | set safety 0 12 | // 5. Verify p1 using UMC / ITP / PDR 13 | verify umc p1 14 | verify itp p1 15 | verify pdr p1 16 | // 6. Set a liveness property p2: F(!output1) 17 | set liveness -invc PO[1] 18 | // 7. Verify p2 using UMC / ITP / PDR 19 | verify umc p2 -max 30 20 | verify itp p2 21 | verify pdr p2 22 | // Quit the program 23 | quit -f 24 | -------------------------------------------------------------------------------- /src/dfx/v3DfxCmd.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3DfxCmd.h ] 3 | PackageName [ v3/src/dfx ] 4 | Synopsis [ Debugging and Fix Commands. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_DFX_CMD_H 10 | #define V3_DFX_CMD_H 11 | 12 | #include "v3CmdMgr.h" 13 | 14 | // Counterexample Simplification Commands 15 | V3_COMMAND(V3TraceSimplifyCmd, CMD_TYPE_DEBUGFIX); 16 | // Counterexample Manipulation Commands 17 | V3_COMMAND(V3OptTraceCmd, CMD_TYPE_DEBUGFIX); 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /src/trans/v3TransCmd.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3TransCmd.h ] 3 | PackageName [ v3/src/trans ] 4 | Synopsis [ Ntk Transformation Commands. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_TRANS_CMD_H 10 | #define V3_TRANS_CMD_H 11 | 12 | #include "v3CmdMgr.h" 13 | 14 | V3_COMMAND(V3ExpandNtkCmd, CMD_TYPE_SYNTHESIS); 15 | V3_COMMAND(V3BlastNtkCmd, CMD_TYPE_SYNTHESIS); 16 | V3_COMMAND(V3MiterNtkCmd, CMD_TYPE_SYNTHESIS); 17 | V3_COMMAND(V3FlattenNtkCmd, CMD_TYPE_SYNTHESIS); 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /design/vending/aiger.dofile: -------------------------------------------------------------------------------- 1 | // V3 DOFILE for the user tutorial "Design Simulation". 2 | // BE SURE to execute this script under the directory that contains it. 3 | 4 | // 1. Read the Verilog design 5 | read rtl vending.v 6 | // 2. Blast into Boolean-level network 7 | blast ntk 8 | // 3. Report network information 9 | print ntk -primary 10 | print ntk -verbose 11 | // 3. Simulate pattern file 12 | sim ntk -input input.pattern -output aiger-sim.output 13 | // 4. Turn on event-driven simulation 14 | sim ntk -input input.pattern -output aiger-event.output -e 15 | // 5. Dump simulation results into waveform file 16 | plot trace input.pattern aiger-vending.vcd 17 | // 6. Write the network in Verilog 18 | write rtl aiger-vending.v -s 19 | // Quit the program 20 | quit -f 21 | -------------------------------------------------------------------------------- /src/alg/v3AlgSim.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3AlgSim.h ] 3 | PackageName [ v3/src/alg ] 4 | Synopsis [ V3 Ntk Simulation. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_ALG_SIM_H 10 | #define V3_ALG_SIM_H 11 | 12 | #include "v3AlgSimulate.h" 13 | 14 | // General Simulation Functions 15 | const bool performInputFileSimulation(const V3NtkHandler* const, const string&, const bool&, const string&); 16 | const bool performRandomSimulation(const V3NtkHandler* const, const uint32_t&, const bool&, const string&); 17 | 18 | #endif 19 | 20 | -------------------------------------------------------------------------------- /src/stg/v3StgCmd.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3StgCmd.h ] 3 | PackageName [ v3/src/stg ] 4 | Synopsis [ State-Transition-Graph Commands. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_STG_CMD_H 10 | #define V3_STG_CMD_H 11 | 12 | #include "v3CmdMgr.h" 13 | 14 | // FSM Extraction Commands 15 | V3_COMMAND(V3ElaborateFSMCmd, CMD_TYPE_EXTRACT); 16 | V3_COMMAND(V3ExtractFSMCmd, CMD_TYPE_EXTRACT); 17 | V3_COMMAND(V3WriteFSMCmd, CMD_TYPE_EXTRACT); 18 | V3_COMMAND(V3PlotFSMCmd, CMD_TYPE_EXTRACT); 19 | 20 | #endif 21 | 22 | -------------------------------------------------------------------------------- /src/v3mc/v3MCCmd.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3MCCmd.h ] 3 | PackageName [ v3/src/v3mc ] 4 | Synopsis [ Model Checking Commands. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_MC_CMD_H 10 | #define V3_MC_CMD_H 11 | 12 | #include "v3CmdMgr.h" 13 | 14 | // Model Checking Property Commands 15 | V3_COMMAND(V3MCReadPropertyCmd, CMD_TYPE_MODELCHKING); 16 | V3_COMMAND(V3MCWritePropertyCmd, CMD_TYPE_MODELCHKING); 17 | // Model Checking Verification Commands 18 | V3_COMMAND(V3MCRunCmd, CMD_TYPE_MODELCHKING); 19 | 20 | #endif 21 | 22 | -------------------------------------------------------------------------------- /src/cmd/v3CmdComm.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3CmdComm.h ] 3 | PackageName [ v3/src/cmd ] 4 | Synopsis [ Global Commands Implementation ] 5 | Author [ Chung-Yang (Ric) Huang, Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_CMD_COMM_H 10 | #define V3_CMD_COMM_H 11 | 12 | #include "v3CmdMgr.h" 13 | 14 | V3_COMMAND(V3HelpCmd, CMD_TYPE_COMMON); 15 | V3_COMMAND(V3QuitCmd, CMD_TYPE_COMMON); 16 | V3_COMMAND(V3HistoryCmd, CMD_TYPE_COMMON); 17 | V3_COMMAND(V3DofileCmd, CMD_TYPE_COMMON); 18 | V3_COMMAND(V3UsageCmd, CMD_TYPE_COMMON); 19 | V3_COMMAND(V3LogFileCmd, CMD_TYPE_COMMON); 20 | 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /src/vrf/v3VrfSIM.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3VrfSIM.h ] 3 | PackageName [ v3/src/vrf ] 4 | Synopsis [ Constrained Random Simulation on V3 Ntk. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_VRF_SIM_H 10 | #define V3_VRF_SIM_H 11 | 12 | #include "v3VrfBase.h" 13 | 14 | // class V3VrfSIM : Verification Handler for Constrained Random Simulation 15 | class V3VrfSIM : public V3VrfBase 16 | { 17 | public : 18 | // Constructor and Destructor 19 | V3VrfSIM(const V3NtkHandler* const); 20 | ~V3VrfSIM(); 21 | private : 22 | // Private Verification Main Functions 23 | void startVerify(const uint32_t&); 24 | }; 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /src/alg/.extheader.mak: -------------------------------------------------------------------------------- 1 | alg.d: ../../include/v3AlgCmd.h ../../include/v3AlgGeneralize.h ../../include/v3AlgSim.h ../../include/v3AlgSimulate.h ../../include/v3AlgType.h 2 | ../../include/v3AlgCmd.h: v3AlgCmd.h 3 | @rm -f ../../include/v3AlgCmd.h 4 | @ln -fs ../src/alg/v3AlgCmd.h ../../include/v3AlgCmd.h 5 | ../../include/v3AlgGeneralize.h: v3AlgGeneralize.h 6 | @rm -f ../../include/v3AlgGeneralize.h 7 | @ln -fs ../src/alg/v3AlgGeneralize.h ../../include/v3AlgGeneralize.h 8 | ../../include/v3AlgSim.h: v3AlgSim.h 9 | @rm -f ../../include/v3AlgSim.h 10 | @ln -fs ../src/alg/v3AlgSim.h ../../include/v3AlgSim.h 11 | ../../include/v3AlgSimulate.h: v3AlgSimulate.h 12 | @rm -f ../../include/v3AlgSimulate.h 13 | @ln -fs ../src/alg/v3AlgSimulate.h ../../include/v3AlgSimulate.h 14 | ../../include/v3AlgType.h: v3AlgType.h 15 | @rm -f ../../include/v3AlgType.h 16 | @ln -fs ../src/alg/v3AlgType.h ../../include/v3AlgType.h 17 | -------------------------------------------------------------------------------- /src/io/v3NtkParser.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3NtkParser.h ] 3 | PackageName [ v3/src/io ] 4 | Synopsis [ Generic Parsers for V3 Ntk Construction. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_NTK_PARSER_H 10 | #define V3_NTK_PARSER_H 11 | 12 | #include "v3NtkInput.h" 13 | 14 | // Front-End Framework Integration Main Functions 15 | V3NtkInput* const V3NtkFromQuteRTL(const char*, const bool&, const bool&, const bool& = false); 16 | 17 | // Generic Parser Main Functions 18 | V3NtkInput* const V3BtorParser(const char*, const bool& = true); 19 | V3NtkInput* const V3AigParser(const char*, const bool& = true); 20 | V3NtkInput* const V3RTLParser(const char*); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /design/alu/alu.v: -------------------------------------------------------------------------------- 1 | /* 2 | Source : alu/alu.v 3 | Synopsis : A sample arithmetic logic unit (ALU) design. 4 | Authors : Cheng-Yin Wu, NTUGIEE 5 | Date : 2013/02/20 6 | Version : 1.0 7 | */ 8 | 9 | 10 | module alu( 11 | // General I/O Ports 12 | clk, 13 | rst, 14 | // Input Ports 15 | a, 16 | inst, 17 | // Output Ports 18 | out 19 | ); 20 | 21 | // General I/O Ports 22 | input clk; 23 | input rst; 24 | // Input Ports 25 | input [7:0] a; 26 | input [1:0] inst; 27 | // Output Ports 28 | output [15:0] out; 29 | 30 | reg [15:0] out; 31 | 32 | always@ (posedge clk) begin 33 | if (!rst) begin 34 | out <= 16'd0; 35 | end 36 | else begin 37 | case(inst) 38 | 2'b00 : out <= out + {8'b0, a}; 39 | 2'b01 : out <= out - {8'b0, a}; 40 | 2'b10 : out <= out * {8'b0, a}; 41 | 2'b11 : out <= {8'b0, (out[7:0] & a)}; 42 | endcase 43 | end 44 | end 45 | 46 | endmodule 47 | -------------------------------------------------------------------------------- /design/traffic/settings.dofile: -------------------------------------------------------------------------------- 1 | // V3 DOFILE for the user tutorial "Design Verification -- Part 1". 2 | // BE SURE to execute this script under the directory that contains it. 3 | 4 | // 1. Read the Verilog design 5 | read rtl traffic.v 6 | // 2. Blast PI/PIO/FF into Bits 7 | blast ntk -primary 8 | // 3. Set a safety property p1: G(!output2) 9 | set safety 2 10 | // 4. Report verification verbosity settings 11 | print report 12 | // 5. Verify p1 using property directed reachability (PDR) 13 | verify pdr p1 14 | // 6. Turn on all verification verbosities 15 | set report -all -on 16 | // 7. Verify p1 using PDR again 17 | verify pdr p1 18 | // 8. Turn off all verification verbosities 19 | set report -all -off 20 | // 9. Verify p1 using PDR again 21 | verify pdr p1 22 | // 10. Reset verification verbosities 23 | set report -reset 24 | // 11. Set verification verbosities for clean output 25 | set report -result -off 26 | // 12. Verify p1 using PDR again 27 | verify pdr p1 28 | // Quit the program 29 | quit -f 30 | -------------------------------------------------------------------------------- /src/svr/v3SvrHandler.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3SvrHandler.h ] 3 | PackageName [ v3/src/svr ] 4 | Synopsis [ Handler Functions for V3 Base Solver. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_SVR_HANDLER_H 10 | #define V3_SVR_HANDLER_H 11 | 12 | #include "v3SvrMiniSat.h" 13 | #include "v3SvrBoolector.h" 14 | 15 | // Solver Type Enumerations 16 | enum V3SolverType 17 | { 18 | V3_SVR_MINISAT = 0, 19 | V3_SVR_BOOLECTOR = 1, 20 | V3_SVR_TOTAL = 2 21 | }; 22 | 23 | const string V3SolverTypeStr[] = 24 | { 25 | "MINISAT", "BOOLECTOR" 26 | }; 27 | 28 | // Solver Creation Functions 29 | V3SvrBase* const allocSolver(const V3SolverType&, const V3Ntk* const, const bool& = false); 30 | V3SvrBase* const referenceSolver(V3SvrBase* const); 31 | 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /src/ext/.extheader.mak: -------------------------------------------------------------------------------- 1 | ext.d: ../../include/v3ExtType.h ../../include/v3ExtUtil.h ../../include/v3Formula.h ../../include/v3LTLFormula.h ../../include/v3NtkElaborate.h ../../include/v3Property.h 2 | ../../include/v3ExtType.h: v3ExtType.h 3 | @rm -f ../../include/v3ExtType.h 4 | @ln -fs ../src/ext/v3ExtType.h ../../include/v3ExtType.h 5 | ../../include/v3ExtUtil.h: v3ExtUtil.h 6 | @rm -f ../../include/v3ExtUtil.h 7 | @ln -fs ../src/ext/v3ExtUtil.h ../../include/v3ExtUtil.h 8 | ../../include/v3Formula.h: v3Formula.h 9 | @rm -f ../../include/v3Formula.h 10 | @ln -fs ../src/ext/v3Formula.h ../../include/v3Formula.h 11 | ../../include/v3LTLFormula.h: v3LTLFormula.h 12 | @rm -f ../../include/v3LTLFormula.h 13 | @ln -fs ../src/ext/v3LTLFormula.h ../../include/v3LTLFormula.h 14 | ../../include/v3NtkElaborate.h: v3NtkElaborate.h 15 | @rm -f ../../include/v3NtkElaborate.h 16 | @ln -fs ../src/ext/v3NtkElaborate.h ../../include/v3NtkElaborate.h 17 | ../../include/v3Property.h: v3Property.h 18 | @rm -f ../../include/v3Property.h 19 | @ln -fs ../src/ext/v3Property.h ../../include/v3Property.h 20 | -------------------------------------------------------------------------------- /src/svr/.extheader.mak: -------------------------------------------------------------------------------- 1 | svr.d: ../../include/v3SvrBase.h ../../include/v3SvrBoolector.h ../../include/v3SvrHandler.h ../../include/v3SvrMiniSat.h ../../include/v3SvrSatHelper.h ../../include/v3SvrType.h 2 | ../../include/v3SvrBase.h: v3SvrBase.h 3 | @rm -f ../../include/v3SvrBase.h 4 | @ln -fs ../src/svr/v3SvrBase.h ../../include/v3SvrBase.h 5 | ../../include/v3SvrBoolector.h: v3SvrBoolector.h 6 | @rm -f ../../include/v3SvrBoolector.h 7 | @ln -fs ../src/svr/v3SvrBoolector.h ../../include/v3SvrBoolector.h 8 | ../../include/v3SvrHandler.h: v3SvrHandler.h 9 | @rm -f ../../include/v3SvrHandler.h 10 | @ln -fs ../src/svr/v3SvrHandler.h ../../include/v3SvrHandler.h 11 | ../../include/v3SvrMiniSat.h: v3SvrMiniSat.h 12 | @rm -f ../../include/v3SvrMiniSat.h 13 | @ln -fs ../src/svr/v3SvrMiniSat.h ../../include/v3SvrMiniSat.h 14 | ../../include/v3SvrSatHelper.h: v3SvrSatHelper.h 15 | @rm -f ../../include/v3SvrSatHelper.h 16 | @ln -fs ../src/svr/v3SvrSatHelper.h ../../include/v3SvrSatHelper.h 17 | ../../include/v3SvrType.h: v3SvrType.h 18 | @rm -f ../../include/v3SvrType.h 19 | @ln -fs ../src/svr/v3SvrType.h ../../include/v3SvrType.h 20 | -------------------------------------------------------------------------------- /src/util/v3StrUtil.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3StrUtil.h ] 3 | PackageName [ v3/src/util ] 4 | Synopsis [ String Related Utility Functions. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_STR_UTIL_H 10 | #define V3_STR_UTIL_H 11 | 12 | #include 13 | #include 14 | 15 | #include "v3IntType.h" 16 | 17 | using namespace std; 18 | 19 | // General Functions 20 | const int v3StrNCmp(const string&, const string&, const uint32_t&); 21 | const bool v3Str2Int(const string&, int&); 22 | const bool v3Str2UInt(const string&, uint32_t&); 23 | const string v3Int2Str(const int&, const uint32_t& = 0); 24 | 25 | // Tokenization Functions 26 | const size_t v3StrGetTok(const string&, string&, const size_t& = 0, const char = ' '); 27 | const string v3Str2BVExpr(const string&, uint32_t&, uint32_t&); 28 | 29 | // Trimming Functions 30 | const string v3StrRemoveSpaces(const string); 31 | 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /src/ntk/v3NtkSimplify.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3NtkSimplify.h ] 3 | PackageName [ v3/src/ntk ] 4 | Synopsis [ Simplifications for V3 Network. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_NTK_SIMPLIFY_H 10 | #define V3_NTK_SIMPLIFY_H 11 | 12 | #include "v3NtkHandler.h" 13 | 14 | // class V3NtkSimplify : Perform Network Simplifications 15 | class V3NtkSimplify : public V3NtkHandler 16 | { 17 | public : 18 | // Constructor and Destructor 19 | V3NtkSimplify(V3NtkHandler* const); 20 | ~V3NtkSimplify(); 21 | // Net Ancestry Functions 22 | const V3NetId getParentNetId(const V3NetId&) const; 23 | const V3NetId getCurrentNetId(const V3NetId&, const uint32_t& = 0) const; 24 | private : 25 | // Private Members 26 | V3NetVec _c2pMap; // V3NetId Mapping From Current to Parent Ntk 27 | V3NetVec _p2cMap; // V3NetId Mapping From Parent to Current Ntk 28 | }; 29 | 30 | #endif 31 | 32 | -------------------------------------------------------------------------------- /src/util/.extheader.mak: -------------------------------------------------------------------------------- 1 | util.d: ../../include/v3FileUtil.h ../../include/v3HashUtil.h ../../include/v3IntType.h ../../include/v3Msg.h ../../include/v3NumUtil.h ../../include/v3StrUtil.h ../../include/v3Usage.h 2 | ../../include/v3FileUtil.h: v3FileUtil.h 3 | @rm -f ../../include/v3FileUtil.h 4 | @ln -fs ../src/util/v3FileUtil.h ../../include/v3FileUtil.h 5 | ../../include/v3HashUtil.h: v3HashUtil.h 6 | @rm -f ../../include/v3HashUtil.h 7 | @ln -fs ../src/util/v3HashUtil.h ../../include/v3HashUtil.h 8 | ../../include/v3IntType.h: v3IntType.h 9 | @rm -f ../../include/v3IntType.h 10 | @ln -fs ../src/util/v3IntType.h ../../include/v3IntType.h 11 | ../../include/v3Msg.h: v3Msg.h 12 | @rm -f ../../include/v3Msg.h 13 | @ln -fs ../src/util/v3Msg.h ../../include/v3Msg.h 14 | ../../include/v3NumUtil.h: v3NumUtil.h 15 | @rm -f ../../include/v3NumUtil.h 16 | @ln -fs ../src/util/v3NumUtil.h ../../include/v3NumUtil.h 17 | ../../include/v3StrUtil.h: v3StrUtil.h 18 | @rm -f ../../include/v3StrUtil.h 19 | @ln -fs ../src/util/v3StrUtil.h ../../include/v3StrUtil.h 20 | ../../include/v3Usage.h: v3Usage.h 21 | @rm -f ../../include/v3Usage.h 22 | @ln -fs ../src/util/v3Usage.h ../../include/v3Usage.h 23 | -------------------------------------------------------------------------------- /src/trans/v3NtkMiter.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3NtkMiter.h ] 3 | PackageName [ v3/src/trans ] 4 | Synopsis [ Miter of V3 Networks. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_NTK_MITER_H 10 | #define V3_NTK_MITER_H 11 | 12 | #include "v3NtkHandler.h" 13 | 14 | // class V3NtkMiter : Miter of V3 Networks 15 | class V3NtkMiter : public V3NtkHandler 16 | { 17 | public : 18 | // Constructor and Destructor 19 | V3NtkMiter(V3NtkHandler* const, V3NtkHandler* const, const bool&, const string& = ""); 20 | V3NtkMiter(V3NtkHandler* const, V3NtkHandler* const, const V3UI32Vec&, const bool&, const string& = ""); 21 | ~V3NtkMiter(); 22 | // Net Ancestry Functions 23 | void getNetName(V3NetId&, string&) const; 24 | private : 25 | // Transformation Functions 26 | void performNtkTransformation(V3NtkHandler* const, V3NtkHandler* const, const bool&); 27 | // Private Members 28 | const string _ntkName; 29 | }; 30 | 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /src/vrf/v3VrfBMC.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3VrfBMC.h ] 3 | PackageName [ v3/src/vrf ] 4 | Synopsis [ Bounded Model Checking on V3 Ntk. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_VRF_BMC_H 10 | #define V3_VRF_BMC_H 11 | 12 | #include "v3VrfBase.h" 13 | 14 | // class V3VrfBMC : Verification Handler for Bounded Model Checking 15 | class V3VrfBMC : public V3VrfBase 16 | { 17 | public : 18 | // Constructor and Destructor 19 | V3VrfBMC(const V3NtkHandler* const); 20 | ~V3VrfBMC(); 21 | // BMC Specific Functions 22 | inline void setPreDepth(const uint32_t& d) { _preDepth = d; } 23 | inline void setIncDepth(const uint32_t& d) { _incDepth = d; } 24 | private : 25 | // Private Verification Main Functions 26 | void startVerify(const uint32_t&); 27 | // Private Data Members 28 | uint32_t _preDepth; // Pre-Run Depth (default = 0) 29 | uint32_t _incDepth; // Increment Depth (default = 1) 30 | }; 31 | 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /design/traffic/aiger.dofile: -------------------------------------------------------------------------------- 1 | // V3 DOFILE for the user tutorial "Design Verification -- Part 1". 2 | // BE SURE to execute this script under the directory that contains it. 3 | 4 | // 1. Read the Verilog design 5 | read rtl traffic.v 6 | // 2. Blast into Boolean-level network 7 | blast ntk 8 | // 3. Report network information 9 | print ntk -primary 10 | // 4. Set current solver as MiniSat 11 | set solver -minisat 12 | // 5. Set a safety property p1: G(!output0) 13 | set safety 0 14 | // 6. Verify p1 using unbounded model checking (BMC + induction) 15 | verify umc p1 16 | // 7. Set another safety property p2: G(!output1) 17 | set safety 1 18 | // 8. Verify p2 using interpolation-based model checking 19 | verify itp p2 20 | // 9. Set the last safety property p3: G(!output2) 21 | set safety 2 22 | // 10. Verify p3 using property directed reachability (PDR) 23 | verify pdr p3 24 | // 11. Check counterexample for the p3 25 | check result p3 26 | // 12. Write the counterexample trace for p3 27 | write result p3 aiger-p3.pattern 28 | // 13. Check if the pattern file leads to a counterexample of p3 29 | check result p3 -trace aiger-p3.pattern 30 | // 14. Dump the counterexample trace into waveform file 31 | plot result p3 aiger-p3.vcd 32 | // Quit the program 33 | quit -f 34 | -------------------------------------------------------------------------------- /src/ext/v3ExtUtil.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3ExtUtil.h ] 3 | PackageName [ v3/src/ext ] 4 | Synopsis [ Generic Utility Functions for V3 Property Manipulation. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_EXT_UTIL_H 10 | #define V3_EXT_UTIL_H 11 | 12 | #include "v3Property.h" 13 | 14 | /* GENERAL V3 ELABORATION FUNCTIONS : Implemented in v3ExtElaborate.cpp */ 15 | // General Elaboration Functions for V3 Ntk 16 | const V3NetId elaborateAigFormula(V3Formula* const, const uint32_t&, V3PortableType&); 17 | const V3NetId elaborateBvFormula(V3Formula* const, const uint32_t&, V3PortableType&); 18 | 19 | /* GENERAL V3 EXTENDED I/O FUNCTIONS : Implemented in v3ExtIO.cpp */ 20 | // Counterexample Trace Recording and Recovering Functions 21 | V3CexTrace* const V3CexTraceParser(const V3NtkHandler* const, const string&); 22 | void V3CexTraceWriter(const V3NtkHandler* const, const V3CexTrace* const, const string&); 23 | void V3CexTraceVisualizer(const V3NtkHandler* const, const V3CexTrace* const, const string&); 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 - 2014 2 | Design Verification Lab (DVLab), Graduate Institute of Electronics Engineering, 3 | National Taiwan University (NTU), Taipei, Taiwan. ALL RIGHTS RESERVED. 4 | 5 | V3: An Extensible Framework for Hardware Verification and Debugging 6 | 7 | http://dvlab.ee.ntu.edu.tw/~publication/V3 8 | 9 | 10 | THIS LICENSE FORBIDS THIS SOFTWARE TO BE USED UNDER ANY COMMERCIAL PURPOSES. 11 | IN ADDITION, USING THIS SOFTWARE WITHOUT EXPLICIT PERMISSIONS IS PROHIBITED. 12 | 13 | Permission is hereby granted, free of charge, to use, copy, and modify this 14 | software and its documentations for evaluation and research purposes, provided 15 | that the above copyright notice and the following content appear in all copies 16 | or substantial portions of this software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 24 | IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /src/svr/v3SvrType.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3SvrType.h ] 3 | PackageName [ v3/src/svr ] 4 | Synopsis [ Types in V3 Solver. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_SVR_TYPE_H 10 | #define V3_SVR_TYPE_H 11 | 12 | #include "v3Misc.h" 13 | 14 | // MiniSat 15 | #include "Solver.h" 16 | 17 | // Boolector 18 | extern "C" { 19 | #include "boolector.h" 20 | } 21 | 22 | // Defines for Common Representation 23 | typedef size_t V3SvrData; 24 | typedef V3Vec::Vec V3SvrDataVec; 25 | typedef V3Set::Set V3SvrDataSet; 26 | typedef V3Vec::Vec V3SvrDataTable; 27 | 28 | // Defines for MiniSAT 29 | typedef V3Vec::Vec V3SvrMVarData; 30 | typedef V3Vec::Vec V3SvrMLitData; 31 | typedef V3Vec::Vec V3SvrMVarTable; 32 | 33 | // Defines for Boolector 34 | typedef struct BtorNode BtorExp; 35 | typedef V3Vec::Vec V3BtorExpVec; 36 | typedef V3Vec::Vec V3BtorExpTable; 37 | 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /src/ext/v3ExtType.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3ExtType.h ] 3 | PackageName [ v3/src/ext ] 4 | Synopsis [ Ext Types in V3 Network. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_EXT_TYPE_H 10 | #define V3_EXT_TYPE_H 11 | 12 | #include "v3StrUtil.h" 13 | 14 | // V3 Extensive Naming Prefix 15 | const string V3PropertyPrefix = "P_"; 16 | const string V3SafetyPrefix = "v3_Safety_"; 17 | const string V3LivenessPrefix = "v3_Liveness_"; 18 | const string V3L2SPrefix = "v3_L2S_"; 19 | const string V3L2SGeneralID = V3L2SPrefix + v3Int2Str(time(NULL)); 20 | const string V3L2SAssertName = V3L2SPrefix + "Assertion_"; 21 | const string V3L2SShadowName = V3L2SPrefix + "Shadow_Latch_"; 22 | const string V3L2SPCheckName = V3L2SPrefix + "F_not_P_Latch_"; 23 | const string V3L2SLoopedName = V3L2SGeneralID + "_Looped"; 24 | const string V3L2SOracleName = V3L2SGeneralID + "_Loop_Oracle"; 25 | const string V3L2SInLoopName = V3L2SGeneralID + "_InLoop_Latch"; 26 | const string V3L2SLatchONName = V3L2SGeneralID + "_Shadow_Latch_ON"; 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /engine/quteRTL.script: -------------------------------------------------------------------------------- 1 | echo "########################################################################################################################"; 2 | echo "##### Please note that this script is designed for the installation of quteRTL-V3-1.2. #####"; 3 | echo "##### Thus the compatibility of the script with other QuteRTL versions is not always guaranteed. #####"; 4 | echo "########################################################################################################################"; 5 | 6 | # get QuteRTL package 7 | #echo "Downloading QuteRTL ..." 8 | #wget http://dvlab.ee.ntu.edu.tw/~publication/V3/release/quteRTL-V3-1.2.tar.gz; 9 | tar zxvf quteRTL-V3-1.2.tar.gz >& /dev/null; 10 | rm -rf quteRTL; mv quteRTL-V3-1.2 quteRTL; 11 | 12 | # build QuteRTL 13 | echo "Building QuteRTL ..."; 14 | cd quteRTL; make clean >& /dev/null; make v3Lib >& /dev/null; 15 | 16 | # create a new directory for keeping files 17 | rm -rf v3_src; mkdir v3_src; cp quteRTL.h v3_src; cp *.a v3_src; 18 | 19 | # clean QuteRTL 20 | make clean >& /dev/null; 21 | 22 | # create softlink from quteRTL/v3_src to src/eng/quteRTL 23 | echo "Creating softlink from quteRTL/v3_src to src/eng/quteRTL ..."; 24 | cd ../../src/eng; rm -rf quteRTL; ln -s ../../engine/quteRTL/v3_src quteRTL; 25 | -------------------------------------------------------------------------------- /design/traffic/rtl.dofile: -------------------------------------------------------------------------------- 1 | // V3 DOFILE for the user tutorial "Design Verification -- Part 1". 2 | // BE SURE to execute this script under the directory that contains it. 3 | 4 | // 1. Read the Verilog design 5 | read rtl traffic.v 6 | // 2. Report network information 7 | print ntk -primary 8 | // 3. Blast PI/PIO/FF into Bits 9 | blast ntk -primary 10 | // 4. Print current solver 11 | print solver 12 | // 5. Set current solver as Boolector 13 | set solver -boolector 14 | // 6. Set a safety property p1: G(!output0) 15 | set safety 0 16 | // 7. Verify p1 using unbounded model checking (BMC + induction) 17 | verify umc p1 18 | // 8. Set another safety property p2: G(!output1) 19 | set safety 1 20 | // 9. Verify p2 using interpolation-based model checking 21 | verify itp p2 22 | // 10. Set the last safety property p3: G(!output2) 23 | set safety 2 24 | // 11. Verify p3 using property directed reachability (PDR) 25 | verify pdr p3 26 | // 12. Check counterexample for the p3 27 | check result p3 28 | // 13. Write the counterexample trace for p3 29 | write result p3 rtl-p3.pattern 30 | // 14. Check if the pattern output leads to a counterexample of p3 31 | check result p3 -trace rtl-p3.pattern 32 | // 15. Dump the counterexample trace into waveform file 33 | plot result p3 rtl-p3.vcd 34 | // Quit the program 35 | quit -f 36 | -------------------------------------------------------------------------------- /src/alg/v3AlgType.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3AlgType.h ] 3 | PackageName [ v3/src/alg ] 4 | Synopsis [ Types for V3 Algorithms. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_ALG_TYPE_H 10 | #define V3_ALG_TYPE_H 11 | 12 | #include "v3Ntk.h" 13 | 14 | // Defines for Simulation Data 15 | typedef V3Vec::Vec V3SimTrace; 16 | typedef V3Vec::Vec V3BvSimDataVec; 17 | typedef V3Vec::Vec V3AigSimDataVec; 18 | typedef V3Vec::Vec V3SimTraceVec; 19 | typedef V3Vec::Vec V3BvSimTraceVec; 20 | typedef V3Vec::Vec V3AigSimTraceVec; 21 | 22 | // Defines for Simulation Records 23 | typedef pair V3BvSimNetId; 24 | typedef V3Vec::Vec V3BvSimNetVec; 25 | typedef pair V3BvSimRecord; 26 | typedef pair V3AigSimRecord; 27 | typedef V3Vec::Vec V3BvSimRecordVec; 28 | typedef V3Vec::Vec V3AigSimRecordVec; 29 | 30 | #endif 31 | 32 | -------------------------------------------------------------------------------- /src/util/v3HashUtil.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3Hash.h ] 3 | PackageName [ v3/src/util ] 4 | Synopsis [ V3 Hash Functions. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_HASH_H 10 | #define V3_HASH_H 11 | 12 | #include 13 | 14 | using namespace std; 15 | 16 | // Robert Jenkins' 32 bit integer hash function (http://www.concentric.net/~ttwang/tech/inthash.htm) 17 | static inline size_t V3MakeHash(size_t a) { 18 | a = (a + 0x7ed55d16) + (a << 12); 19 | a = (a ^ 0xc761c23c) ^ (a >> 19); 20 | a = (a + 0x165667b1) + (a << 5); 21 | a = (a + 0xd3a2646c) ^ (a << 9); 22 | a = (a + 0xfd7046c5) + (a << 3); 23 | a = (a ^ 0xb55a4f09) ^ (a >> 16); 24 | return a; 25 | } 26 | 27 | static inline size_t V3MakeHash(const string& s) { 28 | const char* data = s.data(); 29 | size_t value = 0; 30 | for (int i = s.length(); i > 0; --i) 31 | value = (value * 131) + *data++; 32 | return value; 33 | } 34 | 35 | static inline size_t V3MakeHash(const size_t a, const size_t b) { 36 | return V3MakeHash(b | (a << (sizeof(size_t) << 2))); 37 | } 38 | 39 | #endif 40 | 41 | -------------------------------------------------------------------------------- /src/svr/v3SvrHandler.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3SvrHandler.cpp ] 3 | PackageName [ v3/src/svr ] 4 | Synopsis [ Handler Functions for V3 Base Solver. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_SVR_HANDLER_C 10 | #define V3_SVR_HANDLER_C 11 | 12 | #include "v3SvrHandler.h" 13 | 14 | // Solver Creation Functions 15 | V3SvrBase* const allocSolver(const V3SolverType& type, const V3Ntk* const ntk, const bool& freeBound) { 16 | assert (type < V3_SVR_TOTAL); assert (ntk); 17 | switch (type) { 18 | case V3_SVR_MINISAT : return new V3SvrMiniSat(ntk, freeBound); 19 | case V3_SVR_BOOLECTOR : return new V3SvrBoolector(ntk, freeBound); 20 | default : return 0; 21 | } 22 | } 23 | 24 | V3SvrBase* const referenceSolver(V3SvrBase* const solver) { 25 | assert (solver); 26 | if (dynamic_cast(solver)) return new V3SvrMiniSat(*(dynamic_cast(solver))); 27 | else if (dynamic_cast(solver)) return new V3SvrBoolector(*(dynamic_cast(solver))); 28 | else return 0; 29 | } 30 | 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /src/trans/.extheader.mak: -------------------------------------------------------------------------------- 1 | trans.d: ../../include/v3BvBlastAig.h ../../include/v3BvBlastAigHelper.h ../../include/v3BvBlastBv.h ../../include/v3NtkExpand.h ../../include/v3NtkFlatten.h ../../include/v3NtkMiter.h ../../include/v3TransCmd.h 2 | ../../include/v3BvBlastAig.h: v3BvBlastAig.h 3 | @rm -f ../../include/v3BvBlastAig.h 4 | @ln -fs ../src/trans/v3BvBlastAig.h ../../include/v3BvBlastAig.h 5 | ../../include/v3BvBlastAigHelper.h: v3BvBlastAigHelper.h 6 | @rm -f ../../include/v3BvBlastAigHelper.h 7 | @ln -fs ../src/trans/v3BvBlastAigHelper.h ../../include/v3BvBlastAigHelper.h 8 | ../../include/v3BvBlastBv.h: v3BvBlastBv.h 9 | @rm -f ../../include/v3BvBlastBv.h 10 | @ln -fs ../src/trans/v3BvBlastBv.h ../../include/v3BvBlastBv.h 11 | ../../include/v3NtkExpand.h: v3NtkExpand.h 12 | @rm -f ../../include/v3NtkExpand.h 13 | @ln -fs ../src/trans/v3NtkExpand.h ../../include/v3NtkExpand.h 14 | ../../include/v3NtkFlatten.h: v3NtkFlatten.h 15 | @rm -f ../../include/v3NtkFlatten.h 16 | @ln -fs ../src/trans/v3NtkFlatten.h ../../include/v3NtkFlatten.h 17 | ../../include/v3NtkMiter.h: v3NtkMiter.h 18 | @rm -f ../../include/v3NtkMiter.h 19 | @ln -fs ../src/trans/v3NtkMiter.h ../../include/v3NtkMiter.h 20 | ../../include/v3TransCmd.h: v3TransCmd.h 21 | @rm -f ../../include/v3TransCmd.h 22 | @ln -fs ../src/trans/v3TransCmd.h ../../include/v3TransCmd.h 23 | -------------------------------------------------------------------------------- /src/ntk/v3NtkInput.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3NtkInput.h ] 3 | PackageName [ v3/src/ntk ] 4 | Synopsis [ Base Input Handler for V3 Ntk. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_NTK_INPUT_H 10 | #define V3_NTK_INPUT_H 11 | 12 | #include "v3NtkHandler.h" 13 | 14 | // Defines for Arrays 15 | typedef V3Vec::Vec V3StringVec; 16 | 17 | // Define for Functional Pointers 18 | typedef const bool(*V3Str2BoolFuncPtr) (const string&); 19 | 20 | // V3NtkInput : Base V3 Ntk Parser 21 | class V3NtkInput : public V3NtkHandler 22 | { 23 | public : 24 | // Constructor and Destructor 25 | V3NtkInput(const bool&, const string& = ""); 26 | ~V3NtkInput(); 27 | // Ntk Ancestry Functions 28 | inline const string getNtkName() const { return _ntkName; } 29 | // Net Ancestry Functions 30 | const V3NetId createNet(const string& = "", uint32_t = 1); 31 | const V3NetId getNetId(const string&) const; 32 | // Ntk Extended Helper Functions 33 | void removePrefixNetName(V3Str2BoolFuncPtr); 34 | void renderFreeNetAsInput(); 35 | }; 36 | 37 | #endif 38 | 39 | -------------------------------------------------------------------------------- /src/trans/v3NtkFlatten.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3NtkFlatten.h ] 3 | PackageName [ v3/src/trans ] 4 | Synopsis [ Flatten Hierarchical Network. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_NTK_FLATTEN_H 10 | #define V3_NTK_FLATTEN_H 11 | 12 | #include "v3NtkHandler.h" 13 | 14 | // class V3NtkFlatten : Flatten Network 15 | class V3NtkFlatten : public V3NtkHandler 16 | { 17 | public : 18 | // Constructor and Destructor 19 | V3NtkFlatten(V3NtkHandler* const, const uint32_t&); 20 | ~V3NtkFlatten(); 21 | // Net Ancestry Functions 22 | void getNetName(V3NetId&, string&) const; 23 | const V3NetId getNetFromName(const string&) const; 24 | const V3NetId getParentNetId(const V3NetId&) const; 25 | const V3NetId getCurrentNetId(const V3NetId&, const uint32_t&) const; 26 | private : 27 | // Ancestry Helper Functions 28 | const uint32_t getParentIndex(const V3NetId&) const; 29 | // Private Members 30 | V3NetVec _c2pMap; // V3NetId Mapping From Current to Parent Ntk 31 | V3NtkHierInfo _hierInfo; // Hierarchical Information for Flattened Ntk 32 | }; 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /engine/boolector.script: -------------------------------------------------------------------------------- 1 | echo "########################################################################################################################"; 2 | echo "##### Please note that this script is designed for the installation of boolector-1.6.0-with-sat-solvers. #####"; 3 | echo "##### Thus the compatibility of the script with other Boolector versions is not always guaranteed. #####"; 4 | echo "########################################################################################################################"; 5 | 6 | # get Boolector package 7 | echo "Downloading Boolector ..." 8 | wget http://fmv.jku.at/boolector/boolector-1.6.0-with-sat-solvers.tar.gz; 9 | tar zxvf boolector-1.6.0-with-sat-solvers.tar.gz >& /dev/null; rm -f boolector-1.6.0-with-sat-solvers.tar.gz; 10 | rm -rf boolector; mv boolector-1.6.0-with-sat-solvers boolector; 11 | 12 | # build Boolector 13 | echo "Building Boolector ..."; 14 | cd boolector; ./build.sh >& /dev/null; 15 | 16 | # create a new directory for keeping files 17 | rm -rf v3_src; mkdir v3_src; cp boolector/boolector.h v3_src; 18 | ar rc v3_src/libboolector.a */*.o minisat/build/release/minisat/*/*.o; 19 | 20 | # clean Boolector 21 | ./clean.sh >& /dev/null; 22 | 23 | # create softlink from boolector/v3_src to src/eng/boolector 24 | echo "Creating softlink from boolector/v3_src to src/eng/boolector ..."; 25 | cd ../../src/eng; rm -rf boolector; ln -s ../../engine/boolector/v3_src boolector; 26 | -------------------------------------------------------------------------------- /design/philosopher/philosopher.v: -------------------------------------------------------------------------------- 1 | /* 2 | Source : philosopher/philosopher.v 3 | Synopsis : A sample philosopher design for the dinning philosopher problem. 4 | Authors : Fabio Somenzi, Colorado. Rewritten by Cheng-Yin Wu, NTUGIEE 5 | Date : 2013/02/20 6 | Version : 1.0 7 | */ 8 | 9 | `define THINKING 2'd0 10 | `define READING 2'd1 11 | `define EATING 2'd2 12 | `define HUNGRY 2'd3 13 | 14 | module philosopher(clk, reset, out, left, right, init, random); 15 | input clk, reset, random; 16 | input [1:0] left, right, init; 17 | output [1:0] out; 18 | 19 | reg [1:0] state; 20 | 21 | assign out = state; 22 | 23 | always @(posedge clk) begin 24 | if (!reset) begin 25 | state <= init; 26 | end 27 | else begin 28 | case (state) 29 | `READING : begin 30 | if (left == `THINKING) begin 31 | state <= `THINKING; 32 | end 33 | end 34 | `THINKING : begin 35 | if (right == `READING) begin 36 | state <= `READING; 37 | end 38 | else begin 39 | state <= random ? `THINKING : `HUNGRY; 40 | end 41 | end 42 | `EATING : begin 43 | state <= random ? `THINKING : `EATING; 44 | end 45 | `HUNGRY : begin 46 | if (left != `EATING && right != `HUNGRY && right != `EATING) begin 47 | state <= `EATING; 48 | end 49 | end 50 | endcase 51 | end 52 | end 53 | endmodule 54 | -------------------------------------------------------------------------------- /src/Makefile.in: -------------------------------------------------------------------------------- 1 | CSRCS = $(wildcard *.cpp) 2 | CHDRS = $(wildcard *.h) 3 | COBJS = $(addsuffix .o, $(basename $(CSRCS))) 4 | 5 | INCDIR = ../../include 6 | DEPDIR = -I. -I$(INCDIR) 7 | LIBDIR = ../../lib 8 | LIBDEP = $(LIBDIR)/lib.d 9 | EXTLINK = $(PKGNAME).d 10 | 11 | CC = g++ 12 | AR = ar cr 13 | 14 | ENGFLGS = -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS 15 | 16 | #CFLAGS = $(ENGFLGS) $(PKGFLAG) -pg -g -Wall -Wno-parentheses 17 | CFLAGS = $(ENGFLGS) $(PKGFLAG) -O3 -DNDEBUG -Wall -Wno-parentheses -Wno-unused-function 18 | #CFLAGS = $(ENGFLGS) $(PKGFLAG) -g -Wall -Wno-parentheses 19 | 20 | .PHONY: depend extheader 21 | 22 | %.o: %.cpp 23 | @echo "> compiling: $<" 24 | @$(CC) $(CFLAGS) -I$(INCDIR) -c -o $@ $< 25 | 26 | top: $(EXTLINK) target 27 | @echo -n 28 | 29 | clean: 30 | @rm -f $(COBJS) 31 | 32 | ## Make dependencies 33 | depend: .depend.mak 34 | .depend.mak: $(CSRCS) $(CHDRS) 35 | @echo Making dependencies ... 36 | @$(CC) -MM $(DEPDIR) $(CSRCS) > $@ 37 | 38 | ## Linking external headers 39 | extheader: .extheader.mak 40 | .extheader.mak: $(EXTHDRS) 41 | @echo Linking external header files... 42 | @rm -f $@ 43 | @echo -n "$(EXTLINK): " > $@ 44 | @for hdr in $(EXTHDRS); \ 45 | do \ 46 | echo -n "$(INCDIR)/$$hdr " >> $@; \ 47 | rm -f $(INCDIR)/$$hdr; \ 48 | done 49 | @echo >> $@ 50 | @for hdr in $(EXTHDRS); \ 51 | do \ 52 | echo "$(INCDIR)/$$hdr: $$hdr" >> $@; \ 53 | echo " @rm -f $(INCDIR)/$$hdr" >> $@; \ 54 | echo " @ln -fs ../src/$(PKGNAME)/$$hdr $(INCDIR)/$$hdr" >> $@; \ 55 | done 56 | 57 | include .depend.mak 58 | include .extheader.mak 59 | -------------------------------------------------------------------------------- /src/vrf/v3VrfCmd.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3VrfCmd.h ] 3 | PackageName [ v3/src/vrf ] 4 | Synopsis [ Verification Commands. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_VRF_CMD_H 10 | #define V3_VRF_CMD_H 11 | 12 | #include "v3CmdMgr.h" 13 | 14 | // Verification Verbosity Manipulation Commands 15 | V3_COMMAND(V3SetReportCmd, CMD_TYPE_VERIFY); 16 | V3_COMMAND(V3PrintReportCmd, CMD_TYPE_VERIFY); 17 | V3_COMMAND(V3SetSolverCmd, CMD_TYPE_VERIFY); 18 | V3_COMMAND(V3PrintSolverCmd, CMD_TYPE_VERIFY); 19 | // Verification Property Setting Commands 20 | V3_COMMAND(V3SetSafetyCmd, CMD_TYPE_VERIFY); 21 | V3_COMMAND(V3SetLivenessCmd, CMD_TYPE_VERIFY); 22 | V3_COMMAND(V3ElaboratePrptyCmd, CMD_TYPE_VERIFY); 23 | // Verification Main Commands 24 | V3_COMMAND(V3SIMVrfCmd, CMD_TYPE_VERIFY); 25 | V3_COMMAND(V3BMCVrfCmd, CMD_TYPE_VERIFY); 26 | V3_COMMAND(V3UMCVrfCmd, CMD_TYPE_VERIFY); 27 | V3_COMMAND(V3PDRVrfCmd, CMD_TYPE_VERIFY); 28 | V3_COMMAND(V3ITPVrfCmd, CMD_TYPE_VERIFY); 29 | V3_COMMAND(V3SECVrfCmd, CMD_TYPE_VERIFY); 30 | V3_COMMAND(V3KLiveVrfCmd, CMD_TYPE_VERIFY); 31 | // Verification Result Reporting Commands 32 | V3_COMMAND(V3CheckResultCmd, CMD_TYPE_VERIFY); 33 | V3_COMMAND(V3WriteResultCmd, CMD_TYPE_VERIFY); 34 | V3_COMMAND(V3PlotResultCmd, CMD_TYPE_VERIFY); 35 | 36 | #endif 37 | 38 | -------------------------------------------------------------------------------- /src/util/v3NumUtil.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3NumUtil.h ] 3 | PackageName [ v3/src/util ] 4 | Synopsis [ V3 Numerical Utility Functions. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_NUM_UTIL_H 10 | #define V3_NUM_UTIL_H 11 | 12 | using namespace std; 13 | 14 | template 15 | inline bool V3SafeAdd(const T a, const T b, T& c) { 16 | // Perform c = a + b and return whether it overflows 17 | // NOTE: class T should overload '+', '=', '-', ... 18 | c = a + b; 19 | return (a == (c - b)) && (b == (c - a)); 20 | } 21 | 22 | template 23 | inline bool V3SafeAdd(T& a, const T b) { 24 | // Perform a += b and return whether it overflows 25 | // NOTE: class T should overload '+', '=', '-', ... 26 | const T c(a); assert (a == c); a += b; 27 | return (c == (a - b)) && (b == (a - c)); 28 | } 29 | 30 | template 31 | inline bool V3SafeMult(const T a, const T b, T& c) { 32 | // Perform c = a * b and return whether it overflows 33 | // NOTE: class T should overload '*', '=', '/', ... 34 | c = a * b; 35 | return (!a || !b) || ((a == (c / b)) && (b == (c / a))); 36 | } 37 | 38 | template 39 | inline bool V3SafeMult(T& a, const T b) { 40 | // Perform a *= b and return whether it overflows 41 | // NOTE: class T should overload '*', '=', '/', ... 42 | const T c(a); assert (a == c); a *= b; 43 | return (!a || !b) || ((c == (a / b)) && (b == (a / c))); 44 | } 45 | 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /src/adt/.extheader.mak: -------------------------------------------------------------------------------- 1 | adt.d: ../../include/v3BitVec.h ../../include/v3Graph.h ../../include/v3Hash.h ../../include/v3Map.h ../../include/v3Queue.h ../../include/v3Stack.h ../../include/v3Bucket.h ../../include/v3List.h ../../include/v3Misc.h ../../include/v3Set.h ../../include/v3Vec.h 2 | ../../include/v3BitVec.h: v3BitVec.h 3 | @rm -f ../../include/v3BitVec.h 4 | @ln -fs ../src/adt/v3BitVec.h ../../include/v3BitVec.h 5 | ../../include/v3Graph.h: v3Graph.h 6 | @rm -f ../../include/v3Graph.h 7 | @ln -fs ../src/adt/v3Graph.h ../../include/v3Graph.h 8 | ../../include/v3Hash.h: v3Hash.h 9 | @rm -f ../../include/v3Hash.h 10 | @ln -fs ../src/adt/v3Hash.h ../../include/v3Hash.h 11 | ../../include/v3Map.h: v3Map.h 12 | @rm -f ../../include/v3Map.h 13 | @ln -fs ../src/adt/v3Map.h ../../include/v3Map.h 14 | ../../include/v3Queue.h: v3Queue.h 15 | @rm -f ../../include/v3Queue.h 16 | @ln -fs ../src/adt/v3Queue.h ../../include/v3Queue.h 17 | ../../include/v3Stack.h: v3Stack.h 18 | @rm -f ../../include/v3Stack.h 19 | @ln -fs ../src/adt/v3Stack.h ../../include/v3Stack.h 20 | ../../include/v3Bucket.h: v3Bucket.h 21 | @rm -f ../../include/v3Bucket.h 22 | @ln -fs ../src/adt/v3Bucket.h ../../include/v3Bucket.h 23 | ../../include/v3List.h: v3List.h 24 | @rm -f ../../include/v3List.h 25 | @ln -fs ../src/adt/v3List.h ../../include/v3List.h 26 | ../../include/v3Misc.h: v3Misc.h 27 | @rm -f ../../include/v3Misc.h 28 | @ln -fs ../src/adt/v3Misc.h ../../include/v3Misc.h 29 | ../../include/v3Set.h: v3Set.h 30 | @rm -f ../../include/v3Set.h 31 | @ln -fs ../src/adt/v3Set.h ../../include/v3Set.h 32 | ../../include/v3Vec.h: v3Vec.h 33 | @rm -f ../../include/v3Vec.h 34 | @ln -fs ../src/adt/v3Vec.h ../../include/v3Vec.h 35 | -------------------------------------------------------------------------------- /src/ntk/.extheader.mak: -------------------------------------------------------------------------------- 1 | ntk.d: ../../include/v3NtkCmd.h ../../include/v3NtkHandler.h ../../include/v3NtkInput.h ../../include/v3NtkSimplify.h ../../include/v3NtkUtil.h ../../include/v3Ntk.h ../../include/v3NtkHash.h ../../include/v3NtkRewrite.h ../../include/v3NtkStrash.h ../../include/v3Type.h 2 | ../../include/v3NtkCmd.h: v3NtkCmd.h 3 | @rm -f ../../include/v3NtkCmd.h 4 | @ln -fs ../src/ntk/v3NtkCmd.h ../../include/v3NtkCmd.h 5 | ../../include/v3NtkHandler.h: v3NtkHandler.h 6 | @rm -f ../../include/v3NtkHandler.h 7 | @ln -fs ../src/ntk/v3NtkHandler.h ../../include/v3NtkHandler.h 8 | ../../include/v3NtkInput.h: v3NtkInput.h 9 | @rm -f ../../include/v3NtkInput.h 10 | @ln -fs ../src/ntk/v3NtkInput.h ../../include/v3NtkInput.h 11 | ../../include/v3NtkSimplify.h: v3NtkSimplify.h 12 | @rm -f ../../include/v3NtkSimplify.h 13 | @ln -fs ../src/ntk/v3NtkSimplify.h ../../include/v3NtkSimplify.h 14 | ../../include/v3NtkUtil.h: v3NtkUtil.h 15 | @rm -f ../../include/v3NtkUtil.h 16 | @ln -fs ../src/ntk/v3NtkUtil.h ../../include/v3NtkUtil.h 17 | ../../include/v3Ntk.h: v3Ntk.h 18 | @rm -f ../../include/v3Ntk.h 19 | @ln -fs ../src/ntk/v3Ntk.h ../../include/v3Ntk.h 20 | ../../include/v3NtkHash.h: v3NtkHash.h 21 | @rm -f ../../include/v3NtkHash.h 22 | @ln -fs ../src/ntk/v3NtkHash.h ../../include/v3NtkHash.h 23 | ../../include/v3NtkRewrite.h: v3NtkRewrite.h 24 | @rm -f ../../include/v3NtkRewrite.h 25 | @ln -fs ../src/ntk/v3NtkRewrite.h ../../include/v3NtkRewrite.h 26 | ../../include/v3NtkStrash.h: v3NtkStrash.h 27 | @rm -f ../../include/v3NtkStrash.h 28 | @ln -fs ../src/ntk/v3NtkStrash.h ../../include/v3NtkStrash.h 29 | ../../include/v3Type.h: v3Type.h 30 | @rm -f ../../include/v3Type.h 31 | @ln -fs ../src/ntk/v3Type.h ../../include/v3Type.h 32 | -------------------------------------------------------------------------------- /src/ntk/v3NtkCmd.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3NtkCmd.h ] 3 | PackageName [ v3/src/ntk ] 4 | Synopsis [ Ntk Commands. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_NTK_CMD_H 10 | #define V3_NTK_CMD_H 11 | 12 | #include "v3CmdMgr.h" 13 | 14 | // Network Input Commands 15 | V3_COMMAND(V3ReadRTLCmd, CMD_TYPE_IO); 16 | V3_COMMAND(V3ReadAIGCmd, CMD_TYPE_IO); 17 | V3_COMMAND(V3ReadBTORCmd, CMD_TYPE_IO); 18 | // Network Output Commands 19 | V3_COMMAND(V3WriteRTLCmd, CMD_TYPE_IO); 20 | V3_COMMAND(V3WriteAIGCmd, CMD_TYPE_IO); 21 | V3_COMMAND(V3WriteBTORCmd, CMD_TYPE_IO); 22 | // Network Report Commands 23 | V3_COMMAND(V3PrintNtkCmd, CMD_TYPE_PRINT); 24 | V3_COMMAND(V3PrintNetCmd, CMD_TYPE_PRINT); 25 | V3_COMMAND(V3PlotNtkCmd, CMD_TYPE_PRINT); 26 | // Network Hierarchy Manipulation Commands 27 | V3_COMMAND(V3SetNtkCmd, CMD_TYPE_MANIP); 28 | V3_COMMAND(V3ListNtkCmd, CMD_TYPE_MANIP); 29 | V3_COMMAND(V3WorkNtkCmd, CMD_TYPE_MANIP); 30 | V3_COMMAND(V3RefNtkCmd, CMD_TYPE_MANIP); 31 | // Network Simplification Commands 32 | V3_COMMAND(V3StrashNtkCmd, CMD_TYPE_SYNTHESIS); 33 | V3_COMMAND(V3ReduceNtkCmd, CMD_TYPE_SYNTHESIS); 34 | V3_COMMAND(V3RewriteNtkCmd, CMD_TYPE_SYNTHESIS); 35 | V3_COMMAND(V3DuplicateNtkCmd, CMD_TYPE_SYNTHESIS); 36 | // Network Verbosity Setting Commands 37 | V3_COMMAND(V3SetVerbosityCmd, CMD_TYPE_SYNTHESIS); 38 | V3_COMMAND(V3PrintVerbosityCmd, CMD_TYPE_SYNTHESIS); 39 | 40 | #endif 41 | 42 | -------------------------------------------------------------------------------- /src/ntk/v3NtkHash.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3NtkHash.h ] 3 | PackageName [ v3/src/ntk ] 4 | Synopsis [ Hash Tables for V3 Network. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_NTK_HASH_H 10 | #define V3_NTK_HASH_H 11 | 12 | #include "v3Ntk.h" 13 | 14 | // Defines for Net Hash Data Types 15 | typedef pair V3MuxKey; 16 | typedef V3PairHashFcn V3MuxFcn; 17 | typedef V3PairHashEqual V3MuxEqual; 18 | 19 | // Defines for Net Hash Tables 20 | typedef V3HashMap::Hash V3UI64Hash; 21 | typedef V3HashMap::Hash V3UI32Hash; 22 | typedef V3HashMap::Hash V3MuxHash; 23 | 24 | // Helper Functions for Inputs to Hash Key Translation 25 | inline const uint32_t V3NetType2HashKey(const V3NetType& id) { return id.value; } 26 | 27 | inline const uint64_t V3OrderedNetType2HashKey(const V3NetType& id1, const V3NetType& id2) { 28 | return V3PairType(id1.value, id2.value).pair; } 29 | 30 | inline const uint64_t V3UnorderedNetType2HashKey(const V3NetType& id1, const V3NetType& id2) { 31 | if (id1.value > id2.value) return V3PairType(id2.value, id1.value).pair; 32 | else return V3PairType(id1.value, id2.value).pair; } 33 | 34 | inline const V3MuxKey V3MuxNetType2HashKey(const V3NetType& fId, const V3NetType& tId, const V3NetType& sId) { 35 | return make_pair(V3OrderedNetType2HashKey(fId, tId), V3NetType2HashKey(sId)); } 36 | 37 | #endif 38 | 39 | -------------------------------------------------------------------------------- /src/vrf/v3VrfResult.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3VrfResult.h ] 3 | PackageName [ v3/src/vrf ] 4 | Synopsis [ Verification Result Validation Checker. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_VRF_RESULT_H 10 | #define V3_VRF_RESULT_H 11 | 12 | #include "v3NtkHandler.h" 13 | 14 | // Counterexample Checker 15 | const int simulationCheckFiredResult(const V3CexTrace&, const V3NetVec&, const V3NetVec&, const bool&, 16 | const V3NtkHandler* const, const uint32_t& = 0); 17 | const int formalCheckFiredResult(const V3CexTrace&, const V3NetVec&, const V3NetVec&, const bool&, 18 | const V3NtkHandler* const, const uint32_t& = 0); 19 | 20 | // Simulation-Based Checker 21 | const int cycleSimulateResult(const V3CexTrace&, const V3NetVec&, const V3NetVec&, const bool&, 22 | const V3NtkHandler* const, const uint32_t& = 0); 23 | const int expandSimulateResult(const V3CexTrace&, const V3NetVec&, const V3NetVec&, const bool&, 24 | const V3NtkHandler* const, const uint32_t& = 0); 25 | 26 | // Counterexample Checker Report Functions 27 | void reportUnexpectedState(const uint32_t&, const uint32_t&, const V3BitVecX&, const V3BitVecX&); 28 | void reportUnsatisfiedConstraint(const uint32_t&, const uint32_t&, const V3BitVecX&); 29 | void reportShorterTrace(const uint32_t&, const char&); 30 | 31 | // Inductive Invariant Checker 32 | const int formalCheckProvenResult(const V3Ntk* const, const V3NtkHandler* const); 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /src/io/v3NtkWriter.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3NtkWriter.h ] 3 | PackageName [ v3/src/io ] 4 | Synopsis [ Generic Writers for V3 Ntk Output. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_NTK_WRITER_H 10 | #define V3_NTK_WRITER_H 11 | 12 | #include "v3NtkUtil.h" 13 | #include "v3NtkHandler.h" 14 | 15 | #include 16 | 17 | // Defines 18 | #define V3RTLName(n) ((n.cp ? "~" : "") + rtlName[n.id]) 19 | #define V3RTLNameBase(h, n) (getVerilogName(h, n)) 20 | #define V3RTLNameOrId(h, n) (getVerilogName(h, h->getNetNameOrFormedWithId(n))) 21 | #define V3RTLNameById(h, n) (getVerilogName(h, h->applyAuxNetNamePrefix(v3Int2Str(n.id)))) 22 | 23 | // Writer Helper Functions 24 | void writeV3GeneralHeader(const string&, ofstream&, const string&); 25 | const string getVerilogName(const V3NtkHandler* const, const string&); 26 | 27 | // Generic Network Plot Functions 28 | void V3PlotNtkByLevel(const V3NtkHandler* const, const char*, const uint32_t&, const V3NetVec&, const bool&); 29 | void V3PlotNtkByDepth(const V3NtkHandler* const, const char*, const uint32_t&, const V3NetVec&, const bool&); 30 | 31 | // Generic Writer Main Functions 32 | void V3BtorWriter(const V3NtkHandler* const, const char*, const bool& = false); 33 | void V3AigWriter(const V3NtkHandler* const, const char*, const bool& = false); 34 | void V3RTLWriter(const V3NtkHandler* const, const char*, const bool& = true, const bool& = false); 35 | 36 | // Specific Writer Main Functions 37 | void splitAigFromProperties(const string&, const bool& = false); 38 | 39 | #endif 40 | 41 | -------------------------------------------------------------------------------- /src/trans/v3NtkExpand.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3NtkExpand.h ] 3 | PackageName [ v3/src/trans ] 4 | Synopsis [ Time-Frame Expansion to V3 Network. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2013-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_NTK_EXPAND_H 10 | #define V3_NTK_EXPAND_H 11 | 12 | #include "v3NtkHandler.h" 13 | 14 | // class V3NtkExpand : Time-Frame Expansion 15 | class V3NtkExpand : public V3NtkHandler 16 | { 17 | public : 18 | // Constructor and Destructor 19 | V3NtkExpand(V3NtkHandler* const, const uint32_t&, const bool& = false); 20 | ~V3NtkExpand(); 21 | // Inline Member Functions 22 | inline const uint32_t& getCycle() const { return _cycle; } 23 | // I/O Ancestry Functions 24 | const string getInputName(const uint32_t&) const; 25 | const string getOutputName(const uint32_t&) const; 26 | const string getInoutName(const uint32_t&) const; 27 | // Net Ancestry Functions 28 | void getNetName(V3NetId&, string&) const; 29 | const V3NetId getNetFromName(const string&) const; 30 | const V3NetId getParentNetId(const V3NetId&) const; 31 | const V3NetId getCurrentNetId(const V3NetId&, const uint32_t&) const; 32 | private : 33 | // Transformation Functions 34 | void performNtkTransformation(const bool& = false); 35 | // Private Members 36 | const uint32_t _cycle; // Number of Cycles for Expansion 37 | V3NetVec _c2pMap; // V3NetId Mapping From Current to Parent Ntk 38 | V3NetTable _p2cMap; // V3NetId Mapping From Parent to Current Ntk 39 | }; 40 | 41 | #endif 42 | 43 | -------------------------------------------------------------------------------- /src/adt/v3Hash.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3Hash.h ] 3 | PackageName [ v3/src/adt ] 4 | Synopsis [ Abstract Data Type for Hash. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_ADT_HASH_H 10 | #define V3_ADT_HASH_H 11 | 12 | // Defines 13 | #define V3_USE_BOOST_HASH 14 | 15 | #include "v3HashUtil.h" 16 | 17 | #ifdef V3_USE_BOOST_HASH 18 | #include 19 | #include 20 | #else 21 | #include 22 | #include 23 | #endif 24 | 25 | template, class EqualKey = std::equal_to, class Alloc = allocator > > 26 | struct V3HashMap { 27 | #ifdef V3_USE_BOOST_HASH 28 | typedef tr1::unordered_map Hash; 29 | #else 30 | typedef std::hash_map Hash; 31 | #endif 32 | }; 33 | 34 | template, class EqualKey = std::equal_to, class Alloc = allocator > 35 | struct V3HashSet { 36 | #ifdef V3_USE_BOOST_HASH 37 | typedef tr1::unordered_set Hash; 38 | #else 39 | typedef std::hash_set Hash; 40 | #endif 41 | }; 42 | 43 | // Extended Hash Function for Pair Key 44 | template 45 | struct V3PairHashFcn { 46 | inline size_t operator() (const pair& key) const { 47 | return V3MakeHash(key.first, key.second); 48 | } 49 | }; 50 | 51 | template 52 | struct V3PairHashEqual { 53 | inline size_t operator() (const pair& key1, const pair& key2) const { 54 | return key1 == key2; 55 | } 56 | }; 57 | 58 | #endif 59 | 60 | -------------------------------------------------------------------------------- /src/dfx/v3DfxSimplify.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3DfxSimplify.h ] 3 | PackageName [ v3/src/dfx ] 4 | Synopsis [ Trace Simplification. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2013-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_DFX_SIMPLIFY_H 10 | #define V3_DFX_SIMPLIFY_H 11 | 12 | #include "v3Property.h" 13 | #include "v3NtkHandler.h" 14 | #include "v3AlgGeneralize.h" 15 | 16 | // class V3TraceSimplify: Trace Simplification Based-on Generalization 17 | class V3TraceSimplify 18 | { 19 | public : 20 | // Constructor and Destructor 21 | V3TraceSimplify(V3NtkHandler* const, const V3CexTrace&); 22 | ~V3TraceSimplify(); 23 | // Trace Retrieval Functions 24 | V3CexTrace* const getTrace() const; 25 | // Trace Simplification Functions 26 | void simplifyInputPatterns(const bool&, const uint32_t& = V3NtkUD); 27 | // Trace Information 28 | void printTraceInfo() const; 29 | private: 30 | // Private Helper Functions 31 | void computeSimTrace(const V3CexTrace&); 32 | V3NtkHandler* const getUnrolledNtk(const bool&, const uint32_t&); 33 | void maximizeDontCares(V3Ntk* const, V3AlgGeneralize* const, const V3SimTrace&, V3SimTrace&, const V3NetVec&); 34 | void minimizeTransitions(V3Ntk* const, V3AlgGeneralize* const, const V3SimTrace&, V3SimTrace&, const V3NetVec&); 35 | // Private Data Members 36 | V3NtkHandler* const _handler; 37 | V3NetVec _target; 38 | V3SimTraceVec _piValue; 39 | V3SimTraceVec _ffValue; 40 | // Statistics 41 | V3Stat* _totalStat; 42 | V3Stat* _piUnrollStat; 43 | V3Stat* _piGenStat; 44 | V3Stat* _ffUnrollStat; 45 | V3Stat* _ffGenStat; 46 | }; 47 | 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /src/trans/v3BvBlastBv.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3BvBlastBv.h ] 3 | PackageName [ v3/src/trans ] 4 | Synopsis [ Bit-Blasting (Pseudo) Primary Ports for BV Networks. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_BV_BLAST_BV_H 10 | #define V3_BV_BLAST_BV_H 11 | 12 | #include "v3NtkHandler.h" 13 | 14 | // Defines for Hash Tables 15 | typedef V3Map::Map V3BvBlastBvMap; 16 | 17 | // class V3BvBlastBv : Bit-Blast Ports for BV Networks 18 | class V3BvBlastBv : public V3NtkHandler 19 | { 20 | public : 21 | // Constructor and Destructor 22 | V3BvBlastBv(V3NtkHandler* const); 23 | ~V3BvBlastBv(); 24 | // I/O Ancestry Functions 25 | const string getInputName(const uint32_t&) const; 26 | const string getOutputName(const uint32_t&) const; 27 | const string getInoutName(const uint32_t&) const; 28 | // Net Ancestry Functions 29 | void getNetName(V3NetId&, string&) const; 30 | const V3NetId getNetFromName(const string&) const; 31 | const V3NetId getParentNetId(const V3NetId&) const; 32 | const V3NetId getCurrentNetId(const V3NetId&, const uint32_t& = 0) const; 33 | private : 34 | // Ancestry Helper Functions 35 | const uint32_t getParentIndex(const V3NetId&) const; 36 | // Transformation Functions 37 | void performNtkTransformation(); 38 | // Transformation Helper Functions 39 | void mergeBitBlastedNets(V3NetId, const uint32_t&, const V3NetId&); 40 | const V3NetId getBitBlastedNet(const V3NetId&, const uint32_t&); 41 | // Private Members 42 | V3BvBlastBvMap _p2cMap; // Net Index Mapping From Parent to Current Ntk 43 | V3UI32Vec _c2pMap; // Net Index Mapping From Current to Parent Ntk 44 | }; 45 | 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /src/v3mc/v3MCEngine.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3MCEngine.h ] 3 | PackageName [ v3/src/v3mc ] 4 | Synopsis [ V3 Verification Engines. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_MC_ENGINE_H 10 | #define V3_MC_ENGINE_H 11 | 12 | #include "v3StrUtil.h" 13 | 14 | // An Enumeration of Verification Engines with Configurations 15 | // NOTE: Only Exploiting Checkers are In the List 16 | enum V3MCEngineType 17 | { 18 | // IDLE 19 | V3MC_IDLE = 0, 20 | // BMC / UMC 21 | V3MC_BMC, 22 | V3MC_UBC, 23 | V3MC_UMC, 24 | V3MC_IND, 25 | // PDR 26 | V3MC_MPDR, 27 | V3MC_IPDR, 28 | // ITP 29 | V3MC_CITP, 30 | V3MC_CITP_I, 31 | V3MC_CITP_F_I, 32 | V3MC_CITP_REC, 33 | V3MC_FITP, 34 | // PROVE 35 | V3MC_SEC_BMC, 36 | V3MC_SEC_UMC, 37 | V3MC_SEC_IPDR, 38 | V3MC_SEC_MPDR, 39 | V3MC_SEC_SYN_BMC, 40 | V3MC_SEC_SYN_UMC, 41 | V3MC_SEC_SYN_IPDR, 42 | V3MC_SEC_SYN_MPDR, 43 | // K-LIVENESS 44 | V3MC_KLIVE_MPDR, 45 | V3MC_KLIVE_IPDR, 46 | V3MC_KLIVE_CITP, 47 | V3MC_KLIVE_CITP_REC, 48 | V3MC_KLIVE_FITP, 49 | // SIM 50 | V3MC_SIM, 51 | // TOTAL 52 | V3MC_TOTAL 53 | }; 54 | 55 | const string V3MCEngineTypeStr[] = 56 | { 57 | // IDLE 58 | "IDLE", 59 | // BMC / UMC 60 | "BMC", 61 | "UBC", 62 | "UMC", 63 | "IND", 64 | // PDR 65 | "MPDR", 66 | "IPDR", 67 | // ITP 68 | "CITP", 69 | "CITP_I", 70 | "CITP_F_I", 71 | "CITP_REC", 72 | "FITP", 73 | // PROVE 74 | "SEC_BMC", 75 | "SEC_UMC", 76 | "SEC_IPDR", 77 | "SEC_MPDR", 78 | "SEC_SYN_BMC", 79 | "SEC_SYN_UMC", 80 | "SEC_SYN_IPDR", 81 | "SEC_SYN_MPDR", 82 | // K-LIVENESS 83 | "KLIVE_MPDR", 84 | "KLIVE_IPDR", 85 | "KLIVE_CITP", 86 | "KLIVE_CITP_REC", 87 | "KLIVE_FITP", 88 | // SIM 89 | "SIM", 90 | // TOTAL 91 | "TOTAL" 92 | }; 93 | 94 | #endif 95 | 96 | -------------------------------------------------------------------------------- /src/ntk/v3NtkStrash.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3NtkStrash.h ] 3 | PackageName [ v3/src/ntk ] 4 | Synopsis [ Implementation of Structural Hashing. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2013-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_NTK_STRASH_H 10 | #define V3_NTK_STRASH_H 11 | 12 | #include "v3NtkUtil.h" 13 | 14 | // Structural Hashing Sub-Functions for BV Network 15 | const V3NetId strashBvPairTypeGate(V3BvNtk* const, const V3GateType&, const V3InputVec&, V3PortableType&); 16 | const V3NetId strashBvReducedTypeGate(V3BvNtk* const, const V3GateType&, const V3InputVec&, V3PortableType&); 17 | const V3NetId strashBvMuxGate(V3BvNtk* const, const V3InputVec&, V3PortableType&); 18 | const V3NetId strashBvSliceGate(V3BvNtk* const, const V3InputVec&, V3PortableType&); 19 | const V3NetId strashBvConstGate(V3BvNtk* const, const V3InputVec&, V3PortableType&); 20 | void strashBvPairTypeGate(V3BvNtk* const, const V3NetId& id, V3PortableType&); 21 | void strashBvReducedTypeGate(V3BvNtk* const, const V3NetId& id, V3PortableType&); 22 | void strashBvMuxGate(V3BvNtk* const, const V3NetId& id, V3PortableType&); 23 | void strashBvSliceGate(V3BvNtk* const, const V3NetId& id, V3PortableType&); 24 | void strashBvConstGate(V3BvNtk* const, const V3NetId& id, V3PortableType&); 25 | 26 | // Structural Hashing Sub-Functions for AIG Network 27 | const V3NetId strashAigNodeGate(V3AigNtk* const, const V3InputVec&, V3PortableType&); 28 | void strashAigNodeGate(V3AigNtk* const, const V3NetId&, V3PortableType&); 29 | 30 | // Structural Hashing Main Functions 31 | const V3NetId strashBvGate(V3BvNtk* const, const V3GateType&, const V3InputVec&, V3PortableType&); 32 | const V3NetId strashAigGate(V3AigNtk* const, const V3GateType&, const V3InputVec&, V3PortableType&); 33 | void strashBvGate(V3BvNtk* const, const V3NetId& id, V3PortableType&); 34 | void strashAigGate(V3AigNtk* const, const V3NetId&, V3PortableType&); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/ntk/v3NtkSimplify.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3NtkSimplify.cpp ] 3 | PackageName [ v3/src/ntk ] 4 | Synopsis [ Simplifications for V3 Network. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_NTK_SIMPLIFY_C 10 | #define V3_NTK_SIMPLIFY_C 11 | 12 | #include "v3NtkUtil.h" 13 | #include "v3NtkSimplify.h" 14 | 15 | /* -------------------------------------------------- *\ 16 | * Class V3NtkSimplify Implementations 17 | \* -------------------------------------------------- */ 18 | // Constructor and Destructor 19 | V3NtkSimplify::V3NtkSimplify(V3NtkHandler* const handler) : V3NtkHandler(handler) { 20 | assert (_handler); assert (!_ntk); _c2pMap.clear(); _p2cMap.clear(); 21 | // Duplicate Ntk 22 | _ntk = duplicateNtk(_handler, _p2cMap, _c2pMap); assert (_ntk); 23 | // Duplicate PO 24 | for (uint32_t i = 0; i < handler->getNtk()->getOutputSize(); ++i) { 25 | V3NetId id = handler->getNtk()->getOutput(i); assert (V3NetUD != _p2cMap[id.id]); 26 | _ntk->createOutput(V3NetId::makeNetId(_p2cMap[id.id].id, _p2cMap[id.id].cp ^ id.cp)); 27 | } 28 | // Reserve Mapping Tables if Needed 29 | if (!V3NtkHandler::P2CMapON()) _p2cMap.clear(); 30 | if (!V3NtkHandler::C2PMapON()) _c2pMap.clear(); 31 | } 32 | 33 | V3NtkSimplify::~V3NtkSimplify() { 34 | _c2pMap.clear(); _p2cMap.clear(); 35 | } 36 | 37 | // Net Ancestry Functions 38 | const V3NetId 39 | V3NtkSimplify::getParentNetId(const V3NetId& id) const { 40 | if (V3NetUD == id || _c2pMap.size() <= id.id) return V3NetUD; 41 | return (isV3NetInverted(id) ? getV3InvertNet(_c2pMap[id.id]) : _c2pMap[id.id]); 42 | } 43 | 44 | const V3NetId 45 | V3NtkSimplify::getCurrentNetId(const V3NetId& id, const uint32_t& index) const { 46 | if (V3NetUD == id || _p2cMap.size() <= id.id) return V3NetUD; 47 | return (isV3NetInverted(id) ? getV3InvertNet(_p2cMap[id.id]) : _p2cMap[id.id]); 48 | } 49 | 50 | #endif 51 | 52 | -------------------------------------------------------------------------------- /design/traffic/traffic.v: -------------------------------------------------------------------------------- 1 | /* 2 | Source : traffic/traffic 3 | Synopsis : A sample traffic light design. 4 | Authors : Cheng-Yin Wu, NTUGIEE 5 | Date : 2013/02/20 6 | Version : 1.0 7 | */ 8 | 9 | module trafficLight( 10 | // Property Output Ports 11 | p1, 12 | p2, 13 | p3, 14 | // General I/O Ports 15 | reset, 16 | clk, 17 | // Output Ports 18 | time_left 19 | ); 20 | 21 | // Parameters 22 | parameter RED = 0; 23 | parameter GREEN = 1; 24 | parameter YELLOW = 2; 25 | 26 | // Property Output Ports 27 | output p1; 28 | output p2; 29 | output p3; 30 | // General I/O Ports 31 | input reset; 32 | input clk; 33 | // Output Ports 34 | output [7:0] time_left; 35 | 36 | wire [5:0] RED_count; 37 | wire [5:0] GREEN_count; 38 | wire [2:0] YELLOW_count; 39 | 40 | reg [1:0] light; 41 | reg [7:0] counter; 42 | 43 | // Property Logics 44 | assign p1 = (light != RED) && (light != GREEN) && (light != YELLOW); 45 | assign p2 = ((light == RED) && (counter > RED_count)) || 46 | ((light == GREEN) && (counter > GREEN_count)) || 47 | ((light == YELLOW) && (counter > YELLOW_count)); 48 | assign p3 = light == YELLOW; 49 | 50 | // Combinational Assignments 51 | assign RED_count = 6'd60; 52 | assign GREEN_count = 6'd40; 53 | assign YELLOW_count = 3'd5; 54 | assign time_left = counter; 55 | 56 | always @(posedge clk) begin 57 | if (!reset) begin 58 | light <= RED; 59 | counter <= 8'd0; 60 | end 61 | else begin 62 | case (light) 63 | RED : light <= (counter == 8'd0) ? GREEN : RED; 64 | GREEN : light <= (counter == 8'd0) ? YELLOW : GREEN; 65 | default : light <= (counter == 8'd0) ? RED : YELLOW; 66 | endcase 67 | case (light) 68 | RED : counter <= (counter == 8'd0) ? GREEN_count : counter - 8'd1; 69 | GREEN : counter <= (counter == 8'd0) ? YELLOW_count : counter - 8'd1; 70 | default : counter <= (counter == 8'd0) ? RED_count : counter - 8'd1; 71 | endcase 72 | end 73 | end 74 | 75 | endmodule 76 | -------------------------------------------------------------------------------- /src/v3mc/v3MCReport.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3MCReport.cpp ] 3 | PackageName [ v3/src/v3mc ] 4 | Synopsis [ V3 Model Checker Verification Result Report. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_MC_REPORT_C 10 | #define V3_MC_REPORT_C 11 | 12 | #include "v3MCMain.h" 13 | 14 | // V3 Verification Result Report Functions 15 | void reportAigerCex(const uint32_t& inputSize, const uint32_t& latchSize, const V3CexTrace& cex, const string& prefix) { 16 | assert (cex.getTraceSize()); assert (prefix.size()); 17 | // Store Output for Each Cycle into String 18 | V3BitVecX initValue(latchSize ? latchSize : 1); 19 | V3BitVecX patternValue(inputSize ? inputSize : 1); 20 | // Report Cex in AIGER 1.9 Format 21 | V3VrfShared::printLock(); 22 | Msg(MSG_IFO) << "1" << endl; 23 | Msg(MSG_IFO) << prefix << endl; 24 | // Report Initial State 25 | if (latchSize) { 26 | if (cex.getInit()) initValue = cex.getInit()->bv_slice(latchSize - 1, 0); 27 | for (uint32_t k = 0; k < latchSize; ++k) Msg(MSG_IFO) << ('1' == initValue[k] ? '1' : '0'); 28 | } 29 | Msg(MSG_IFO) << endl; 30 | // Report Pattern Values 31 | for (uint32_t i = 0; i < cex.getTraceSize(); ++i) { 32 | if (inputSize) { 33 | patternValue = cex.getData(i).bv_slice(inputSize - 1, 0); 34 | for (uint32_t k = 0; k < inputSize; ++k) Msg(MSG_IFO) << ('1' == patternValue[k] ? '1' : '0'); 35 | } 36 | Msg(MSG_IFO) << endl; 37 | } 38 | Msg(MSG_IFO) << "." << endl; 39 | V3VrfShared::printUnlock(); 40 | } 41 | 42 | void reportAigerInv(const uint32_t& inputSize, const uint32_t& latchSize, const string& prefix) { 43 | assert (prefix.size()); 44 | // Report Inv in AIGER 1.9 Format 45 | V3VrfShared::printLock(); 46 | Msg(MSG_IFO) << "0" << endl; 47 | Msg(MSG_IFO) << prefix << endl; 48 | Msg(MSG_IFO) << "." << endl; 49 | V3VrfShared::printUnlock(); 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # source codes to be compiled 2 | SRCPKGS = cmd ntk alg stg ext io trans vrf dfx svr adt util v3mc 3 | 4 | # library to be linked (should include SRCPKGS) 5 | LIBPKGS = vrf dfx stg trans alg ext ntk io ntk svr cmd adt util v3mc 6 | 7 | # engine header files and libraries to be soft linked 8 | ENGPKGS += minisat 9 | ENGPKGS += boolector 10 | 11 | # front-end Verilog parser 12 | ENGPKGS += quteRTL 13 | 14 | # specific directories 15 | ENGSSRC = eng 16 | MAIN = main 17 | 18 | # libraries (if you come up with some readline undefined errors, try replacing -ltinfo with either -ltermcap or -lncurses) 19 | EXTLIBS = -lm -lz -lrt -lreadline -ltermcap -ldl -lgmp -lstdc++ 20 | SRCLIBS = $(addprefix -l, $(LIBPKGS)) $(addprefix -l, $(ENGPKGS)) 21 | 22 | # compile outputs 23 | EXEC = v3 24 | LIB = libv3.a 25 | 26 | all: srcLib 27 | @echo "Checking $(MAIN)..." 28 | @cd src/$(MAIN); make --no-print-directory EXTLIB="$(SRCLIBS) $(EXTLIBS)" EXEC=$(EXEC); cd ../.. ; 29 | # @strip $(EXEC) 30 | 31 | srcLib: engLib 32 | @for pkg in $(SRCPKGS); \ 33 | do \ 34 | echo "Checking $$pkg..."; \ 35 | cd src/$$pkg; make --no-print-directory PKGNAME=$$pkg; \ 36 | cd ../.. ; \ 37 | done 38 | 39 | engLib: 40 | @for pkg in $(ENGPKGS); \ 41 | do \ 42 | cd include ; ln -fs ../src/$(ENGSSRC)/$$pkg/* .; cd .. ; \ 43 | cd lib ; ln -fs ../src/$(ENGSSRC)/$$pkg/*.a .; cd .. ; \ 44 | done 45 | @rm -f include/*.a 46 | 47 | clean: 48 | @for pkg in $(SRCPKGS); \ 49 | do \ 50 | echo "Cleaning $$pkg..."; \ 51 | cd src/$$pkg; make --no-print-directory PKGNAME=$$pkg clean; \ 52 | cd ../.. ; \ 53 | done 54 | @echo "Cleaning $(MAIN)..." 55 | @cd src/$(MAIN); make --no-print-directory clean 56 | @echo "Removing $(EXEC)..." 57 | @rm -f $(EXEC) 58 | 59 | ctags: 60 | @rm -f src/tags 61 | @for pkg in $(SRCPKGS); \ 62 | do \ 63 | echo "Tagging $$pkg..."; \ 64 | cd src; ctags -a $$pkg/*.cpp $$pkg/*.h; cd ..; \ 65 | done 66 | @echo "Tagging $(MAIN)..." 67 | cd src; ctags -a $(MAIN)/*.cpp 68 | @echo "Tagging $(GUI)..." 69 | cd src; ctags -a $(GUI)/*.cpp 70 | 71 | rmdep: 72 | @for pkg in $(SRCPKGS); \ 73 | do \ 74 | rm src/$$pkg/.*.mak; \ 75 | done 76 | @rm src/main/.*.mak; 77 | -------------------------------------------------------------------------------- /src/vrf/.extheader.mak: -------------------------------------------------------------------------------- 1 | vrf.d: ../../include/v3VrfBase.h ../../include/v3VrfCmd.h ../../include/v3VrfIPDR.h ../../include/v3VrfMPDR.h ../../include/v3VrfKLive.h ../../include/v3VrfSIM.h ../../include/v3VrfCITP.h ../../include/v3VrfFITP.h ../../include/v3VrfResult.h ../../include/v3VrfSEC.h ../../include/v3VrfUMC.h ../../include/v3VrfBMC.h ../../include/v3VrfShared.h 2 | ../../include/v3VrfBase.h: v3VrfBase.h 3 | @rm -f ../../include/v3VrfBase.h 4 | @ln -fs ../src/vrf/v3VrfBase.h ../../include/v3VrfBase.h 5 | ../../include/v3VrfCmd.h: v3VrfCmd.h 6 | @rm -f ../../include/v3VrfCmd.h 7 | @ln -fs ../src/vrf/v3VrfCmd.h ../../include/v3VrfCmd.h 8 | ../../include/v3VrfIPDR.h: v3VrfIPDR.h 9 | @rm -f ../../include/v3VrfIPDR.h 10 | @ln -fs ../src/vrf/v3VrfIPDR.h ../../include/v3VrfIPDR.h 11 | ../../include/v3VrfMPDR.h: v3VrfMPDR.h 12 | @rm -f ../../include/v3VrfMPDR.h 13 | @ln -fs ../src/vrf/v3VrfMPDR.h ../../include/v3VrfMPDR.h 14 | ../../include/v3VrfKLive.h: v3VrfKLive.h 15 | @rm -f ../../include/v3VrfKLive.h 16 | @ln -fs ../src/vrf/v3VrfKLive.h ../../include/v3VrfKLive.h 17 | ../../include/v3VrfSIM.h: v3VrfSIM.h 18 | @rm -f ../../include/v3VrfSIM.h 19 | @ln -fs ../src/vrf/v3VrfSIM.h ../../include/v3VrfSIM.h 20 | ../../include/v3VrfCITP.h: v3VrfCITP.h 21 | @rm -f ../../include/v3VrfCITP.h 22 | @ln -fs ../src/vrf/v3VrfCITP.h ../../include/v3VrfCITP.h 23 | ../../include/v3VrfFITP.h: v3VrfFITP.h 24 | @rm -f ../../include/v3VrfFITP.h 25 | @ln -fs ../src/vrf/v3VrfFITP.h ../../include/v3VrfFITP.h 26 | ../../include/v3VrfResult.h: v3VrfResult.h 27 | @rm -f ../../include/v3VrfResult.h 28 | @ln -fs ../src/vrf/v3VrfResult.h ../../include/v3VrfResult.h 29 | ../../include/v3VrfSEC.h: v3VrfSEC.h 30 | @rm -f ../../include/v3VrfSEC.h 31 | @ln -fs ../src/vrf/v3VrfSEC.h ../../include/v3VrfSEC.h 32 | ../../include/v3VrfUMC.h: v3VrfUMC.h 33 | @rm -f ../../include/v3VrfUMC.h 34 | @ln -fs ../src/vrf/v3VrfUMC.h ../../include/v3VrfUMC.h 35 | ../../include/v3VrfBMC.h: v3VrfBMC.h 36 | @rm -f ../../include/v3VrfBMC.h 37 | @ln -fs ../src/vrf/v3VrfBMC.h ../../include/v3VrfBMC.h 38 | ../../include/v3VrfShared.h: v3VrfShared.h 39 | @rm -f ../../include/v3VrfShared.h 40 | @ln -fs ../src/vrf/v3VrfShared.h ../../include/v3VrfShared.h 41 | -------------------------------------------------------------------------------- /engine/minisat.script: -------------------------------------------------------------------------------- 1 | echo "########################################################################################################################"; 2 | echo "##### Please note that this script is designed for the installation of Minisat v2.2 core on git. #####"; 3 | echo "##### Thus the compatibility of the script with other Minisat versions is not always guaranteed. #####"; 4 | echo "########################################################################################################################"; 5 | 6 | # get Minisat package 7 | echo "Downloading Minisat ..." 8 | #rm -rf minisat; git clone https://github.com/niklasso/minisat.git; 9 | rm -rf minisat; wget https://github.com/niklasso/minisat/archive/master.zip; 10 | unzip master >& /dev/null; mv minisat-master minisat; rm -f master; 11 | 12 | # copy source code to a new directory 13 | echo "Copying files to minisat/v3_src ..."; 14 | cd minisat; rm -rf v3_src; mkdir v3_src; cd v3_src; 15 | cp -f ../minisat/core/* .; cp -f ../minisat/mtl/* .; cp -f ../minisat/utils/* .; 16 | 17 | # typedef Solver to MSolver 18 | echo "Modifying files under minisat/v3_src ..."; 19 | sed -i '/^}$/{ 20 | N 21 | N 22 | s/}\n\n#endif/typedef Solver MSolver;\n\n#endif/ } ' Solver.h 23 | 24 | # resolve header files 25 | sed -i 's/minisat\/mtl\///g' *; 26 | sed -i 's/minisat\/utils\///g' *; 27 | sed -i 's/minisat\/core\///g' *; 28 | 29 | # remove namespace (ad hoc, not general) 30 | sed -i '/^}$/{ 31 | N 32 | N 33 | s/}\n\n#endif/\n\n#endif/ } ' *.h; 34 | sed -i '/^}$/{ 35 | N 36 | N 37 | s/}\n\n\/\/---/\n\n\/\/---/ } ' System.h; 38 | sed -i 's/namespace Minisat {//g' *.h; 39 | sed -i 's/using namespace Minisat;//g' *.cc; 40 | sed -i 's/Minisat:://g' *.cc System.h; 41 | sed -i 's/} \/\/ namespace Minisat//g' *.cc IntMap.h; 42 | 43 | # build Minisat 44 | echo "Building Minisat ..."; 45 | cp ../../minisat.mk Makefile; export MROOT=./; gmake rs >& /dev/null; 46 | rm -f Main.or; ar cr libminisat.a *.or; rm -f v3_src* *.cc *.mk *.or; 47 | 48 | # create softlink from minisat/v3_src to src/eng/minisat 49 | echo "Creating softlink from minisat/v3_src to src/eng/minisat ..."; 50 | cd ../../../src/eng; rm -rf minisat; ln -s ../../engine/minisat/v3_src minisat; 51 | -------------------------------------------------------------------------------- /src/vrf/v3VrfKLive.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3VrfKLive.h ] 3 | PackageName [ v3/src/vrf ] 4 | Synopsis [ K-Liveness Algorithm. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2013-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_VRF_KLIVE_H 10 | #define V3_VRF_KLIVE_H 11 | 12 | #include "v3VrfBase.h" 13 | 14 | // class V3VrfKLive : Verification Handler for K-Liveness 15 | class V3VrfKLive : public V3VrfBase 16 | { 17 | public : 18 | // Constructor and Destructor 19 | V3VrfKLive(const V3NtkHandler* const); 20 | ~V3VrfKLive(); 21 | // KLive Model Checker Setting Functions 22 | inline void setIncDepth(const uint32_t& i) { _incDepth = i; } 23 | inline void setChecker(V3VrfBase* const c) { _klChecker = c; } 24 | // KLive Network Retrieval Functions 25 | // NOTE: An extra primary output is augmented for K-Liveness checks 26 | inline V3NtkHandler* const getKLHandler() const { return _klHandler; } 27 | private : 28 | // Private Verification Main Functions 29 | void startVerify(const uint32_t&); 30 | // Private KLive Network Transformation Functions 31 | void attachNetwork(const uint32_t&); 32 | void simplifyNetwork(const uint32_t&); 33 | void initializeNetwork(const uint32_t&); 34 | void updateOutput(const uint32_t&); 35 | // Private KLive Helper Functions 36 | const bool isValidChecker() const; 37 | // Private Data Members 38 | V3NtkHandler* _klHandler; // KLiveness Network Handler 39 | V3Ntk* _klNtk; // KLiveness Network 40 | V3VrfBase* _klChecker; // Formal Engine for KLiveness 41 | uint32_t _incDepth; // Increment Depth 42 | V3NetVec _klNetList; // List of V3NetId for K-Liveness Signals 43 | // Statistics 44 | V3Stat* _totalStat; // Total Statistic 45 | V3Stat* _checkStat; // Formal Checking 46 | V3Stat* _ntkGenStat; // Network Generation 47 | }; 48 | 49 | #endif 50 | 51 | -------------------------------------------------------------------------------- /src/ntk/v3NtkRewrite.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3NtkRewrite.h ] 3 | PackageName [ v3/src/ntk ] 4 | Synopsis [ Implementation of Rule-based Rewriting. ] 5 | Author [ Mao-Kai (Nanny) Huang, Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2013-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_NTK_REWRITE_H 10 | #define V3_NTK_REWRITE_H 11 | 12 | #include "v3NtkUtil.h" 13 | 14 | // Rewrite Sub-Functions 15 | const bool rewrite_AND (V3BvNtk * const, V3GateType&, V3InputVec&, V3PortableType&); 16 | const bool rewrite_XOR (V3BvNtk * const, V3GateType&, V3InputVec&, V3PortableType&); 17 | const bool rewrite_ADD (V3BvNtk * const, V3GateType&, V3InputVec&, V3PortableType&); 18 | const bool rewrite_SUB (V3BvNtk * const, V3GateType&, V3InputVec&, V3PortableType&); 19 | const bool rewrite_MULT (V3BvNtk * const, V3GateType&, V3InputVec&, V3PortableType&); 20 | const bool rewrite_DIV (V3BvNtk * const, V3GateType&, V3InputVec&, V3PortableType&); 21 | const bool rewrite_MODULO (V3BvNtk * const, V3GateType&, V3InputVec&, V3PortableType&); 22 | const bool rewrite_SHL (V3BvNtk * const, V3GateType&, V3InputVec&, V3PortableType&); 23 | const bool rewrite_SHR (V3BvNtk * const, V3GateType&, V3InputVec&, V3PortableType&); 24 | const bool rewrite_MERGE (V3BvNtk * const, V3GateType&, V3InputVec&, V3PortableType&); 25 | const bool rewrite_EQUALITY(V3BvNtk * const, V3GateType&, V3InputVec&, V3PortableType&); 26 | const bool rewrite_GEQ (V3BvNtk * const, V3GateType&, V3InputVec&, V3PortableType&); 27 | const bool rewrite_RED_AND (V3BvNtk * const, V3GateType&, V3InputVec&, V3PortableType&); 28 | const bool rewrite_RED_OR (V3BvNtk * const, V3GateType&, V3InputVec&, V3PortableType&); 29 | const bool rewrite_RED_XOR (V3BvNtk * const, V3GateType&, V3InputVec&, V3PortableType&); 30 | const bool rewrite_MUX (V3BvNtk * const, V3GateType&, V3InputVec&, V3PortableType&); 31 | const bool rewrite_SLICE (V3BvNtk * const, V3GateType&, V3InputVec&, V3PortableType&); 32 | const bool rewrite_CONST (V3BvNtk * const, V3GateType&, V3InputVec&, V3PortableType&); 33 | const bool rewrite_AIG_NODE(V3AigNtk* const, V3GateType&, V3InputVec&, V3PortableType&); 34 | 35 | // Rewrite Main Functions 36 | const bool rewriteBvGate (V3BvNtk * const, V3GateType&, V3InputVec&, V3PortableType&); 37 | const bool rewriteAigGate (V3AigNtk* const, V3GateType&, V3InputVec&, V3PortableType&); 38 | 39 | #endif 40 | 41 | -------------------------------------------------------------------------------- /src/util/v3FileUtil.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3FileUtil.h ] 3 | PackageName [ v3/src/util ] 4 | Synopsis [ V3 File and Directory Manipulation Functions ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_FILE_UTIL_H 10 | #define V3_FILE_UTIL_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #define DIR_MOD_MASK 0777 22 | 23 | static inline const char* v3GetExecPath() { 24 | char buf[PATH_MAX + 1]; 25 | if (readlink("/proc/self/exe", buf, sizeof(buf) - 1) == -1) return NULL; 26 | string str = buf; 27 | return str.substr(0, str.rfind('/')).c_str(); 28 | } 29 | 30 | static inline const char* v3GetAbsPath(const char* fileName) { 31 | // Note that we didn't check if the fileName exists, i.e. return value of realpath() 32 | if (!fileName) return 0; 33 | char AbsPath[4096]; realpath(fileName, AbsPath); 34 | char* absPath = (char*)(malloc(sizeof(char) * (strlen(AbsPath) + 1))); 35 | strcpy(absPath, AbsPath); 36 | return absPath; 37 | } 38 | 39 | static inline bool v3ExistDir(const char* dirName) { 40 | struct stat st; 41 | return (stat(dirName,&st) == 0); 42 | } 43 | 44 | static inline void v3DeleteDir(const char* dirName) { 45 | // Lazy version... 46 | char* cmd = new char[100]; 47 | strcpy(cmd, "rm -rf "); 48 | strcat(cmd, dirName); 49 | system(cmd); 50 | } 51 | 52 | static inline bool v3CreateDir(const char* dirName, bool replace = true) { 53 | if (v3ExistDir(dirName)) { 54 | if (!replace) return false; 55 | else v3DeleteDir(dirName); 56 | } 57 | int temp = umask(0); 58 | if ((temp = mkdir(dirName, DIR_MOD_MASK)) != 0) return false; 59 | return true; 60 | } 61 | 62 | // Format Transformation 63 | static inline void dotToPng(const string fileName) { 64 | const string name = ".v3." + fileName + ".png"; 65 | const string cmd = "dot -Tpng " + fileName + " -o " + name + "; mv " + name + " " + fileName; 66 | system(cmd.c_str()); 67 | } 68 | 69 | static inline void dotToPs(const string fileName) { 70 | const string name = ".v3." + fileName + ".ps"; 71 | const string cmd = "dot -Tps " + fileName + " -o " + name + "; mv " + name + " " + fileName; 72 | system(cmd.c_str()); 73 | } 74 | 75 | #endif 76 | 77 | -------------------------------------------------------------------------------- /src/vrf/v3VrfUMC.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3VrfUMC.h ] 3 | PackageName [ v3/src/vrf ] 4 | Synopsis [ Unbounded Model Checking on V3 Ntk. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_VRF_UMC_H 10 | #define V3_VRF_UMC_H 11 | 12 | #include "v3VrfBase.h" 13 | 14 | // class V3VrfUMC : Verification Handler for Unbounded Model Checking 15 | class V3VrfUMC : public V3VrfBase 16 | { 17 | public : 18 | // Constructor and Destructor 19 | V3VrfUMC(const V3NtkHandler* const); 20 | ~V3VrfUMC(); 21 | // UMC Specific Functions 22 | inline void setPreDepth(const uint32_t& d) { _preDepth = d; } 23 | inline void setIncDepth(const uint32_t& d) { _incDepth = d; } 24 | inline void setFireOnly (const bool& f) { if (f) _umcAttr |= 1ul; else _umcAttr &= ~1ul; } 25 | inline void setProveOnly (const bool& p) { if (p) _umcAttr |= 2ul; else _umcAttr &= ~2ul; } 26 | inline void setUniqueness(const bool& u) { if (u) _umcAttr |= 4ul; else _umcAttr &= ~4ul; } 27 | inline void setDynamicInc(const bool& d) { if (d) _umcAttr |= 8ul; else _umcAttr &= ~8ul; } 28 | private : 29 | // Private Verification Main Functions 30 | void startVerify(const uint32_t&); 31 | void addUniqueness(const uint32_t&, const uint32_t&, const bool& = false); 32 | void computeLatchBoundsForUniqueness(const uint32_t&); 33 | const bool generateAndAddUniquenessBound(const uint32_t&); 34 | // UMC Specific Helper Functions 35 | inline const bool isFireOnly () { return _umcAttr & 1ul; } 36 | inline const bool isProveOnly () { return _umcAttr & 2ul; } 37 | inline const bool isUniqueness() { return _umcAttr & 4ul; } 38 | inline const bool isDynamicInc() { return _umcAttr & 8ul; } 39 | // Private Data Members 40 | uint32_t _preDepth; // Pre-Run Depth (default = 0) 41 | uint32_t _incDepth; // Increment Depth (default = 1) 42 | unsigned char _umcAttr; // Special Settings for UMC 43 | V3SvrBase* _solver; // Single Instance SAT Solver 44 | // Uniqueness Constraints 45 | V3UI32Vec _uniList; // List of Uniqueness Bounds (Indexed by uniIndex) 46 | V3UI32Vec _uniLatch; // Upper Bound of Depth for the Existence of Latch in the Solver 47 | V3SvrDataTable _uniAssump; // Assumptions to Enable Uniqueness for Every Pair [depth][uniIndex] 48 | }; 49 | 50 | #endif 51 | 52 | -------------------------------------------------------------------------------- /src/main/main.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ main.cpp ] 3 | PackageName [ main ] 4 | Synopsis [ Main Function ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_MAIN_C 10 | #define V3_MAIN_C 11 | 12 | #include "v3Usage.h" 13 | #include "v3CmdMgr.h" 14 | #include "v3StrUtil.h" 15 | #include "v3NtkHandler.h" 16 | 17 | // Global Variables for V3MsgMgr 18 | string V3Msg::_allName = ""; 19 | ofstream V3Msg::_allout; 20 | V3MsgMgr Msg; 21 | 22 | // Global Variable for V3Usage 23 | V3Usage v3Usage; 24 | 25 | // Global Variable for V3CmdMgr 26 | V3CmdMgr* v3CmdMgr = new V3CmdMgr("v3"); 27 | 28 | // Global Variable for V3Handler 29 | V3Handler v3Handler; 30 | 31 | // Various Commands Registration 32 | extern bool initAlgCmd(); 33 | extern bool initDfxCmd(); 34 | extern bool initNtkCmd(); 35 | extern bool initStgCmd(); 36 | extern bool initVrfCmd(); 37 | extern bool initV3MCCmd(); 38 | extern bool initTransCmd(); 39 | extern bool initCommonCmd(); 40 | 41 | // Program Usage 42 | static void usage() { 43 | Msg(MSG_IFO) << "Usage: [ -File < dofile > ]" << endl; exit(-1); 44 | } 45 | 46 | int main(int argc, char** argv) { 47 | bool dof = false; 48 | string dofile = ""; 49 | 50 | // Set Random Number Seed 51 | srand(time(NULL)); 52 | 53 | // Register Commands 54 | if (!(initAlgCmd() && initDfxCmd() && initNtkCmd() && initStgCmd() && initVrfCmd() && 55 | initV3MCCmd() && initTransCmd() && initCommonCmd())) { 56 | Msg(MSG_ERR) << "Command Register Failed !!!" << endl; exit(0); 57 | } 58 | 59 | for (int i = 1; i < argc; ++i) { 60 | if (v3StrNCmp("-File", argv[i], 2) == 0) { 61 | if (dof) { Msg(MSG_ERR) << "Extra Argument \"" << argv[i] << "\" !!" << endl; usage(); } 62 | else dof = true; 63 | } 64 | else if (dof && !dofile.size()) dofile = argv[i]; 65 | else { Msg(MSG_ERR) << "Unknown Argument \"" << argv[i] << "\" !!" << endl; usage(); } 66 | } 67 | 68 | // Dofile 69 | if (dof) { 70 | if (dofile.size() == 0) { Msg(MSG_ERR) << "Missing Argument \"< dofile >\" !!" << endl; usage(); } 71 | else if (!v3CmdMgr->openDofile(dofile.c_str())) { 72 | Msg(MSG_ERR) << "Cannot Open File \"" << dofile << "\" !!" << endl; usage(); 73 | } 74 | } 75 | // Start Program 76 | V3CmdExecStatus status = CMD_EXEC_DONE; 77 | while (status != CMD_EXEC_QUIT) { 78 | v3CmdMgr->setPrompt(); 79 | status = v3CmdMgr->execOneCmd(); 80 | cout << endl; 81 | } 82 | return 0; 83 | } 84 | 85 | #endif 86 | 87 | -------------------------------------------------------------------------------- /src/ntk/v3NtkInput.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3NtkInput.cpp ] 3 | PackageName [ v3/src/ntk ] 4 | Synopsis [ Base Input Handler for V3 Ntk. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_NTK_INPUT_C 10 | #define V3_NTK_INPUT_C 11 | 12 | #include "v3Msg.h" 13 | #include "v3NtkUtil.h" 14 | #include "v3NtkInput.h" 15 | 16 | /* -------------------------------------------------- *\ 17 | * Class V3Parser Implementations 18 | \* -------------------------------------------------- */ 19 | // Constructor and Destructor 20 | V3NtkInput::V3NtkInput(const bool& isAig, const string& name) : V3NtkHandler(0, createV3Ntk(!isAig)) { 21 | assert (_ntk); if (name.size()) setNtkName(name); 22 | _nameHash.insert(make_pair("0", V3NetId::makeNetId(0))); _netHash.insert(make_pair(0, "0")); 23 | } 24 | 25 | V3NtkInput::~V3NtkInput() { 26 | } 27 | 28 | // Net Ancestry Functions 29 | const V3NetId 30 | V3NtkInput::createNet(const string& netName, uint32_t width) { 31 | assert (width); 32 | V3NetId id = (netName.size()) ? getNetId(netName) : V3NetUD; 33 | if (id == V3NetUD) { 34 | id = _ntk->createNet(width); assert (V3NetUD != id); 35 | if (netName.size()) { 36 | _nameHash.insert(make_pair(netName, id)); 37 | _netHash.insert(make_pair(id.id, netName)); 38 | } 39 | return id; 40 | } 41 | else if (width == _ntk->getNetWidth(id)) return id; 42 | Msg(MSG_ERR) << "Existing net \"" << netName << "\" has width = " << _ntk->getNetWidth(id) << " != " << width << endl; 43 | return V3NetUD; 44 | } 45 | 46 | const V3NetId 47 | V3NtkInput::getNetId(const string& netName) const { 48 | V3StrNetHash::const_iterator it = _nameHash.find(netName); 49 | return (it != _nameHash.end()) ? it->second : V3NetUD; 50 | } 51 | 52 | // Extended Helper Functions 53 | void 54 | V3NtkInput::removePrefixNetName(V3Str2BoolFuncPtr toRemove) { 55 | assert (_nameHash.size() == _netHash.size()); 56 | V3NetStrHash::iterator it = _netHash.begin(); 57 | while (_netHash.end() != it) { 58 | if (!toRemove(it->second)) ++it; 59 | else { 60 | assert (_nameHash.end() != _nameHash.find(it->second)); 61 | assert (it->first == _nameHash.find(it->second)->second.id); 62 | _nameHash.erase(_nameHash.find(it->second)); _netHash.erase(it++); 63 | } 64 | } 65 | assert (_nameHash.size() == _netHash.size()); 66 | } 67 | 68 | void 69 | V3NtkInput::renderFreeNetAsInput() { 70 | V3NetId id = V3NetId::makeNetId(1); assert (!_ntk->getInputSize()); 71 | for (uint32_t i = 1; i < _ntk->getNetSize(); ++i, ++id.id) { 72 | if (V3_PI != _ntk->getGateType(id)) continue; 73 | assert (i == id.id); _ntk->createInput(id); 74 | } 75 | } 76 | 77 | #endif 78 | 79 | -------------------------------------------------------------------------------- /src/ext/v3LTLFormula.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3LTLFormula.h ] 3 | PackageName [ v3/src/ext ] 4 | Synopsis [ V3 LTL Formula. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_LTL_FORMULA_H 10 | #define V3_LTL_FORMULA_H 11 | 12 | #include "v3Formula.h" 13 | 14 | // Forward Declaration 15 | class V3Formula; 16 | 17 | enum V3LTLOpType { 18 | V3_LTL_P = 0, V3_LTL_T_G, V3_LTL_T_F, V3_LTL_T_X, V3_LTL_T_U, V3_LTL_T_R, 19 | V3_LTL_L_NEG, V3_LTL_L_AND, V3_LTL_L_IMPLY, V3_LTL_TOTAL 20 | }; 21 | 22 | // V3LTLFormula : LTL Formula Storage 23 | class V3LTLFormula 24 | { 25 | public : 26 | // Constructor and Destructor 27 | V3LTLFormula(V3NtkHandler* const, const string&, const string& = ""); 28 | V3LTLFormula(const V3LTLFormula&, const string& = ""); 29 | ~V3LTLFormula(); 30 | // Constructor for Simple Property (AGp and AFp) 31 | V3LTLFormula(V3NtkHandler* const, const V3NetId&, const bool&, const string& = ""); 32 | // Inline LTL Formula Interface Functions 33 | inline V3NtkHandler* const getHandler() const { return _handler; } 34 | inline const string& getName() const { return _name; } 35 | inline const bool isValid() const { return _rootId < _formula.size(); } 36 | inline const bool isValid(const uint32_t& i) const { return i < _formula.size(); } 37 | inline const bool isLeaf(const uint32_t& i) const { assert (isValid(i)); return V3_LTL_P == _formula[i].first; } 38 | inline const V3LTLOpType& getOpType(const uint32_t& i) const { assert (!isLeaf(i)); return _formula[i].first; } 39 | inline V3Formula* const getFormula(const uint32_t& i) const { 40 | assert (isLeaf(i)); assert (1 == _formula[i].second.size()); return (V3Formula*)(_formula[i].second[0]); } 41 | inline const uint32_t getBranchSize(const uint32_t& i) const { 42 | assert (!isLeaf(i)); return _formula[i].second.size(); } 43 | inline const uint32_t getBranchIndex(const uint32_t& i, const uint32_t& j) const { 44 | assert (!isLeaf(i)); assert (j < getBranchSize(i)); return (uint32_t)(_formula[i].second[j]); } 45 | inline const uint32_t getRoot() const { assert (isValid()); return _rootId; } 46 | // Restricted Copy Functions 47 | V3LTLFormula* const createSuccessor(V3NtkHandler* const) const; 48 | // Elaboration Functions 49 | void collectLeafFormula(V3UI32Set&) const; 50 | private : 51 | typedef pair V3LTLFormulaNode; 52 | typedef V3Vec::Vec V3LTLFormulaList; 53 | // Formula Expression Lexing Functions 54 | const uint32_t lexLTLFormula(const string&); 55 | // Private Data Members 56 | V3NtkHandler* const _handler; 57 | const string _name; 58 | V3LTLFormulaList _formula; 59 | uint32_t _rootId; 60 | }; 61 | 62 | #endif 63 | 64 | -------------------------------------------------------------------------------- /src/dfx/v3DfxTrace.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3DfxTrace.h ] 3 | PackageName [ v3/src/dfx ] 4 | Synopsis [ Counterexample Trace Manipulation. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_DFX_TRACE_H 10 | #define V3_DFX_TRACE_H 11 | 12 | #include "v3VrfCITP.h" 13 | #include "v3NtkHandler.h" 14 | 15 | // class V3DfxCube : Cube Data Structue for Counterexample Optimization 16 | // NOTE: State Variables are Intrinsically Sorted by their Cut Signal Indices (less) 17 | class V3DfxCube 18 | { 19 | public : 20 | V3DfxCube(const uint32_t& f) : _frameId(f) { _stateId.clear(); _signature = 0; } 21 | ~V3DfxCube() { _stateId.clear(); } 22 | // Cube Setting Functions 23 | inline void setState(const V3NetVec&); 24 | inline const V3NetVec& getState() const { return _stateId; } 25 | inline const uint64_t getSignature() const { return _signature; } 26 | inline const uint32_t getFrameId() const { return _frameId; } 27 | private : 28 | // Private Cube Data 29 | const uint32_t _frameId; // Counterexample Frame of the Cube 30 | V3NetVec _stateId; // Cut Signal Index (id) with Value (cp) 31 | uint64_t _signature; // Subsumption Marker 32 | }; 33 | 34 | // Inline Function Implementations of Cube Setting Functions 35 | inline void V3DfxCube::setState(const V3NetVec& v) { 36 | _stateId = v; _signature = 0; 37 | for (uint32_t i = 0; i < _stateId.size(); ++i) _signature |= (1ul << (_stateId[i].id % 64)); } 38 | 39 | // Defines for Sorted Dfx Cube List 40 | struct V3DfxCubeCompare { 41 | const bool operator() (const V3DfxCube* const s1, const V3DfxCube* const s2) const { 42 | const V3NetVec& state1 = s1->getState(); 43 | const V3NetVec& state2 = s2->getState(); 44 | uint32_t i = 0; 45 | // Render the One with Larger Leading Id the Latter 46 | while (i < state1.size() && i < state2.size()) { 47 | assert (!i || (state1[i].id > state1[i-1].id)); 48 | assert (!i || (state2[i].id > state2[i-1].id)); 49 | if (state1[i].id == state2[i].id) { 50 | if (state1[i].cp == state2[i].cp) ++i; 51 | else return state1[i].cp < state2[i].cp; 52 | } 53 | else return state1[i].id < state2[i].id; 54 | } 55 | // Render the One with Less Variables the Latter 56 | return (state2.size() > i); //return (state1.size() <= i); 57 | } 58 | }; 59 | 60 | typedef V3Set::Set V3DfxCubeList; 61 | 62 | // Counterexample Trace Utility Functions 63 | void computeTraceData(V3NtkHandler* const, const V3CexTrace&, V3SimTraceVec&, V3SimTraceVec&); 64 | 65 | // Counterexample Trace Optimization Functions 66 | void performTraceReduction(V3NtkHandler* const, V3Property* const); 67 | void performTraceGeneralization(V3NtkHandler* const, V3Property* const); 68 | 69 | #endif 70 | 71 | -------------------------------------------------------------------------------- /src/trans/v3BvBlastAig.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3BvBlastAig.h ] 3 | PackageName [ v3/src/trans ] 4 | Synopsis [ Bit Blasting of BV Network to AIG Network. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_BV_BLAST_AIG_H 10 | #define V3_BV_BLAST_AIG_H 11 | 12 | #include "v3NtkHandler.h" 13 | 14 | // class V3BvBlastAig : Bit Blast BV to AIG 15 | class V3BvBlastAig : public V3NtkHandler 16 | { 17 | public : 18 | // Constructor and Destructor 19 | V3BvBlastAig(V3NtkHandler* const); 20 | ~V3BvBlastAig(); 21 | // I/O Ancestry Functions 22 | const string getInputName(const uint32_t&) const; 23 | const string getOutputName(const uint32_t&) const; 24 | const string getInoutName(const uint32_t&) const; 25 | // Net Ancestry Functions 26 | void getNetName(V3NetId&, string&) const; 27 | const V3NetId getNetFromName(const string&) const; 28 | const V3NetId getParentNetId(const V3NetId&) const; 29 | const V3NetId getCurrentNetId(const V3NetId&, const uint32_t&) const; 30 | private : 31 | // Ancestry Helper Functions 32 | const uint32_t getParentIndex(const V3NetId&) const; 33 | // Transformation Functions 34 | void performNtkTransformation(); 35 | // Transformation Helper Functions 36 | void bitBlast_FF(const V3BvNtk* const, const V3NetId&); 37 | void bitBlast_RED_AND(const V3BvNtk* const, const V3NetId&); 38 | void bitBlast_RED_OR(const V3BvNtk* const, const V3NetId&); 39 | void bitBlast_RED_XOR(const V3BvNtk* const, const V3NetId&); 40 | void bitBlast_AND(const V3BvNtk* const, const V3NetId&); 41 | void bitBlast_XOR(const V3BvNtk* const, const V3NetId&); 42 | void bitBlast_ADD(const V3BvNtk* const, const V3NetId&); 43 | void bitBlast_SUB(const V3BvNtk* const, const V3NetId&); 44 | void bitBlast_MULT(const V3BvNtk* const, const V3NetId&); 45 | void bitBlast_DIV(const V3BvNtk* const, const V3NetId&); 46 | void bitBlast_MODULO(const V3BvNtk* const, const V3NetId&); 47 | void bitBlast_SHL(const V3BvNtk* const, const V3NetId&); 48 | void bitBlast_SHR(const V3BvNtk* const, const V3NetId&); 49 | void bitBlast_MERGE(const V3BvNtk* const, const V3NetId&); 50 | void bitBlast_EQUALITY(const V3BvNtk* const, const V3NetId&); 51 | void bitBlast_GEQ(const V3BvNtk* const, const V3NetId&); 52 | void bitBlast_MUX(const V3BvNtk* const, const V3NetId&); 53 | void bitBlast_SLICE(const V3BvNtk* const, const V3NetId&); 54 | void bitBlast_CONST(const V3BvNtk* const, const V3NetId&); 55 | // Divider / Modular Helper Functions 56 | void bitBlast_DIV_MODULO(const V3BvNtk* const, const V3NetId&, const bool&); 57 | // Private Members 58 | V3NetVec _c2pMap; // V3NetId Mapping From Current to Parent Ntk 59 | V3NetTable _p2cMap; // V3NetId Mapping From Parent to Current Ntk 60 | }; 61 | 62 | #endif 63 | 64 | -------------------------------------------------------------------------------- /src/adt/v3Misc.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3Misc.h ] 3 | PackageName [ v3/src/adt ] 4 | Synopsis [ Definition of Miscellaneous Types. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_MISC_H 10 | #define V3_MISC_H 11 | 12 | #include "v3Map.h" 13 | #include "v3Set.h" 14 | #include "v3Vec.h" 15 | #include "v3List.h" 16 | #include "v3Hash.h" 17 | #include "v3Type.h" 18 | #include "v3Queue.h" 19 | #include "v3Stack.h" 20 | 21 | #include 22 | 23 | // Defines for General Arrays 24 | typedef V3Vec::Vec V3BoolVec; 25 | typedef V3Vec::Vec V3IntVec; 26 | typedef V3Vec::Vec V3PtrVec; 27 | typedef V3Vec::Vec V3DblVec; 28 | typedef V3Vec::Vec V3StrVec; 29 | typedef V3Vec::Vec V3UI32Vec; 30 | typedef V3Vec::Vec V3UI64Vec; 31 | 32 | // Defines for General Tables 33 | typedef V3Vec::Vec V3StrTable; 34 | typedef V3Vec::Vec V3BoolTable; 35 | typedef V3Vec::Vec V3UI32Table; 36 | 37 | // Defines for General Sets 38 | typedef V3Set::Set V3StrSet; 39 | typedef V3Set::Set V3UI32Set; 40 | 41 | // Defines for General Queues 42 | typedef V3Queue::Queue V3UI32Queue; 43 | 44 | // Defines for General Stacks 45 | typedef V3Stack::Stack V3UI32Stack; 46 | 47 | // Defines for General Compare Functions 48 | template 49 | struct V3UI32LessOrEq { const bool operator() (const T& i, const T& j) const { return i <= j; } }; 50 | 51 | // class V3PortableType : Portable Type for Dynamic Allocation 52 | // NOTE : Data in _list will not be freed by the destructor !! 53 | class V3PortableType { 54 | public : 55 | // Constructor and Destructor 56 | V3PortableType(const uint32_t& s = 0, const uint32_t& f = 0) : _size(s), _shift(f) { 57 | _list.clear(); _list.reserve(s); _index.clear(); _index.reserve(s); 58 | for (uint32_t i = 0; i < s; ++i) _index.push_back(V3NtkUD); 59 | } 60 | ~V3PortableType() { _list.clear(); _index.clear(); } 61 | // Inline Member Functions 62 | inline const bool existList(const uint32_t& i) const { 63 | assert (i >= _shift); assert (i < (_shift + _size)); return (V3NtkUD != _index[i - _shift]); } 64 | inline const size_t& getList(const uint32_t& i) const { 65 | assert (existList(i)); return _list[_index[i - _shift]]; } 66 | inline void setList(const uint32_t& i, const size_t& t) { 67 | assert (!existList(i)); _index[i - _shift] = _list.size(); _list.push_back(t); } 68 | // Operator Overloads 69 | V3PortableType& operator = (const V3PortableType& t) { 70 | *(const_cast(&_size)) = t._size; 71 | *(const_cast(&_shift)) = t._shift; 72 | _list = t._list; _index = t._index; return *this; 73 | } 74 | private : 75 | const uint32_t _size; 76 | const uint32_t _shift; 77 | V3PtrVec _list; 78 | V3UI32Vec _index; 79 | }; 80 | 81 | #endif 82 | 83 | -------------------------------------------------------------------------------- /src/trans/.depend.mak: -------------------------------------------------------------------------------- 1 | v3BvBlastAig.o: v3BvBlastAig.cpp ../../include/v3Msg.h \ 2 | ../../include/v3NtkUtil.h ../../include/v3NtkHandler.h \ 3 | ../../include/v3Ntk.h ../../include/v3Misc.h ../../include/v3Map.h \ 4 | ../../include/v3Set.h ../../include/v3Vec.h ../../include/v3List.h \ 5 | ../../include/v3Hash.h ../../include/v3HashUtil.h \ 6 | ../../include/v3Type.h ../../include/v3IntType.h \ 7 | ../../include/v3Queue.h ../../include/v3Stack.h \ 8 | ../../include/v3BitVec.h ../../include/v3StrUtil.h v3BvBlastAig.h \ 9 | ../../include/v3NtkHandler.h v3BvBlastAigHelper.h ../../include/v3Ntk.h 10 | v3BvBlastBv.o: v3BvBlastBv.cpp ../../include/v3NtkUtil.h \ 11 | ../../include/v3NtkHandler.h ../../include/v3Ntk.h \ 12 | ../../include/v3Misc.h ../../include/v3Map.h ../../include/v3Set.h \ 13 | ../../include/v3Vec.h ../../include/v3List.h ../../include/v3Hash.h \ 14 | ../../include/v3HashUtil.h ../../include/v3Type.h \ 15 | ../../include/v3IntType.h ../../include/v3Queue.h \ 16 | ../../include/v3Stack.h ../../include/v3BitVec.h \ 17 | ../../include/v3StrUtil.h v3BvBlastBv.h ../../include/v3NtkHandler.h 18 | v3NtkExpand.o: v3NtkExpand.cpp ../../include/v3Msg.h \ 19 | ../../include/v3NtkUtil.h ../../include/v3NtkHandler.h \ 20 | ../../include/v3Ntk.h ../../include/v3Misc.h ../../include/v3Map.h \ 21 | ../../include/v3Set.h ../../include/v3Vec.h ../../include/v3List.h \ 22 | ../../include/v3Hash.h ../../include/v3HashUtil.h \ 23 | ../../include/v3Type.h ../../include/v3IntType.h \ 24 | ../../include/v3Queue.h ../../include/v3Stack.h \ 25 | ../../include/v3BitVec.h ../../include/v3StrUtil.h v3NtkExpand.h \ 26 | ../../include/v3NtkHandler.h 27 | v3NtkFlatten.o: v3NtkFlatten.cpp ../../include/v3Msg.h \ 28 | ../../include/v3NtkUtil.h ../../include/v3NtkHandler.h \ 29 | ../../include/v3Ntk.h ../../include/v3Misc.h ../../include/v3Map.h \ 30 | ../../include/v3Set.h ../../include/v3Vec.h ../../include/v3List.h \ 31 | ../../include/v3Hash.h ../../include/v3HashUtil.h \ 32 | ../../include/v3Type.h ../../include/v3IntType.h \ 33 | ../../include/v3Queue.h ../../include/v3Stack.h \ 34 | ../../include/v3BitVec.h ../../include/v3StrUtil.h v3NtkFlatten.h \ 35 | ../../include/v3NtkHandler.h 36 | v3NtkMiter.o: v3NtkMiter.cpp ../../include/v3Msg.h \ 37 | ../../include/v3NtkUtil.h ../../include/v3NtkHandler.h \ 38 | ../../include/v3Ntk.h ../../include/v3Misc.h ../../include/v3Map.h \ 39 | ../../include/v3Set.h ../../include/v3Vec.h ../../include/v3List.h \ 40 | ../../include/v3Hash.h ../../include/v3HashUtil.h \ 41 | ../../include/v3Type.h ../../include/v3IntType.h \ 42 | ../../include/v3Queue.h ../../include/v3Stack.h \ 43 | ../../include/v3BitVec.h ../../include/v3StrUtil.h v3NtkMiter.h \ 44 | ../../include/v3NtkHandler.h ../../include/v3NtkSimplify.h 45 | v3TransCmd.o: v3TransCmd.cpp ../../include/v3Msg.h \ 46 | ../../include/v3NtkUtil.h ../../include/v3NtkHandler.h \ 47 | ../../include/v3Ntk.h ../../include/v3Misc.h ../../include/v3Map.h \ 48 | ../../include/v3Set.h ../../include/v3Vec.h ../../include/v3List.h \ 49 | ../../include/v3Hash.h ../../include/v3HashUtil.h \ 50 | ../../include/v3Type.h ../../include/v3IntType.h \ 51 | ../../include/v3Queue.h ../../include/v3Stack.h \ 52 | ../../include/v3BitVec.h ../../include/v3StrUtil.h v3NtkMiter.h \ 53 | ../../include/v3NtkHandler.h v3TransCmd.h ../../include/v3CmdMgr.h \ 54 | v3NtkExpand.h v3BvBlastBv.h v3BvBlastAig.h v3NtkFlatten.h 55 | -------------------------------------------------------------------------------- /src/ext/v3Formula.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3Formula.h ] 3 | PackageName [ v3/src/ext ] 4 | Synopsis [ V3 External Formula. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_FORMULA_H 10 | #define V3_FORMULA_H 11 | 12 | #include "v3AlgType.h" 13 | #include "v3NtkHandler.h" 14 | 15 | // Defines 16 | typedef V3Map >::Map V3OperatorMap; 17 | 18 | // V3Formula : External Formula Storage 19 | class V3Formula 20 | { 21 | public : 22 | // Constructor and Destructor 23 | V3Formula(V3NtkHandler* const, const string& = ""); 24 | V3Formula(const V3Formula&); 25 | ~V3Formula(); 26 | // Constructor for Simple Formula (Specify an Existing V3NetId) 27 | V3Formula(V3NtkHandler* const, const V3NetId&); 28 | // Constructor for Random Formula 29 | V3Formula(V3NtkHandler* const, const V3SimTraceVec&, const double&); 30 | V3Formula(V3NtkHandler* const, const uint32_t&, const uint32_t&, const V3GateType&, const uint32_t&); 31 | // Inline Formula Interface Functions 32 | inline V3NtkHandler* const getHandler() const { return _handler; } 33 | inline const bool isValid() const { return _rootId < _formula.size(); } 34 | inline const bool isValid(const uint32_t& i) const { return i < _formula.size(); } 35 | inline const bool isLeaf(const uint32_t& i) const { assert (isValid(i)); return V3_PI == _formula[i].first; } 36 | inline const V3GateType& getGateType(const uint32_t& i) const { assert (!isLeaf(i)); return _formula[i].first; } 37 | inline const V3NetId& getNetId(const uint32_t& i) const { 38 | assert (isLeaf(i)); return _formula[i].second[0].id; } 39 | inline const uint32_t getBranchSize(const uint32_t& i) const { 40 | assert (!isLeaf(i)); return _formula[i].second.size(); } 41 | inline const uint32_t getBranchIndex(const uint32_t& i, const uint32_t& j) const { 42 | assert (!isLeaf(i)); assert (j < getBranchSize(i)); return _formula[i].second[j].value; } 43 | inline const uint32_t getRoot() const { assert (isValid()); return _rootId; } 44 | // Restricted Copy Functions 45 | V3Formula* const createSuccessor(V3NtkHandler* const) const; 46 | // Elaboration Functions 47 | void collectLeafFormula(V3UI32Set&) const; 48 | // Static Member Initialization Functions 49 | static const V3OperatorMap initializeOperatorMap(); 50 | private : 51 | typedef pair V3FormulaNode; 52 | typedef V3Vec::Vec V3FormulaList; 53 | // Formula Expression Lexing Functions 54 | const bool lexFormula(V3OperatorMap::const_iterator&, string&, uint32_t&); 55 | const bool lexOperand(const string&, uint32_t&); 56 | const bool lexConstOperand(const string&); 57 | const bool lexSliceOperand(const string&, uint32_t&, uint32_t&, uint32_t&); 58 | const bool lexConcatenateOperand(const string&, uint32_t&); 59 | const V3OperatorMap::const_iterator findNextOperator(const string&, uint32_t&); 60 | const bool findSliceOperand(const string&, uint32_t&, uint32_t&); 61 | const uint32_t findCorresOperator(const string&, const char&, const char&); 62 | // Private Data Members 63 | static V3OperatorMap _opTable; 64 | V3NtkHandler* const _handler; 65 | V3FormulaList _formula; 66 | uint32_t _rootId; 67 | }; 68 | 69 | #endif 70 | 71 | -------------------------------------------------------------------------------- /engine/minisat.mk: -------------------------------------------------------------------------------- 1 | ## 2 | ## Template makefile for Standard, Profile, Debug, Release, and Release-static versions 3 | ## 4 | ## eg: "make rs" for a statically linked release version. 5 | ## "make d" for a debug version (no optimizations). 6 | ## "make" for the standard version (optimized, but with debug information and assertions active) 7 | 8 | PWD = $(shell pwd) 9 | EXEC ?= $(notdir $(PWD)) 10 | 11 | CSRCS = $(wildcard $(PWD)/*.cc) 12 | DSRCS = $(foreach dir, $(DEPDIR), $(filter-out $(MROOT)/$(dir)/Main.cc, $(wildcard $(MROOT)/$(dir)/*.cc))) 13 | CHDRS = $(wildcard $(PWD)/*.h) 14 | COBJS = $(CSRCS:.cc=.o) $(DSRCS:.cc=.o) 15 | 16 | PCOBJS = $(addsuffix p, $(COBJS)) 17 | DCOBJS = $(addsuffix d, $(COBJS)) 18 | RCOBJS = $(addsuffix r, $(COBJS)) 19 | 20 | 21 | CXX ?= g++ 22 | CFLAGS ?= -Wall -Wno-parentheses 23 | LFLAGS ?= -Wall 24 | 25 | COPTIMIZE ?= -O3 26 | 27 | CFLAGS += -I$(MROOT) -D __STDC_LIMIT_MACROS -D __STDC_FORMAT_MACROS 28 | LFLAGS += -lz 29 | 30 | .PHONY : s p d r rs clean 31 | 32 | s: $(EXEC) 33 | p: $(EXEC)_profile 34 | d: $(EXEC)_debug 35 | r: $(EXEC)_release 36 | rs: $(EXEC)_static 37 | 38 | libs: lib$(LIB)_standard.a 39 | libp: lib$(LIB)_profile.a 40 | libd: lib$(LIB)_debug.a 41 | libr: lib$(LIB)_release.a 42 | 43 | ## Compile options 44 | %.o: CFLAGS +=$(COPTIMIZE) -g -D DEBUG 45 | %.op: CFLAGS +=$(COPTIMIZE) -pg -g -D NDEBUG 46 | %.od: CFLAGS +=-O0 -g -D DEBUG 47 | %.or: CFLAGS +=$(COPTIMIZE) -g -D NDEBUG 48 | 49 | ## Link options 50 | $(EXEC): LFLAGS += -g 51 | $(EXEC)_profile: LFLAGS += -g -pg 52 | $(EXEC)_debug: LFLAGS += -g 53 | #$(EXEC)_release: LFLAGS += ... 54 | $(EXEC)_static: LFLAGS += --static 55 | 56 | ## Dependencies 57 | $(EXEC): $(COBJS) 58 | $(EXEC)_profile: $(PCOBJS) 59 | $(EXEC)_debug: $(DCOBJS) 60 | $(EXEC)_release: $(RCOBJS) 61 | $(EXEC)_static: $(RCOBJS) 62 | 63 | lib$(LIB)_standard.a: $(filter-out */Main.o, $(COBJS)) 64 | lib$(LIB)_profile.a: $(filter-out */Main.op, $(PCOBJS)) 65 | lib$(LIB)_debug.a: $(filter-out */Main.od, $(DCOBJS)) 66 | lib$(LIB)_release.a: $(filter-out */Main.or, $(RCOBJS)) 67 | 68 | 69 | ## Build rule 70 | %.o %.op %.od %.or: %.cc 71 | @echo Compiling: $(subst $(MROOT)/,,$@) 72 | @$(CXX) $(CFLAGS) -c -o $@ $< 73 | 74 | ## Linking rules (standard/profile/debug/release) 75 | $(EXEC) $(EXEC)_profile $(EXEC)_debug $(EXEC)_release $(EXEC)_static: 76 | @echo Linking: "$@ ( $(foreach f,$^,$(subst $(MROOT)/,,$f)) )" 77 | @$(CXX) $^ $(LFLAGS) -o $@ 78 | 79 | ## Library rules (standard/profile/debug/release) 80 | lib$(LIB)_standard.a lib$(LIB)_profile.a lib$(LIB)_release.a lib$(LIB)_debug.a: 81 | @echo Making library: "$@ ( $(foreach f,$^,$(subst $(MROOT)/,,$f)) )" 82 | @$(AR) -rcsv $@ $^ 83 | 84 | ## Library Soft Link rule: 85 | libs libp libd libr: 86 | @echo "Making Soft Link: $^ -> lib$(LIB).a" 87 | @ln -sf $^ lib$(LIB).a 88 | 89 | ## Clean rule 90 | clean: 91 | @rm -f $(EXEC) $(EXEC)_profile $(EXEC)_debug $(EXEC)_release $(EXEC)_static \ 92 | $(COBJS) $(PCOBJS) $(DCOBJS) $(RCOBJS) *.core depend.mk 93 | 94 | ## Make dependencies 95 | depend.mk: $(CSRCS) $(CHDRS) 96 | @echo Making dependencies 97 | @$(CXX) $(CFLAGS) -I$(MROOT) \ 98 | $(CSRCS) -MM | sed 's|\(.*\):|$(PWD)/\1 $(PWD)/\1r $(PWD)/\1d $(PWD)/\1p:|' > depend.mk 99 | @for dir in $(DEPDIR); do \ 100 | if [ -r $(MROOT)/$${dir}/depend.mk ]; then \ 101 | echo Depends on: $${dir}; \ 102 | cat $(MROOT)/$${dir}/depend.mk >> depend.mk; \ 103 | fi; \ 104 | done 105 | 106 | -include $(MROOT)/mtl/config.mk 107 | -include depend.mk 108 | -------------------------------------------------------------------------------- /src/ext/v3NtkElaborate.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3NtkElaborate.h ] 3 | PackageName [ v3/src/ext ] 4 | Synopsis [ Ntk Elaboration. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_NTK_ELABORATE_H 10 | #define V3_NTK_ELABORATE_H 11 | 12 | #include "v3NtkHash.h" 13 | #include "v3Property.h" 14 | #include "v3NtkHandler.h" 15 | 16 | // class V3NtkElaborate : Ntk Elaboration 17 | class V3NtkElaborate : public V3NtkHandler 18 | { 19 | public : 20 | // Constructor and Destructor 21 | V3NtkElaborate(V3NtkHandler* const, const V3NetVec& = V3NetVec()); 22 | ~V3NtkElaborate(); 23 | // Net Ancestry Functions 24 | const V3NetId getParentNetId(const V3NetId&) const; 25 | const V3NetId getCurrentNetId(const V3NetId&, const uint32_t& = 0) const; 26 | // Elaboration Functions 27 | const uint32_t elaborateProperty(V3Property* const, V3NetVec&, const bool& = true); 28 | const uint32_t elaborateLTLFormula(V3LTLFormula* const, const bool& = true); 29 | const V3NetId elaborateInvariants(V3Constraint* const); 30 | void elaborateConstraints(V3Constraint* const, V3NetVec&); 31 | void elaborateFairness(V3Constraint* const, V3NetVec&); 32 | void elaborateFairnessL2S(V3Constraint* const, V3NetVec&); 33 | void createConstrOutputs(const V3NetVec&); 34 | void combineInvariantToOutputs(const uint32_t&, const V3NetVec&); 35 | void combineConstraintsToOutputs(const uint32_t&, const V3NetVec&); 36 | void combineFSMInvariantsToOutputs(const uint32_t&, V3FSM* const); 37 | const V3NetId combineConstraints(const V3NetVec&); 38 | // Formula Maintenance Functions 39 | inline const uint32_t getLTLFormulSize() const { return _pOutput.size(); } 40 | V3LTLFormula* const getLTLFormula(const uint32_t&) const; 41 | private : 42 | typedef V3Vec::Vec V3LTLFormulaVec; 43 | // Elaboration Helper Functions 44 | void elaborate(V3LTLFormula* const); 45 | void elaboratePOConstraints(const uint32_t&, const uint32_t&, V3NetVec&); 46 | void elaborateFSMConstraints(V3FSM* const, V3NetVec&); 47 | void elaborateFSMInvariants(V3FSM* const, V3NetVec&); 48 | const V3NetId elaborateFSMState(const V3NetVec&, const bool&); 49 | const V3NetId elaborateLTLFormula(V3LTLFormula* const, const uint32_t&); 50 | const V3NetId elaborateL2S(const V3NetId&); 51 | // Private Members 52 | V3NetVec _c2pMap; // V3NetId Mapping From Current to Parent Ntk 53 | V3NetVec _p2cMap; // V3NetId Mapping From Parent to Current Ntk 54 | // Formula Elaboration Members for Property 55 | V3PortableType _netHash; // Hash Table for Ntk Elaboration 56 | V3LTLFormulaVec _pOutput; // List of V3LTLFormula* for Corresponding Elaborated Output 57 | // Formula Elaboration Members for Delay 58 | V3NetId _nextOpId; // Delay NetId for the Delay Operator 59 | V3UI32Hash _mirror; // Mirror V3NetId for the Delay Operator 60 | // Formula Elaboration Members for L2S 61 | V3NetVec _shadow; // V3NetId of Shadow Latches 62 | V3NetId _saved; // V3NetId of State Recorded Latch 63 | V3NetId _1stSave; // V3NetId of First Time Oracle ON for L2S 64 | V3NetId _inLoop; // V3NetId for the Formula "_1stSave || _saved" 65 | V3NetId _looped; // V3NetId for Loop Found in L2S 66 | }; 67 | 68 | #endif 69 | 70 | -------------------------------------------------------------------------------- /src/ntk/v3Type.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3Type.h ] 3 | PackageName [ v3/src/ntk ] 4 | Synopsis [ Types in V3 Network. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_TYPE_H 10 | #define V3_TYPE_H 11 | 12 | #include "v3IntType.h" 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | using namespace std; 19 | 20 | // Global Define 21 | #define V3UI64Type(x) ((uint64_t)(x)) 22 | #define V3UI64Pair(x, y) ((V3UI64Type(x) << 32) | V3UI64Type(y)) 23 | #define V3UI64MSB(x) ((uint32_t)(x >> 32)) 24 | #define V3UI64LSB(x) ((uint32_t)x) 25 | 26 | // Constants 27 | const uint32_t V3NtkUD = V3IntMAX; 28 | const string V3_INDENT = " "; 29 | 30 | // Defines 31 | struct V3NetId { // 4 Bytes 32 | uint32_t cp : 1; 33 | uint32_t id : 31; 34 | static V3NetId makeNetId(uint32_t i = V3NtkUD, uint32_t c = 0) { V3NetId j; j.cp = c; j.id = i; return j; } 35 | V3NetId operator ~ () const { return makeNetId(id, cp ^ 1); } 36 | const bool operator == (const V3NetId& i) const { return cp == i.cp && id == i.id; } 37 | const bool operator != (const V3NetId& i) const { return !(*this == i); } 38 | }; 39 | 40 | struct V3MiscType { // 4 Bytes 41 | uint32_t type : 6; 42 | uint32_t misc : 26; 43 | V3MiscType(uint32_t t = 0, uint32_t m = 0) { type = t; misc = m; } 44 | }; 45 | 46 | union V3NetType { // 4 Bytes 47 | V3NetId id; 48 | uint32_t value; 49 | V3NetType(uint32_t i = V3NtkUD) { value = i; } 50 | V3NetType(const V3NetId& i) { id = i; } 51 | }; 52 | 53 | struct V3PairType { // 8 Bytes 54 | union { 55 | uint64_t pair; 56 | uint32_t bus[2]; 57 | }; 58 | V3PairType(uint64_t p) { pair = p; } 59 | V3PairType(uint32_t m, uint32_t l) { bus[0] = m; bus[1] = l; } 60 | }; 61 | 62 | // Gate Types in V3 Network 63 | enum V3GateType { 64 | // Internal Admitted Types 65 | V3_PI = 0, V3_PIO, V3_FF, V3_MODULE, AIG_NODE, AIG_FALSE, // PI, PIO, FF, MODULE, AIG GATES 66 | BV_RED_AND, BV_RED_OR, BV_RED_XOR, BV_MUX, BV_AND, BV_XOR, // BV_(RED, LOGIC) 67 | BV_ADD, BV_SUB, BV_MULT, BV_DIV, BV_MODULO, BV_SHL, BV_SHR, // BV_(ARITH) 68 | BV_MERGE, BV_EQUALITY, BV_GEQ, BV_SLICE, BV_CONST, V3_XD, // BV_(MODEL), BV_(COMP) 69 | // External Extended Types 70 | BV_BUF, BV_INV, BV_OR, BV_NAND, BV_NOR, BV_XNOR, // BV_EXTERNAL_ONLY 71 | BV_NEQ, BV_GREATER, BV_LEQ, BV_LESS, V3_GATE_TOTAL // BV_EXTERNAL_ONLY 72 | }; 73 | 74 | // String of Gate Types in V3 Network 75 | const string V3GateTypeStr[] = { 76 | // Internal Admitted Types 77 | "V3_PI", "V3_PIO", "V3_FF", "V3_MODULE", "AIG_NODE", "AIG_FALSE", // PI, PIO, FF, MODULE, AIG GATES 78 | "BV_RED_AND", "BV_RED_OR", "BV_RED_XOR", "BV_MUX", "BV_AND", "BV_XOR", // BV_(RED, LOGIC) 79 | "BV_ADD", "BV_SUB", "BV_MULT", "BV_DIV", "BV_MODULO", "BV_SHL", "BV_SHR", // BV_(ARITH) 80 | "BV_MERGE", "BV_EQUALITY", "BV_GEQ", "BV_SLICE", "BV_CONST", "V3_XD", // BV_(MODEL), BV_(COMP) 81 | // External Extended Types 82 | "BV_BUF", "BV_INV", "BV_OR", "BV_NAND", "BV_NOR", "BV_XNOR", // BV_EXTERNAL_ONLY 83 | "BV_NEQ", "BV_GREATER", "BV_LEQ", "BV_LESS" // BV_EXTERNAL_ONLY 84 | }; 85 | 86 | // V3 Automatic Renaming Prefix and Suffix 87 | const string V3HierSeparator = "."; 88 | const string V3NameInvPrefix = "~"; 89 | const string V3NameBitPrefix = "["; 90 | const string V3NameBitSuffix = "]"; 91 | const string V3ExpansionName = "@"; 92 | const string V3NetNamePrefix = "v3_Internal_Net_"; 93 | const string V3AsyncDFFName = "v3_Async_FF_Net_"; 94 | const string V3AsyncMuxName = "v3_Async_MUX_Net_"; 95 | 96 | #endif 97 | 98 | -------------------------------------------------------------------------------- /src/ext/v3Property.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3Property.cpp ] 3 | PackageName [ v3/src/ext ] 4 | Synopsis [ Property Handler for V3 Ntk. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_PROPERTY_C 10 | #define V3_PROPERTY_C 11 | 12 | #include "v3StgFSM.h" 13 | #include "v3Property.h" 14 | 15 | /* -------------------------------------------------- *\ 16 | * Class V3Constraint Implementations 17 | \* -------------------------------------------------- */ 18 | // Constructor and Destructor 19 | V3Constraint::V3Constraint(V3NtkHandler* const handler, const uint32_t& start, const uint32_t& end) 20 | : _handler(handler), _constrInfo(V3PairType(start, end).pair) { 21 | assert (_handler); assert (isPOConstr()); 22 | assert (getStart() < _handler->getNtk()->getOutputSize()); 23 | assert (getEnd() < _handler->getNtk()->getOutputSize()); 24 | } 25 | 26 | V3Constraint::V3Constraint(V3NtkHandler* const handler, V3FSM* const fsm) 27 | : _handler((V3NtkHandler* const)(1ul | (size_t)(handler))), _constrInfo((size_t)(fsm)) { 28 | assert (getHandler()); assert (getFSM()); 29 | assert (!getFSM()->getNtkHandler() || getHandler() == getFSM()->getNtkHandler()); 30 | } 31 | 32 | V3Constraint::~V3Constraint() { 33 | } 34 | 35 | /* -------------------------------------------------- *\ 36 | * Class V3Property Implementations 37 | \* -------------------------------------------------- */ 38 | // Constructor and Destructor 39 | V3Property::V3Property(V3LTLFormula* const formula) : _formula(formula) { 40 | assert (formula); _invariants.clear(); _invConstrs.clear(); _fairConstrs.clear(); 41 | } 42 | 43 | V3Property::~V3Property() { 44 | if (_formula) delete _formula; 45 | _result.clear(); _invariants.clear(); _invConstrs.size(); _fairConstrs.size(); 46 | } 47 | 48 | // Record Verification Result Functions 49 | void 50 | V3Property::setResult(const V3VrfResult& r) { 51 | assert (r.isCex() || r.isInv()); 52 | if (r.isInv()) { assert (!isFired()); _result.setIndInv(r.getIndInv()); assert (isProven()); } 53 | else { assert (!isProven()); _result.setCexTrace(r.getCexTrace()); assert (isFired()); } 54 | } 55 | 56 | void 57 | V3Property::setInvariant(V3NtkHandler* const constrHandler, const uint32_t& start, const uint32_t& end) { 58 | assert (constrHandler); assert (constrHandler->getNtk()); 59 | _invariants.push_back(new V3Constraint(constrHandler, start, end)); assert (_invariants.back()); 60 | } 61 | 62 | void 63 | V3Property::setInvariant(V3NtkHandler* const constrHandler, V3FSM* const fsm) { 64 | assert (constrHandler); assert (constrHandler->getNtk()); 65 | _invariants.push_back(new V3Constraint(constrHandler, fsm)); assert (_invariants.back()); 66 | } 67 | 68 | void 69 | V3Property::setInvConstr(V3NtkHandler* const constrHandler, const uint32_t& start, const uint32_t& end) { 70 | assert (constrHandler); assert (constrHandler->getNtk()); 71 | _invConstrs.push_back(new V3Constraint(constrHandler, start, end)); assert (_invConstrs.back()); 72 | } 73 | 74 | void 75 | V3Property::setInvConstr(V3NtkHandler* const constrHandler, V3FSM* const fsm) { 76 | assert (constrHandler); assert (constrHandler->getNtk()); 77 | _invConstrs.push_back(new V3Constraint(constrHandler, fsm)); assert (_invConstrs.back()); 78 | } 79 | 80 | void 81 | V3Property::setFairConstr(V3NtkHandler* const constrHandler, const uint32_t& start, const uint32_t& end) { 82 | assert (constrHandler); assert (constrHandler->getNtk()); 83 | _fairConstrs.push_back(new V3Constraint(constrHandler, start, end)); assert (_fairConstrs.back()); 84 | } 85 | 86 | void 87 | V3Property::setFairConstr(V3NtkHandler* const constrHandler, V3FSM* const fsm) { 88 | assert (constrHandler); assert (constrHandler->getNtk()); 89 | _fairConstrs.push_back(new V3Constraint(constrHandler, fsm)); assert (_fairConstrs.back()); 90 | } 91 | 92 | V3Constraint* const 93 | V3Property::getInvariant(const uint32_t& i) const { 94 | assert (i < getInvariantSize()); return _invariants[i]; 95 | } 96 | 97 | V3Constraint* const 98 | V3Property::getInvConstr(const uint32_t& i) const { 99 | assert (i < getInvConstrSize()); return _invConstrs[i]; 100 | } 101 | 102 | V3Constraint* const 103 | V3Property::getFairConstr(const uint32_t& i) const { 104 | assert (i < getFairConstrSize()); return _fairConstrs[i]; 105 | } 106 | 107 | #endif 108 | 109 | -------------------------------------------------------------------------------- /src/util/v3Msg.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3Msg.h ] 3 | PackageName [ v3/src/util ] 4 | Synopsis [ V3 File and Directory Manipulation Functions ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_MSG_H 10 | #define V3_MSG_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | using namespace std; 18 | 19 | class V3MsgMgr; 20 | extern V3MsgMgr Msg; 21 | 22 | class V3Msg 23 | { 24 | public : 25 | V3Msg(ostream& os) : _default(os) { _defaultON = true; _filename = ""; } 26 | ~V3Msg() {} 27 | bool isOutFileON() { return _outfile.is_open(); } 28 | void setOutFile(const string filename) { _filename = filename; } 29 | void stopOutFile() { if (isOutFileON()) _outfile.close(); } 30 | void startOutFile(bool append) { 31 | stopOutFile(); 32 | if (append) _outfile.open(_filename.c_str(), ios::app); 33 | else _outfile.open(_filename.c_str()); 34 | } 35 | void stopDefault() { _defaultON = false; } 36 | void startDefault() { _defaultON = true; } 37 | 38 | // operator overload 39 | template friend V3Msg& operator << (V3Msg& m, const T& s) { 40 | if (m._defaultON) m._default << s; 41 | if (m.isOutFileON()) m._outfile << s; 42 | if (V3Msg::_allout.is_open()) V3Msg::_allout << s; 43 | return m; 44 | } 45 | 46 | typedef ostream& (*StdEndLine)(ostream&); // overload operator << for std::endl 47 | friend V3Msg& operator << (V3Msg& m, StdEndLine e) { 48 | if (m._defaultON) e(m._default); 49 | if (m.isOutFileON()) e(m._outfile); 50 | if (V3Msg::_allout.is_open()) e(V3Msg::_allout); 51 | return m; 52 | } 53 | static ofstream _allout; 54 | static string _allName; 55 | private : 56 | bool _defaultON; 57 | string _filename; 58 | ofstream _outfile; 59 | ostream& _default; 60 | }; 61 | 62 | enum V3MsgType 63 | { 64 | MSG_LOG = 0, 65 | MSG_ERR = 1, 66 | MSG_WAR = 2, 67 | MSG_DBG = 3, 68 | MSG_IFO = 4 69 | }; 70 | 71 | class V3MsgMgr 72 | { 73 | public : 74 | V3MsgMgr() { 75 | Msgs.clear(); 76 | MsgTypeString.clear(); 77 | Msgs.push_back(new V3Msg(cout)); MsgTypeString.push_back(""); // 0 : CmdLogMsg 78 | Msgs.push_back(new V3Msg(cerr)); MsgTypeString.push_back("[ERROR]: "); // 1 : ErrorMsg 79 | Msgs.push_back(new V3Msg(cerr)); MsgTypeString.push_back("[WARNING]: "); // 2 : WarningMsg 80 | Msgs.push_back(new V3Msg(cout)); MsgTypeString.push_back(""); // 3 : DebugMsg 81 | Msgs.push_back(new V3Msg(cout)); MsgTypeString.push_back(""); // 4 : InfoMsg 82 | Msgs[0]->stopDefault(); // NO std output needed for command Log 83 | } 84 | ~V3MsgMgr() { Msgs.clear(); } 85 | V3Msg& operator () (const V3MsgType type) { 86 | (*Msgs[type]) << MsgTypeString[type]; 87 | return *Msgs[type]; 88 | } 89 | void setOutFile(const string filename, const V3MsgType type) { Msgs[type]->setOutFile(filename); } 90 | void startOutFile(const V3MsgType type, bool append = false) { Msgs[type]->startOutFile(append); } 91 | void stopOutFile(const V3MsgType type) { Msgs[type]->stopOutFile(); } 92 | void startDefault(const V3MsgType type) { Msgs[type]->startDefault(); } 93 | void stopDefault(const V3MsgType type) { Msgs[type]->stopDefault(); } 94 | 95 | bool isAllOutFileON() { return V3Msg::_allout.is_open(); } 96 | void setAllOutFile(const string filename) { V3Msg::_allName = filename; } 97 | void startAllOutFile(bool append = false) { 98 | stopAllOutFile(); 99 | if (append) V3Msg::_allout.open(V3Msg::_allName.c_str(), ios::app); 100 | else V3Msg::_allout.open(V3Msg::_allName.c_str()); 101 | } 102 | void stopAllOutFile() { if (isAllOutFileON()) V3Msg::_allout.close(); } 103 | void startAllDefault() { for (unsigned i = 1; i < 5; ++i) Msgs[i]->startDefault(); } 104 | void stopAllDefault() { for (unsigned i = 1; i < 5; ++i) Msgs[i]->stopDefault(); } 105 | private : 106 | vector MsgTypeString; 107 | vector Msgs; 108 | pthread_mutex_t msgMutex; 109 | }; 110 | 111 | // V3 Pre-Defined Template Messages 112 | static inline const int callEmptyVirtual(const string& functionName) { 113 | Msg(MSG_ERR) << "Calling virtual function " << functionName << " !!" << endl; return 0; 114 | } 115 | 116 | #endif 117 | 118 | -------------------------------------------------------------------------------- /src/util/v3StrUtil.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3StrUtil.cpp ] 3 | PackageName [ v3/src/util ] 4 | Synopsis [ String Related Utility Functions. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_STR_UTIL_C 10 | #define V3_STR_UTIL_C 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include "v3StrUtil.h" 18 | 19 | // General Functions 20 | const int 21 | v3StrNCmp(const string& s1, const string& s2, const uint32_t& n) { 22 | assert(n > 0); 23 | if (s2.size() == 0) return -1; 24 | uint32_t l = s1.size(); 25 | assert(l >= n); 26 | for (uint32_t i = 0; i < l; ++i) { 27 | if (!s2[i]) 28 | return (i < n)? 1 : 0; 29 | char ch1 = (isupper(s1[i]))? tolower(s1[i]) : s1[i]; 30 | char ch2 = (isupper(s2[i]))? tolower(s2[i]) : s2[i]; 31 | if (ch1 != ch2) 32 | return (ch1 - ch2); 33 | } 34 | return (l - s2.size()); 35 | } 36 | 37 | const bool 38 | v3Str2Int(const string& str, int& num) { 39 | num = 0; 40 | size_t i = 0; 41 | int sign = 1; 42 | if (str[0] == '-') { sign = -1; i = 1; } 43 | bool valid = false; 44 | for (; i < str.size(); ++i) { 45 | if (isdigit(str[i])) { 46 | num *= 10; 47 | num += int(str[i] - '0'); 48 | valid = true; 49 | } 50 | else return false; 51 | } 52 | num *= sign; 53 | return valid; 54 | } 55 | 56 | const bool 57 | v3Str2UInt(const string& str, uint32_t& num) { 58 | int temp; 59 | if (!v3Str2Int(str, temp) || temp < 0) return false; 60 | num = (uint32_t)temp; return true; 61 | } 62 | 63 | const string 64 | v3Int2Str(const int& num, const uint32_t& width) { 65 | if (!width) { 66 | char str[64]; 67 | sprintf (str, "%d", num); 68 | return str; 69 | } 70 | else { 71 | stringstream ss; 72 | ss << setw(width) << setfill('0') << num; 73 | return ss.str(); 74 | } 75 | } 76 | 77 | // Tokenization Functions 78 | const size_t 79 | v3StrGetTok(const string& str, string& tok, const size_t& pos, const char del) { 80 | size_t begin = str.find_first_not_of(del, pos); 81 | if (begin == string::npos) { tok = ""; return begin; } 82 | size_t end = str.find_first_of(del, begin); 83 | tok = str.substr(begin, end - begin); 84 | return end; 85 | } 86 | 87 | const string 88 | v3Str2BVExpr(const string& expr, uint32_t& start, uint32_t& end) { 89 | // E.g. expr = c --> start = V3IntMAX, end = V3IntMAX, return c 90 | // expr = c[1] --> start = 1, end = 1, return c 91 | // expr = c[0:3] --> start = 0, end = 3, return c 92 | // expr = c[3:0] --> start = 3, end = 0, return c 93 | // expr = c[$] --> start = V3IntMAX, end = V3IntMAX, return c 94 | // expr = c[3:$] --> start = 3, end = V3IntMAX, return c 95 | // expr = c[$:3] --> start = V3IntMAX, end = 3, return c 96 | // Return "" if expr does not match any expected expr patterns above 97 | // Note: c[], c[$], c[$:$] are illegal 98 | uint32_t startPos = V3IntMAX, midPos = V3IntMAX; 99 | for (uint32_t i = 0; i < expr.size(); ++i) { 100 | if ('[' == expr[i]) { 101 | if (V3IntMAX != startPos) return ""; 102 | startPos = midPos = 1 + i; 103 | } 104 | else if (':' == expr[i]) { 105 | if (V3IntMAX == startPos) return ""; midPos = 1 + i; 106 | const string startStr = expr.substr(startPos, i - startPos); 107 | if ("$" == startStr) start = V3IntMAX; 108 | else { 109 | int temp; if (!v3Str2Int(startStr, temp)) return ""; 110 | if (temp < 0) return ""; start = (uint32_t)temp; 111 | } 112 | } 113 | else if (']' == expr[i]) { 114 | if (V3IntMAX == midPos) return ""; 115 | if ((1 + i) != expr.size()) return ""; 116 | const string endStr = expr.substr(midPos, i - midPos); 117 | if ("$" == endStr) end = V3IntMAX; 118 | else { 119 | int temp; if (!v3Str2Int(endStr, temp)) return ""; 120 | if (temp < 0) return ""; end = (uint32_t)temp; 121 | } 122 | if (startPos == midPos) start = end; 123 | if (V3IntMAX == start && V3IntMAX == end) return ""; 124 | return expr.substr(0, startPos - 1); 125 | } 126 | } 127 | if (V3IntMAX != startPos) return ""; 128 | else { start = end = V3IntMAX; return expr; } 129 | } 130 | 131 | // Trimming Functions 132 | const string 133 | v3StrRemoveSpaces(const string str) { 134 | string s = ""; 135 | for (uint32_t i = 0; i < str.size(); ++i) 136 | if (!isspace(str[i]) && '\n' != str[i]) s += str[i]; 137 | return s; 138 | } 139 | 140 | #endif 141 | 142 | -------------------------------------------------------------------------------- /src/ext/v3LTLFormula.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3LTLFormula.cpp ] 3 | PackageName [ v3/src/ext ] 4 | Synopsis [ V3 LTL Formula. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_LTL_FORMULA_C 10 | #define V3_LTL_FORMULA_C 11 | 12 | #include "v3StrUtil.h" 13 | #include "v3LTLFormula.h" 14 | 15 | /* -------------------------------------------------- *\ 16 | * Class V3Formula Implementations 17 | \* -------------------------------------------------- */ 18 | // Constructor and Destructor 19 | V3LTLFormula::V3LTLFormula(V3NtkHandler* const handler, const string& ltlFormulaExp, const string& name) 20 | : _handler(handler), _name(name) { 21 | assert (handler); _formula.clear(); 22 | _rootId = lexLTLFormula(ltlFormulaExp); 23 | } 24 | 25 | V3LTLFormula::V3LTLFormula(const V3LTLFormula& ltlFormula, const string& name) 26 | : _handler(ltlFormula._handler), _name(name) { 27 | assert (_handler); _formula = ltlFormula._formula; _rootId = ltlFormula._rootId; 28 | for (uint32_t i = 0; i < _formula.size(); ++i) 29 | if (isLeaf(i)) _formula[i].second[0] = (size_t)(new V3Formula(*(getFormula(i)))); 30 | } 31 | 32 | V3LTLFormula::~V3LTLFormula() { 33 | for (uint32_t i = 0; i < _formula.size(); ++i) { 34 | if (isLeaf(i)) delete (V3Formula*)(_formula[i].second[0]); 35 | _formula[i].second.clear(); 36 | } 37 | _formula.clear(); 38 | } 39 | 40 | // Constructor for Simple LTL Formula (AGp and AFp) 41 | V3LTLFormula::V3LTLFormula(V3NtkHandler* const handler, const V3NetId& id, const bool& safe, const string& name) 42 | : _handler(handler), _name(name) { 43 | assert (handler); _formula.clear(); _rootId = V3NtkUD; 44 | V3Formula* const formula = new V3Formula(handler, id); assert (formula); 45 | if (formula->isValid()) { 46 | _formula.push_back(make_pair(V3_LTL_P, V3PtrVec(1, (size_t)(formula)))); 47 | _formula.push_back(make_pair((safe ? V3_LTL_T_G : V3_LTL_T_F), V3PtrVec(1, 0))); 48 | _rootId = 1; assert (isValid()); 49 | } 50 | else { delete formula; assert (!isValid()); } 51 | } 52 | 53 | // Restricted Copy Functions 54 | V3LTLFormula* const 55 | V3LTLFormula::createSuccessor(V3NtkHandler* const handler) const { 56 | V3LTLFormula* const ltlFormula = new V3LTLFormula(handler, "", _name); assert (ltlFormula); 57 | ltlFormula->_formula.clear(); ltlFormula->_formula.reserve(_formula.size()); 58 | ltlFormula->_rootId = _rootId; V3Formula* formula = 0; 59 | for (uint32_t i = 0; i < _formula.size(); ++i) 60 | if (isLeaf(i)) { 61 | formula = getFormula(i)->createSuccessor(handler); 62 | if (!formula) { delete ltlFormula; return 0; } 63 | else ltlFormula->_formula.push_back(make_pair(_formula[i].first, V3PtrVec(1, (size_t)formula))); 64 | } 65 | else ltlFormula->_formula.push_back(_formula[i]); 66 | assert (ltlFormula); return ltlFormula; 67 | } 68 | 69 | // Elaboration Functions 70 | void 71 | V3LTLFormula::collectLeafFormula(V3UI32Set& netSet) const { 72 | for (uint32_t i = 0; i < _formula.size(); ++i) 73 | if (isLeaf(i)) getFormula(i)->collectLeafFormula(netSet); 74 | } 75 | 76 | // Formula Expression Lexing Functions 77 | const uint32_t 78 | V3LTLFormula::lexLTLFormula(const string& exp) { 79 | // Currently we support only G(formula), F(formula), and formula 80 | const string expNoSpaces = v3StrRemoveSpaces(exp); 81 | if ((expNoSpaces.size() > 4) && ('(' == expNoSpaces[1]) && (')' == expNoSpaces[expNoSpaces.size() - 1])) { 82 | const size_t begin = exp.find_first_of('('); assert (string::npos != begin); 83 | const size_t end = exp.find_last_of('('); assert (string::npos != end); 84 | if ('G' == expNoSpaces[0]) { // safety property 85 | V3Formula* const formula = new V3Formula(_handler, exp.substr(1 + begin, end - begin - 1)); 86 | if (!formula || !formula->isValid()) { delete formula; return V3NtkUD; } 87 | _formula.push_back(make_pair(V3_LTL_P, V3PtrVec(1, (size_t)(formula)))); 88 | _formula.push_back(make_pair(V3_LTL_T_G, V3PtrVec(1, 0))); return 1; 89 | } 90 | else if ('F' == expNoSpaces[0]) { // liveness property 91 | V3Formula* const formula = new V3Formula(_handler, exp.substr(1 + begin, end - begin - 1)); 92 | if (!formula || !formula->isValid()) { delete formula; return V3NtkUD; } 93 | _formula.push_back(make_pair(V3_LTL_P, V3PtrVec(1, (size_t)(formula)))); 94 | _formula.push_back(make_pair(V3_LTL_T_F, V3PtrVec(1, 0))); return 1; 95 | } 96 | } 97 | V3Formula* const formula = new V3Formula(_handler, exp); 98 | if (!formula || !formula->isValid()) { delete formula; return V3NtkUD; } 99 | _formula.push_back(make_pair(V3_LTL_P, V3PtrVec(1, (size_t)(formula)))); return 0; 100 | } 101 | 102 | #endif 103 | 104 | -------------------------------------------------------------------------------- /src/svr/v3SvrBoolector.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3SvrBoolector.h ] 3 | PackageName [ v3/src/svr ] 4 | Synopsis [ V3 Solver with Boolector as Engine. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_SVR_BOOLECTOR_H 10 | #define V3_SVR_BOOLECTOR_H 11 | 12 | #include "v3SvrBase.h" 13 | 14 | // V3SvrBoolector : V3 Solver with Boolector as Engine 15 | class V3SvrBoolector : public V3SvrBase 16 | { 17 | public : 18 | // Constructor and Destructor 19 | V3SvrBoolector(const V3Ntk* const, const bool& = false); 20 | V3SvrBoolector(const V3SvrBoolector&); 21 | ~V3SvrBoolector(); 22 | // Basic Operation Functions 23 | void reset(); 24 | void update(); 25 | void assumeInit(); 26 | void assertInit(); 27 | void initRelease(); 28 | void assumeRelease(); 29 | void assumeProperty(const size_t&, const bool& = false); 30 | void assertProperty(const size_t&, const bool& = false); 31 | void assumeProperty(const V3NetId&, const bool&, const unsigned&); 32 | void assertProperty(const V3NetId&, const bool&, const unsigned&); 33 | const bool simplify(); 34 | const bool solve(); 35 | const bool assump_solve(); 36 | // Manipulation Helper Functions 37 | void setTargetValue(const V3NetId&, const V3BitVecX&, const unsigned&, V3SvrDataVec&); 38 | void assertImplyUnion(const V3SvrDataVec&); 39 | const size_t setTargetValue(const V3NetId&, const V3BitVecX&, const unsigned&, const size_t&); 40 | const size_t setImplyUnion(const V3SvrDataVec&); 41 | const size_t setImplyIntersection(const V3SvrDataVec&); 42 | const size_t setImplyInit(); 43 | // Retrieval Functions 44 | const V3BitVecX getDataValue(const V3NetId&, const unsigned&) const; 45 | const bool getDataValue(const size_t&) const; 46 | void getDataConflict(V3SvrDataVec&) const; 47 | const size_t getFormula(const V3NetId&, const uint32_t&); 48 | const size_t getFormula(const V3NetId&, const uint32_t&, const uint32_t&); 49 | // Variable Interface Functions 50 | inline const size_t reserveFormula() { return getPosExp(boolector_var(_Solver, 1, NULL)); } 51 | inline const bool isNegFormula(const size_t& e) const { return (e & 2ul); } 52 | inline const size_t getNegFormula(const size_t& e) const { return (e ^ 2ul); } 53 | // Print Data Functions 54 | void printInfo() const; 55 | // Gate Formula to Solver Functions 56 | void add_FALSE_Formula(const V3NetId&, const uint32_t&); 57 | void add_PI_Formula(const V3NetId&, const unsigned&); 58 | void add_FF_Formula(const V3NetId&, const unsigned&); 59 | void add_AND_Formula(const V3NetId&, const unsigned&); 60 | void add_XOR_Formula(const V3NetId&, const unsigned&); 61 | void add_MUX_Formula(const V3NetId&, const unsigned&); 62 | void add_RED_AND_Formula(const V3NetId&, const unsigned&); 63 | void add_RED_OR_Formula(const V3NetId&, const unsigned&); 64 | void add_RED_XOR_Formula(const V3NetId&, const unsigned&); 65 | void add_ADD_Formula(const V3NetId&, const unsigned&); 66 | void add_SUB_Formula(const V3NetId&, const unsigned&); 67 | void add_MULT_Formula(const V3NetId&, const unsigned&); 68 | void add_DIV_Formula(const V3NetId&, const unsigned&); 69 | void add_MODULO_Formula(const V3NetId&, const unsigned&); 70 | void add_SHL_Formula(const V3NetId&, const unsigned&); 71 | void add_SHR_Formula(const V3NetId&, const unsigned&); 72 | void add_CONST_Formula(const V3NetId&, const unsigned&); 73 | void add_SLICE_Formula(const V3NetId&, const unsigned&); 74 | void add_MERGE_Formula(const V3NetId&, const unsigned&); 75 | void add_EQUALITY_Formula(const V3NetId&, const unsigned&); 76 | void add_GEQ_Formula(const V3NetId&, const unsigned&); 77 | // Network to Solver Function 78 | const bool existVerifyData(const V3NetId&, const uint32_t&); 79 | private : 80 | // Boolector Functions 81 | BtorExp* const getVerifyData(const V3NetId&, const unsigned&) const; 82 | void setRewriteLevel(const int& = 3); 83 | // Helper Functions : Transformation Between Internal and External Representations 84 | inline BtorExp* const getOriExp(const size_t& e) const { return (BtorExp*)(e & ~2ul); } 85 | inline const size_t getPosExp(const BtorExp* const e) const { return ((size_t)e); } 86 | inline const size_t getNegExp(const BtorExp* const e) const { return ((getPosExp(e)) | 2ul); } 87 | // Data Members 88 | Btor* _Solver; // Pointer to a Boolector solver 89 | V3BtorExpVec _assump; // Assumption List for assumption solve 90 | V3BtorExpVec _init; // Initial state Var storage 91 | V3BtorExpTable _ntkData; // Mapping between V3NetId and Solver Data 92 | }; 93 | 94 | #endif 95 | 96 | -------------------------------------------------------------------------------- /src/ntk/v3NtkUtil.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3NtkUtil.h ] 3 | PackageName [ v3/src/ntk ] 4 | Synopsis [ Generic Utility Functions for V3 Ntk Manipulation. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_NTK_UTIL_H 10 | #define V3_NTK_UTIL_H 11 | 12 | #include "v3NtkHandler.h" 13 | 14 | /* GENERAL V3 NTK CONSTRUCTION FUNCTIONS : Implemented in v3NtkConstruct.cpp */ 15 | // General Construction Functions for V3 Ntk 16 | V3Ntk* const createV3Ntk(const bool&); 17 | V3Ntk* const copyV3Ntk(V3Ntk* const&); 18 | const bool replaceV3Ntk(V3Ntk* const, V3Ntk* const); 19 | const V3NetId createNet(V3Ntk* const, uint32_t = 1); 20 | const bool createInput(V3Ntk* const, const V3NetId&); 21 | const bool createOutput(V3Ntk* const, const V3NetId&); 22 | const bool createInout(V3Ntk* const, const V3NetId&); 23 | // General Gate Type Construction Functions for V3 Ntk 24 | const bool createV3BufGate(V3Ntk* const, const V3NetId&, const V3NetId&); 25 | const bool createV3FFGate(V3Ntk* const, const V3NetId&, const V3NetId&, const V3NetId&); 26 | const bool createV3AndGate(V3Ntk* const, const V3NetId&, const V3NetId&, const V3NetId&); 27 | // General Gate Type Construction Functions for AIG Ntk 28 | const bool createAigAndGate(V3AigNtk* const, const V3NetId&, const V3NetId&, const V3NetId&); 29 | const bool createAigFalseGate(V3AigNtk* const, const V3NetId&); 30 | // General Gate Type Construction Functions for BV Ntk 31 | const bool createBvReducedGate(V3BvNtk* const, const V3GateType&, const V3NetId&, const V3NetId&); 32 | const bool createBvPairGate(V3BvNtk* const, const V3GateType&, const V3NetId&, const V3NetId&, const V3NetId&); 33 | const bool createBvMuxGate(V3BvNtk* const, const V3NetId&, const V3NetId&, const V3NetId&, const V3NetId&); 34 | const bool createBvSliceGate(V3BvNtk* const, const V3NetId&, const V3NetId&, uint32_t, uint32_t); 35 | const bool createBvConstGate(V3BvNtk* const, const V3NetId&, const string&); 36 | // General Utilities for the Construction of Bit-Width Matching Ntk 37 | const V3NetId createNetExtensionGate(V3BvNtk* const, const V3NetId&, const uint32_t&); 38 | const bool createIOExtensionGate(V3BvNtk* const, const V3NetId&, const V3NetId&); 39 | // General Ntk Topology Validation Functions for V3 Ntk 40 | const uint32_t reportCombinationalLoops(V3Ntk* const); 41 | // General Hierarchical Ntk Construction Functions for V3 Ntk 42 | const bool createModule(V3Ntk* const, const V3NetVec&, const V3NetVec&, V3NtkHandler* const, const bool& = false); 43 | const bool updateModule(V3Ntk* const, V3NtkModule* const, V3NtkHandler* const, const bool& = false); 44 | const bool reportInconsistentRefNtk(V3Ntk* const); 45 | const bool reportIncompatibleModule(V3NtkHandler* const, V3NtkHandler* const); 46 | const bool reportIncompatibleModule(V3Ntk* const, const V3NetVec&, const V3NetVec&, V3NtkHandler* const); 47 | 48 | /* GENERAL V3 NTK DUPLICATION FUNCTIONS : Implemented in v3NtkDuplicate.cpp */ 49 | // General Duplication Functions for V3 Ntk (Note that PO will NOT be created !!) 50 | V3Ntk* const duplicateNtk(V3NtkHandler* const, V3NetVec&, V3NetVec&); 51 | V3Ntk* const elaborateNtk(V3NtkHandler* const, const V3NetVec&, V3NetVec&, V3NetVec&, V3PortableType&); 52 | V3Ntk* const flattenNtk(V3NtkHandler* const, V3NetVec&, V3NtkHierInfo&, const uint32_t&); 53 | V3Ntk* const attachToNtk(V3NtkHandler* const, V3Ntk* const, const V3NetVec&, V3NetVec&, V3NetVec&, V3PortableType&); 54 | // General Gate Type Elaboration Functions for V3 Ntk 55 | const V3NetId elaborateAigGate(V3AigNtk* const, const V3GateType&, V3InputVec&, V3PortableType&); 56 | const V3NetId elaborateBvGate(V3BvNtk* const, const V3GateType&, V3InputVec&, V3PortableType&); 57 | const V3NetId elaborateAigAndOrAndGate(V3AigNtk* const, V3InputVec&, V3PortableType&); 58 | 59 | /* GENERAL V3 NTK TRAVERSAL FUNCTIONS : Implemented in v3NtkTraverse.cpp */ 60 | // General Fanout Computation Functions for V3 Ntk 61 | void computeFanout(V3Ntk* const, V3NetTable&, const V3NetVec& = V3NetVec()); 62 | // General Level Computation Functions for V3 Ntk 63 | const uint32_t computeLevel(V3Ntk* const, V3UI32Vec&, const V3NetVec& = V3NetVec()); 64 | // General DFS Traversal Functions for V3 Ntk 65 | const uint32_t dfsNtkForGeneralOrder(V3Ntk* const, V3NetVec&, const V3NetVec& = V3NetVec(), const bool& = false); 66 | const uint32_t dfsNtkForSimulationOrder(V3Ntk* const, V3NetVec&, const V3NetVec& = V3NetVec(), const bool& = false); 67 | const uint32_t dfsNtkForReductionOrder(V3Ntk* const, V3NetVec&, const V3NetVec& = V3NetVec(), const bool& = false); 68 | // General DFS Fanin Cone Marking Functions for V3 Ntk 69 | void dfsMarkFaninCone(V3Ntk* const, const V3NetId&, V3BoolVec&); 70 | void dfsMarkFaninCone(V3Ntk* const, const V3NetId&, const V3BoolVec&, V3BoolVec&); 71 | void dfsMarkFaninCone(V3Ntk* const, const V3NetTable&, V3BoolTable&); 72 | // General BFS Fanin Cone Indexing Functions for V3 Ntk 73 | void bfsIndexFaninConeFF(V3Ntk* const, V3NetVec&, const V3NetVec&); 74 | 75 | #endif 76 | 77 | -------------------------------------------------------------------------------- /src/vrf/v3VrfSEC.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3VrfSEC.h ] 3 | PackageName [ v3/src/vrf ] 4 | Synopsis [ Sequential Equivalence Checking on V3 Ntk. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2013-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_VRF_SEC_H 10 | #define V3_VRF_SEC_H 11 | 12 | #include "v3VrfBase.h" 13 | #include "v3AlgSimulate.h" 14 | 15 | // Type Defines 16 | typedef V3Vec::Vec V3VrfSimTraceVec; 17 | 18 | // class V3VrfSEC : Verification Handler for Sequential Equivalence Checking 19 | class V3VrfSEC : public V3VrfBase 20 | { 21 | public : 22 | // Constructor and Destructor 23 | V3VrfSEC(const V3NtkHandler* const); 24 | ~V3VrfSEC(); 25 | // SEC Model Checker Setting Functions 26 | inline void setChecker(V3VrfBase* const c) { _secChecker = c; } 27 | inline void setAssumeCECMiter() { _secCECAssumed = 1; } 28 | inline void setAssumeSECMiter() { _secSECAssumed = 1; } 29 | inline void setSynthesisMode(const bool& s) { _secSynthesis = s; } 30 | // SEC Network Retrieval Functions 31 | // NOTE: An extra primary output is augmented for SEC checks 32 | inline V3NtkHandler* const getSECHandler() const { return _secHandler; } 33 | private : 34 | // Private SEC Model Checker Setting Functions 35 | inline const bool isAssumeCECMiter() const { return _secCECAssumed; } 36 | inline const bool isAssumeSECMiter() const { return _secSECAssumed; } 37 | inline const bool isSynthesisMode() const { return _secSynthesis; } 38 | inline const bool isInternalCEC() const { return _secCECAssumed && !_secIsCECorSEC; } 39 | inline const bool isInternalSEC() const { return _secSECAssumed && _secIsCECorSEC; } 40 | inline void setInternalCEC() { assert (isAssumeCECMiter()); _secIsCECorSEC = 0; } 41 | inline void setInternalSEC() { assert (isAssumeSECMiter()); _secIsCECorSEC = 1; } 42 | // Private Verification Main Functions 43 | void startVerify(const uint32_t&); 44 | // Private EC Pair Simulation Functions 45 | void randomSimulate(const uint32_t&, const uint32_t&, const bool&); 46 | void addSimulationTrace(const V3CexTrace&, const bool& = true); 47 | void addSimulationTrace(const V3SimTrace&, const V3VrfSimTraceVec&, const bool&); 48 | void computeTrace(const V3CexTrace&, V3SimTrace&, V3VrfSimTraceVec&); 49 | V3CexTrace* const getSolverCexTrace(V3SvrBase* const, const uint32_t&); 50 | V3CexTrace* const computeTrace(const V3SimTrace&, const V3VrfSimTraceVec&, const uint32_t&); 51 | // Private EC Pair Construction Functions 52 | void initializeECPair(); 53 | void removeECPairOutOfCOI(); 54 | void updateECPair(const bool&, const bool&); 55 | void updateEQList(const uint32_t&, V3RepIdHash&); 56 | const uint32_t getTargetCandidate(); 57 | // Private SEC Network Transformation Functions 58 | void replaceSECOutput(const uint32_t&); 59 | void replaceSECNetwork(V3RepIdHash&); 60 | void simplifySECNetwork(V3NetVec&, V3NetVec&, const V3NetVec& = V3NetVec()); 61 | void speculativeReduction(const uint32_t&); 62 | // Private SEC Helper Functions 63 | const bool isValidChecker() const; 64 | const bool isValidNet(const V3NetId&) const; 65 | const bool isValidInvariant(const uint32_t&); 66 | const bool isValidCandidates(const uint32_t&) const; 67 | void printCandidate(const uint32_t&) const; 68 | const string getCOISize(); 69 | // Private Data Members 70 | V3NtkHandler* _secHandler; // SEC Network Handler 71 | V3Ntk* _secNtk; // SEC Network 72 | V3AlgSimulate* _secSim; // Simulator for SEC 73 | V3VrfBase* _secChecker; // Formal Engine for SEC 74 | // Private Mapping Tables 75 | V3NetVec _p2cMap; // Mapping from old to new 76 | V3NetVec _c2pMap; // Mapping from new to old 77 | // Private EC Pair Storage Data 78 | V3NetTable _secCandidate; // List of SEC Candidates 79 | V3BoolVec _secCheckFail; // List of Undecided Candidates 80 | uint32_t _secEQSize; // Number of Proven EQ Sets 81 | uint32_t _secSynthesis : 1; // Toggle Synthesis Mode 82 | uint32_t _secIsCECorSEC : 1; // Toggle Internal CEC or SEC 83 | uint32_t _secCECAssumed : 1; // Toggle Assuming CEC Miter 84 | uint32_t _secSECAssumed : 1; // Toggle Assuming SEC Miter 85 | uint32_t _secLastDepth : 28; // Last Checked Deep Bound 86 | // Statistics 87 | V3Stat* _totalStat; // Total Statistic 88 | V3Stat* _simStat; // Simulation 89 | V3Stat* _simpStat; // Simplification 90 | V3Stat* _checkStat; // Formal Checking 91 | V3Stat* _specuStat; // Speculative Reduction 92 | }; 93 | 94 | #endif 95 | 96 | -------------------------------------------------------------------------------- /src/svr/v3SvrMiniSat.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3SvrMiniSat.h ] 3 | PackageName [ v3/src/svr ] 4 | Synopsis [ V3 Solver with MiniSAT as Engine. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_SVR_MSAT_H 10 | #define V3_SVR_MSAT_H 11 | 12 | #include "v3SvrBase.h" 13 | 14 | // V3SvrMiniSat : V3 Solver with MiniSAT as Engine 15 | class V3SvrMiniSat : public V3SvrBase 16 | { 17 | public : 18 | // Constructor and Destructor 19 | V3SvrMiniSat(const V3Ntk* const, const bool& = false); 20 | V3SvrMiniSat(const V3SvrMiniSat&); 21 | ~V3SvrMiniSat(); 22 | // Basic Operation Functions 23 | void reset(); 24 | void update(); 25 | void assumeInit(); 26 | void assertInit(); 27 | void initRelease(); 28 | void assumeRelease(); 29 | void assumeProperty(const size_t&, const bool& = false); 30 | void assertProperty(const size_t&, const bool& = false); 31 | void assumeProperty(const V3NetId&, const bool&, const uint32_t&); 32 | void assertProperty(const V3NetId&, const bool&, const uint32_t&); 33 | const bool simplify(); 34 | const bool solve(); 35 | const bool assump_solve(); 36 | // Manipulation Helper Functions 37 | void setTargetValue(const V3NetId&, const V3BitVecX&, const uint32_t&, V3SvrDataVec&); 38 | void assertImplyUnion(const V3SvrDataVec&); 39 | const size_t setTargetValue(const V3NetId&, const V3BitVecX&, const uint32_t&, const size_t&); 40 | const size_t setImplyUnion(const V3SvrDataVec&); 41 | const size_t setImplyIntersection(const V3SvrDataVec&); 42 | const size_t setImplyInit(); 43 | // Retrieval Functions 44 | const V3BitVecX getDataValue(const V3NetId&, const uint32_t&) const; 45 | const bool getDataValue(const size_t&) const; 46 | void getDataConflict(V3SvrDataVec&) const; 47 | const size_t getFormula(const V3NetId&, const uint32_t&); 48 | const size_t getFormula(const V3NetId&, const uint32_t&, const uint32_t&); 49 | // Variable Interface Functions 50 | inline const size_t reserveFormula() { return getPosVar(newVar(1)); } 51 | inline const bool isNegFormula(const size_t& v) const { return (v & 1ul); } 52 | inline const size_t getNegFormula(const size_t& v) const { return (v ^ 1ul); } 53 | // Print Data Functions 54 | void printInfo() const; 55 | void printVerbose() const; 56 | // Resource Functions 57 | const double getTime() const; 58 | const int getMemory() const; 59 | // Gate Formula to Solver Functions 60 | void add_FALSE_Formula(const V3NetId&, const uint32_t&); 61 | void add_PI_Formula(const V3NetId&, const uint32_t&); 62 | void add_FF_Formula(const V3NetId&, const uint32_t&); 63 | void add_AND_Formula(const V3NetId&, const uint32_t&); 64 | void add_XOR_Formula(const V3NetId&, const uint32_t&); 65 | void add_MUX_Formula(const V3NetId&, const uint32_t&); 66 | void add_RED_AND_Formula(const V3NetId&, const uint32_t&); 67 | void add_RED_OR_Formula(const V3NetId&, const uint32_t&); 68 | void add_RED_XOR_Formula(const V3NetId&, const uint32_t&); 69 | void add_ADD_Formula(const V3NetId&, const uint32_t&); 70 | void add_SUB_Formula(const V3NetId&, const uint32_t&); 71 | void add_MULT_Formula(const V3NetId&, const uint32_t&); 72 | void add_DIV_Formula(const V3NetId&, const uint32_t&); 73 | void add_MODULO_Formula(const V3NetId&, const uint32_t&); 74 | void add_SHL_Formula(const V3NetId&, const uint32_t&); 75 | void add_SHR_Formula(const V3NetId&, const uint32_t&); 76 | void add_CONST_Formula(const V3NetId&, const uint32_t&); 77 | void add_SLICE_Formula(const V3NetId&, const uint32_t&); 78 | void add_MERGE_Formula(const V3NetId&, const uint32_t&); 79 | void add_EQUALITY_Formula(const V3NetId&, const uint32_t&); 80 | void add_GEQ_Formula(const V3NetId&, const uint32_t&); 81 | // Network to Solver Functions 82 | const bool existVerifyData(const V3NetId&, const uint32_t&); 83 | private : 84 | // MiniSat Functions 85 | const Var newVar(const uint32_t&); 86 | const Var getVerifyData(const V3NetId&, const uint32_t&) const; 87 | // Helper Functions : Transformation Between Internal and External Representations 88 | inline const Var getOriVar(const size_t& v) const { return (Var)(v >> 1ul); } 89 | inline const size_t getPosVar(const Var& v) const { return (((size_t)v) << 1ul); } 90 | inline const size_t getNegVar(const Var& v) const { return ((getPosVar(v)) | 1ul); } 91 | // Data Members 92 | MSolver* _Solver; // Pointer to a Minisat solver 93 | Var _curVar; // Latest Fresh Variable 94 | vec _assump; // Assumption List for assumption solve 95 | V3SvrMLitData _init; // Initial state Var storage 96 | V3SvrMVarTable _ntkData; // Mapping between V3NetId and Solver Data 97 | }; 98 | 99 | #endif 100 | 101 | -------------------------------------------------------------------------------- /src/stg/v3StgSDG.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3StgSDG.h ] 3 | PackageName [ v3/src/stg ] 4 | Synopsis [ Sequential Dependency Graph for V3 Ntk. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2012-2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_STG_SDG_H 10 | #define V3_STG_SDG_H 11 | 12 | #include "v3NtkHandler.h" 13 | 14 | // Forward Declaration 15 | class V3SDGNode; 16 | 17 | // Defines 18 | typedef V3Vec::Vec V3SDGNodeList; 19 | 20 | // Class V3SDGBase : Base Node Structure for SDG 21 | class V3SDGBase { 22 | public : 23 | // Constructor and Destructor 24 | V3SDGBase(); 25 | V3SDGBase(const V3SDGBase&); 26 | ~V3SDGBase(); 27 | // Inline Interface Functions 28 | inline const V3UI32Set& getDepFFSet() const { return _depFFSet; } 29 | inline const V3UI32Set& getDepMuxSet() const { return _depMuxSet; } 30 | inline void insertFF(const uint32_t& i) { _depFFSet.insert(i); } 31 | inline void insertMux(const uint32_t& i) { _depMuxSet.insert(i); } 32 | inline void clearDepFF() { _depFFSet.clear(); } 33 | inline void clearDepMux() { _depMuxSet.clear(); } 34 | // Inline Fanin Cone Collection Functions 35 | inline V3SDGBase* const getDepFFCone() { return _depFFCone; } 36 | inline V3SDGBase* const getDepMuxCone() { return _depMuxCone; } 37 | inline void newDepFFCone() { assert (!_depFFCone); _depFFCone = new V3SDGBase(); assert (_depFFCone); } 38 | inline void newDepMuxCone() { assert (!_depMuxCone); _depMuxCone = new V3SDGBase(); assert (_depMuxCone); } 39 | // Special Handling Functions 40 | void markDepFF(V3BitVec&) const; 41 | void markDepMux(V3BitVec&) const; 42 | // Print and Debug Functions 43 | void print() const; 44 | private : 45 | // Private Data Members 46 | V3UI32Set _depFFSet; // Dependent FF Nodes 47 | V3UI32Set _depMuxSet; // Dependent MUX Nodes 48 | V3SDGBase* _depFFCone; // V3SDGBase of Dependent FaninFF Nodes 49 | V3SDGBase* _depMuxCone; // V3SDGBase of Dependent FaninMuxFF Nodes 50 | }; 51 | 52 | // V3SDGNode : Simple Node (Other than MUX) in SDG 53 | class V3SDGNode { 54 | public : 55 | // Constructor and Destructor 56 | V3SDGNode(const V3NetId&); 57 | virtual ~V3SDGNode(); 58 | // Inline Interface Functions 59 | inline const V3NetId& getNetId() const { return _netId; } 60 | inline V3SDGBase* const getBase() const { return _base; } 61 | private : 62 | const V3NetId _netId; // NetId Corresponding to Ntk 63 | V3SDGBase* const _base; // Base Dependency Structure 64 | }; 65 | 66 | // V3SDGMUX : MUX Node in SDG 67 | class V3SDGMUX : public V3SDGNode { 68 | public : 69 | // Constructor and Destructor 70 | V3SDGMUX(const V3NetId&); // NOTE: Set Select Signal, NOT MUX Output Signal 71 | ~V3SDGMUX(); 72 | // Inline Interface Functions 73 | inline V3SDGBase* const getTBase() const { return _tBase; } 74 | inline V3SDGBase* const getFBase() const { return _fBase; } 75 | private : 76 | V3SDGBase* const _tBase; // Base Structure for True Part of MUX 77 | V3SDGBase* const _fBase; // Base Structure for False Part of MUX 78 | }; 79 | 80 | // Class V3SDG : Sequential Dependency Graph (SDG) Representation of BV Networks 81 | class V3SDG { 82 | public : 83 | // Constructor and Destructor 84 | V3SDG(V3NtkHandler* const); 85 | virtual ~V3SDG(); 86 | // Inline Interface Functions 87 | inline V3NtkHandler* const getNtkHandler() const { return _handler; } 88 | inline V3SDGNode* const getSDGNode(const uint32_t& i) const { 89 | assert (i < _nodeList.size()); return _nodeList[i]; } 90 | // SDG Construction Function 91 | virtual V3SDGBase* const constructSDG(const V3NetId&); 92 | void collectFaninFF(V3SDGBase* const, V3SDGBase* const = 0); 93 | void collectFaninMuxFF(V3SDGBase* const, V3SDGBase* const = 0); 94 | private : 95 | // Private SDG Construction Functions 96 | const bool constructBvSDG(const V3NetId&, V3SDGBase* const); 97 | protected : 98 | // Private Data Members 99 | V3NtkHandler* const _handler; // Ntk Handler 100 | V3SDGNodeList _nodeList; // List of SDG Nodes for Care Signals 101 | }; 102 | 103 | // Class V3AigSDG : SDG of AIG Networks 104 | class V3AigSDG : public V3SDG { 105 | public : 106 | // Constructor and Destructor 107 | V3AigSDG(V3NtkHandler* const); 108 | // SDG Construction Function 109 | V3SDGBase* const constructSDG(const V3NetId&); 110 | private : 111 | // Private SDG Construction Functions 112 | void identifyCandidates(); 113 | const bool constructAigSDG(const V3NetId&, V3SDGBase* const); 114 | // Private Data Members 115 | V3UI32Vec _muxCandidate; // MUX Candidates on AIG Network 116 | V3BoolVec _mexCandidate; // Mutex Candidates for MUX Candidates 117 | }; 118 | 119 | #endif 120 | 121 | -------------------------------------------------------------------------------- /src/vrf/v3VrfShared.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | FileName [ v3VrfShared.h ] 3 | PackageName [ v3/src/vrf ] 4 | Synopsis [ Shared Information Among Verification Engines. ] 5 | Author [ Cheng-Yin Wu ] 6 | Copyright [ Copyright(c) 2014 DVLab, GIEE, NTU, Taiwan ] 7 | ****************************************************************************/ 8 | 9 | #ifndef V3_VRF_SHARED_H 10 | #define V3_VRF_SHARED_H 11 | 12 | #include "v3Usage.h" 13 | #include "v3SvrBase.h" 14 | #include "v3Property.h" 15 | #include "v3NtkHandler.h" 16 | 17 | #include 18 | #include 19 | 20 | // Defines 21 | #define getTimeUsed(i, e) ((double)(e.tv_sec - i.tv_sec) + (0.000001 * (double)(e.tv_usec - i.tv_usec))) 22 | 23 | // Defines 24 | typedef V3Vec::Vec V3VrfResultVec; 25 | 26 | // class V3VrfShared : Base class for Verification Shared Data 27 | class V3VrfShared 28 | { 29 | public : 30 | // Constructor and Destructor 31 | V3VrfShared() { pthread_mutex_init(&_mutex, NULL); } 32 | virtual ~V3VrfShared() {} 33 | // Public Member Functions 34 | static inline void printLock() { pthread_mutex_lock(&_printMutex); } 35 | static inline void printUnlock() { pthread_mutex_unlock(&_printMutex); } 36 | protected : 37 | // Protected Member Functions 38 | inline void lock() { pthread_mutex_lock(&_mutex); } 39 | inline void unlock() { pthread_mutex_unlock(&_mutex); } 40 | // Protected Data Members 41 | pthread_mutex_t _mutex; // Mutex for a Specific Type of Shared Data 42 | static pthread_mutex_t _printMutex; // Mutex for Output Messages 43 | }; 44 | 45 | // class V3VrfSharedBound : Deep Bound Data for Each Property 46 | class V3VrfSharedBound : public V3VrfShared 47 | { 48 | public : 49 | // Constructor and Destructor 50 | V3VrfSharedBound(const uint32_t&, const bool& = false); 51 | ~V3VrfSharedBound(); 52 | // Public Member Functions 53 | const bool updateBound(const uint32_t&, const uint32_t&); 54 | const uint32_t getBound(const uint32_t&); 55 | inline uint32_t getUnsolvedSize() const { return _unsvd; } 56 | inline void getBound(V3UI32Vec& bound) { lock(); bound = _bound; unlock(); } 57 | private : 58 | // Private Data Members 59 | const bool _print; // Enable Deep Bound Printing (Only Valid for Single Property) 60 | V3UI32Vec _bound; // The Deep Bound of Each Property (V3NtkUD for Verified) 61 | uint32_t _unsvd; // Number of Unsolved Properties 62 | }; 63 | 64 | // class V3VrfSharedInv : Cube Invariants for Checkers 65 | class V3VrfSharedInv : public V3VrfShared 66 | { 67 | public : 68 | // Constructor and Destructor 69 | V3VrfSharedInv(); 70 | ~V3VrfSharedInv(); 71 | // Public Member Functions 72 | void pushInv(V3SvrBase* const, V3Ntk* const, const uint32_t&); 73 | inline void getInv(V3NetTable& inv) { lock(); inv = _inv; unlock(); } 74 | inline void updateInv(const V3NetTable& i) { lock(); _inv = i; unlock(); } 75 | inline void updateInv(const V3NetVec& i) { lock(); _inv.push_back(i); unlock(); } 76 | private : 77 | // Private Data Members 78 | V3NetTable _inv; // Cube Invariants (in terms of latch indices) 79 | }; 80 | 81 | // class V3VrfSharedNtk : Optimized Network for Checkers 82 | class V3VrfSharedNtk : public V3VrfShared 83 | { 84 | public : 85 | // Constructor and Destructor 86 | V3VrfSharedNtk(); 87 | ~V3VrfSharedNtk(); 88 | // Public Member Functions 89 | const uint32_t getNetSize(); 90 | void updateNtk(V3Ntk* const, const V3NetTable&); 91 | void releaseNtk(V3NtkHandler* const); 92 | V3NtkHandler* const getNtk(V3NtkHandler* const); 93 | V3NtkHandler* const getNtk(V3NtkHandler* const, V3NetTable&); 94 | private : 95 | struct V3VrfSharedNtkData 96 | { 97 | uint32_t _refCount; // Reference Count 98 | V3NtkHandler* _handler; // Network Handler 99 | V3NetTable _constr; // Constraints 100 | }; 101 | // Private Data Members 102 | V3Vec::Vec _data; // Verification Data for Optimized Networks 103 | }; 104 | 105 | // class V3VrfSharedMem : Memory Control Among Checkers 106 | class V3VrfSharedMem : public V3VrfShared 107 | { 108 | public : 109 | // Constructor and Destructor 110 | V3VrfSharedMem(const double& m) : V3VrfShared() { _maxMemory = m; } 111 | ~V3VrfSharedMem() {} 112 | // Public Member Functions 113 | inline void updateMaxMemory(const double& m) { lock(); _maxMemory = m; unlock(); } 114 | inline const double getMaxMemory() { lock(); const double m = _maxMemory; unlock(); return m; } 115 | inline const double getMemory() { lock(); const double m = v3Usage.getMemUsage(); unlock(); return m; } 116 | inline const bool isMemValid() { lock(); const double m = v3Usage.getMemUsage(); unlock(); return _maxMemory > m; } 117 | private : 118 | // Private Data Members 119 | double _maxMemory; // Memory Bound 120 | }; 121 | 122 | #endif 123 | 124 | --------------------------------------------------------------------------------