pax_global_header00006660000000000000000000000064152547001310014510gustar00rootroot0000000000000052 comment=c402d53dceede6b04f21fd410440faeb88dcef4e hwmcc-btor2tools-c402d53/000077500000000000000000000000001525470013100152465ustar00rootroot00000000000000hwmcc-btor2tools-c402d53/.clang-format000066400000000000000000000010661525470013100176240ustar00rootroot00000000000000--- Language: Cpp BasedOnStyle: Google SpaceAfterCStyleCast: true AlignConsecutiveAssignments: true AllowShortCaseLabelsOnASingleLine: true AlwaysBreakAfterReturnType: TopLevelDefinitions BinPackArguments: false BinPackParameters: false BreakBeforeBinaryOperators: NonAssignment BraceWrapping: AfterClass: true AfterControlStatement: true AfterEnum: true AfterFunction: true AfterStruct: true AfterUnion: true BeforeCatch: true BeforeElse: true BreakBeforeBraces: Custom CommentPragmas: '^\w*(:param|:return|\.\. note)' SpaceBeforeParens: Always ... hwmcc-btor2tools-c402d53/.github/000077500000000000000000000000001525470013100166065ustar00rootroot00000000000000hwmcc-btor2tools-c402d53/.github/workflows/000077500000000000000000000000001525470013100206435ustar00rootroot00000000000000hwmcc-btor2tools-c402d53/.github/workflows/ci.yml000066400000000000000000000007561525470013100217710ustar00rootroot00000000000000on: [push, pull_request] name: CI jobs: build: strategy: matrix: os: [ubuntu-latest, macos-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 - name: Configure run: | mkdir build cd build cmake .. -DCMAKE_INSTALL_PREFIX=$(pwd)/install - name: Build working-directory: build run: make -j2 - name: Install working-directory: build run: make install hwmcc-btor2tools-c402d53/.gitignore000066400000000000000000000000421525470013100172320ustar00rootroot00000000000000*.o makefile catbtor deps/ build/ hwmcc-btor2tools-c402d53/AUTHORS000066400000000000000000000005731525470013100163230ustar00rootroot00000000000000The main authors and developers of the Btor2Tools package are: Armin Biere, Johannes Kepler University Linz Aina Niemetz, Johannes Kepler University Linz, Stanford University Mathias Preiner, Johannes Kepler University Linz, Stanford University The Btor2Tools package's copyright is held by these individuals and the affiliated institutions at the time of their contributions. hwmcc-btor2tools-c402d53/CMakeLists.txt000066400000000000000000000071161525470013100200130ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.5) project(btor2tools) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) include(GNUInstallDirs) #-----------------------------------------------------------------------------# option(ASAN "Compile with ASAN support" OFF) option(BUILD_BTOR2AIGER "Build btor2aiger binary" OFF) option(BUILD_TOOLS "Build btorsim, catbtor, btorsplit binaries" ON) option(CHECK "Enable assertions for optimized builds" OFF) option(BUILD_SHARED_LIBS "Build as shared library" ON) #-----------------------------------------------------------------------------# include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) macro(add_c_flag flag) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}") message(STATUS "Configuring with C flag '${flag}'") endmacro() macro(add_cxx_flag flag) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}") message(STATUS "Configuring with CXX flag '${flag}'") endmacro() macro(add_c_cxx_flag flag) add_c_flag(${flag}) add_cxx_flag(${flag}) endmacro() macro(add_check_c_flag flag) string(REGEX REPLACE "[-=]" "_" flagname ${flag}) check_c_compiler_flag("${flag}" HAVE_FLAG${flagname}) if(HAVE_FLAG${flagname}) add_c_flag(${flag}) endif() endmacro() macro(add_check_cxx_flag flag) string(REGEX REPLACE "[-=]" "_" flagname ${flag}) check_cxx_compiler_flag("${flag}" HAVE_FLAG${flagname}) if(HAVE_FLAG${flagname}) add_cxx_flag(${flag}) endif() endmacro() macro(add_check_c_cxx_flag flag) add_check_c_flag(${flag}) add_check_cxx_flag(${flag}) endmacro() macro(add_required_cxx_flag flag) string(REGEX REPLACE "[-=]" "_" flagnamename ${flag}) check_cxx_compiler_flag("${flag}" HAVE_FLAG${flagname}) if (NOT HAVE_FLAG${flagname}) message(FATAL_ERROR "Required compiler flag ${flag} not supported") endif() add_cxx_flag(${flag}) endmacro() macro(add_required_c_flag flag) string(REGEX REPLACE "[-=]" "_" flagname ${flag}) check_c_compiler_flag("${flag}" HAVE_FLAG${flagname}) if (NOT HAVE_FLAG${flagname}) message(FATAL_ERROR "Required compiler flag ${flag} not supported") endif() add_c_flag(${flag}) endmacro() macro(add_required_c_cxx_flag flag) add_required_c_flag(${flag}) add_required_cxx_flag(${flag}) endmacro() #-----------------------------------------------------------------------------# add_check_c_cxx_flag("-W") add_check_c_cxx_flag("-Wall") add_check_c_cxx_flag("-Wextra") add_check_c_cxx_flag("-Wredundant-decls") add_check_c_flag("-std=gnu99") add_required_cxx_flag("-std=gnu++11") if(CMAKE_BUILD_TYPE STREQUAL "Debug") add_check_c_cxx_flag("-g3") add_check_c_cxx_flag("-ggdb") else() add_check_c_cxx_flag("-O3") if(NOT CHECK) add_check_c_cxx_flag("-DNDEBUG") endif() endif() if(ASAN) # -fsanitize=address requires CMAKE_REQUIRED_FLAGS to be explicitely set, # otherwise the -fsanitize=address check will fail while linking. set(CMAKE_REQUIRED_FLAGS -fsanitize=address) add_required_c_cxx_flag("-fsanitize=address") unset(CMAKE_REQUIRED_FLAGS) add_check_c_cxx_flag("-fno-omit-frame-pointer") add_required_c_cxx_flag("-fsanitize-recover=address") set(BUILD_SHARED_LIBS ON) endif() if(BUILD_BTOR2AIGER) if(NOT EXISTS "${CMAKE_SOURCE_DIR}/deps/aiger/aiger.c") message(FATAL_ERROR "Could not find AIGER sources. Execute script setup-aiger.sh.") endif() list(APPEND CMAKE_PREFIX_PATH "${PROJECT_SOURCE_DIR}/deps/install") find_package(Boolector) endif() add_subdirectory(src) hwmcc-btor2tools-c402d53/LICENSE.txt000066400000000000000000000023231525470013100170710ustar00rootroot00000000000000The Btor2Tools package provides a generic parser and tools for the BTOR2 format. Copyright (c) 2012-2018 Armin Biere. Copyright (c) 2013-2018 Mathias Preiner. Copyright (c) 2015-2018 Aina Niemetz. MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. hwmcc-btor2tools-c402d53/README.md000066400000000000000000000152361525470013100165340ustar00rootroot00000000000000Btor2Tools =============================================================================== The Btor2Tools package provides a generic parser and tools for the BTOR2 format. For a more detailed description of the BTOR2 format, refer to *BTOR2, BtorMC and Boolector 3.0.* Aina Niemetz, Mathias Preiner, Clifford Wolf, and Armin Biere. CAV 2018. Download ------------------------------------------------------------------------------- The latest version of Btor2Tools can be found on GitHub: https://github.com/boolector/btor2tools Build ------------------------------------------------------------------------------- From the Btor2Tools root directory configure and build as follows: ``` ./configure.sh cd build make ``` For more build configuration options of Btor2Tools, see `configure.sh -h`. All binaries (btorsim, catbtor) are generated into directory `build/bin`, and all libraries (libbtor2parser.a, libbtor2parser.so) are generated into directory `build/lib`. Usage ------------------------------------------------------------------------------- ### BTOR2 Parser Btor2Parser is a generic parser for the BTOR2 format. ``` Btor2Parser* parser; Btor2LineIterator it; Btor2Line* line; parser = btor2parser_new (); if (!btor2parser_read_lines (reader, input_file)) { // parse error const char *err = btor2parser_error (parser); // error handling } // iterate over parsed lines it = btor2parser_iter_init (parser); while ((line = btor2parser_iter_next (&it))) { // process line } btor2parser_delete (parser); ``` For a simple example on how to use the BTOR2 parser, refer to `src/catbtor.c`. For a more comprehensive example, refer to function `parse_model()` in `src/btorsim/btorsim.c`. ### BtorSim BtorSim is a witness simulator and checker for BTOR2 witnesses. For a list of command line options, refer to `btorsim -h`. For examples and instructions on how to use BtorSim, refer to `examples/btorsim`. ### Catbtor Catbtor is a simple tool to parse and print BTOR2 files. It is mainly used for debugging purposes. For a list of command line options, refer to `catbtor -h`. The BTOR2 Format ------------------------------------------------------------------------------- For a detailed description, please refer to [BTOR2, BtorMC and Boolector 3.0](https://link.springer.com/chapter/10.1007/978-3-319-96145-3_32) at [CAV 2018](http://cavconference.org/2018/). ### Input Format ``` ::= positive unsigned integer (greater than zero) ::= unsigned integer (including zero) ::= sequence of whitespace and printable characters without '\n' ::= sequence of printable characters without '\n' ::= ';' ::= ::= ::= 'const' [0-1]+ ::= 'constd' ['-'] ::= 'consth' [0-9a-fA-F]+ ::= ('input' | 'one' | 'ones' | 'zero') | | | ::= 'state' ::= 'bitvec' ::= 'array' ::= 'sort' ( | ) | ( | ) | [] | [ []] | ('init' | 'next') | ('bad' | 'constraint' | 'fair' | 'output') | 'justice' ()+ ::= | [] [] ::= ('\n')+ ``` Non-terminals `` and `` are indexed and non-indexed operaters as defined below (`B_[n]` represents a bit-vector sort of size n, and `A_[I -> E]` represents an array sort with index sort `I` and element sort `E`). #### Indexed Operators | Operator | Description | Signature | | ------------------- | ------------------------- | ------------------------- | | `[su]ext w` | (un)signed extension | `B_[n] -> B_[n+w]` | | `slice u l` | extraction, `n > u >= l` | `B_[n] -> B_[u-l+1]` | #### Unary Operators | Operator | Description | Signature | | --------------------------- | ----------------- | ------------------------- | | `not` | bit-wise | `B_[n] -> B_[n]` | | `inc`, `dec`, `neg` | arithmetic | `B_[n] -> B_[n]` | | `redand`, `redor`, `redxor` | reduction | `B_[n] -> B_[1]` | #### Binary Operators | Operator | Description | Signature | | ------------------------------------------------- | --------------------- | -------------------------- | | `iff`, `implies` | Boolean | `B_[1] x B_[1] -> B_[1]` | | `eq`, `neq` | (dis)equality | `S x S -> B_[1]` | | `[su]gt`, `[su]gte`, `[su]lt`, `[su]lte` | (un)signed inequality | `B_[n] x B_[n] -> B_[1]` | | `and`, `nand`, `nor`, `or`, `xnor`, `xor` | bit-wise | `B_[n] x B_[n] -> B_[n]` | | `rol`, `ror`, `sll`, `sra`, `srl` | rotate, shift | `B_[n] x B_[n] -> B_[n]` | | `add`, `mul`, `[su]div`, `smod`, `[su]rem`, `sub` | arithmetic | `B_[n] x B_[n] -> B_[n]` | | `[su]addo`, `sdivo`, `[su]mulo`, `[su]subo` | overflow | `B_[n] x B_[n] -> B_[1]` | | `concat` | concatenation | `B_[n] x B_[m] -> B_[n+m]` | | `read` | array read | `A_[I -> E] x I -> E` | #### Ternary Operators | Operator | Description | Signature | | -------------- | --------------------- | ---------------------------------- | | `ite` | conditional | `B_[1] x B_[n] x B_[n] -> B_[n]` | | `write` | array write | `A_[I -> E] x I x E -> A_[I -> E]` | ### Witness Format ``` ::= [0-1]+ ::= ::= '['']' ::= ( | ) [] ::= ('\n' | '\n')+ ::= '#''\n' ::= '@''\n' ::= [] ::= ('b' | 'j')
::= 'sat\n' ()+ '\n' ::= ('\n')+ |
()+ '.' ``` hwmcc-btor2tools-c402d53/VERSION000066400000000000000000000000061525470013100163120ustar00rootroot000000000000001.0.3 hwmcc-btor2tools-c402d53/configure.sh000077500000000000000000000032571525470013100175750ustar00rootroot00000000000000#!/usr/bin/env bash set -e -o pipefail BUILD_DIR=build asan=no check=no debug=no static=no btor2aiger=no #--------------------------------------------------------------------------# die () { echo "*** configure.sh: $*" 1>&2 exit 1 } usage () { cat < ...] where