下载
直接git clone https://gitlab.com/securityengineering/CBMC-GC-2.git
下载下来
下载依赖
需要的依赖有bison和flex,这俩都可以直接apt下载
apt-get install bison
apt-get install flex
编译运行
make minisat2-download
make
到这都没什么问题。
但在运行 make test
和make run-test
的时候
在make test时候报了个这个错误
error this file requires compiler and library support for the ISO C++ 2011 standrad.This support is currently exprimental,and must be enabled with the -std=c++11 or -std=gun++11 compiler options.
解决方法是在test-default文件夹下的 make_tester.inc
文件中,有g++那行的代码改为g++ -std=c++11 $(之后不变)
,在test-lowdepth文件夹中也这么做。
之后又一个问题,在make run-test中,
这个需要在test-default和test-lowdepth文件夹下 makefile
中加入cbmc的路径,添加
export CBMC=$(realpath ../bin/cbmc)
make_verifier.inc
文件中修改
cbmc verifier.c --trace
改为
'$(CBMC)' verifier.c --trace
之后就可以运行通过了
例子
这是一个普通的加法程序
直接在本文件夹下编译得到一堆output文件,其中output.gate.txt是电路文件,具体的表示规则我还得研究一下。
输入make run-sim
可以进行一次模拟输入,输出。