Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Refinement Handling in Verilog Verification Target Generation #219

Open
wants to merge 81 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
cf6e36b
add vexp parser
zhanghongce Apr 15, 2021
426c227
update vexp ref
zhanghongce Apr 21, 2021
b34f537
rf parsing step 1 structure
zhanghongce Apr 23, 2021
4908961
structure parse
zhanghongce Apr 29, 2021
10caa7e
add array addr width extract
zhanghongce May 12, 2021
89ac6e2
fix update
zhanghongce May 12, 2021
9228556
rfmap wip
zhanghongce May 12, 2021
c7f845e
add array addr width extract
zhanghongce May 12, 2021
cdafa8b
fix update
zhanghongce May 12, 2021
ca747d3
fix array range parsing
zhanghongce May 12, 2021
e6d9532
Merge branch 'master' into refinement-upgrade
zhanghongce May 12, 2021
ad1e20a
update vexpparser
zhanghongce May 15, 2021
8ce9967
type inference
zhanghongce Jun 1, 2021
7d79862
update vexpparser ref
zhanghongce Jun 11, 2021
8907884
type check rewrite
zhanghongce Jun 11, 2021
1f925c2
vexp ref
zhanghongce Jun 15, 2021
480e4d0
test
zhanghongce Jun 15, 2021
77b55bb
rfmap update
zhanghongce Jun 15, 2021
25c9f82
backend mod WIP
zhanghongce Jun 18, 2021
61fe609
update vexp ref
zhanghongce Jun 21, 2021
1f28383
rfexpr2smt
zhanghongce Jun 21, 2021
e207e89
rfexpr to smt test WIP
zhanghongce Jul 3, 2021
e465c78
rfexpr 2 smt
zhanghongce Jul 7, 2021
3c41241
add rfexpr 2 smt convert test
zhanghongce Jul 7, 2021
758fff6
gen_util mod WIP
zhanghongce Jul 14, 2021
01be7d4
stage1 test
zhanghongce Jul 20, 2021
f669a75
update vexp ref
zhanghongce Jul 21, 2021
cf009f5
rfexpr wip
zhanghongce Jul 28, 2021
de50765
rfexpr array
zhanghongce Aug 14, 2021
b2cf2bc
vexp ref update
zhanghongce Aug 18, 2021
85ac6c7
update vexp ref
zhanghongce Aug 18, 2021
750ad5a
rfexpr to smt
zhanghongce Aug 18, 2021
6d597aa
vpipe test debug
zhanghongce Aug 20, 2021
ec80c09
im smt property WIP
zhanghongce Aug 28, 2021
f107da4
smt property-interface
zhanghongce Sep 2, 2021
26d0c3b
add stall vpipe
zhanghongce Sep 7, 2021
a867fcb
new benchmark
zhanghongce Sep 9, 2021
f8f84dc
test vtg
zhanghongce Sep 13, 2021
b4b65fe
add flex dev
zhanghongce Sep 14, 2021
0c64528
update workflow
zhanghongce Sep 14, 2021
3315da8
style change
zhanghongce Sep 14, 2021
3be66b7
add rtl verify api
zhanghongce Oct 15, 2021
dad9922
update vexpparser ref
zhanghongce Oct 15, 2021
9b9cb4f
adjust path
zhanghongce Oct 15, 2021
74fca2f
address lgtm
zhanghongce Oct 15, 2021
322ebd3
libfl-dev
zhanghongce Oct 15, 2021
e477ee9
ref
zhanghongce Oct 15, 2021
aeb11a4
Merge branch 'master' of github.com:PrincetonUniversity/ILAng into re…
zhanghongce Oct 15, 2021
236d250
vexpparser on windows
zhanghongce Oct 17, 2021
2920693
fix cmake
zhanghongce Oct 17, 2021
8dc3c8a
add azure ppl include for vexpp in msvc
zhanghongce Oct 17, 2021
6a15618
update vexp ref
zhanghongce Oct 17, 2021
172690f
new test
zhanghongce Oct 17, 2021
3bf933d
add test
zhanghongce Oct 17, 2021
e7736b5
add more test
zhanghongce Oct 20, 2021
61c7588
update vexp ref
zhanghongce Oct 23, 2021
dd8f61e
before remove mod
zhanghongce Oct 23, 2021
cb2ae2e
vexp ref
zhanghongce Oct 24, 2021
6f90197
vexp ref
zhanghongce Oct 24, 2021
133ed8b
fix cmake install
zhanghongce Oct 24, 2021
f22ee16
add aux-var section
zhanghongce Oct 27, 2021
03fcfe2
fix wrapper path
zhanghongce Nov 1, 2021
fb1c9d9
annotation for width
zhanghongce Nov 3, 2021
4924f92
fix vexparser build on win ci. ProgramData path is hard-coded
yuex1994 Nov 4, 2021
ca7ae82
fix vlg_mod test failure
zhanghongce Nov 5, 2021
dd66f82
disable overwriting warning
zhanghongce Nov 5, 2021
94490b8
update vexp ref
zhanghongce Nov 5, 2021
c1331c9
Merge branch 'refinement-upgrade' of github.com:zhanghongce/ILA-Tools…
zhanghongce Nov 5, 2021
d7e0df6
more cmake macro def
zhanghongce Nov 8, 2021
9312422
update vexpparser ref
zhanghongce Nov 26, 2021
af7b268
add quantified support in rfexpr
zhanghongce Nov 28, 2021
6f96e80
add quantifier handling in vtg
zhanghongce Nov 28, 2021
19a1358
add quantifier support
zhanghongce Nov 29, 2021
638f8c0
add flex lexer include path
zhanghongce Nov 30, 2021
fb5c41d
remove ubuntu 16.04 in azure ppl
zhanghongce Nov 30, 2021
c88eb9c
inst complete cond default
zhanghongce Dec 13, 2021
da73b40
fix bug
zhanghongce Dec 20, 2021
e1ba297
new test case
zhanghongce Dec 20, 2021
2dbdbab
fix typo
zhanghongce Jan 10, 2022
1a406bf
add wire def
zhanghongce Jan 10, 2022
76a99fa
rf expr type resolution
zhanghongce Jan 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v2

- name: Install Dependent Packages
run: sudo apt install bison flex z3 libz3-dev
run: sudo apt install bison flex z3 libz3-dev libfl-dev

- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
[submodule "extern/smt-switch"]
path = extern/smt-switch
url = https://github.com/makaimann/smt-switch.git
[submodule "extern/vexpparser"]
path = extern/vexpparser
url = https://github.com/zhanghongce/vexpparser.git
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
- bison
- z3
- libz3-dev
- libfl-dev
- g++-7
before_install:
- echo -n | openssl s_client -connect https://scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-
Expand All @@ -77,6 +78,7 @@ addons:
- bison
- z3
- libz3-dev
- libfl-dev
- g++-7

notifications:
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ configuration:

install:
- sudo apt update --yes
- sudo apt install --yes z3 libz3-dev bison flex gcc g++
- sudo apt install --yes z3 libz3-dev bison libfl-dev flex gcc g++

build_script:
- cd $APPVEYOR_BUILD_FOLDER
Expand Down
37 changes: 13 additions & 24 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,6 @@ jobs:
./test/unit_tests
displayName: 'build'

- job: Ubuntu_1604_LTS
pool:
vmImage: 'ubuntu-16.04'
steps:
- script: |
sudo apt-get update
sudo apt-get install bison
sudo apt-get install flex
sudo apt-get install z3
sudo apt-get install libz3-dev
sudo apt-get install g++-7
displayName: 'package'
- script: |
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=g++-7
cmake --build .
sudo cmake --build . --target install
cmake --build . --target test
displayName: 'build'

- job: Ubuntu_1804_LTS
pool:
vmImage: 'ubuntu-18.04'
Expand All @@ -86,6 +65,7 @@ jobs:
sudo apt-get install flex
sudo apt-get install z3
sudo apt-get install libz3-dev
sudo apt-get install libfl-dev
sudo apt-get install g++-8
displayName: 'package'
- script: |
Expand Down Expand Up @@ -118,7 +98,7 @@ jobs:
cd glog
md build
cd build
cmake ..
cmake .. -DFLEXLEXER_INCLUDE_PATH=c:\ProgramData\chocolatey\lib\winflexbison3\tools\
cmake --build . --target install
displayName: 'glog'

Expand All @@ -140,11 +120,20 @@ jobs:
cmake --build . --target install
displayName: 'vlog-parser'

- script: |
cd extern
cd vexpparser
md build
cd build
cmake .. -DFLEXLEXER_INCLUDE_PATH=c:\ProgramData\chocolatey\lib\winflexbison3\tools\
cmake --build . --target install
displayName: 'vexpparser'

- script: |
md build
cd build
# For building the test, we need CMAKE_MSVC_RUNTIME_LIBRARY (which will be supported in CMake 3.15+)
cmake .. -DILANG_BUILD_TEST=OFF -DBUILD_SHARED_LIBS=OFF -DILANG_BUILD_INVSYN=OFF -DZ3_INCLUDE_DIR=$(Build.Repository.LocalPath)/z3/include -DZ3_LIBRARY=$(Build.Repository.LocalPath)/z3/bin/libz3.lib -DZ3_EXEC=$(Build.Repository.LocalPath)/z3/bin/z3.exe
cmake .. -DILANG_BUILD_TEST=OFF -DBUILD_SHARED_LIBS=OFF -DILANG_BUILD_INVSYN=OFF -DZ3_INCLUDE_DIR=$(Build.Repository.LocalPath)/z3/include -DZ3_LIBRARY=$(Build.Repository.LocalPath)/z3/bin/libz3.lib -DZ3_EXEC=$(Build.Repository.LocalPath)/z3/bin/z3.exe -DFLEXLEXER_INCLUDE_PATH=c:\ProgramData\chocolatey\lib\winflexbison3\tools\
cmake --build .
cmake --build . --target install
displayName: 'build'
Expand All @@ -153,7 +142,7 @@ jobs:
cd starter
md build
cd build
cmake .. -DZ3_INCLUDE_DIR=$(Build.Repository.LocalPath)/z3/include -DZ3_LIBRARY=$(Build.Repository.LocalPath)/z3/bin/libz3.lib -DZ3_EXEC=$(Build.Repository.LocalPath)/z3/bin/z3.exe
cmake .. -DZ3_INCLUDE_DIR=$(Build.Repository.LocalPath)/z3/include -DZ3_LIBRARY=$(Build.Repository.LocalPath)/z3/bin/libz3.lib -DZ3_EXEC=$(Build.Repository.LocalPath)/z3/bin/z3.exe -DFLEXLEXER_INCLUDE_PATH=c:\ProgramData\chocolatey\lib\winflexbison3\tools\
cmake --build .
displayName: 'starter'

1 change: 1 addition & 0 deletions cmake/config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ find_dependency(glog REQUIRED)
find_dependency(nlohmann_json REQUIRED)
find_dependency(verilogparser REQUIRED)
find_dependency(vcdparser REQUIRED)
find_dependency(vexpparser REQUIRED)
find_dependency(smtparser REQUIRED)
find_dependency(fmt REQUIRED)
find_dependency(Z3 REQUIRED)
Expand Down
33 changes: 33 additions & 0 deletions extern/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,39 @@ if(NOT VERILOGPARSER_FOUND)
endif() # VERILOGPARSER_FOUND


# ---------------------------------------------------------------------------- #
# Verilog Expression Parser
#
# TARGET vexpparser::vexpparser
# SOURCE https://github.com/zhanghongce/vexpparser.git
# PATH extern/vexpparser
# ---------------------------------------------------------------------------- #
# find installed package
find_package(vexpparser 1.1.0 QUIET)

# embed to build tree if not installed
if(NOT VEXP_PARSER_FOUND)

# fetch from git
if(${ILANG_FETCH_DEPS})

execute_process(
COMMAND ${GIT_EXECUTABLE} submodule update --init vexpparser
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT
)

if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "Submodule update failed with ${GIT_SUBMOD_RESULT}")
endif()

endif() # ILANG_FETCH_DEPS

# embedded build
add_subdirectory(vexpparser)

endif() # VERILOGPARSER_FOUND

# ---------------------------------------------------------------------------- #
# Template-based ILA Synthesis
#
Expand Down
1 change: 1 addition & 0 deletions extern/vexpparser
Submodule vexpparser added at 4b6131
23 changes: 23 additions & 0 deletions include/ilang/ilang++.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#endif // SMTSWITCH_INTERFACE

#include <ilang/config.h>
#include <ilang/rtl_verify.h>

/// \namespace ilang
/// Defines the core data structure and APIs for constructing and storing ILA.
Expand Down Expand Up @@ -745,6 +746,28 @@ class IlaZ3Unroller {

}; // class IlaZ3Unroller


/// \brief The wrapper of Rtl verification target generator
class IlaVerilogRefinementChecker {

public:
// ------------------------- CONSTRUCTOR/DESTRUCTOR ----------------------- //
/// Default constructor
IlaVerilogRefinementChecker(
const Ila& ila,
const std::vector<std::string>& implementation_include_path,
const std::vector<std::string>& implementation_srcs,
const std::string& implementation_top_module,
const std::string& refinement_variable_mapping,
const std::string& refinement_conditions,
const std::string& output_path,
ModelCheckerSelection backend,
const RtlVerifyConfig& vtg_config = RtlVerifyConfig() );
/// Default virtual destructor.
~IlaVerilogRefinementChecker() {};

}; // class RtlVerifier

#ifdef SMTSWITCH_INTERFACE

/// \brief Reset the solver and generate the SMT Term (for smt-switch).
Expand Down
38 changes: 38 additions & 0 deletions include/ilang/rfmap-in/rfexpr_shortcut.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/// \file rfexpr_shortcut.h Refinement map expression
/// construction
/// Hongce Zhang ([email protected])

#ifndef ILANG_RFEXPR_SHORTCUT_H__
#define ILANG_RFEXPR_SHORTCUT_H__

#include <ilang/rfmap-in/rfmap_typecheck.h>

namespace ilang {

rfmap::RfExpr rfmap_reduce_or(const rfmap::RfExpr& in);
rfmap::RfExpr rfmap_imply(const rfmap::RfExpr& l, const rfmap::RfExpr& r);
rfmap::RfExpr rfmap_and(const rfmap::RfExpr& l, const rfmap::RfExpr& r);
rfmap::RfExpr rfmap_or(const rfmap::RfExpr& l, const rfmap::RfExpr& r);
rfmap::RfExpr rfmap_and(const std::vector<rfmap::RfExpr>& v);
rfmap::RfExpr rfmap_or(const std::vector<rfmap::RfExpr>& v);

rfmap::RfExpr rfmap_ite(const rfmap::RfExpr& c, const rfmap::RfExpr& l,
const rfmap::RfExpr& r);

rfmap::RfExpr rfmap_eq(const rfmap::RfExpr& l, const rfmap::RfExpr& r);
rfmap::RfExpr rfmap_le(const rfmap::RfExpr& l, const rfmap::RfExpr& r);

rfmap::RfExpr rfmap_not(const rfmap::RfExpr& l);

rfmap::RfExpr rfmap_true();
rfmap::RfExpr rfmap_false();
rfmap::RfExpr rfmap_const(unsigned b, unsigned w, unsigned v);
/// if it is RTL. or ILA. then will use MakeVar
/// otherwise will use MakeSpecial
/// will not determine its type
/// ReplExpr will determine the type
rfmap::RfExpr rfmap_var(const std::string& v);

} // namespace ilang

#endif // ILANG_RFEXPR_SHORTCUT_H__
58 changes: 58 additions & 0 deletions include/ilang/rfmap-in/rfexpr_to_smt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/// \file rfexpr_to_smt.cc Refinement map to smt-lib2
/// Hongce Zhang ([email protected])

#ifndef ILANG_RFEXPR_TO_SMT_H__
#define ILANG_RFEXPR_TO_SMT_H__

#include <ilang/rfmap-in/rfmap_typecheck.h>

namespace ilang {
namespace rfmap {

struct SmtType : public RfMapVarType {
bool bool_or_bv;

SmtType() : RfMapVarType(1), bool_or_bv(true) {}
SmtType(unsigned w) : RfMapVarType(w), bool_or_bv(false) {}
SmtType(unsigned a, unsigned d) : RfMapVarType(a, d), bool_or_bv(false) {}
SmtType(const RfMapVarType& r, bool request_bool)
: RfMapVarType(r), bool_or_bv(request_bool) {}

bool is_bool() const { return bool_or_bv && (RfMapVarType::is_bv()); }
bool is_bv() const { return (!bool_or_bv) && (RfMapVarType::is_bv()); }
bool operator==(const SmtType& r) const {
if (bool_or_bv != r.bool_or_bv)
return false;
if (type != r.type)
return false;
if (type == TYPE::BV)
return width == r.width;
if (type == TYPE::MEM)
return data_width == r.data_width && addr_width == r.addr_width;
return false; // unknown type , unknown
} // operator=

std::string type_to_smt2() const;

}; // SmtType

struct RfExpr2Smt {

public:
static std::string to_smt2(const RfExpr& in, SmtType expected_type);

protected:
// helper function
static std::string
to_smt2_const(const std::shared_ptr<verilog_expr::VExprAstConstant>& in,
SmtType expected_type);
static std::string
to_smt2_var(const std::shared_ptr<verilog_expr::VExprAstVar>& in,
SmtType expected_type);

}; // struct RfExpr2Smt

} // namespace rfmap
} // namespace ilang

#endif // ILANG_RFEXPR_TO_SMT_H__
Loading