diff --git a/.github/workflows/build-posix-cmake.yml b/.github/workflows/build-posix-cmake.yml index 50f9ef902f..cd0b03d26d 100644 --- a/.github/workflows/build-posix-cmake.yml +++ b/.github/workflows/build-posix-cmake.yml @@ -2,6 +2,8 @@ name: Build Posix CMake on: push: + branches: + - master pull_request: jobs: @@ -13,6 +15,9 @@ jobs: use_namespace: [false, true] runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash env: CMAKE_ARGS: ${{ matrix.use_namespace && '-DABC_USE_NAMESPACE=xxx' || '' }} @@ -24,7 +29,10 @@ jobs: - name: Git Checkout uses: actions/checkout@v4 with: - submodules: recursive + fetch-depth: 0 + + - name: Update CMake + uses: jwlawson/actions-setup-cmake@v1.8 - name: Install brew dependencies run: | @@ -37,8 +45,13 @@ jobs: if: ${{ !contains(matrix.os, 'macos') }} - name: Configure CMake - run: | - cmake -G Ninja -DCMAKE_BUILD_TYPE=Release ${CMAKE_ARGS} -B build + run: > + cmake -S . -B build + -G Ninja + ${CMAKE_ARGS} + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_INSTALL_PREFIX=./staging + -DVENDOR_GTEST=ON - name: Build CMake run: | @@ -50,7 +63,7 @@ jobs: - name: Test Executable run: | - ./build/abc -c "r i10.aig; b; ps; b; rw -l; rw -lz; b; rw -lz; b; ps; cec" + ./build/src/base/main/abc -c "r i10.aig; b; ps; b; rw -l; rw -lz; b; rw -lz; b; ps; cec" - name: Test Library run: | @@ -60,8 +73,7 @@ jobs: - name: Stage Executable run: | - mkdir staging - cp build/abc build/libabc.a staging/ + cmake --build build --target install - name: Upload pacakge artifact uses: actions/upload-artifact@v4 diff --git a/.github/workflows/build-posix.yml b/.github/workflows/build-posix.yml index 080c6e0453..f7136ee8a0 100644 --- a/.github/workflows/build-posix.yml +++ b/.github/workflows/build-posix.yml @@ -2,6 +2,8 @@ name: Build Posix on: push: + branches: + - master pull_request: jobs: @@ -33,12 +35,13 @@ jobs: - name: Install APT dependencies run: | - sudo apt install -y libreadline-dev + sudo apt-get -y -qq update + sudo apt-get install -y libreadline-dev if: ${{ !contains(matrix.os, 'macos') }} - name: Build Executable run: | - make -j3 ${MAKE_ARGS} abc + make -j3 ABC_USE_PIC=1 ${MAKE_ARGS} abc - name: Test Executable run: | diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 2d08943648..53f100172d 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -2,6 +2,8 @@ name: Build Windows on: push: + branches: + - master pull_request: jobs: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..2cce8f4eac --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,173 @@ +name: ci + +on: + workflow_dispatch: + pull_request: + push: + branches: + - master + - develop + paths-ignore: + - '**.md' + - '**.rst' + - '**.sh' + +jobs: + ci_build: + name: ${{ matrix.name }} + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + + strategy: + fail-fast: false + matrix: + python-version: ['3.11'] + + name: [ + windows-2019-cl, + ubuntu-22.04-gcc-10, + ubuntu-24.04-gcc-13, + ubuntu-22.04-clang-15, + macOS-13-gcc, + macOS-13-clang, + ] + + include: + - name: windows-2019-cl + os: windows-2019 + compiler: cl + + - name: ubuntu-22.04-gcc-10 + os: ubuntu-22.04 + compiler: gcc + version: "10" + toxcmd: soname,tests + + - name: ubuntu-24.04-gcc-13 + os: ubuntu-24.04 + compiler: gcc + version: "13" + toxcmd: libs + + - name: ubuntu-22.04-clang-15 + os: ubuntu-22.04 + compiler: clang + version: "15" + toxcmd: clang + + - name: macOS-13-gcc + os: macOS-13 + compiler: gcc + version: "12" + toxcmd: abc,tests + + - name: macOS-13-clang + os: macOS-13 + compiler: xcode + version: "15.1" + toxcmd: "ctestwin -- Xcode" + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Update CMake + uses: jwlawson/actions-setup-cmake@v2 + if: runner.os == 'Windows' + + - name: Install Tox + run: | + python -m pip install --upgrade pip + pip install tox + + - name: Install and setup Linux packages + if: runner.os == 'Linux' + run: | + sudo apt-get -y -qq update + sudo apt-get install -yqq software-properties-common + sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa + sudo apt-get -qq update + sudo apt-get install -y libreadline-dev ncurses-dev libgtest-dev + if [ "${{ matrix.compiler }}" = gcc ]; then + sudo apt-get install -y g++-${{ matrix.version }} g++-${{ matrix.version }}-multilib + echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV + echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV + else + sudo apt-get install -y clang-${{ matrix.version }} clang++-${{ matrix.version }} llvm-${{ matrix.version }}-tools lld-${{ matrix.version }} + echo "CC=clang-${{ matrix.version }}" >> $GITHUB_ENV + echo "CXX=clang++-${{ matrix.version }}" >> $GITHUB_ENV + echo "LLVM_VER_DIR=/usr/lib/llvm-${{ matrix.version }}" >> $GITHUB_ENV + fi + + - name: Build and test Linux + if: runner.os == 'Linux' + env: + CC: ${{ env.CC }} + CXX: ${{ env.CXX }} + LLVM_VER_DIR: ${{ env.LLVM_VER_DIR }} + PREFIX: ../staging + run: | + tox -e ${{ matrix.toxcmd }} + + - uses: actions/upload-artifact@v4 + if: matrix.name == 'ubuntu-22.04-clang-15' + with: + name: src_coverage_data + path: | + build/coverage/html + build/coverage/lcov.info + + - name: Install and setup MacOS packages + if: runner.os == 'macOS' + run: | + brew update + #brew upgrade + if [ "${{ matrix.compiler }}" = xcode ]; then + sudo xcode-select -s /Applications/Xcode_${{ matrix.version }}.app/Contents/Developer + ls -ls /Applications/ + else + brew install gcc@${{ matrix.version }} + echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV + echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV + fi + + - name: Build and test MacOS + if: runner.os == 'macOS' + run: | + if [ "${{ matrix.compiler }}" = gcc ]; then + CC=${{ env.CC }} CXX=${{ env.CXX }} tox -e ${{ matrix.toxcmd }} + else + tox -e ${{ matrix.toxcmd }} + fi + + - name: Configure Windows + if: runner.os == 'Windows' + run: > + cmake -S . -B build + -DBUILD_SHARED_LIBS=OFF + -DABC_USE_NO_PTHREADS=ON + -DABC_USE_NO_READLINE=ON + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_INSTALL_PREFIX=${{ env.PREFIX }} + -DVENDOR_GTEST=ON + env: + CC: cl + CXX: cl + PREFIX: staging + + - name: Build Windows + if: runner.os == 'Windows' + run: cmake --build build --config Release -j 2 --target install + + - name: Test Windows + if: runner.os == 'Windows' + run: | + ctest -V -C Release --test-dir build/ + ls -lh staging/ || true diff --git a/.github/workflows/conda-dev.yml b/.github/workflows/conda-dev.yml new file mode 100644 index 0000000000..f7523a1a59 --- /dev/null +++ b/.github/workflows/conda-dev.yml @@ -0,0 +1,123 @@ +name: CondaDev + +on: + workflow_dispatch: + pull_request: + push: + branches: + - master + - develop + +jobs: + conda_build: + name: abc ${{ matrix.python-version }} ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: ['ubuntu-24.04', 'ubuntu-22.04', 'macOS-14', 'windows-2019'] + use_namespace: [false, true] + python-version: ['3.9'] + include: + - os: 'ubuntu-22.04' + generator: 'Ninja' + build_type: 'Release' + extra_args: '-DBUILD_SHARED_LIBS=ON -DABC_USE_SONAME=ON' + - os: 'ubuntu-24.04' + generator: 'Ninja' + build_type: 'RelWithDebInfo' + extra_args: '-DBUILD_SHARED_LIBS=ON -DABC_USE_SONAME=ON' + - os: 'macOS-14' + generator: 'Ninja' + build_type: 'Debug' + extra_args: '-DBUILD_SHARED_LIBS=ON -DABC_USE_SONAME=ON' + - os: 'windows-2019' + generator: 'Ninja' + build_type: 'Debug' + extra_args: '-DBUILD_SHARED_LIBS=OFF -DABC_USE_NO_PTHREADS=ON -DABC_USE_NO_READLINE=ON -DVENDOR_GTEST=ON' + env: + OS: ${{ matrix.os }} + PY_VER: ${{ matrix.python-version }} + PYTHONIOENCODING: utf-8 + CMAKE_ARGS: ${{ matrix.use_namespace && '-DABC_USE_NAMESPACE=xxx' || '' }} + + steps: + #- if: matrix.os == 'windows-2019' + #name: Install newer windows compiler + #id: install_cc + #uses: rlalik/setup-cpp-compiler@master + #with: + #compiler: g++-11.2.0 + + #- if: matrix.os == 'windows-2019' + #name: Use compiler + #shell: bash -l {0} + #env: + #CC: ${{ steps.install_cc.outputs.cc }} + #CXX: ${{ steps.install_cc.outputs.cxx }} + #run: | + + - uses: actions/checkout@v4 + + - name: Setup base python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Prepare build environment for windows + if: runner.os == 'Windows' + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x64 + + - name: Env (Windows) + if: runner.os == 'Windows' + run: | + echo "CXX=cl.exe" >> $GITHUB_ENV + echo "CC=cl.exe" >> $GITHUB_ENV + + - name: Cache conda + id: cache + uses: actions/cache@v4 + env: + # Increase this value to reset cache if environment.devenv.yml has not changed + CACHE_NUMBER: 2 + with: + path: ~/conda_pkgs_dir + key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.devenv.yml') }} + + - uses: conda-incubator/setup-miniconda@v3 + with: + auto-update-conda: true + auto-activate-base: true + activate-environment: '' + channels: conda-forge,defaults + channel-priority: flexible + conda-remove-defaults: true + + - name: Configure condadev environment + shell: bash -l {0} + env: + PY_VER: ${{ matrix.python-version }} + run: | + conda config --set always_yes yes --set changeps1 no + conda config --add channels conda-forge + conda install conda-devenv + conda info -a + conda devenv + + - name: Build and test + shell: bash -l {0} + env: + PY_VER: ${{ matrix.python-version }} + run: | + source activate abc-test + conda info --envs + ctest --build-config "${{ matrix.build_type }}" \ + --build-generator "${{ matrix.generator }}" \ + --build-and-test . build \ + --build-options ${CMAKE_ARGS} ${{ matrix.extra_args }} \ + -DCMAKE_PREFIX_PATH="$CONDA_PREFIX" \ + --test-command ctest -V \ + --build-config "${{ matrix.build_type }}" \ + --rerun-failed --output-on-failure diff --git a/.github/workflows/win.yml b/.github/workflows/win.yml new file mode 100644 index 0000000000..ebb48746a7 --- /dev/null +++ b/.github/workflows/win.yml @@ -0,0 +1,68 @@ +name: msystem + +on: + workflow_dispatch: + pull_request: + push: + branches: + - master + - develop + +jobs: + msys2_build: + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + include: [ + { msystem: MINGW64, arch: x86_64 }, + { msystem: CLANG64, arch: clang-x86_64 }, + { msystem: MINGW32, arch: i686 }, + ] + defaults: + run: + shell: msys2 {0} + steps: + - uses: actions/checkout@v4 + + - name: Setup MinGW native environment + uses: msys2/setup-msys2@v2 + with: + msystem: ${{ matrix.msystem }} + update: false + install: >- + git + make + mingw-w64-${{ matrix.arch }}-toolchain + mingw-w64-${{ matrix.arch }}-cmake + mingw-w64-${{ matrix.arch }}-ninja + mingw-w64-${{ matrix.arch }}-pkgconf + mingw-w64-${{ matrix.arch }}-readline + mingw-w64-${{ matrix.arch }}-gtest + + - run: >- + cmake + -Wdev + -B build + -DABC_USE_NAMESPACE=xxxx + -DBUILD_SHARED_LIBS=OFF + -DABC_USE_NO_READLINE=ON + -DVENDOR_GTEST=ON + -DCMAKE_BUILD_TYPE=RelWithDebInfo + -DCMAKE_INSTALL_PREFIX=$PWD/_dist + + - name: CMake build + run: | + cmake --build build --parallel + + - name: Test + run: ctest --test-dir build --output-on-failure --parallel -V + + - uses: actions/upload-artifact@v4 + if: failure() + with: + name: WindowsCMakeTestlog + path: build/Testing/Temporary/LastTest.log + + - name: Install project + run: cmake --install build diff --git a/.gitignore b/.gitignore index 9bd049424a..f383e5b3f8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +default.profraw +result.blif + DebugLib/ DebugExe/ DebugExt/ @@ -61,6 +64,9 @@ tags /arch_flags -/cmake /cscope abc.history + +.tox/ +staging/ +environment.yml diff --git a/CMakeLists.txt b/CMakeLists.txt index bbb153e642..3385c173c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,59 @@ -cmake_minimum_required(VERSION 3.5.0) +# pre-test discovery mode for gtest_discover_tests was added in 3.18 +cmake_minimum_required(VERSION 3.18) + +# Add cmake modules of this project to the module path +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) + +# with at least one base tag, this can have dynamic (git) versioning: +# git describe last tag = 1.1.0 +# git describe last tag + rev count = 1.1.0.45 +# +# for now, set -DSCM_VERSION_INFO in the build env to override +if(NOT SCM_VERSION_INFO) + set(LIBRARY_VERSION 1.2.0) + set(SCM_VERSION_INFO ${LIBRARY_VERSION}) +endif() +set(LIBRARY_SOVERSION 1) + +project( + abc + LANGUAGES CXX C + VERSION ${SCM_VERSION_INFO} +) + +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +set(CMAKE_VERBOSE_MAKEFILE ON) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +set(CMAKE_C_STANDARD 99) + +# MSVC has symbols hidden by default. On GCC and Clang we need to explicitly +# set the visibility to hidden to achieve the same result and then manually +# expose what we need. This results in smaller abc dynamic library and thus +# a shorter loading time and higher performance. +set(CMAKE_CXX_VISIBILITY_PRESET hidden) +set(CMAKE_VISIBILITY_INLINES_HIDDEN ON) + +if(CMAKE_CXX_COMPILER_ID STREQUAL Clang) + set(CLANG_DEFAULT_CXX_STDLIB libc++) + set(CLANG_DEFAULT_RTLIB compiler-rt) +endif() + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE + "RelWithDebInfo" + CACHE STRING "Default build type: RelWithDebInfo" FORCE + ) +endif() include(CMakeParseArguments) include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) +include(GNUInstallDirs) + # Generate compilation database compile_commands.json set(CMAKE_EXPORT_COMPILE_COMMANDS ON) @@ -10,121 +61,466 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_CXX_STANDARD 17 CACHE STRING "the C++ standard to use for this project") set(CMAKE_CXX_STANDARD_REQUIRED ON) -function(addprefix var prefix) - foreach( s ${ARGN} ) - list(APPEND tmp "-I${s}") - endforeach() - set(${var} ${tmp} PARENT_SCOPE) -endfunction() +# LTO requires cmake min version 3.9 and clang LTO requires lld +if(ABC_ENABLE_LTO AND CMAKE_BUILD_TYPE MATCHES "Release") + if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + find_package(LLVM CONFIG) + endif() -# filter out flags that are not appropriate for the compiler being used -function(target_compile_options_filtered target visibility) - foreach( flag ${ARGN} ) - if( flag MATCHES "^-D.*" ) - target_compile_options( ${target} ${visibility} ${flag} ) - else() - check_c_compiler_flag( ${flag} C_COMPILER_SUPPORTS__${flag} ) - if( C_COMPILER_SUPPORTS__${flag} ) - target_compile_options( ${target} ${visibility} $<$:${flag}> ) - endif() + include(CheckIPOSupported) + check_ipo_supported(RESULT ipo_supported OUTPUT error) - check_cxx_compiler_flag( ${flag} CXX_COMPILER_SUPPORTS__${flag} ) - if( CXX_COMPILER_SUPPORTS__${flag} ) - target_compile_options( ${target} ${visibility} $<$:${flag}> ) - endif() - endif() - endforeach() -endfunction() + if(ipo_supported) + message(STATUS "IPO / LTO supported") + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) + else() + message(WARNING "IPO / LTO not supported: <${error}>") + endif() +endif() + +set(ABC_USE_NAMESPACE "" CACHE STRING "ABC namespace") +option(ABC_USE_STDINT_H "Use C99 stdint.h header for platform-dependent types") +option(ABC_USE_NO_CUDD "Compile CUDD with ABC") +option(ABC_USE_NO_READLINE "Whether to use libreadline") +option(ABC_USE_NO_PTHREADS "Whether to compile with pthread support") +option(ABC_USE_PIC "Whether to compile into position independent code") +option(ABC_USE_LIBSTDCXX "Link explicitly to stdc++") +option(ABC_USE_SONAME "Set library soname") +option(BUILD_TESTING "Build and run tests" ON) +option(COVERAGE_BUILD "Enable source-based LLVM code coverage" OFF) +option(ABC_SKIP_EXE "Skip building executable (build libs only)" OFF) +option(VENDOR_GTEST "download googletest" OFF) + +#if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + #add_definitions(-DABC_DLL=__attribute__\(\(visibility\(\"default\"\)\)\)) +#endif() + +add_library(abc_interface INTERFACE) -project(abc) +set(ABC_HEADERS + src/base/main/abcapis_old.h + src/base/main/abcapis.h +) + +string(REPLACE "src/" "${CMAKE_CURRENT_SOURCE_DIR}/src/" ABC_HEADERS + "${ABC_HEADERS}" +) + +# Cache variable so this can be used in parent projects +set(abc_INCLUDE_DIR + "${CMAKE_CURRENT_LIST_DIR}/src" + CACHE INTERNAL "Directory where common headers are located" +) -if(READLINE_FOUND MATCHES TRUE) - addprefix(ABC_READLINE_INCLUDES_FLAGS "-I" ${READLINE_INCLUDE}) - string(REPLACE ";" " " ABC_READLINE_INCLUDES_FLAGS "${ABC_READLINE_INCLUDES_FLAGS}") - list(APPEND ABC_READLINE_FLAGS "ABC_READLINE_INCLUDES=${ABC_READLINE_INCLUDES_FLAGS}") +set(ABC_MODULES + src/base/abc src/base/abci src/base/cmd src/base/io src/base/main src/base/exor + src/base/ver src/base/wlc src/base/wln src/base/acb src/base/bac src/base/cba src/base/pla src/base/test + src/map/mapper src/map/mio src/map/super src/map/if/acd src/map/if + src/map/amap src/map/cov src/map/scl src/map/mpm + src/misc/extra src/misc/mvc src/misc/st src/misc/util src/misc/nm + src/misc/vec src/misc/hash src/misc/tim src/misc/bzlib src/misc/zlib + src/misc/mem src/misc/bar src/misc/bbl src/misc/parse + src/opt/cut src/opt/fxu src/opt/fxch src/opt/rwr src/opt/mfs src/opt/sim + src/opt/ret src/opt/fret src/opt/res src/opt/lpk src/opt/nwk src/opt/rwt src/opt/rar + src/opt/cgt src/opt/csw src/opt/dar src/opt/dau src/opt/dsc src/opt/sfm src/opt/sbd src/opt/eslim + src/sat/bsat src/sat/xsat src/sat/satoko src/sat/csat src/sat/msat src/sat/psat + src/sat/cnf src/sat/bmc src/sat/glucose src/sat/glucose2 src/sat/kissat src/sat/cadical + src/bool/bdc src/bool/deco src/bool/dec src/bool/kit src/bool/lucky + src/bool/rsb src/bool/rpo + src/proof/pdr src/proof/abs src/proof/live src/proof/ssc src/proof/int + src/proof/cec src/proof/acec src/proof/dch src/proof/fraig src/proof/fra src/proof/ssw + src/aig/aig src/aig/saig src/aig/gia src/aig/ioa src/aig/ivy src/aig/hop + src/aig/miniaig +) - string(REPLACE ";" " " ABC_READLINE_LIBRARIES_FLAGS "${READLINE_LIBRARIES}") - list(APPEND ABC_READLINE_FLAGS "ABC_READLINE_LIBRARIES=${ABC_READLINE_LIBRARIES_FLAGS}") -elseif(READLINE_FOUND MATCHES FALSE) - list(APPEND ABC_READLINE_FLAGS "ABC_USE_NO_READLINE=1") +if(NOT ABC_SKIP_EXE) + message(STATUS "Building abc main executable") + set(BUILD_MAIN_EXE + TRUE + CACHE BOOL "Building executable" FORCE + ) +endif() + +file(GLOB "src/ext*" ABC_EXTERNAL_MODULES) + +if(ABC_EXTERNAL_MODULES) + message(STATUS "External abc modules: ${ABC_EXTERNAL_MODULES}") + list(APPEND ABC_MODULES ${ABC_EXTERNAL_MODULES}) +endif() + +target_compile_definitions(abc_interface INTERFACE $<$:_DEBUG> $<$>:NDEBUG>) +target_include_directories( + abc_interface + INTERFACE $ + $ +) + +target_link_libraries(abc_interface INTERFACE ${CMAKE_DL_LIBS}) + +if(NOT ABC_USE_NO_CUDD) + message(STATUS "Compiling with CUDD") + list(APPEND ABC_MODULES src/bdd/cudd src/bdd/extrab src/bdd/dsd src/bdd/epd src/bdd/mtr src/bdd/reo src/bdd/cas src/bdd/bbr src/bdd/llb) + target_compile_definitions(abc_interface + INTERFACE ABC_USE_CUDD=1 + ) +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.6.0")) + target_compile_options(abc_interface + INTERFACE -fno-aggressive-loop-optimizations -Wno-unused-but-set-variable + ) +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + target_compile_options(abc_interface + INTERFACE -Werror=c99-designator + ) +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + target_compile_options(abc_interface + INTERFACE + -Wall -Wno-unused-function -Wno-write-strings -Wno-sign-compare + -Wno-deprecated -Wno-unused-but-set-variable + ) + target_link_libraries(abc_interface INTERFACE m) + if(WIN32 OR ABC_USE_NAMESPACE) + target_compile_options(abc_interface + INTERFACE + $<$:-fpermissive> + ) + endif() +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + target_compile_definitions(abc_interface + INTERFACE + "_CONSOLE" + "_MBCS" + "_SCL_SECURE_NO_WARNINGS" + "_CRT_SECURE_NO_WARNINGS" + "_CRT_INTERNAL_NONSTDC_NAMES" + "_XKEYCHECK_H" + "_ALLOW_KEYWORD_MACROS=1" + ) + set(CMAKE_DEBUG_POSTFIX d) +endif() +if(WIN32) + if(MINGW OR MSYS) + add_definitions(-DWIN32 -D__MINGW32__ -DHAVE_STRUCT_TIMESPEC) + if(DEFINED ENV{CONDA_PREFIX}) + target_include_directories(abc_interface + INTERFACE $ENV{CONDA_PREFIX}/Library/include + ) + endif() + endif() + target_compile_definitions(abc_interface + INTERFACE + $<$:HAVE_STRUCT_TIMESPEC> + $<$:ABC_DLL=ABC_DLLEXPORT> + $<$>:WIN32_NO_DLL> + $<$>:ABC_NO_DYNAMIC_LINKING> + ) + target_link_libraries(abc_interface INTERFACE shlwapi) endif() if(ABC_USE_NAMESPACE) - set(ABC_USE_NAMESPACE_FLAGS "ABC_USE_NAMESPACE=${ABC_USE_NAMESPACE}") -endif() - -if( APPLE ) - set(make_env ${CMAKE_COMMAND} -E env SDKROOT=${CMAKE_OSX_SYSROOT}) -endif() - -# run make to extract compiler options, linker options and list of source files -execute_process( - COMMAND - ${make_env} - make - ${ABC_READLINE_FLAGS} - ${ABC_USE_NAMESPACE_FLAGS} - ARCHFLAGS_EXE=${CMAKE_CURRENT_BINARY_DIR}/abc_arch_flags_program.exe - ABC_MAKE_NO_DEPS=1 - CC=${CMAKE_C_COMPILER} - CXX=${CMAKE_CXX_COMPILER} - LD=${CMAKE_CXX_COMPILER} - cmake_info - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - OUTPUT_VARIABLE MAKE_OUTPUT + message(STATUS "Compiling in namespace ${ABC_USE_NAMESPACE}") + target_compile_definitions(abc_interface INTERFACE "ABC_NAMESPACE=${ABC_USE_NAMESPACE}") +else() + set(ABC_USE_STDINT_H 1) +endif() + +include(CheckTypeSize) + +if(ABC_USE_STDINT_H) + check_type_size("void*" SIZEOF_VOID_P LANGUAGE C) + message(STATUS "Setting ABC_USE_STDINT_H ${ABC_USE_STDINT_H}") + target_compile_definitions(abc_interface INTERFACE "ABC_USE_STDINT_H=1") +else() + check_type_size("void*" SIZEOF_VOID_P LANGUAGE CXX) + check_type_size(long SIZEOF_LONG LANGUAGE CXX) + check_type_size(int SIZEOF_INT LANGUAGE CXX) + if(WIN32 OR MINGW OR MSYS) + set(ARCH_PREFIX "NT") + elseif(UNIX OR APPLE) + set(ARCH_PREFIX "LIN") + else() + message(FATAL_ERROR "Unknown arch") + endif() + if(SIZEOF_VOID_P EQUAL 4) + set(ARCH_SUFFIX "") + elseif(SIZEOF_VOID_P EQUAL 8) + set(ARCH_SUFFIX "64") + else() + message(FATAL_ERROR "Unknown pointer size") + endif() + target_compile_definitions(abc_interface INTERFACE + "SIZEOF_VOID_P=${SIZEOF_VOID_P}" + "SIZEOF_LONG=${SIZEOF_LONG}" + "SIZEOF_INT=${SIZEOF_INT}" + "${ARCH_PREFIX}${ARCH_SUFFIX}" + ) +endif() + +if(CMAKE_SYSTEM_PROCESS STREQUAL "arm") + target_compile_definitions(abc_interface INTERFACE + ABC_MEMALIGN=4 + ) +endif() + +if(NOT ABC_USE_NO_READLINE) + message(STATUS "Using libreadline") + target_compile_definitions(abc_interface + INTERFACE ABC_USE_READLINE + ) + find_path(ABC_READLINE_INCLUDES + NAMES readline.h + HINTS + $ENV{READLINE_ROOT} + PATH_SUFFIXES include include/readline + ) + find_library(ABC_READLINE_LIBRARIES + NAMES readline libreadline + HINTS + $ENV{READLINE_ROOT} + ) + if(NOT ABC_READLINE_INCLUDES OR NOT ABC_READLINE_LIBRARIES) + message(FATAL_ERROR "Could not find readline") + endif() + target_include_directories(abc_interface + INTERFACE ${ABC_READLINE_INCLUDES} + ) + target_link_libraries(abc_interface + INTERFACE ${ABC_READLINE_LIBRARIES} + ) +endif() + +if(NOT ABC_USE_NO_PTHREADS) + message(STATUS "Using pthreads") + target_compile_definitions(abc_interface + INTERFACE ABC_USE_PTHREADS + ) + if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + option(ABC_USE_EXTERNAL_PTHREAD "Use external pthread library") + if(ABC_USE_EXTERNAL_PTHREAD) + find_path(ABC_EXTERNAL_PTHREAD_INCLUDES + NAMES pthread.h + HINTS + $ENV{PTHREAD_ROOT} + PATH_SUFFIXES include include/readline + ) + find_library(ABC_EXTERNAL_PTHREAD_LIBRARIES + NAMES pthread pthread_lib pthread_dll + HINTS + $ENV{PTHREAD_ROOT} + ) + set(ABC_PTHREAD_INCLUDES "${ABC_EXTERNAL_PTHREAD_INCLUDES}") + set(ABC_PTHREAD_LIBRARIES "${ABC_EXTERNAL_PTHREAD_LIBRARIES}") + else() + if(SIZEOF_VOID_P EQUAL 8) + set(PTHREAD_ARCH "x64") + else() + set(PTHREAD_ARCH "x86") + endif() + set(ABC_PTHREAD_INCLUDES "${abc_SOURCE_DIR}/lib") + set(ABC_PTHREAD_LIBRARIES "${abc_SOURCE_DIR}/lib/${PTHREAD_ARCH}/pthreadVC2.lib") + install(FILES "${abc_SOURCE_DIR}/lib/${PTHREAD_ARCH}/pthreadVC2.dll" + DESTINATION "${CMAKE_INSTALL_BINDIR}" + ) + endif() + if(NOT ABC_PTHREAD_INCLUDES OR NOT ABC_PTHREAD_LIBRARIES) + message(FATAL_ERROR "Could not find pthread") + endif() + target_include_directories( + abc_interface + INTERFACE $ + ) + target_link_libraries(abc_interface INTERFACE ${ABC_PTHREAD_LIBRARIES}) + else() + set(CMAKE_THREAD_PREFER_PTHREAD ON) + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads REQUIRED) + target_link_libraries(abc_interface + INTERFACE ${CMAKE_THREAD_LIBS_INIT} + ) + endif() +endif() + +if(ABC_USE_PIC) + message(STATUS "Compiling position independent code") + set(CMAKE_POSITION_INDEPENDENT_CODE ON) +endif() + +if(ABC_USE_LIBSTDCXX OR NOT ABC_USE_NAMESPACE) + if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + message(STATUS "Using explicit -lstdc++") + target_link_libraries(abc_interface + INTERFACE stdc++ + ) + endif() +endif() + +define_property(GLOBAL + PROPERTY LIBABC_SOURCES + BRIEF_DOCS "Sources of libabc" + FULL_DOCS "All source files of libabc" ) -# extract options from make output -function(extract_var SEPARATOR DEST_VARIABLE MAKE_OUTPUT) - string(REGEX MATCH "${SEPARATOR} .* ${SEPARATOR}" TMP "${MAKE_OUTPUT}") - string(REGEX REPLACE "${SEPARATOR} (.*) ${SEPARATOR}" "\\1" TMP "${TMP}") +define_property(GLOBAL + PROPERTY ABC_SOURCES + BRIEF_DOCS "Sources of executables of abc" + FULL_DOCS "All source files of abc" +) - separate_arguments(TMP) +function(abc_libabc_add_sources) + cmake_parse_arguments(AAM "" "NAME" "SOURCES" ${ARGN}) + file(RELATIVE_PATH RELDIR "${abc_SOURCE_DIR}" "${CMAKE_CURRENT_LIST_DIR}") + set(RELSOURCES) + foreach(SOURCE ${AAM_SOURCES}) + list(APPEND RELSOURCES "${RELDIR}/${SOURCE}") + endforeach() + source_group("${RELDIR}" FILES "${AAM_SOURCES}") + set_property(GLOBAL APPEND PROPERTY LIBABC_SOURCES ${RELSOURCES}) +endfunction() - set(${DEST_VARIABLE} ${TMP} PARENT_SCOPE) +function(abc_add_executable) + cmake_parse_arguments(AAE "" "NAME" "SOURCES" ${ARGN}) + file(RELATIVE_PATH RELDIR "${abc_SOURCE_DIR}" "${CMAKE_CURRENT_LIST_DIR}") + set(RELSOURCES) + foreach(SOURCE ${AAE_SOURCES}) + list(APPEND RELSOURCES "${RELDIR}${SOURCE}") + endforeach() + if(ABC_USE_NAMESPACE) + set_source_files_properties(${AAE_SOURCES} PROPERTIES LANGUAGE CXX) + endif() + add_executable("${AAE_NAME}" ${AAE_SOURCES}) + target_link_libraries("${AAE_NAME}" PUBLIC libabc) + set_property(GLOBAL APPEND PROPERTY ABC_SOURCES ${RELSOURCES}) endfunction() -extract_var(SEPARATOR_SRC ABC_SRC ${MAKE_OUTPUT}) -extract_var(SEPARATOR_LIBS ABC_LIBS ${MAKE_OUTPUT}) -extract_var(SEPARATOR_CFLAGS ABC_CFLAGS ${MAKE_OUTPUT}) -extract_var(SEPARATOR_CXXFLAGS ABC_CXXFLAGS ${MAKE_OUTPUT}) +foreach(ABC_MODULE ${ABC_MODULES}) + add_subdirectory("${ABC_MODULE}") +endforeach() + +get_property(LIBABC_SOURCES GLOBAL PROPERTY LIBABC_SOURCES) +get_property(ABC_SOURCES GLOBAL PROPERTY ABC_SOURCES) if(ABC_USE_NAMESPACE) - set_source_files_properties(${ABC_SRC} PROPERTIES LANGUAGE CXX) + set_source_files_properties(${LIBABC_SOURCES} PROPERTIES LANGUAGE CXX) endif() -function(abc_properties target visibility) - target_include_directories(${target} ${visibility} ${CMAKE_CURRENT_SOURCE_DIR}/src ) - target_compile_options_filtered(${target} ${visibility} ${ABC_CFLAGS} ${ABC_CXXFLAGS} -Wno-unused-but-set-variable ) - target_link_libraries(${target} ${visibility} ${ABC_LIBS}) -endfunction() +add_library(libabc ${LIBABC_SOURCES}) +target_link_libraries(libabc PUBLIC abc_interface) +set_target_properties(libabc + PROPERTIES OUTPUT_NAME "abc" +) -set(ABC_MAIN_SRC src/base/main/main.c) -list(REMOVE_ITEM ABC_SRC ${ABC_MAIN_SRC}) +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + set_target_properties(libabc + PROPERTIES OUTPUT_NAME "abc$<$:d>$<$>:r>" + ) +endif() -add_library(libabc EXCLUDE_FROM_ALL ${ABC_SRC}) -abc_properties(libabc PUBLIC) -set_property(TARGET libabc PROPERTY OUTPUT_NAME abc) +if(BUILD_SHARED_LIBS) + if(ABC_USE_SONAME) + set_target_properties( + libabc PROPERTIES VERSION ${LIBRARY_VERSION} + SOVERSION ${LIBRARY_SOVERSION} + WINDOWS_EXPORT_ALL_SYMBOLS TRUE + ) + endif() +endif() -add_executable(abc ${ABC_MAIN_SRC}) -target_link_libraries(abc PRIVATE libabc) -abc_properties(abc PRIVATE) +install(FILES ${ABC_HEADERS} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/abc +) -add_library(libabc-pic EXCLUDE_FROM_ALL ${ABC_SRC}) -abc_properties(libabc-pic PUBLIC) -set_property(TARGET libabc-pic PROPERTY POSITION_INDEPENDENT_CODE ON) -set_property(TARGET libabc-pic PROPERTY OUTPUT_NAME abc-pic) +install( + TARGETS abc_interface libabc + EXPORT abcConfig + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) -if(NOT DEFINED ABC_SKIP_TESTS) - enable_testing() +install(EXPORT abcConfig + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/abc NAMESPACE abc::) + +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + if(BUILD_SHARED_LIBS) + install(FILES $ DESTINATION bin OPTIONAL) + endif() +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + if(ABC_ENABLE_LTO AND ipo_supported) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=lld") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=lld") + endif() +endif() + +if(VENDOR_GTEST) include(FetchContent) + option(INSTALL_GTEST OFF) FetchContent_Declare( - googletest - DOWNLOAD_EXTRACT_TIMESTAMP TRUE - # Specify the commit you depend on and update it regularly. - URL "https://github.com/google/googletest/archive/refs/tags/v1.14.0.zip" + googletest + DOWNLOAD_EXTRACT_TIMESTAMP TRUE + URL "https://github.com/google/googletest/archive/refs/tags/v1.14.0.zip" + #GIT_REPOSITORY https://github.com/google/googletest.git + #GIT_TAG v1.14.0 ) + set(gtest_force_shared_crt ON CACHE BOOL "Always use msvcrt.dll" FORCE) FetchContent_MakeAvailable(googletest) + include_directories(${gtest_SOURCE_DIR}/include) + set(GTEST_LINK_LIBRARIES GTest::gtest GTest::gtest_main) +endif() + +if(BUILD_TESTING) + if(NOT VENDOR_GTEST) + find_package(GTest 1.14 REQUIRED) + include_directories(${GTEST_INCLUDE_DIRS}) + set(GTEST_LINK_LIBRARIES ${GTEST_BOTH_LIBRARIES}) + endif() + message(STATUS "GTest libraries: ${GTEST_LINK_LIBRARIES}") + + message(STATUS "test discovery enabled") include(GoogleTest) + + set(test_SRCS src/demo.c) + if(ABC_USE_NAMESPACE) + set_source_files_properties(${test_SRCS} PROPERTIES LANGUAGE CXX) + endif() + add_executable(base_test ${test_SRCS}) + target_compile_options(base_test PUBLIC ${GTEST_CFLAGS}) + target_link_libraries( + base_test PUBLIC libabc ${GTEST_LINK_LIBRARIES} + ) + + enable_testing() + add_test(NAME base_test + COMMAND base_test "${abc_SOURCE_DIR}/i10.aig" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + + # Add source-based llvm code coverage targets. + # Note this requires recent clang/llvm tooling. + if(COVERAGE_BUILD) + include(coverage) + add_coverage(abc) + add_coverage(base_test) + add_coverage(gia_test) + endif() + add_subdirectory(test) -endif() \ No newline at end of file +endif() + +add_custom_target(etags + etags ${LIBABC_SOURCES} ${ABC_SOURCES} + COMMENT "Generating etags" + WORKING_DIRECTORY "${abc_SOURCE_DIR}" +) + +add_custom_target(docs + doxygen doxygen.conf + COMMENT "Building documentation." + WORKING_DIRECTORY "${abc_SOURCE_DIR}" +) diff --git a/Makefile b/Makefile index 50cff2d170..eb7b027628 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,22 @@ -CC := gcc -CXX := g++ -AR := ar +CC ?= gcc +CXX ?= g++ +AR ?= ar LD := $(CXX) +LN ?= ln +MV ?= mv MSG_PREFIX ?= ABCSRC ?= . VPATH = $(ABCSRC) -$(info $(MSG_PREFIX)Using CC=$(CC)) -$(info $(MSG_PREFIX)Using CXX=$(CXX)) -$(info $(MSG_PREFIX)Using AR=$(AR)) -$(info $(MSG_PREFIX)Using LD=$(LD)) - PROG := abc OS := $(shell uname -s) +VERSION ?= 1.2.0 +SOVERSION ?= 1 +SONAME := lib$(PROG).so.$(SOVERSION) + MODULES := \ $(wildcard src/ext*) \ src/base/abc src/base/abci src/base/cmd src/base/io src/base/main src/base/exor \ @@ -28,7 +29,8 @@ MODULES := \ src/opt/cut src/opt/fxu src/opt/fxch src/opt/rwr src/opt/mfs src/opt/sim \ src/opt/ret src/opt/fret src/opt/res src/opt/lpk src/opt/nwk src/opt/rwt src/opt/rar \ src/opt/cgt src/opt/csw src/opt/dar src/opt/dau src/opt/dsc src/opt/sfm src/opt/sbd src/opt/eslim \ - src/sat/bsat src/sat/xsat src/sat/satoko src/sat/csat src/sat/msat src/sat/psat src/sat/cnf src/sat/bmc src/sat/glucose src/sat/glucose2 src/sat/kissat src/sat/cadical \ + src/sat/bsat src/sat/xsat src/sat/satoko src/sat/csat src/sat/msat src/sat/psat \ + src/sat/cnf src/sat/bmc src/sat/glucose src/sat/glucose2 src/sat/kissat src/sat/cadical \ src/bool/bdc src/bool/deco src/bool/dec src/bool/kit src/bool/lucky \ src/bool/rsb src/bool/rpo \ src/proof/pdr src/proof/abs src/proof/live src/proof/ssc src/proof/int \ @@ -64,9 +66,14 @@ endif # compile ABC using the C++ compiler and put everything in the namespace $(ABC_NAMESPACE) ifdef ABC_USE_NAMESPACE - CFLAGS += -DABC_NAMESPACE=$(ABC_USE_NAMESPACE) -fpermissive -x c++ + CFLAGS += -DABC_DLL="__attribute__((visibility(\"default\")))" -DABC_NAMESPACE=$(ABC_USE_NAMESPACE) -std=c++17 -fvisibility=hidden -fvisibility-inlines-hidden -fpermissive + CXXFLAGS := $(CFLAGS) CC := $(CXX) + DLIBS := -lstdc++ $(info $(MSG_PREFIX)Compiling in namespace $(ABC_NAMESPACE)) +else + CXXFLAGS := $(CFLAGS) + ABC_USE_LIBSTDCXX := 1 endif # compile CUDD with ABC @@ -120,7 +127,7 @@ GCC_VERSION=$(shell $(CC) -dumpversion) GCC_MAJOR=$(word 1,$(subst .,$(space),$(GCC_VERSION))) GCC_MINOR=$(word 2,$(subst .,$(space),$(GCC_VERSION))) -$(info $(MSG_PREFIX)Found GCC_VERSION $(GCC_VERSION)) +$(info $(MSG_PREFIX)Found CC_VERSION $(GCC_VERSION)) ifeq ($(findstring $(GCC_MAJOR),0 1 2 3),) ifeq ($(GCC_MAJOR),4) $(info $(MSG_PREFIX)Found GCC_MAJOR==4) @@ -130,9 +137,12 @@ CFLAGS += -Wno-unused-but-set-variable endif else $(info $(MSG_PREFIX)Found GCC_MAJOR>=5) +CLANG_HEADER=$(shell $(CC) --version | grep -w clang) +ifeq (,$(CLANG_HEADER)) CFLAGS += -Wno-unused-but-set-variable endif endif +endif endif @@ -151,11 +161,17 @@ ifdef ABC_USE_LIBSTDCXX $(info $(MSG_PREFIX)Using explicit -lstdc++) endif +$(info $(MSG_PREFIX)Using CC=$(CC)) +$(info $(MSG_PREFIX)Using CXX=$(CXX)) +$(info $(MSG_PREFIX)Using AR=$(AR)) +$(info $(MSG_PREFIX)Using LD=$(LD)) + $(info $(MSG_PREFIX)Using CFLAGS=$(CFLAGS)) CXXFLAGS += $(CFLAGS) -std=c++17 -fno-exceptions +$(info $(MSG_PREFIX)Using CXXFLAGS=$(CXXFLAGS)) SRC := -GARBAGE := core core.* *.stackdump ./tags $(PROG) arch_flags +GARBAGE := core core.* *.stackdump ./tags $(PROG) demo* arch_flags result.blif .PHONY: all default tags clean docs cmake_info @@ -168,6 +184,7 @@ OBJ := \ $(patsubst %.y, %.o, $(filter %.y, $(SRC))) LIBOBJ := $(filter-out src/base/main/main.o,$(OBJ)) +DEMOOBJ := src/demo.o DEP := $(OBJ:.o=.d) @@ -213,14 +230,14 @@ depend: $(DEP) clean: @echo "$(MSG_PREFIX)\`\` Cleaning up..." - $(VERBOSE)rm -rvf $(PROG) lib$(PROG).a - $(VERBOSE)rm -rvf $(OBJ) - $(VERBOSE)rm -rvf $(GARBAGE) - $(VERBOSE)rm -rvf $(OBJ:.o=.d) + $(VERBOSE)rm -rvf $(PROG) lib$(PROG).* $(OBJ) $(GARBAGE) $(OBJ:.o=.d) tags: etags `find . -type f -regex '.*\.\(c\|h\)'` +test: $(PROG) + ./abc -c "r i10.aig; b; ps; b; rw -l; rw -lz; b; rw -lz; b; ps; cec" + $(PROG): $(OBJ) @echo "$(MSG_PREFIX)\`\` Building binary:" $(notdir $@) $(VERBOSE)$(LD) -o $@ $^ $(LDFLAGS) $(LIBS) @@ -229,9 +246,23 @@ lib$(PROG).a: $(LIBOBJ) @echo "$(MSG_PREFIX)\`\` Linking:" $(notdir $@) $(VERBOSE)$(AR) rsv $@ $? +ifdef ABC_USE_SONAME +lib: lib$(PROG).so.$(VERSION) + +lib$(PROG).so.$(VERSION): $(LIBOBJ) + @echo "$(MSG_PREFIX)\`\` Linking:" $(notdir $@) + +$(VERBOSE)$(LD) -shared -Wl,-soname=$(SONAME) -o $@ $^ $(LIBS) + ldconfig -v -n . + @$(LN) -sf lib$(PROG).so.$(VERSION) lib$(PROG).so + @$(LN) -sf lib$(PROG).so.$(VERSION) $(SONAME) + +else +lib: lib$(PROG).so + lib$(PROG).so: $(LIBOBJ) @echo "$(MSG_PREFIX)\`\` Linking:" $(notdir $@) - $(VERBOSE)$(CXX) -shared -o $@ $^ $(LIBS) + +$(VERBOSE)$(LD) -shared -o $@ $^ $(LIBS) +endif docs: @echo "$(MSG_PREFIX)\`\` Building documentation." $(notdir $@) diff --git a/README.md b/README.md index 2bb34cd036..56e29a6f37 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,14 @@ +# ABC: System for Sequential Logic Synthesis and Formal Verification + +[![ci](https://github.com/sarnold/abc-fork/actions/workflows/ci.yml/badge.svg)](https://github.com/sarnold/abc-fork/actions/workflows/ci.yml) +[![msystem](https://github.com/sarnold/abc-fork/actions/workflows/win.yml/badge.svg)](https://github.com/sarnold/abc-fork/actions/workflows/win.yml) +[![CondaDev](https://github.com/sarnold/abc-fork/actions/workflows/conda-dev.yml/badge.svg)](https://github.com/sarnold/abc-fork/actions/workflows/conda-dev.yml) + [![.github/workflows/build-posix.yml](https://github.com/berkeley-abc/abc/actions/workflows/build-posix.yml/badge.svg)](https://github.com/berkeley-abc/abc/actions/workflows/build-posix.yml) [![.github/workflows/build-windows.yml](https://github.com/berkeley-abc/abc/actions/workflows/build-windows.yml/badge.svg)](https://github.com/berkeley-abc/abc/actions/workflows/build-windows.yml) [![.github/workflows/build-posix-cmake.yml](https://github.com/berkeley-abc/abc/actions/workflows/build-posix-cmake.yml/badge.svg)](https://github.com/berkeley-abc/abc/actions/workflows/build-posix-cmake.yml) -# ABC: System for Sequential Logic Synthesis and Formal Verification +## Requirements: ABC is always changing but the current snapshot is believed to be stable. @@ -16,17 +22,84 @@ The source code is provided for research and evaluation only. For commercial usa References: -[1] L. Fan and C. Wu, "FPGA technology mapping with adaptive gate decompostion", ACM/SIGDA FPGA International Symposium on FPGAs, 2023. +[1] L. Fan and C. Wu, "FPGA technology mapping with adaptive gate decompostion", ACM/SIGDA FPGA International Symposium on FPGAs, 2023. + +Minimum desktop tools needed: + + * A recent toolchain for your platform: GNU/Clang/Xcode, MSVC/MSYS + * Make and/or CMake/Ninja: the latter can be installed via Tox + +Optional: + + * libstdc++ + * readline/ncurses + * pthreads + * If using Tox, a recent Python for your platform + * If using Conda, install `conda-devenv` and use the `environment.devenv.yml` file + +ABC can be built in multiple ways on each platform; see the github workflow +files for specific build methods and tools/packages. The easiest (local) build +workflow is to install a toolchain, make utilities, and Tox using your system +package manager; you *can* build from source on MacOS/Windows using the usual +developer tools, ie, Apple Xcode or Windows Visual Studio tools (as shown in +the `ci.yml` workflow and `tox.ini` files). + +For non-Linux platforms, if you don't have tools installed yet, an (extra) +package manager should be used to install GNU tools and dependencies. Note +this is exactly what the Github workflow runners use: + + * Windows: `Chocolatey` or `MSYS2` + * MacOS: `brew` + +### Build and test with Tox -## Compiling: +With at least Python 3.6 installed, install [![tox](tox)](https://github.com/tox-dev/tox) -To compile ABC as a binary, download and unzip the code, then type `make`. +After cloning the repository, you can run the current tests using either +cmake or (just) make with the `tox` command. Tox will build a virtual +python environment with most of the build dependencies (except the shared +libraries above) and then run the tests. For cmake plus a simple unittest, +run something like the following: + + $ git clone https://github.com/berkeley-abc/abc.git + $ cd abc/ + $ tox -e ctest + +Note for some Tox targets, eg `demo` and `clang`, both `CC` and `CXX` should +either be set in the shell environment or passed on the command line, eg: + + $ CC=gcc CXX=g++ tox -e abc,demo --or-- + $ CC=clang CXX=clang++ tox -e clang + +There are several `tox -e` environment commands available in the current tox file: + +* Make-based args: + * `abc` - run make build => abc executable and static lib + * `soname` - run make build => shared lib with soname + * `tests` - build/run abc executable as simple test + * `demo` - build/run demo executable against static lib using make +* CMake-based args: + * `base` - run cmake Release build with namespace and staging dir install + * `build` - run cmake Debug build with shared libs, namespace, soname, LTO + * `clang` - run cmake RelWithDebInfo build with clang/LLVM source coverage, namespace, static lib + * `ctest` - build/run tests using ctest => static lib and "test" executable + * `grind` - run cmake Debug build with valgrind +* Misc utility commands: + * `clean` - clean the automake/autoconf build byproducts + * `cclean` - clean the cmake build/ directory/files + * `lint` - run cpplint style checks + +### Compiling manually: + +To compile ABC as a binary, clone/download and unzip the code, then type `make`. To compile ABC as a static library, type `make libabc.a`. +To compile ABC as a shared library, type `make lib`. +To compile ABC as a shared library with soname, type `ABC_USE_SONAME=1 make lib`. -When ABC is used as a static library, two additional procedures, `Abc_Start()` -and `Abc_Stop()`, are provided for starting and quitting the ABC framework in -the calling application. A simple demo program (file src/demo.c) shows how to -create a stand-alone program performing DAG-aware AIG rewriting, by calling +When ABC is used as a static library, two additional procedures, `Abc_Start()` +and `Abc_Stop()`, are provided for starting and quitting the ABC framework in +the calling application. A simple demo program (file src/demo.c) shows how to +create a stand-alone program performing DAG-aware AIG rewriting, by calling APIs of ABC compiled as a static library. To build the demo program @@ -65,23 +138,32 @@ or in the batch mode: The current version of ABC can be compiled with C compiler or C++ compiler. * To compile as C code (default): make sure that `CC=gcc` and `ABC_NAMESPACE` is not defined. - * To compile as C++ code without namespaces: make sure that `CC=g++` and `ABC_NAMESPACE` is not defined. + * To compile as C++ code without namespaces: make sure that `CC=g++` and `ABC_NAMESPACE` is not + defined (deprecated). * To compile as C++ code with namespaces: make sure that `CC=g++` and `ABC_NAMESPACE` is set to the name of the requested namespace. For example, add `-DABC_NAMESPACE=xxx` to OPTFLAGS. ## Building a shared library * Compile the code as position-independent by adding `ABC_USE_PIC=1`. - * Build the `libabc.so` target: - - make ABC_USE_PIC=1 libabc.so + * Build the `libabc.so` target: + + make ABC_USE_PIC=1 lib + +## Adding new source files + +For each module with new sources: + + * Add new source files to the corresponding `module.make` file + * Run `tools/mk-cmakelists.py` and then `git diff` to review changes + * Make sure new object files exist in your build ## Bug reporting: -Please try to reproduce all the reported bugs and unexpected features using the latest +Please try to reproduce all the reported bugs and unexpected features using the latest version of ABC available from https://github.com/berkeley-abc/abc -If the bug still persists, please provide the following information: +If the bug still persists, please provide the following information: 1. ABC version (when it was downloaded from GitHub) 1. Linux distribution and version (32-bit or 64-bit) @@ -92,7 +174,7 @@ If the bug still persists, please provide the following information: ## Troubleshooting: - 1. If compilation does not start because of the cyclic dependency check, + 1. If compilation does not start because of the cyclic dependency check, try touching all files as follows: `find ./ -type f -exec touch "{}" \;` 1. If compilation fails because readline is missing, install 'readline' library or compile with `make ABC_USE_NO_READLINE=1` @@ -107,11 +189,11 @@ compile with `make ABC_USE_NO_PTHREADS=1` The following comment was added by Krish Sundaresan: -"I found that the code does compile correctly on Solaris if gcc is used (instead of -g++ that I was using for some reason). Also readline which is not available by default -on most Sol10 systems, needs to be installed. I downloaded the readline-5.2 package -from sunfreeware.com and installed it locally. Also modified CFLAGS to add the local -include files for readline and LIBS to add the local libreadline.a. Perhaps you can +"I found that the code does compile correctly on Solaris if gcc is used (instead of +g++ that I was using for some reason). Also readline which is not available by default +on most Sol10 systems, needs to be installed. I downloaded the readline-5.2 package +from sunfreeware.com and installed it locally. Also modified CFLAGS to add the local +include files for readline and LIBS to add the local libreadline.a. Perhaps you can add these steps in the readme to help folks compiling this on Solaris." The following tutorial is kindly offered by Ana Petkovska from EPFL: @@ -119,7 +201,7 @@ https://www.dropbox.com/s/qrl9svlf0ylxy8p/ABC_GettingStarted.pdf ## Final remarks: -Unfortunately, there is no comprehensive regression test. Good luck! +Unfortunately, there is no comprehensive regression test. Good luck! -This system is maintained by Alan Mishchenko . Consider also +This system is maintained by Alan Mishchenko . Consider also using ZZ framework developed by Niklas Een: https://bitbucket.org/niklaseen/abc-zz (or https://github.com/berkeley-abc/abc-zz) diff --git a/cmake/coverage.cmake b/cmake/coverage.cmake new file mode 100644 index 0000000000..7d433bbe08 --- /dev/null +++ b/cmake/coverage.cmake @@ -0,0 +1,128 @@ +option(COVERAGE_TEXT "Show text summary of the coverage" ON) +option(COVERAGE_LCOV "Export coverage data in lcov trace file" ON) +option(COVERAGE_HTML "Detailed html report of the coverage" OFF) + +set(COVERAGE_EXCLUDE_REGEX "(test/|lib/)") +set(COVERAGE_PATH ${PROJECT_BINARY_DIR}/coverage) +set(LLVM_DIRECTORY "$ENV{LLVM_VER_DIR}") + +if(COVERAGE_BUILD) + message( + STATUS + "Source coverage is enabled. TEXT=${COVERAGE_TEXT}, LCOV=${COVERAGE_LCOV}, HTML=${COVERAGE_HTML}" + ) + + find_package( + LLVM REQUIRED CONFIG + HINTS ${LLVM_DIRECTORY} + ) + message(STATUS "Using llvm directory: ${LLVM_DIRECTORY}") + + find_program( + LLVM_COV_PATH + NAMES llvm-cov + HINTS ${LLVM_DIRECTORY} + PATH_SUFFIXES bin + ) + find_program( + LLVM_PROFDATA_PATH + NAMES llvm-profdata + HINTS ${LLVM_DIRECTORY} + PATH_SUFFIXES bin + ) + + if(LLVM_COV_PATH AND LLVM_PROFDATA_PATH) + set(ABC_HAVE_LLVM_COVERAGE_TOOLS TRUE) + + message(STATUS "Found llvm-cov: ${LLVM_COV_PATH}") + message(STATUS "Found llvm-profdata: ${LLVM_PROFDATA_PATH}") + else() + message(FATAL_ERROR "llvm-cov stack required for coverage!") + endif() + + set(CMAKE_C_FLAGS + "${CMAKE_C_FLAGS} -fprofile-instr-generate -fcoverage-mapping" + ) + set(CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} -fprofile-instr-generate -fcoverage-mapping" + ) + + set(COVERAGE_TARGETS ${COVERAGE_PATH}/targets.list) + set(COVERAGE_PROFDATA ${COVERAGE_PATH}/all.profdata) + mark_as_advanced(COVERAGE_TARGETS COVERAGE_PROFDATA) +endif() + +function(add_coverage TARGET) + if(NOT COVERAGE_BUILD) + return() + endif() + + if(NOT TARGET coverage) + add_custom_target( + coverage-clear + COMMAND ${CMAKE_COMMAND} -E rm -rf ${COVERAGE_PATH} + COMMAND ${CMAKE_COMMAND} -E make_directory ${COVERAGE_PATH} + ) + + add_custom_target( + coverage-profdata + COMMAND + ${CMAKE_COMMAND} -E env + LLVM_PROFILE_FILE="${COVERAGE_PATH}/test_%p.profraw" + ${CMAKE_CTEST_COMMAND} ${CMAKE_CTEST_ARGUMENTS} + COMMAND ${LLVM_PROFDATA_PATH} merge -sparse + ${COVERAGE_PATH}/*.profraw -o ${COVERAGE_PROFDATA} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + ) + + add_custom_target(coverage) + + if(COVERAGE_TEXT) + add_custom_target( + coverage-text + COMMAND + ${LLVM_COV_PATH} report `cat ${COVERAGE_TARGETS}` + -instr-profile=${COVERAGE_PROFDATA} + -ignore-filename-regex="${COVERAGE_EXCLUDE_REGEX}" + DEPENDS coverage-profdata + ) + add_dependencies(coverage coverage-text) + endif() + + if(COVERAGE_HTML) + add_custom_target( + coverage-html + COMMAND + ${LLVM_COV_PATH} show `cat ${COVERAGE_TARGETS}` + -instr-profile=${COVERAGE_PROFDATA} + -show-line-counts-or-regions + -output-dir=${COVERAGE_PATH}/html -format="html" + -ignore-filename-regex="${COVERAGE_EXCLUDE_REGEX}" + DEPENDS coverage-profdata + ) + add_dependencies(coverage coverage-html) + endif() + + if(COVERAGE_LCOV) + add_custom_target( + coverage-lcov + COMMAND + ${LLVM_COV_PATH} export `cat ${COVERAGE_TARGETS}` + -format="lcov" -instr-profile=${COVERAGE_PROFDATA} + -ignore-filename-regex="${COVERAGE_EXCLUDE_REGEX}" > + ${COVERAGE_PATH}/lcov.info + DEPENDS coverage-profdata + ) + add_dependencies(coverage coverage-lcov) + endif() + endif() + + add_custom_target( + coverage-${TARGET} + COMMAND ${CMAKE_COMMAND} -E echo "-object=$" >> + ${COVERAGE_TARGETS} + DEPENDS coverage-clear + ) + add_dependencies(coverage-profdata coverage-${TARGET}) + +endfunction() diff --git a/environment.devenv.yml b/environment.devenv.yml new file mode 100644 index 0000000000..55846b27e8 --- /dev/null +++ b/environment.devenv.yml @@ -0,0 +1,28 @@ +name: abc-test + +dependencies: + - python ={{ get_env("PY_VER", default="3.10") }} + - cmake>=3.18 + - ninja + - make # [unix] + - pkg-config # [unix] + - readline=8.1 # [unix] + - zlib + - libpng + - gtest=1.14.0 # [not win] + - abseil-cpp + - re2 + - lcov + - gcovr + - c-compiler + - cxx-compiler + - ccache # [unix] + - clcache # [win] + - six + +environment: + CPATH: + - $CONDA_PREFIX/include # [unix] + - $CONDA_PREFIX/Library/include # [win] + + LD_LIBRARY_PATH: $CONDA_PREFIX/lib # [unix] diff --git a/src/aig/aig/CMakeLists.txt b/src/aig/aig/CMakeLists.txt new file mode 100644 index 0000000000..78ace8c34d --- /dev/null +++ b/src/aig/aig/CMakeLists.txt @@ -0,0 +1,35 @@ +abc_libabc_add_sources( + NAME aig_aig + SOURCES + aigInter.c + aigJust.c + aigUtil.c + aigRet.c + aigObj.c + aigRepr.c + aigOrder.c + aigPartReg.c + aigPack.c + aigFanout.c + aigTiming.c + aigCanon.c + aigTruth.c + aigMan.c + aigCheck.c + aigTsim.c + aigOper.c + aigFrames.c + aigTable.c + aigMem.c + aigShow.c + aigPart.c + aigScl.c + aigDup.c + aigPartSat.c + aigWin.c + aigDfs.c + aigSplit.c + aigMffc.c + aigCuts.c + aigRetF.c +) diff --git a/src/aig/aig/aigPart.c b/src/aig/aig/aigPart.c index 9b978e3b47..a6c515696b 100644 --- a/src/aig/aig/aigPart.c +++ b/src/aig/aig/aigPart.c @@ -309,7 +309,7 @@ Vec_Ptr_t * Aig_ManSupports( Aig_Man_t * pMan ) { pPart0 = (Part_One_t *)Aig_ObjFanin0(pObj)->pData; vSupp = Part_ManTransferEntry(pPart0); - Vec_IntPush( vSupp, (int)(long)pObj->pNext ); + Vec_IntPush( vSupp, (int)(ABC_PTRINT_T)pObj->pNext ); Vec_PtrPush( vSupports, vSupp ); assert( pPart0->nRefs > 0 ); if ( --pPart0->nRefs == 0 ) @@ -321,7 +321,7 @@ Vec_Ptr_t * Aig_ManSupports( Aig_Man_t * pMan ) if ( pObj->nRefs ) { pPart0 = Part_ManFetchEntry( p, 1, pObj->nRefs ); - pPart0->pOuts[ pPart0->nOuts++ ] = (int)(long)pObj->pNext; + pPart0->pOuts[ pPart0->nOuts++ ] = (int)(ABC_PTRINT_T)pObj->pNext; pObj->pData = pPart0; } continue; @@ -972,7 +972,7 @@ Aig_Obj_t * Aig_ManDupPart_rec( Aig_Man_t * pNew, Aig_Man_t * pOld, Aig_Obj_t * if ( Aig_ObjIsCi(pObj) ) { assert( Vec_IntSize(vSuppMap) == Aig_ManCiNum(pNew) ); - Vec_IntPush( vSuppMap, (int)(long)pObj->pNext ); + Vec_IntPush( vSuppMap, (int)(ABC_PTRINT_T)pObj->pNext ); return (Aig_Obj_t *)(pObj->pData = Aig_ObjCreateCi(pNew)); } assert( Aig_ObjIsNode(pObj) ); diff --git a/src/aig/gia/CMakeLists.txt b/src/aig/gia/CMakeLists.txt new file mode 100644 index 0000000000..ed09325059 --- /dev/null +++ b/src/aig/gia/CMakeLists.txt @@ -0,0 +1,120 @@ +abc_libabc_add_sources( + NAME aig_gia + SOURCES + giaMem.c + giaMini.c + giaMinLut2.c + giaReshape2.c + giaOf.c + giaSat3.c + giaRex.c + giaIiff.c + giaPat2.c + giaResub3.c + giaStoch.c + giaSatLE.c + giaExist.c + giaDfs.c + giaClp.c + giaResub2.c + giaShrink.c + giaCCof.c + giaPat.c + giaSim.c + giaSwitch.c + giaShrink6.c + giaSupMin.c + giaCSat.c + giaSweep.c + giaStg.c + giaCSatOld.c + giaSort.c + giaCex.c + giaCSatP.c + giaIso.c + giaCof.c + giaReshape1.c + giaSatEdge.c + giaSatMap.c + giaTtopt.cpp + giaMulFind.c + giaIff.c + giaBalMap.c + giaResub.c + giaSif.c + giaBalAig.c + giaFanout.c + giaMfs.c + giaUtil.c + giaTranStoch.c + giaGlitch.c + giaTruth.c + giaEra.c + giaLf.c + giaMan.c + giaCSat2.c + giaTransduction.cpp + giaScript.c + giaQbf.c + giaShow.c + giaAig.c + gia.c + giaEsop.c + giaEnable.c + giaBound.c + giaPack.c + giaBidec.c + giaBalLut.c + giaSimBase.c + giaDup.c + giaEmbed.c + giaNf.c + giaIso3.c + giaTim.c + giaEra2.c + giaEdge.c + giaCSat3.c + giaPf.c + giaFalse.c + giaAiger.c + giaSupps.c + giaIso2.c + giaUnate.c + giaSatSyn.c + giaFx.c + giaSupp.c + giaTsim.c + giaStr.c + giaIf.c + giaCut.c + giaCone.c + giaCTas.c + giaMinLut.c + giaMuxes.c + giaMf.c + giaEquiv.c + giaSplit.c + giaSweeper.c + giaRrr.cpp + giaShrink7.c + giaDecs.c + giaAgi.c + giaFront.c + giaDeep.c + giaSatoko.c + giaJf.c + giaForce.c + giaFrames.c + giaGig.c + giaHash.c + giaSpeedup.c + giaGen.c + giaSatLut.c + giaRetime.c + giaSim2.c + giaKf.c + giaTis.c + giaAigerExt.c + giaResub6.c + giaScl.c +) diff --git a/src/aig/gia/gia.h b/src/aig/gia/gia.h index b950da4be4..18355231cd 100644 --- a/src/aig/gia/gia.h +++ b/src/aig/gia/gia.h @@ -9,7 +9,7 @@ Synopsis [External declarations.] Author [Alan Mishchenko] - + Affiliation [UC Berkeley] Date [Ver. 1.0. Started - June 20, 2005.] @@ -17,7 +17,7 @@ Revision [$Id: gia.h,v 1.00 2005/06/20 00:00:00 alanmi Exp $] ***********************************************************************/ - + #ifndef ABC__aig__gia__gia_h #define ABC__aig__gia__gia_h @@ -31,6 +31,7 @@ #include #include +#include "misc/st/st.h" #include "misc/vec/vec.h" #include "misc/vec/vecWec.h" #include "misc/util/utilCex.h" @@ -49,9 +50,9 @@ ABC_NAMESPACE_HEADER_START /// BASIC TYPES /// //////////////////////////////////////////////////////////////////////// -typedef struct Gia_MmFixed_t_ Gia_MmFixed_t; -typedef struct Gia_MmFlex_t_ Gia_MmFlex_t; -typedef struct Gia_MmStep_t_ Gia_MmStep_t; +typedef struct Gia_MmFixed_t_ Gia_MmFixed_t; +typedef struct Gia_MmFlex_t_ Gia_MmFlex_t; +typedef struct Gia_MmStep_t_ Gia_MmStep_t; typedef struct Gia_Dat_t_ Gia_Dat_t; typedef struct Gia_Rpr_t_ Gia_Rpr_t; @@ -90,7 +91,7 @@ struct Gia_Obj_t_ }; // Value is currently used to store several types of information // - pointer to the next node in the hash table during structural hashing -// - pointer to the node copy during duplication +// - pointer to the node copy during duplication // new AIG manager typedef struct Gia_Man_t_ Gia_Man_t; @@ -105,7 +106,7 @@ struct Gia_Man_t_ Gia_Obj_t * pObjs; // the array of objects unsigned * pMuxes; // control signals of MUXes int nXors; // the number of XORs - int nMuxes; // the number of MUXes + int nMuxes; // the number of MUXes int nBufs; // the number of buffers Vec_Int_t * vCis; // the vector of CIs (PIs + LOs) Vec_Int_t * vCos; // the vector of COs (POs + LIs) @@ -121,13 +122,13 @@ struct Gia_Man_t_ int nLevels; // the mamixum level int nConstrs; // the number of constraints int nTravIds; // the current traversal ID - int nFront; // frontier size + int nFront; // frontier size int * pReprsOld; // representatives (for CIs and ANDs) Gia_Rpr_t * pReprs; // representatives (for CIs and ANDs) int * pNexts; // next nodes in the equivalence classes int * pSibls; // next nodes in the choice nodes int * pIso; // pairs of structurally isomorphic nodes - int nTerLoop; // the state where loop begins + int nTerLoop; // the state where loop begins int nTerStates; // the total number of ternary states int * pFanData; // the database to store fanout information int nFansAlloc; // the size of fanout representation @@ -135,7 +136,7 @@ struct Gia_Man_t_ Vec_Int_t * vFanout; // static fanout Vec_Int_t * vMapping; // mapping for each node Vec_Wec_t * vMapping2; // mapping for each node - Vec_Wec_t * vFanouts2; // mapping fanouts + Vec_Wec_t * vFanouts2; // mapping fanouts Vec_Int_t * vCellMapping; // mapping for each node void * pSatlutWinman; // windowing for SAT-based mapping Vec_Int_t * vPacking; // packing information @@ -172,13 +173,13 @@ struct Gia_Man_t_ Vec_Int_t * vCoArrs; // CO arrival times Vec_Int_t * vCoAttrs; // CO attributes Vec_Int_t * vWeights; // object attributes - int And2Delay; // delay of the AND gate + int And2Delay; // delay of the AND gate float DefInArrs; // default PI arrival times float DefOutReqs; // default PO required times Vec_Int_t * vSwitching; // switching activity int * pTravIds; // separate traversal ID representation int nTravIdsAlloc; // the number of trav IDs allocated - Vec_Ptr_t * vNamesIn; // the input names + Vec_Ptr_t * vNamesIn; // the input names Vec_Ptr_t * vNamesOut; // the output names Vec_Ptr_t * vNamesNode; // the node names Vec_Int_t * vUserPiIds; // numbers assigned to PIs by the user @@ -232,7 +233,7 @@ struct Gia_Man_t_ Vec_Wrd_t * vTtMemory; // truth tables for internal nodes // balancing Vec_Int_t * vSuper; // supergate - Vec_Int_t * vStore; // node storage + Vec_Int_t * vStore; // node storage // existential quantification int iSuppPi; // the number of support variables int nSuppWords; // the number of support words @@ -280,11 +281,11 @@ struct Emb_Par_t_ int nSols; // the number of solutions (typically, 2) int nIters; // the number of iterations of FORCE int fRefine; // use refinement by FORCE - int fCluster; // use clustered representation + int fCluster; // use clustered representation int fDump; // dump Gnuplot file int fDumpLarge; // dump Gnuplot file for large benchmarks int fShowImage; // shows image if Gnuplot is installed - int fVerbose; // verbose flag + int fVerbose; // verbose flag }; @@ -319,7 +320,7 @@ typedef struct Gia_ManSim_t_ Gia_ManSim_t; struct Gia_ManSim_t_ { Gia_Man_t * pAig; - Gia_ParSim_t * pPars; + Gia_ParSim_t * pPars; int nWords; Vec_Int_t * vCis2Ids; Vec_Int_t * vConsts; @@ -329,7 +330,7 @@ struct Gia_ManSim_t_ unsigned * pDataSimCos; // simulation data for COs }; -typedef struct Jf_Par_t_ Jf_Par_t; +typedef struct Jf_Par_t_ Jf_Par_t; struct Jf_Par_t_ { int nLutSize; @@ -475,9 +476,9 @@ static inline int Gia_ManBufNum( Gia_Man_t * p ) { return p->nBufs static inline int Gia_ManAndNotBufNum( Gia_Man_t * p ){ return Gia_ManAndNum(p) - Gia_ManBufNum(p); } static inline int Gia_ManCandNum( Gia_Man_t * p ) { return Gia_ManCiNum(p) + Gia_ManAndNum(p); } static inline int Gia_ManConstrNum( Gia_Man_t * p ) { return p->nConstrs; } -static inline void Gia_ManFlipVerbose( Gia_Man_t * p ) { p->fVerbose ^= 1; } -static inline int Gia_ManHasChoices( Gia_Man_t * p ) { return p->pSibls != NULL; } -static inline int Gia_ManChoiceNum( Gia_Man_t * p ) { int c = 0; if (p->pSibls) { int i; for (i = 0; i < p->nObjs; i++) c += (int)(p->pSibls[i] > 0); } return c; } +static inline void Gia_ManFlipVerbose( Gia_Man_t * p ) { p->fVerbose ^= 1; } +static inline int Gia_ManHasChoices( Gia_Man_t * p ) { return p->pSibls != NULL; } +static inline int Gia_ManChoiceNum( Gia_Man_t * p ) { int c = 0; if (p->pSibls) { int i; for (i = 0; i < p->nObjs; i++) c += (int)(p->pSibls[i] > 0); } return c; } static inline Gia_Obj_t * Gia_ManConst0( Gia_Man_t * p ) { return p->pObjs; } static inline Gia_Obj_t * Gia_ManConst1( Gia_Man_t * p ) { return Gia_Not(Gia_ManConst0(p)); } @@ -502,20 +503,20 @@ static inline char * Gia_ObjCoName( Gia_Man_t * p, int i ) { static inline char * Gia_ObjName( Gia_Man_t * p, int i ) { return p->vNamesNode ? (char*)Vec_PtrEntry(p->vNamesNode, i) : NULL; } static inline char * Gia_ObjNameObj( Gia_Man_t * p, Gia_Obj_t * pObj ) { return p->vNamesNode ? (char*)Vec_PtrEntry(p->vNamesNode, Gia_ObjId(p, pObj)) : NULL; } -static inline int Gia_ObjIsTerm( Gia_Obj_t * pObj ) { return pObj->fTerm; } -static inline int Gia_ObjIsAndOrConst0( Gia_Obj_t * pObj ) { return!pObj->fTerm; } -static inline int Gia_ObjIsCi( Gia_Obj_t * pObj ) { return pObj->fTerm && pObj->iDiff0 == GIA_NONE; } -static inline int Gia_ObjIsCo( Gia_Obj_t * pObj ) { return pObj->fTerm && pObj->iDiff0 != GIA_NONE; } -static inline int Gia_ObjIsAnd( Gia_Obj_t * pObj ) { return!pObj->fTerm && pObj->iDiff0 != GIA_NONE; } -static inline int Gia_ObjIsXor( Gia_Obj_t * pObj ) { return Gia_ObjIsAnd(pObj) && pObj->iDiff0 < pObj->iDiff1; } -static inline int Gia_ObjIsMuxId( Gia_Man_t * p, int iObj ) { return p->pMuxes && p->pMuxes[iObj] > 0; } -static inline int Gia_ObjIsMux( Gia_Man_t * p, Gia_Obj_t * pObj ) { return Gia_ObjIsMuxId( p, Gia_ObjId(p, pObj) ); } -static inline int Gia_ObjIsAndReal( Gia_Man_t * p, Gia_Obj_t * pObj ) { return Gia_ObjIsAnd(pObj) && pObj->iDiff0 > pObj->iDiff1 && !Gia_ObjIsMux(p, pObj); } -static inline int Gia_ObjIsBuf( Gia_Obj_t * pObj ) { return pObj->iDiff0 == pObj->iDiff1 && pObj->iDiff0 != GIA_NONE && !pObj->fTerm; } -static inline int Gia_ObjIsAndNotBuf( Gia_Obj_t * pObj ) { return Gia_ObjIsAnd(pObj) && pObj->iDiff0 != pObj->iDiff1; } -static inline int Gia_ObjIsCand( Gia_Obj_t * pObj ) { return Gia_ObjIsAnd(pObj) || Gia_ObjIsCi(pObj); } -static inline int Gia_ObjIsConst0( Gia_Obj_t * pObj ) { return pObj->iDiff0 == GIA_NONE && pObj->iDiff1 == GIA_NONE; } -static inline int Gia_ManObjIsConst0( Gia_Man_t * p, Gia_Obj_t * pObj){ return pObj == p->pObjs; } +static inline int Gia_ObjIsTerm( Gia_Obj_t * pObj ) { return pObj->fTerm; } +static inline int Gia_ObjIsAndOrConst0( Gia_Obj_t * pObj ) { return!pObj->fTerm; } +static inline int Gia_ObjIsCi( Gia_Obj_t * pObj ) { return pObj->fTerm && pObj->iDiff0 == GIA_NONE; } +static inline int Gia_ObjIsCo( Gia_Obj_t * pObj ) { return pObj->fTerm && pObj->iDiff0 != GIA_NONE; } +static inline int Gia_ObjIsAnd( Gia_Obj_t * pObj ) { return!pObj->fTerm && pObj->iDiff0 != GIA_NONE; } +static inline int Gia_ObjIsXor( Gia_Obj_t * pObj ) { return Gia_ObjIsAnd(pObj) && pObj->iDiff0 < pObj->iDiff1; } +static inline int Gia_ObjIsMuxId( Gia_Man_t * p, int iObj ) { return p->pMuxes && p->pMuxes[iObj] > 0; } +static inline int Gia_ObjIsMux( Gia_Man_t * p, Gia_Obj_t * pObj ) { return Gia_ObjIsMuxId( p, Gia_ObjId(p, pObj) ); } +static inline int Gia_ObjIsAndReal( Gia_Man_t * p, Gia_Obj_t * pObj ) { return Gia_ObjIsAnd(pObj) && pObj->iDiff0 > pObj->iDiff1 && !Gia_ObjIsMux(p, pObj); } +static inline int Gia_ObjIsBuf( Gia_Obj_t * pObj ) { return pObj->iDiff0 == pObj->iDiff1 && pObj->iDiff0 != GIA_NONE && !pObj->fTerm; } +static inline int Gia_ObjIsAndNotBuf( Gia_Obj_t * pObj ) { return Gia_ObjIsAnd(pObj) && pObj->iDiff0 != pObj->iDiff1; } +static inline int Gia_ObjIsCand( Gia_Obj_t * pObj ) { return Gia_ObjIsAnd(pObj) || Gia_ObjIsCi(pObj); } +static inline int Gia_ObjIsConst0( Gia_Obj_t * pObj ) { return pObj->iDiff0 == GIA_NONE && pObj->iDiff1 == GIA_NONE; } +static inline int Gia_ManObjIsConst0( Gia_Man_t * p, Gia_Obj_t * pObj){ return pObj == p->pObjs; } static inline int Gia_Obj2Lit( Gia_Man_t * p, Gia_Obj_t * pObj ) { return Abc_Var2Lit(Gia_ObjId(p, Gia_Regular(pObj)), Gia_IsComplement(pObj)); } static inline Gia_Obj_t * Gia_Lit2Obj( Gia_Man_t * p, int iLit ) { return Gia_NotCond(Gia_ManObj(p, Abc_Lit2Var(iLit)), Abc_LitIsCompl(iLit)); } @@ -525,14 +526,14 @@ static inline int Gia_ManIdToCioId( Gia_Man_t * p, int Id ) { static inline int Gia_ManCiIdToId( Gia_Man_t * p, int CiId ) { return Gia_ObjId( p, Gia_ManCi(p, CiId) ); } static inline int Gia_ManCoIdToId( Gia_Man_t * p, int CoId ) { return Gia_ObjId( p, Gia_ManCo(p, CoId) ); } -static inline int Gia_ObjIsPi( Gia_Man_t * p, Gia_Obj_t * pObj ) { return Gia_ObjIsCi(pObj) && Gia_ObjCioId(pObj) < Gia_ManPiNum(p); } -static inline int Gia_ObjIsPo( Gia_Man_t * p, Gia_Obj_t * pObj ) { return Gia_ObjIsCo(pObj) && Gia_ObjCioId(pObj) < Gia_ManPoNum(p); } -static inline int Gia_ObjIsRo( Gia_Man_t * p, Gia_Obj_t * pObj ) { return Gia_ObjIsCi(pObj) && Gia_ObjCioId(pObj) >= Gia_ManPiNum(p); } -static inline int Gia_ObjIsRi( Gia_Man_t * p, Gia_Obj_t * pObj ) { return Gia_ObjIsCo(pObj) && Gia_ObjCioId(pObj) >= Gia_ManPoNum(p); } +static inline int Gia_ObjIsPi( Gia_Man_t * p, Gia_Obj_t * pObj ) { return Gia_ObjIsCi(pObj) && Gia_ObjCioId(pObj) < Gia_ManPiNum(p); } +static inline int Gia_ObjIsPo( Gia_Man_t * p, Gia_Obj_t * pObj ) { return Gia_ObjIsCo(pObj) && Gia_ObjCioId(pObj) < Gia_ManPoNum(p); } +static inline int Gia_ObjIsRo( Gia_Man_t * p, Gia_Obj_t * pObj ) { return Gia_ObjIsCi(pObj) && Gia_ObjCioId(pObj) >= Gia_ManPiNum(p); } +static inline int Gia_ObjIsRi( Gia_Man_t * p, Gia_Obj_t * pObj ) { return Gia_ObjIsCo(pObj) && Gia_ObjCioId(pObj) >= Gia_ManPoNum(p); } -static inline Gia_Obj_t * Gia_ObjRoToRi( Gia_Man_t * p, Gia_Obj_t * pObj ) { assert( Gia_ObjIsRo(p, pObj) ); return Gia_ManCo(p, Gia_ManCoNum(p) - Gia_ManCiNum(p) + Gia_ObjCioId(pObj)); } -static inline Gia_Obj_t * Gia_ObjRiToRo( Gia_Man_t * p, Gia_Obj_t * pObj ) { assert( Gia_ObjIsRi(p, pObj) ); return Gia_ManCi(p, Gia_ManCiNum(p) - Gia_ManCoNum(p) + Gia_ObjCioId(pObj)); } -static inline int Gia_ObjRoToRiId( Gia_Man_t * p, int ObjId ) { return Gia_ObjId( p, Gia_ObjRoToRi( p, Gia_ManObj(p, ObjId) ) ); } +static inline Gia_Obj_t * Gia_ObjRoToRi( Gia_Man_t * p, Gia_Obj_t * pObj ) { assert( Gia_ObjIsRo(p, pObj) ); return Gia_ManCo(p, Gia_ManCoNum(p) - Gia_ManCiNum(p) + Gia_ObjCioId(pObj)); } +static inline Gia_Obj_t * Gia_ObjRiToRo( Gia_Man_t * p, Gia_Obj_t * pObj ) { assert( Gia_ObjIsRi(p, pObj) ); return Gia_ManCi(p, Gia_ManCiNum(p) - Gia_ManCoNum(p) + Gia_ObjCioId(pObj)); } +static inline int Gia_ObjRoToRiId( Gia_Man_t * p, int ObjId ) { return Gia_ObjId( p, Gia_ObjRoToRi( p, Gia_ManObj(p, ObjId) ) ); } static inline int Gia_ObjRiToRoId( Gia_Man_t * p, int ObjId ) { return Gia_ObjId( p, Gia_ObjRiToRo( p, Gia_ManObj(p, ObjId) ) ); } static inline int Gia_ObjDiff0( Gia_Obj_t * pObj ) { return pObj->iDiff0; } @@ -673,9 +674,9 @@ static inline word * Gia_ObjSim( Gia_Man_t * p, int Id ) { static inline word * Gia_ObjSimObj( Gia_Man_t * p, Gia_Obj_t * pObj ) { return Gia_ObjSim( p, Gia_ObjId(p, pObj) ); } // AIG construction -extern void Gia_ObjAddFanout( Gia_Man_t * p, Gia_Obj_t * pObj, Gia_Obj_t * pFanout ); -static inline Gia_Obj_t * Gia_ManAppendObj( Gia_Man_t * p ) -{ +ABC_DLL extern void Gia_ObjAddFanout( Gia_Man_t * p, Gia_Obj_t * pObj, Gia_Obj_t * pFanout ); +static inline Gia_Obj_t * Gia_ManAppendObj( Gia_Man_t * p ) +{ if ( p->nObjs == p->nObjsAlloc ) { int nObjNew = Abc_MinInt( 2 * p->nObjsAlloc, (1 << 29) ); @@ -697,8 +698,8 @@ static inline Gia_Obj_t * Gia_ManAppendObj( Gia_Man_t * p ) if ( Vec_IntSize(&p->vHTable) ) Vec_IntPush( &p->vHash, 0 ); return Gia_ManObj( p, p->nObjs++ ); } -static inline int Gia_ManAppendCi( Gia_Man_t * p ) -{ +static inline int Gia_ManAppendCi( Gia_Man_t * p ) +{ Gia_Obj_t * pObj = Gia_ManAppendObj( p ); pObj->fTerm = 1; pObj->iDiff0 = GIA_NONE; @@ -707,11 +708,11 @@ static inline int Gia_ManAppendCi( Gia_Man_t * p ) return Gia_ObjId( p, pObj ) << 1; } -extern void Gia_ManQuantSetSuppAnd( Gia_Man_t * p, Gia_Obj_t * pObj ); -extern void Gia_ManBuiltInSimPerform( Gia_Man_t * p, int iObj ); +ABC_DLL extern void Gia_ManQuantSetSuppAnd( Gia_Man_t * p, Gia_Obj_t * pObj ); +ABC_DLL extern void Gia_ManBuiltInSimPerform( Gia_Man_t * p, int iObj ); -static inline int Gia_ManAppendAnd( Gia_Man_t * p, int iLit0, int iLit1 ) -{ +static inline int Gia_ManAppendAnd( Gia_Man_t * p, int iLit0, int iLit1 ) +{ Gia_Obj_t * pObj = Gia_ManAppendObj( p ); assert( iLit0 >= 0 && Abc_Lit2Var(iLit0) < Gia_ManObjNum(p) ); assert( iLit1 >= 0 && Abc_Lit2Var(iLit1) < Gia_ManObjNum(p) ); @@ -754,8 +755,8 @@ static inline int Gia_ManAppendAnd( Gia_Man_t * p, int iLit0, int iLit1 ) Gia_ManQuantSetSuppAnd( p, pObj ); return Gia_ObjId( p, pObj ) << 1; } -static inline int Gia_ManAppendXorReal( Gia_Man_t * p, int iLit0, int iLit1 ) -{ +static inline int Gia_ManAppendXorReal( Gia_Man_t * p, int iLit0, int iLit1 ) +{ Gia_Obj_t * pObj = Gia_ManAppendObj( p ); assert( iLit0 >= 0 && Abc_Lit2Var(iLit0) < Gia_ManObjNum(p) ); assert( iLit1 >= 0 && Abc_Lit2Var(iLit1) < Gia_ManObjNum(p) ); @@ -779,8 +780,8 @@ static inline int Gia_ManAppendXorReal( Gia_Man_t * p, int iLit0, int iLit1 ) p->nXors++; return Gia_ObjId( p, pObj ) << 1; } -static inline int Gia_ManAppendMuxReal( Gia_Man_t * p, int iLitC, int iLit1, int iLit0 ) -{ +static inline int Gia_ManAppendMuxReal( Gia_Man_t * p, int iLitC, int iLit1, int iLit0 ) +{ Gia_Obj_t * pObj = Gia_ManAppendObj( p ); assert( p->pMuxes != NULL ); assert( iLit0 >= 0 && Abc_Lit2Var(iLit0) < Gia_ManObjNum(p) ); @@ -809,8 +810,8 @@ static inline int Gia_ManAppendMuxReal( Gia_Man_t * p, int iLitC, int iLit1, int p->nMuxes++; return Gia_ObjId( p, pObj ) << 1; } -static inline int Gia_ManAppendBuf( Gia_Man_t * p, int iLit ) -{ +static inline int Gia_ManAppendBuf( Gia_Man_t * p, int iLit ) +{ Gia_Obj_t * pObj = Gia_ManAppendObj( p ); assert( iLit >= 0 && Abc_Lit2Var(iLit) < Gia_ManObjNum(p) ); pObj->iDiff0 = pObj->iDiff1 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit); @@ -818,12 +819,12 @@ static inline int Gia_ManAppendBuf( Gia_Man_t * p, int iLit ) p->nBufs++; return Gia_ObjId( p, pObj ) << 1; } -static inline int Gia_ManAppendCo( Gia_Man_t * p, int iLit0 ) -{ +static inline int Gia_ManAppendCo( Gia_Man_t * p, int iLit0 ) +{ Gia_Obj_t * pObj; assert( iLit0 >= 0 && Abc_Lit2Var(iLit0) < Gia_ManObjNum(p) ); assert( !Gia_ObjIsCo(Gia_ManObj(p, Abc_Lit2Var(iLit0))) ); - pObj = Gia_ManAppendObj( p ); + pObj = Gia_ManAppendObj( p ); pObj->fTerm = 1; pObj->iDiff0 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit0); pObj->fCompl0 = Abc_LitIsCompl(iLit0); @@ -837,26 +838,26 @@ static inline int Gia_ManAppendOr( Gia_Man_t * p, int iLit0, int iLit1 ) { return Abc_LitNot(Gia_ManAppendAnd( p, Abc_LitNot(iLit0), Abc_LitNot(iLit1) )); } -static inline int Gia_ManAppendMux( Gia_Man_t * p, int iCtrl, int iData1, int iData0 ) -{ +static inline int Gia_ManAppendMux( Gia_Man_t * p, int iCtrl, int iData1, int iData0 ) +{ int iTemp0 = Gia_ManAppendAnd( p, Abc_LitNot(iCtrl), iData0 ); int iTemp1 = Gia_ManAppendAnd( p, iCtrl, iData1 ); return Abc_LitNotCond( Gia_ManAppendAnd( p, Abc_LitNot(iTemp0), Abc_LitNot(iTemp1) ), 1 ); } -static inline int Gia_ManAppendMaj( Gia_Man_t * p, int iData0, int iData1, int iData2 ) -{ +static inline int Gia_ManAppendMaj( Gia_Man_t * p, int iData0, int iData1, int iData2 ) +{ int iTemp0 = Gia_ManAppendOr( p, iData1, iData2 ); int iTemp1 = Gia_ManAppendAnd( p, iData0, iTemp0 ); int iTemp2 = Gia_ManAppendAnd( p, iData1, iData2 ); return Gia_ManAppendOr( p, iTemp1, iTemp2 ); } -static inline int Gia_ManAppendXor( Gia_Man_t * p, int iLit0, int iLit1 ) -{ +static inline int Gia_ManAppendXor( Gia_Man_t * p, int iLit0, int iLit1 ) +{ return Gia_ManAppendMux( p, iLit0, Abc_LitNot(iLit1), iLit1 ); } -static inline int Gia_ManAppendAnd2( Gia_Man_t * p, int iLit0, int iLit1 ) -{ +static inline int Gia_ManAppendAnd2( Gia_Man_t * p, int iLit0, int iLit1 ) +{ if ( !p->fGiaSimple ) { if ( iLit0 < 2 ) @@ -874,26 +875,26 @@ static inline int Gia_ManAppendOr2( Gia_Man_t * p, int iLit0, int iLit1 ) { return Abc_LitNot(Gia_ManAppendAnd2( p, Abc_LitNot(iLit0), Abc_LitNot(iLit1) )); } -static inline int Gia_ManAppendMux2( Gia_Man_t * p, int iCtrl, int iData1, int iData0 ) -{ +static inline int Gia_ManAppendMux2( Gia_Man_t * p, int iCtrl, int iData1, int iData0 ) +{ int iTemp0 = Gia_ManAppendAnd2( p, Abc_LitNot(iCtrl), iData0 ); int iTemp1 = Gia_ManAppendAnd2( p, iCtrl, iData1 ); return Abc_LitNotCond( Gia_ManAppendAnd2( p, Abc_LitNot(iTemp0), Abc_LitNot(iTemp1) ), 1 ); } -static inline int Gia_ManAppendMaj2( Gia_Man_t * p, int iData0, int iData1, int iData2 ) -{ +static inline int Gia_ManAppendMaj2( Gia_Man_t * p, int iData0, int iData1, int iData2 ) +{ int iTemp0 = Gia_ManAppendOr2( p, iData1, iData2 ); int iTemp1 = Gia_ManAppendAnd2( p, iData0, iTemp0 ); int iTemp2 = Gia_ManAppendAnd2( p, iData1, iData2 ); return Gia_ManAppendOr2( p, iTemp1, iTemp2 ); } -static inline int Gia_ManAppendXor2( Gia_Man_t * p, int iLit0, int iLit1 ) -{ +static inline int Gia_ManAppendXor2( Gia_Man_t * p, int iLit0, int iLit1 ) +{ return Gia_ManAppendMux2( p, iLit0, Abc_LitNot(iLit1), iLit1 ); } -static inline int Gia_ManAppendXorReal2( Gia_Man_t * p, int iLit0, int iLit1 ) -{ +static inline int Gia_ManAppendXorReal2( Gia_Man_t * p, int iLit0, int iLit1 ) +{ if ( !p->fGiaSimple ) { if ( iLit0 < 2 ) @@ -908,7 +909,7 @@ static inline int Gia_ManAppendXorReal2( Gia_Man_t * p, int iLit0, int iLit1 ) return Gia_ManAppendXorReal( p, iLit0, iLit1 ); } -static inline void Gia_ManPatchCoDriver( Gia_Man_t * p, int iCoIndex, int iLit0 ) +static inline void Gia_ManPatchCoDriver( Gia_Man_t * p, int iCoIndex, int iLit0 ) { Gia_Obj_t * pObjCo = Gia_ManCo( p, iCoIndex ); assert( Gia_ObjId(p, pObjCo) > Abc_Lit2Var(iLit0) ); @@ -920,16 +921,16 @@ static inline void Gia_ManPatchCoDriver( Gia_Man_t * p, int iCoIndex, int iLit0 #define GIA_ONE 2 #define GIA_UND 3 -static inline int Gia_XsimNotCond( int Value, int fCompl ) -{ +static inline int Gia_XsimNotCond( int Value, int fCompl ) +{ if ( Value == GIA_UND ) return GIA_UND; if ( Value == GIA_ZER + fCompl ) return GIA_ZER; return GIA_ONE; } -static inline int Gia_XsimAndCond( int Value0, int fCompl0, int Value1, int fCompl1 ) -{ +static inline int Gia_XsimAndCond( int Value0, int fCompl0, int Value1, int fCompl1 ) +{ if ( Value0 == GIA_ZER + fCompl0 || Value1 == GIA_ZER + fCompl1 ) return GIA_ZER; if ( Value0 == GIA_UND || Value1 == GIA_UND ) @@ -963,7 +964,7 @@ static inline void Gia_ObjTerSimAnd( Gia_Obj_t * pObj ) Gia_ObjTerSimSet0( pObj ); else if ( Gia_ObjTerSimGet1Fanin0(pObj) && Gia_ObjTerSimGet1Fanin1(pObj) ) Gia_ObjTerSimSet1( pObj ); - else + else Gia_ObjTerSimSetX( pObj ); } static inline void Gia_ObjTerSimCo( Gia_Obj_t * pObj ) @@ -974,7 +975,7 @@ static inline void Gia_ObjTerSimCo( Gia_Obj_t * pObj ) Gia_ObjTerSimSet0( pObj ); else if ( Gia_ObjTerSimGet1Fanin0(pObj) ) Gia_ObjTerSimSet1( pObj ); - else + else Gia_ObjTerSimSetX( pObj ); } static inline void Gia_ObjTerSimRo( Gia_Man_t * p, Gia_Obj_t * pObj ) @@ -1346,11 +1347,11 @@ extern Gia_Man_t * Gia_ManDupOrderAiger( Gia_Man_t * p ); extern Gia_Man_t * Gia_ManDupLastPis( Gia_Man_t * p, int nLastPis ); extern Gia_Man_t * Gia_ManDupFlip( Gia_Man_t * p, int * pInitState ); extern Gia_Man_t * Gia_ManDupCycled( Gia_Man_t * pAig, Abc_Cex_t * pCex, int nFrames ); -extern Gia_Man_t * Gia_ManDup( Gia_Man_t * p ); -extern Gia_Man_t * Gia_ManDupNoBuf( Gia_Man_t * p ); +extern Gia_Man_t * Gia_ManDup( Gia_Man_t * p ); +extern Gia_Man_t * Gia_ManDupNoBuf( Gia_Man_t * p ); extern Gia_Man_t * Gia_ManDupMap( Gia_Man_t * p, Vec_Int_t * vMap ); extern Gia_Man_t * Gia_ManDup2( Gia_Man_t * p1, Gia_Man_t * p2 ); -extern Gia_Man_t * Gia_ManDupWithAttributes( Gia_Man_t * p ); +extern Gia_Man_t * Gia_ManDupWithAttributes( Gia_Man_t * p ); extern Gia_Man_t * Gia_ManDupRemovePis( Gia_Man_t * p, int nRemPis ); extern Gia_Man_t * Gia_ManDupZero( Gia_Man_t * p ); extern Gia_Man_t * Gia_ManDupPerm( Gia_Man_t * p, Vec_Int_t * vPiPerm ); @@ -1363,12 +1364,12 @@ extern Gia_Man_t * Gia_ManDupAppendCones( Gia_Man_t * p, Gia_Man_t ** pp extern Gia_Man_t * Gia_ManDupSelf( Gia_Man_t * p ); extern Gia_Man_t * Gia_ManDupFlopClass( Gia_Man_t * p, int iClass ); extern Gia_Man_t * Gia_ManDupMarked( Gia_Man_t * p ); -extern Gia_Man_t * Gia_ManDupTimes( Gia_Man_t * p, int nTimes ); -extern Gia_Man_t * Gia_ManDupDfs( Gia_Man_t * p ); +extern Gia_Man_t * Gia_ManDupTimes( Gia_Man_t * p, int nTimes ); +extern Gia_Man_t * Gia_ManDupDfs( Gia_Man_t * p ); extern Gia_Man_t * Gia_ManDupDfsOnePo( Gia_Man_t * p, int iPo ); extern Gia_Man_t * Gia_ManDupDfsRehash( Gia_Man_t * p ); -extern Gia_Man_t * Gia_ManDupCofactorVar( Gia_Man_t * p, int iVar, int Value ); -extern Gia_Man_t * Gia_ManDupCofactorObj( Gia_Man_t * p, int iObj, int Value ); +extern Gia_Man_t * Gia_ManDupCofactorVar( Gia_Man_t * p, int iVar, int Value ); +extern Gia_Man_t * Gia_ManDupCofactorObj( Gia_Man_t * p, int iObj, int Value ); extern Gia_Man_t * Gia_ManDupMux( int iVar, Gia_Man_t * pCof1, Gia_Man_t * pCof0 ); extern Gia_Man_t * Gia_ManDupBlock( Gia_Man_t * p, int nBlock ); extern Gia_Man_t * Gia_ManDupExist( Gia_Man_t * p, int iVar ); @@ -1457,13 +1458,13 @@ extern int Gia_ManFilterEquivsForSpeculation( Gia_Man_t * pGia, extern int Gia_ManFilterEquivsUsingParts( Gia_Man_t * pGia, char * pName1, char * pName2 ); extern void Gia_ManFilterEquivsUsingLatches( Gia_Man_t * pGia, int fFlopsOnly, int fFlopsWith, int fUseRiDrivers ); /*=== giaExist.c =========================================================*/ -extern void Gia_ManQuantSetSuppStart( Gia_Man_t * p ); +ABC_DLL extern void Gia_ManQuantSetSuppStart( Gia_Man_t * p ); extern void Gia_ManQuantSetSuppZero( Gia_Man_t * p ); extern void Gia_ManQuantSetSuppCi( Gia_Man_t * p, Gia_Obj_t * pObj ); extern void Gia_ManQuantUpdateCiSupp( Gia_Man_t * p, int iObj ); extern int Gia_ManQuantExist( Gia_Man_t * p, int iLit, int(*pFuncCiToKeep)(void *, int), void * pData ); /*=== giaFanout.c =========================================================*/ -extern void Gia_ObjAddFanout( Gia_Man_t * p, Gia_Obj_t * pObj, Gia_Obj_t * pFanout ); +ABC_DLL extern void Gia_ObjAddFanout( Gia_Man_t * p, Gia_Obj_t * pObj, Gia_Obj_t * pFanout ); extern void Gia_ObjRemoveFanout( Gia_Man_t * p, Gia_Obj_t * pObj, Gia_Obj_t * pFanout ); extern void Gia_ManFanoutStart( Gia_Man_t * p ); extern void Gia_ManFanoutStop( Gia_Man_t * p ); @@ -1480,7 +1481,7 @@ extern void * Gia_ManUnrollAdd( void * pMan, int fMax ); extern void Gia_ManUnrollStop( void * pMan ); extern int Gia_ManUnrollLastLit( void * pMan ); extern void Gia_ManFraSetDefaultParams( Gia_ParFra_t * p ); -extern Gia_Man_t * Gia_ManFrames( Gia_Man_t * pAig, Gia_ParFra_t * pPars ); +extern Gia_Man_t * Gia_ManFrames( Gia_Man_t * pAig, Gia_ParFra_t * pPars ); extern Gia_Man_t * Gia_ManFramesInitSpecial( Gia_Man_t * pAig, int nFrames, int fVerbose ); /*=== giaFront.c ==========================================================*/ extern Gia_Man_t * Gia_ManFront( Gia_Man_t * p ); @@ -1488,14 +1489,14 @@ extern void Gia_ManFrontTest( Gia_Man_t * p ); /*=== giaFx.c ==========================================================*/ extern Gia_Man_t * Gia_ManPerformFx( Gia_Man_t * p, int nNewNodesMax, int LitCountMax, int fReverse, int fVerbose, int fVeryVerbose ); /*=== giaHash.c ===========================================================*/ -extern void Gia_ManHashAlloc( Gia_Man_t * p ); -extern void Gia_ManHashStart( Gia_Man_t * p ); +extern void Gia_ManHashAlloc( Gia_Man_t * p ); +extern void Gia_ManHashStart( Gia_Man_t * p ); extern void Gia_ManHashStop( Gia_Man_t * p ); extern int Gia_ManHashXorReal( Gia_Man_t * p, int iLit0, int iLit1 ); extern int Gia_ManHashMuxReal( Gia_Man_t * p, int iLitC, int iLit1, int iLit0 ); -extern int Gia_ManHashAnd( Gia_Man_t * p, int iLit0, int iLit1 ); -extern int Gia_ManHashOr( Gia_Man_t * p, int iLit0, int iLit1 ); -extern int Gia_ManHashXor( Gia_Man_t * p, int iLit0, int iLit1 ); +extern int Gia_ManHashAnd( Gia_Man_t * p, int iLit0, int iLit1 ); +extern int Gia_ManHashOr( Gia_Man_t * p, int iLit0, int iLit1 ); +extern int Gia_ManHashXor( Gia_Man_t * p, int iLit0, int iLit1 ); extern int Gia_ManHashMux( Gia_Man_t * p, int iCtrl, int iData1, int iData0 ); extern int Gia_ManHashMaj( Gia_Man_t * p, int iData0, int iData1, int iData2 ); extern int Gia_ManHashAndTry( Gia_Man_t * p, int iLit0, int iLit1 ); @@ -1516,7 +1517,7 @@ extern int Gia_ManLutNum( Gia_Man_t * p ); extern int Gia_ManLutLevel( Gia_Man_t * p, int ** ppLevels ); extern void Gia_ManLutParams( Gia_Man_t * p, int * pnCurLuts, int * pnCurEdges, int * pnCurLevels ); extern void Gia_ManSetRefsMapped( Gia_Man_t * p ); -extern void Gia_ManSetLutRefs( Gia_Man_t * p ); +extern void Gia_ManSetLutRefs( Gia_Man_t * p ); extern void Gia_ManSetIfParsDefault( void * pIfPars ); extern void Gia_ManMappingVerify( Gia_Man_t * p ); extern void Gia_ManTransferMapping( Gia_Man_t * p, Gia_Man_t * pGia ); @@ -1542,13 +1543,13 @@ extern Gia_Man_t * Gia_ManPerformLfMapping( Gia_Man_t * p, Jf_Par_t * pP extern void Gia_ManTestDistance( Gia_Man_t * p ); extern void Gia_ManSolveProblem( Gia_Man_t * pGia, Emb_Par_t * pPars ); /*=== giaMan.c ===========================================================*/ -extern Gia_Man_t * Gia_ManStart( int nObjsMax ); -extern void Gia_ManStop( Gia_Man_t * p ); -extern void Gia_ManStopP( Gia_Man_t ** p ); +ABC_DLL extern Gia_Man_t * Gia_ManStart( int nObjsMax ); +ABC_DLL extern void Gia_ManStop( Gia_Man_t * p ); +extern void Gia_ManStopP( Gia_Man_t ** p ); extern double Gia_ManMemory( Gia_Man_t * p ); -extern void Gia_ManPrintStats( Gia_Man_t * p, Gps_Par_t * pPars ); -extern void Gia_ManPrintStatsShort( Gia_Man_t * p ); -extern void Gia_ManPrintMiterStatus( Gia_Man_t * p ); +extern void Gia_ManPrintStats( Gia_Man_t * p, Gps_Par_t * pPars ); +extern void Gia_ManPrintStatsShort( Gia_Man_t * p ); +extern void Gia_ManPrintMiterStatus( Gia_Man_t * p ); extern void Gia_ManPrintStatsMiter( Gia_Man_t * p, int fVerbose ); extern void Gia_ManSetRegNum( Gia_Man_t * p, int nRegs ); extern void Gia_ManReportImprovement( Gia_Man_t * p, Gia_Man_t * pNew ); @@ -1624,7 +1625,7 @@ extern void Gia_ManSimInfoInit( Gia_ManSim_t * p ); extern void Gia_ManSimInfoTransfer( Gia_ManSim_t * p ); extern void Gia_ManSimulateRound( Gia_ManSim_t * p ); extern void Gia_ManBuiltInSimStart( Gia_Man_t * p, int nWords, int nObjs ); -extern void Gia_ManBuiltInSimPerform( Gia_Man_t * p, int iObj ); +ABC_DLL extern void Gia_ManBuiltInSimPerform( Gia_Man_t * p, int iObj ); extern int Gia_ManBuiltInSimCheckOver( Gia_Man_t * p, int iLit0, int iLit1 ); extern int Gia_ManBuiltInSimCheckEqual( Gia_Man_t * p, int iLit0, int iLit1 ); extern void Gia_ManBuiltInSimResimulateCone( Gia_Man_t * p, int iLit0, int iLit1 ); @@ -1636,7 +1637,7 @@ extern int Gia_ManIncrSimCheckOver( Gia_Man_t * p, int iLit0, in extern int Gia_ManIncrSimCheckEqual( Gia_Man_t * p, int iLit0, int iLit1 ); /*=== giaSimBase.c ============================================================*/ extern Vec_Wrd_t * Gia_ManSimPatSim( Gia_Man_t * p ); -extern Vec_Wrd_t * Gia_ManSimPatSimOut( Gia_Man_t * pGia, Vec_Wrd_t * vSimsPi, int fOuts ); +ABC_DLL extern Vec_Wrd_t * Gia_ManSimPatSimOut( Gia_Man_t * pGia, Vec_Wrd_t * vSimsPi, int fOuts ); extern void Gia_ManSim2ArrayOne( Vec_Wrd_t * vSimsPi, Vec_Int_t * vRes ); extern Vec_Wec_t * Gia_ManSim2Array( Vec_Ptr_t * vSims ); extern Vec_Wrd_t * Gia_ManArray2SimOne( Vec_Int_t * vRes ); diff --git a/src/aig/gia/giaIso3.c b/src/aig/gia/giaIso3.c index b526676d36..d850e87dc5 100644 --- a/src/aig/gia/giaIso3.c +++ b/src/aig/gia/giaIso3.c @@ -177,7 +177,7 @@ Vec_Wec_t * Gia_Iso4Gia( Gia_Man_t * p ) Vec_WecForEachLevel( vLevs, vLevel, l ) { Gia_Obj_t * pObj; int i; - unsigned RandC[2] = { Abc_Random(0), Abc_Random(0) }; + unsigned int RandC[2] = { Abc_Random(0), Abc_Random(0) }; if ( l == 0 ) { Gia_ManForEachObjVec( vLevel, p, pObj, i ) diff --git a/src/aig/gia/giaKf.c b/src/aig/gia/giaKf.c index 6909851f1a..8ddd6511f5 100644 --- a/src/aig/gia/giaKf.c +++ b/src/aig/gia/giaKf.c @@ -29,7 +29,7 @@ #ifdef ABC_USE_PTHREADS -#ifdef _WIN32 +#ifdef _MSC_VER #include "../lib/pthread.h" #else #include diff --git a/src/aig/gia/module.make b/src/aig/gia/module.make index 2e64d1d1b2..99938cd6c0 100644 --- a/src/aig/gia/module.make +++ b/src/aig/gia/module.make @@ -1,4 +1,5 @@ -SRC += src/aig/gia/giaAig.c \ +SRC += src/aig/gia/gia.c \ + src/aig/gia/giaAig.c \ src/aig/gia/giaAgi.c \ src/aig/gia/giaAiger.c \ src/aig/gia/giaAigerExt.c \ diff --git a/src/aig/hop/CMakeLists.txt b/src/aig/hop/CMakeLists.txt new file mode 100644 index 0000000000..47917ada77 --- /dev/null +++ b/src/aig/hop/CMakeLists.txt @@ -0,0 +1,14 @@ +abc_libabc_add_sources( + NAME aig_hop + SOURCES + hopDfs.c + hopTable.c + hopTruth.c + hopMem.c + hopCheck.c + hopBalance.c + hopMan.c + hopObj.c + hopOper.c + hopUtil.c +) diff --git a/src/aig/ioa/CMakeLists.txt b/src/aig/ioa/CMakeLists.txt new file mode 100644 index 0000000000..3f210b2498 --- /dev/null +++ b/src/aig/ioa/CMakeLists.txt @@ -0,0 +1,7 @@ +abc_libabc_add_sources( + NAME aig_ioa + SOURCES + ioaReadAig.c + ioaWriteAig.c + ioaUtil.c +) diff --git a/src/aig/ivy/CMakeLists.txt b/src/aig/ivy/CMakeLists.txt new file mode 100644 index 0000000000..e32fc42273 --- /dev/null +++ b/src/aig/ivy/CMakeLists.txt @@ -0,0 +1,26 @@ +abc_libabc_add_sources( + NAME aig_ivy + SOURCES + ivyShow.c + ivyCut.c + ivyResyn.c + ivyCheck.c + ivyBalance.c + ivyFraig.c + ivyUtil.c + ivyObj.c + ivySeq.c + ivyCanon.c + ivyMan.c + ivyOper.c + ivyHaig.c + ivyTable.c + ivyDsd.c + ivyFanout.c + ivyMulti.c + ivyFastMap.c + ivyCutTrav.c + ivyRwr.c + ivyDfs.c + ivyMem.c +) diff --git a/src/aig/miniaig/CMakeLists.txt b/src/aig/miniaig/CMakeLists.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/aig/saig/CMakeLists.txt b/src/aig/saig/CMakeLists.txt new file mode 100644 index 0000000000..06c0bfc8db --- /dev/null +++ b/src/aig/saig/CMakeLists.txt @@ -0,0 +1,30 @@ +abc_libabc_add_sources( + NAME aig_saig + SOURCES + saigCone.c + saigIsoFast.c + saigOutDec.c + saigInd.c + saigSimFast.c + saigConstr.c + saigPhase.c + saigRetMin.c + saigTrans.c + saigIoa.c + saigSimMv.c + saigStrSim.c + saigTempor.c + saigDup.c + saigSimSeq.c + saigRetStep.c + saigMiter.c + saigSynch.c + saigDual.c + saigSwitch.c + saigRetFwd.c + saigIsoSlow.c + saigWnd.c + saigScl.c + saigIso.c + saigConstr2.c +) diff --git a/src/base/abc/CMakeLists.txt b/src/base/abc/CMakeLists.txt new file mode 100644 index 0000000000..eb01c56f74 --- /dev/null +++ b/src/base/abc/CMakeLists.txt @@ -0,0 +1,27 @@ +abc_libabc_add_sources( + NAME base_abc + SOURCES + abcHieNew.c + abcDfs.c + abcNtk.c + abcFanio.c + abcHieGia.c + abcMinBase.c + abcCheck.c + abcLatch.c + abcHieCec.c + abcShow.c + abcAig.c + abcNames.c + abcRefs.c + abcNetlist.c + abcFunc.c + abcUtil.c + abcLib.c + abcSop.c + abcObj.c + abcBlifMv.c + abcFanOrder.c + abcHie.c + abcBarBuf.c +) diff --git a/src/base/abc/abcHieNew.c b/src/base/abc/abcHieNew.c index 54a61609f8..87efef2b66 100644 --- a/src/base/abc/abcHieNew.c +++ b/src/base/abc/abcHieNew.c @@ -9,7 +9,7 @@ Synopsis [New hierarchy manager.] Author [Alan Mishchenko] - + Affiliation [UC Berkeley] Date [Ver. 1.0. Started - June 20, 2005.] @@ -34,8 +34,8 @@ ABC_NAMESPACE_IMPL_START //////////////////////////////////////////////////////////////////////// #define AU_MAX_FANINS 0x1FFFFFFF - -typedef enum { + +typedef enum { AU_OBJ_NONE, // 0: non-existent object AU_OBJ_CONST0, // 1: constant node AU_OBJ_PI, // 2: primary input @@ -61,7 +61,7 @@ struct Au_Obj_t_ // 16 bytes int Fanins[2]; // fanin literals }; -struct Au_Ntk_t_ +struct Au_Ntk_t_ { char * pName; // model name Au_Man_t * pMan; // model manager @@ -95,7 +95,7 @@ struct Au_Ntk_t_ double nNodeMuxs; }; -struct Au_Man_t_ +struct Au_Man_t_ { char * pName; // the name of the library Vec_Ptr_t vNtks; // the array of modules @@ -120,7 +120,7 @@ static inline Au_Obj_t * Au_Regular( Au_Obj_t * p ) { retur static inline Au_Obj_t * Au_Not( Au_Obj_t * p ) { return (Au_Obj_t *)((ABC_PTRUINT_T)(p) ^ 01); } static inline Au_Obj_t * Au_NotCond( Au_Obj_t * p, int c ) { return (Au_Obj_t *)((ABC_PTRUINT_T)(p) ^ (c)); } static inline int Au_IsComplement( Au_Obj_t * p ) { return (int)((ABC_PTRUINT_T)(p) & 01); } - + static inline char * Au_UtilStrsav( char * s ) { return s ? strcpy(ABC_ALLOC(char, strlen(s)+1), s) : NULL; } static inline char * Au_ManName( Au_Man_t * p ) { return p->pName; } @@ -130,32 +130,32 @@ static inline Au_Ntk_t * Au_ManNtkRoot( Au_Man_t * p ) { retur static inline char * Au_NtkName( Au_Ntk_t * p ) { return p->pName; } static inline Au_Man_t * Au_NtkMan( Au_Ntk_t * p ) { return p->pMan; } -static inline int Au_NtkPiNum( Au_Ntk_t * p ) { return p->nObjs[AU_OBJ_PI]; } -static inline int Au_NtkPoNum( Au_Ntk_t * p ) { return p->nObjs[AU_OBJ_PO]; } -static inline int Au_NtkFanNum( Au_Ntk_t * p ) { return p->nObjs[AU_OBJ_FAN]; } -static inline int Au_NtkFlopNum( Au_Ntk_t * p ) { return p->nObjs[AU_OBJ_FLOP]; } -static inline int Au_NtkBoxNum( Au_Ntk_t * p ) { return p->nObjs[AU_OBJ_BOX]; } -static inline int Au_NtkNodeNum( Au_Ntk_t * p ) { return p->nObjs[AU_OBJ_NODE]; } -static inline int Au_NtkObjNumMax( Au_Ntk_t * p ) { return (Vec_PtrSize(&p->vPages) - 1) * (1 << 12) + p->iHandle; } -static inline int Au_NtkObjNum( Au_Ntk_t * p ) { return Vec_IntSize(&p->vObjs); } +static inline int Au_NtkPiNum( Au_Ntk_t * p ) { return p->nObjs[AU_OBJ_PI]; } +static inline int Au_NtkPoNum( Au_Ntk_t * p ) { return p->nObjs[AU_OBJ_PO]; } +static inline int Au_NtkFanNum( Au_Ntk_t * p ) { return p->nObjs[AU_OBJ_FAN]; } +static inline int Au_NtkFlopNum( Au_Ntk_t * p ) { return p->nObjs[AU_OBJ_FLOP]; } +static inline int Au_NtkBoxNum( Au_Ntk_t * p ) { return p->nObjs[AU_OBJ_BOX]; } +static inline int Au_NtkNodeNum( Au_Ntk_t * p ) { return p->nObjs[AU_OBJ_NODE]; } +static inline int Au_NtkObjNumMax( Au_Ntk_t * p ) { return (Vec_PtrSize(&p->vPages) - 1) * (1 << 12) + p->iHandle; } +static inline int Au_NtkObjNum( Au_Ntk_t * p ) { return Vec_IntSize(&p->vObjs); } static inline Au_Obj_t * Au_NtkObj( Au_Ntk_t * p, int h ) { return (Au_Obj_t *)p->vPages.pArray[h >> 12] + (h & 0xFFF); } static inline Au_Obj_t * Au_NtkPi( Au_Ntk_t * p, int i ) { return Au_NtkObj(p, Vec_IntEntry(&p->vPis, i)); } static inline Au_Obj_t * Au_NtkPo( Au_Ntk_t * p, int i ) { return Au_NtkObj(p, Vec_IntEntry(&p->vPos, i)); } static inline Au_Obj_t * Au_NtkObjI( Au_Ntk_t * p, int i ) { return Au_NtkObj(p, Vec_IntEntry(&p->vObjs, i)); } -static inline int Au_ObjIsNone( Au_Obj_t * p ) { return p->Type == AU_OBJ_NONE; } -static inline int Au_ObjIsConst0( Au_Obj_t * p ) { return p->Type == AU_OBJ_CONST0; } -static inline int Au_ObjIsPi( Au_Obj_t * p ) { return p->Type == AU_OBJ_PI; } -static inline int Au_ObjIsPo( Au_Obj_t * p ) { return p->Type == AU_OBJ_PO; } -static inline int Au_ObjIsFan( Au_Obj_t * p ) { return p->Type == AU_OBJ_FAN; } -static inline int Au_ObjIsFlop( Au_Obj_t * p ) { return p->Type == AU_OBJ_FLOP; } -static inline int Au_ObjIsBox( Au_Obj_t * p ) { return p->Type == AU_OBJ_BOX; } +static inline int Au_ObjIsNone( Au_Obj_t * p ) { return p->Type == AU_OBJ_NONE; } +static inline int Au_ObjIsConst0( Au_Obj_t * p ) { return p->Type == AU_OBJ_CONST0; } +static inline int Au_ObjIsPi( Au_Obj_t * p ) { return p->Type == AU_OBJ_PI; } +static inline int Au_ObjIsPo( Au_Obj_t * p ) { return p->Type == AU_OBJ_PO; } +static inline int Au_ObjIsFan( Au_Obj_t * p ) { return p->Type == AU_OBJ_FAN; } +static inline int Au_ObjIsFlop( Au_Obj_t * p ) { return p->Type == AU_OBJ_FLOP; } +static inline int Au_ObjIsBox( Au_Obj_t * p ) { return p->Type == AU_OBJ_BOX; } static inline int Au_ObjIsNode( Au_Obj_t * p ) { return p->Type == AU_OBJ_NODE; } -static inline int Au_ObjIsTerm( Au_Obj_t * p ) { return p->Type >= AU_OBJ_PI && p->Type <= AU_OBJ_FLOP; } +static inline int Au_ObjIsTerm( Au_Obj_t * p ) { return p->Type >= AU_OBJ_PI && p->Type <= AU_OBJ_FLOP; } -static inline char * Au_ObjBase( Au_Obj_t * p ) { return (char *)p - ((ABC_PTRINT_T)p & 0x3FF); } -static inline Au_Ntk_t * Au_ObjNtk( Au_Obj_t * p ) { return ((Au_Ntk_t **)Au_ObjBase(p))[0]; } +static inline char * Au_ObjBase( Au_Obj_t * p ) { return (char *)p - ((ABC_PTRINT_T)p & 0x3FF); } +static inline Au_Ntk_t * Au_ObjNtk( Au_Obj_t * p ) { return ((Au_Ntk_t **)Au_ObjBase(p))[0]; } static inline int Au_ObjId( Au_Obj_t * p ) { return ((int *)Au_ObjBase(p))[2] | (((ABC_PTRINT_T)p & 0x3FF) >> 4); } static inline int Au_ObjPioNum( Au_Obj_t * p ) { assert(Au_ObjIsTerm(p)); return p->Fanins[p->nFanins]; } static inline int Au_ObjFunc( Au_Obj_t * p ) { return p->Func; } @@ -197,17 +197,17 @@ static inline void Au_ObjSetTravIdCurrentId( Au_Ntk_t * p, int Id ) { Ve static inline int Au_ObjIsTravIdCurrentId( Au_Ntk_t * p, int Id ) { return (Vec_IntGetEntry(&p->vTravIds, Id) == p->nTravIds); } #define Au_ManForEachNtk( p, pNtk, i ) \ - for ( i = 1; (i < Vec_PtrSize(&p->vNtks)) && (((pNtk) = Au_ManNtk(p, i)), 1); i++ ) + for ( i = 1; (i < Vec_PtrSize(&p->vNtks)) && (((pNtk) = Au_ManNtk(p, i)), 1); i++ ) #define Au_ManForEachNtkReverse( p, pNtk, i ) \ - for ( i = Vec_PtrSize(&p->vNtks) - 1;(i>=1) && (((pNtk) = Au_ManNtk(p, i)), 1); i-- ) + for ( i = Vec_PtrSize(&p->vNtks) - 1;(i>=1) && (((pNtk) = Au_ManNtk(p, i)), 1); i-- ) #define Au_ObjForEachFaninId( pObj, hFanin, i ) \ - for ( i = 0; (i < Au_ObjFaninNum(pObj)) && (((hFanin) = Au_ObjFaninId(pObj, i)), 1); i++ ) + for ( i = 0; (i < Au_ObjFaninNum(pObj)) && (((hFanin) = Au_ObjFaninId(pObj, i)), 1); i++ ) #define Au_BoxForEachFanoutId( pObj, hFanout, i) \ for ( i = 0; (i < Au_BoxFanoutNum(pObj)) && (((hFanout) = Au_BoxFanoutId(pObj, i)), 1); i++ ) #define Au_ObjForEachFanin( pObj, pFanin, i ) \ - for ( i = 0; (i < Au_ObjFaninNum(pObj)) && (((pFanin) = Au_ObjFanin(pObj, i)), 1); i++ ) + for ( i = 0; (i < Au_ObjFaninNum(pObj)) && (((pFanin) = Au_ObjFanin(pObj, i)), 1); i++ ) #define Au_BoxForEachFanout( pObj, pFanout, i) \ for ( i = 0; (i < Au_BoxFanoutNum(pObj)) && (((pFanout) = Au_BoxFanout(pObj, i)), 1); i++ ) @@ -236,7 +236,7 @@ extern void Au_ManFree( Au_Man_t * p ); Synopsis [Working with models.] Description [] - + SideEffects [] SeeAlso [] @@ -318,7 +318,7 @@ int Au_NtkNodeNumFunc( Au_Ntk_t * p, int Func ) Synopsis [Working with manager.] Description [] - + SideEffects [] SeeAlso [] @@ -351,7 +351,7 @@ void Au_ManDelete( Au_Man_t * p ) Au_ManForEachNtk( p, pNtk, i ) Au_NtkFree( pNtk ); } -int Au_ManFindNtk( Au_Man_t * p, char * pName ) +int Au_ManFindNtk( Au_Man_t * p, const char * pName ) { Au_Ntk_t * pNtk; int i; @@ -360,7 +360,7 @@ int Au_ManFindNtk( Au_Man_t * p, char * pName ) return i; return -1; } -Au_Ntk_t * Au_ManFindNtkP( Au_Man_t * p, char * pName ) +Au_Ntk_t * Au_ManFindNtkP( Au_Man_t * p, const char * pName ) { int iNtk = Au_ManFindNtk( p, pName ); if ( iNtk == -1 ) @@ -447,7 +447,7 @@ void Au_ManReorderModels( Au_Man_t * p, Au_Ntk_t * pRoot ) // reverse order vOrder->nSize--; vOrder->pArray++; - Vec_IntReverseOrder( vOrder ); + Vec_IntReverseOrder( vOrder ); vOrder->pArray--; vOrder->nSize++; // compute new order @@ -524,11 +524,11 @@ void Au_ManCountThings( Au_Man_t * p ) // printf( "total %.0f nodes in model %s\n", pNtk->nNodes, Au_NtkName(pNtk) ); } pNtk = Au_ManNtkRoot(p); - printf( "Total nodes = %15.0f. Total instances = %15.0f. Total ports = %15.0f.\n", -// printf( "Total nodes = %.2e. Total instances = %.2e. Total ports = %.2e.\n", + printf( "Total nodes = %15.0f. Total instances = %15.0f. Total ports = %15.0f.\n", +// printf( "Total nodes = %.2e. Total instances = %.2e. Total ports = %.2e.\n", pNtk->nNodes, pNtk->nBoxes, pNtk->nPorts ); -// printf( "Total ANDs = %15.0f. Total XORs = %15.0f. Total MUXes = %15.0f.\n", -// printf( "Total ANDs = %.2e. Total XORs = %.2e. Total MUXes = %.2e. ", +// printf( "Total ANDs = %15.0f. Total XORs = %15.0f. Total MUXes = %15.0f.\n", +// printf( "Total ANDs = %.2e. Total XORs = %.2e. Total MUXes = %.2e. ", // pNtk->nNodeAnds, pNtk->nNodeXors, pNtk->nNodeMuxs ); printf( "Total ANDs = %15.0f.\n", pNtk->nNodeAnds ); printf( "Total XORs = %15.0f.\n", pNtk->nNodeXors ); @@ -744,7 +744,7 @@ int Au_NtkSuppSizeTest( Au_Ntk_t * p ) Synopsis [Returns memory for the next object.] Description [] - + SideEffects [] SeeAlso [] @@ -779,7 +779,7 @@ int Au_NtkAllocObj( Au_Ntk_t * p, int nFanins, int Type ) if ( p->iHandle ) { pMem += 64 - (p->iHandle & 63); - p->iHandle = 0; + p->iHandle = 0; } Vec_PtrPush( &p->vPages, pMem ); Au_NtkInsertHeader( p ); @@ -790,7 +790,7 @@ int Au_NtkAllocObj( Au_Ntk_t * p, int nFanins, int Type ) if ( (p->iHandle & 63) == 0 || nObjInt > (64 - (p->iHandle & 63)) ) { if ( p->iHandle & 63 ) - p->iHandle += 64 - (p->iHandle & 63); + p->iHandle += 64 - (p->iHandle & 63); Au_NtkInsertHeader( p ); } if ( p->iHandle + nObjInt > (1 << 12) ) @@ -899,7 +899,7 @@ Here is a small example: Synopsis [Reads one entry.] Description [] - + SideEffects [] SeeAlso [] @@ -914,7 +914,7 @@ static inline int Au_NtkRemapNum( Vec_Int_t * vNum2Obj, int Num ) Synopsis [Reads one entry.] Description [] - + SideEffects [] SeeAlso [] @@ -950,7 +950,7 @@ static inline void Au_NtkParseCBlifNum( Vec_Int_t * vFanins, char * pToken, Vec_ Synopsis [Parses CBLIF file.] Description [] - + SideEffects [] SeeAlso [] @@ -1077,7 +1077,7 @@ Au_Ntk_t * Au_NtkParseCBlif( char * pFileName ) { pCur = strtok( NULL, " \t\r" ); if ( pCur == NULL || *pCur == '#' ) - break; + break; Au_NtkParseCBlifNum( vFanins, pCur, vNum2Obj ); } assert( Vec_IntSize(vFanins) == nOutputs ); @@ -1122,14 +1122,14 @@ extern int Abc_NtkCheckRecursive( Abc_Ntk_t * pNtk ); Synopsis [Flattens the logic hierarchy of the netlist.] Description [] - + SideEffects [] SeeAlso [] ***********************************************************************/ void Au_NtkDeriveFlatGia_rec( Gia_Man_t * pGia, Au_Ntk_t * p ) -{ +{ Au_Obj_t * pObj, * pTerm; int i, k, Lit = 0; Au_NtkForEachPi( p, pTerm, i ) @@ -1173,8 +1173,8 @@ void Au_NtkDeriveFlatGia_rec( Gia_Man_t * pGia, Au_Ntk_t * p ) Lit2 = Abc_LitNotCond( Au_ObjCopy(Au_ObjFanin2(pObj)), Au_ObjFaninC2(pObj) ); Lit = Gia_ManHashMux( pGia, Lit0, Lit1, Lit2 ); } - else assert( 0 ); - } + else assert( 0 ); + } assert( Lit >= 0 ); Au_ObjSetCopy( pObj, Lit ); } @@ -1196,7 +1196,7 @@ void Au_NtkDeriveFlatGia_rec( Gia_Man_t * pGia, Au_Ntk_t * p ) } else if ( Au_ObjIsConst0(pObj) ) Au_ObjSetCopy( pObj, 0 ); - + } Au_NtkForEachPo( p, pTerm, i ) { @@ -1213,7 +1213,7 @@ void Au_NtkDeriveFlatGia_rec( Gia_Man_t * pGia, Au_Ntk_t * p ) Synopsis [Flattens the logic hierarchy of the netlist.] Description [] - + SideEffects [] SeeAlso [] @@ -1257,17 +1257,17 @@ Gia_Man_t * Au_NtkDeriveFlatGia( Au_Ntk_t * p ) static inline void Au_ObjSetXsim( Au_Obj_t * pObj, int Value ) { pObj->Value = Value; } static inline int Au_ObjGetXsim( Au_Obj_t * pObj ) { return pObj->Value; } -static inline int Au_XsimInv( int Value ) -{ +static inline int Au_XsimInv( int Value ) +{ if ( Value == AU_VAL0 ) return AU_VAL1; if ( Value == AU_VAL1 ) return AU_VAL0; - assert( Value == AU_VALX ); + assert( Value == AU_VALX ); return AU_VALX; } -static inline int Au_XsimAnd( int Value0, int Value1 ) -{ +static inline int Au_XsimAnd( int Value0, int Value1 ) +{ if ( Value0 == AU_VAL0 || Value1 == AU_VAL0 ) return AU_VAL0; if ( Value0 == AU_VALX || Value1 == AU_VALX ) @@ -1275,16 +1275,16 @@ static inline int Au_XsimAnd( int Value0, int Value1 ) assert( Value0 == AU_VAL1 && Value1 == AU_VAL1 ); return AU_VAL1; } -static inline int Au_XsimXor( int Value0, int Value1 ) -{ +static inline int Au_XsimXor( int Value0, int Value1 ) +{ if ( Value0 == AU_VALX || Value1 == AU_VALX ) return AU_VALX; if ( (Value0 == AU_VAL0) == (Value1 == AU_VAL0) ) return AU_VAL0; return AU_VAL1; } -static inline int Au_XsimMux( int ValueC, int Value1, int Value0 ) -{ +static inline int Au_XsimMux( int ValueC, int Value1, int Value0 ) +{ if ( ValueC == AU_VAL0 ) return Value0; if ( ValueC == AU_VAL1 ) @@ -1295,18 +1295,18 @@ static inline int Au_XsimMux( int ValueC, int Value1, int Value0 ) return AU_VAL1; return AU_VALX; } -static inline int Au_ObjGetXsimFan0( Au_Obj_t * pObj ) -{ +static inline int Au_ObjGetXsimFan0( Au_Obj_t * pObj ) +{ int Value = Au_ObjGetXsim( Au_ObjFanin0(pObj) ); return Au_ObjFaninC0(pObj) ? Au_XsimInv(Value) : Value; } -static inline int Au_ObjGetXsimFan1( Au_Obj_t * pObj ) -{ +static inline int Au_ObjGetXsimFan1( Au_Obj_t * pObj ) +{ int Value = Au_ObjGetXsim( Au_ObjFanin1(pObj) ); return Au_ObjFaninC1(pObj) ? Au_XsimInv(Value) : Value; } -static inline int Au_ObjGetXsimFan2( Au_Obj_t * pObj ) -{ +static inline int Au_ObjGetXsimFan2( Au_Obj_t * pObj ) +{ int Value = Au_ObjGetXsim( Au_ObjFanin2(pObj) ); return Au_ObjFaninC2(pObj) ? Au_XsimInv(Value) : Value; } @@ -1316,14 +1316,14 @@ static inline int Au_ObjGetXsimFan2( Au_Obj_t * pObj ) Synopsis [Flattens the logic hierarchy of the netlist.] Description [] - + SideEffects [] SeeAlso [] ***********************************************************************/ void Au_NtkTerSimulate_rec( Au_Ntk_t * p ) -{ +{ Au_Obj_t * pObj = NULL, * pTerm; int i, k; Au_NtkForEachPi( p, pTerm, i ) @@ -1372,7 +1372,7 @@ void Au_NtkTerSimulate_rec( Au_Ntk_t * p ) } else if ( Au_ObjIsConst0(pObj) ) Au_ObjSetXsim( pObj, AU_VAL0 ); - + } Au_NtkForEachPo( p, pTerm, i ) Au_ObjSetXsim( pTerm, Au_ObjGetXsimFan0(pObj) ); @@ -1393,7 +1393,7 @@ void Au_NtkTerSimulate_rec( Au_Ntk_t * p ) Synopsis [Flattens the logic hierarchy of the netlist.] Description [] - + SideEffects [] SeeAlso [] @@ -1420,9 +1420,9 @@ void Au_NtkTerSimulate( Au_Ntk_t * p ) else if ( Au_ObjGetXsim(pTerm) == AU_VAL1 ) Counter[1]++; // print results - printf( "Const0 outputs =%15d. Const1 outputs =%15d. Total outputs =%15d.\n", + printf( "Const0 outputs =%15d. Const1 outputs =%15d. Total outputs =%15d.\n", Counter[0], Counter[1], Au_NtkPoNum(p) ); - printf( "Const0 ports = %.0f. Const1 ports = %.0f. Non-const ports= %.0f. Total ports = %.0f.\n", + printf( "Const0 ports = %.0f. Const1 ports = %.0f. Non-const ports= %.0f. Total ports = %.0f.\n", p->pMan->nPortsC0, p->pMan->nPortsC1, p->pMan->nPortsNC, p->pMan->nPortsC0 + p->pMan->nPortsC1 + p->pMan->nPortsNC ); } @@ -1432,7 +1432,7 @@ void Au_NtkTerSimulate( Au_Ntk_t * p ) Synopsis [Duplicates ABC network.] Description [] - + SideEffects [] SeeAlso [] @@ -1488,7 +1488,7 @@ Gia_Man_t * Au_ManDeriveTest( Abc_Ntk_t * pRoot ) extern Vec_Ptr_t * Abc_NtkCollectHie( Abc_Ntk_t * pNtk ); // char * pModelName = NULL; - char * pModelName = "path_0_r_x_lhs"; + const char * pModelName = "path_0_r_x_lhs"; Gia_Man_t * pGia = NULL; Vec_Ptr_t * vOrder, * vModels; Abc_Ntk_t * pMod; @@ -1533,7 +1533,7 @@ Gia_Man_t * Au_ManDeriveTest( Abc_Ntk_t * pRoot ) if ( pNtk == NULL ) pNtk = (Au_Ntk_t *)pRoot->pData; - + // if ( !Abc_NtkCheckRecursive(pRoot) ) { clk1 = Abc_Clock(); @@ -1549,7 +1549,7 @@ Gia_Man_t * Au_ManDeriveTest( Abc_Ntk_t * pRoot ) clk1 = Abc_Clock(); Au_ManDelete( pMan ); clk2 += Abc_Clock() - clk1; - + Abc_PrintTime( 1, "Time all ", Abc_Clock() - clk ); Abc_PrintTime( 1, "Time new ", clk2 ); Abc_PrintTime( 1, "Time GIA ", clk3 ); @@ -1562,7 +1562,7 @@ Gia_Man_t * Au_ManDeriveTest( Abc_Ntk_t * pRoot ) Synopsis [Performs hierarchical equivalence checking.] Description [] - + SideEffects [] SeeAlso [] diff --git a/src/base/abci/CMakeLists.txt b/src/base/abci/CMakeLists.txt new file mode 100644 index 0000000000..0910dc2d88 --- /dev/null +++ b/src/base/abci/CMakeLists.txt @@ -0,0 +1,81 @@ +abc_libabc_add_sources( + NAME base_abci + SOURCES + abcCascade.c + abcCut.c + abcReach.c + abcIvy.c + abcQbf.c + abc.c + abcExtract.c + abcGen.c + abcAuto.c + abcBmc.c + abcHaig.c + abcFraig.c + abcDress3.c + abcTim.c + abcRec3.c + abcLut.c + abcMfs.c + abcVerify.c + abcNpnSave.c + abcReconv.c + abcLutmin.c + abcSpeedup.c + abcUnate.c + abcRr.c + abcSaucy.c + abcSat.c + abcIfMux.c + abcNpn.c + abcRpo.c + abcDebug.c + abcRenode.c + abcXsim.c + abcReorder.c + abcExact.c + abcOdc.c + abcDar.c + abcCas.c + abcRewrite.c + abcIf.c + abcSweep.c + abcBidec.c + abcAttach.c + abcRestruct.c + abcDsd.c + abcRefactor.c + abcFx.c + abcPart.c + abcDetect.c + abcDress2.c + abcRunGen.c + abcScorr.c + abcNtbdd.c + abcPrint.c + abcProve.c + abcBm.c + abcSymm.c + abcMulti.c + abcQuant.c + abcLog.c + abcStrash.c + abcMerge.c + abcEco.c + abcFxu.c + abcOrchestration.c + abcBalance.c + abcSense.c + abcMap.c + abcDress.c + abcIfif.c + abcCollapse.c + abcUnreach.c + abcMini.c + abcMiter.c + abcDec.c + abcOrder.c + abcResub.c + abcTiming.c +) diff --git a/src/base/abci/abcNpn.c b/src/base/abci/abcNpn.c index 92b47c177a..dcf9854a20 100644 --- a/src/base/abci/abcNpn.c +++ b/src/base/abci/abcNpn.c @@ -340,7 +340,7 @@ void Abc_TruthNpnPerform( Abc_TtStore_t * p, int NpnType, int fVerbose ) // typedef unsigned(*TtCanonicizeFunc)(Abc_TtHieMan_t * p, word * pTruth, int nVars, char * pCanonPerm, int flag); unsigned Abc_TtCanonicizeWrap(TtCanonicizeFunc func, Abc_TtHieMan_t * p, word * pTruth, int nVars, char * pCanonPerm, int flag); unsigned Abc_TtCanonicizeAda(Abc_TtHieMan_t * p, word * pTruth, int nVars, char * pCanonPerm, int iThres); - unsigned Abc_TtCanonicizeCA(Abc_TtHieMan_t * p, word * pTruth, int nVars, char * pCanonPerm, int iThres); + extern unsigned Abc_TtCanonicizeCA(Abc_TtHieMan_t * p, word * pTruth, int nVars, char * pCanonPerm, int iThres); Abc_TtHieMan_t * pMan = Abc_TtHieManStart(p->nVars, 5); for ( i = 0; i < p->nFuncs; i++ ) diff --git a/src/base/acb/CMakeLists.txt b/src/base/acb/CMakeLists.txt new file mode 100644 index 0000000000..d12669d56a --- /dev/null +++ b/src/base/acb/CMakeLists.txt @@ -0,0 +1,13 @@ +abc_libabc_add_sources( + NAME base_acb + SOURCES + acbCom.c + acbFunc.c + acbMfs.c + acbSets.c + acbPush.c + acbTest.c + acbAig.c + acbUtil.c + acbAbc.c +) diff --git a/src/base/acb/acbTest.c b/src/base/acb/acbTest.c index c22d4b55b3..9eef818380 100644 --- a/src/base/acb/acbTest.c +++ b/src/base/acb/acbTest.c @@ -9,7 +9,7 @@ Synopsis [] Author [Alan Mishchenko] - + Affiliation [UC Berkeley] Date [Ver. 1.0. Started - July 21, 2015.] @@ -42,7 +42,7 @@ static int fForceZero = 0; Synopsis [] Description [] - + SideEffects [] SeeAlso [] @@ -74,11 +74,11 @@ void Gia_ManSimTry( Gia_Man_t * pF, Gia_Man_t * pG ) int nBitsFx = Abc_TtCountOnesVec(pSimFx, nWords); int nBitsF1 = Abc_TtCountOnesVecMask(pSimFx, pSimFb, nWords, 1); int nBitsF0 = nWords*64 - nBitsFx - nBitsF1; - + int nBitsGx = Abc_TtCountOnesVec(pSimGx, nWords); int nBitsG1 = Abc_TtCountOnesVecMask(pSimGx, pSimGb, nWords, 1); int nBitsG0 = nWords*64 - nBitsGx - nBitsG1; - + printf( "Output %4d : ", i ); printf( " RF : " ); @@ -135,7 +135,7 @@ void Gia_ManSimTry( Gia_Man_t * pF, Gia_Man_t * pG ) Synopsis [] Description [] - + SideEffects [] SeeAlso [] @@ -145,7 +145,7 @@ void Gia_ManDualNot( Gia_Man_t * p, int LitA[2], int LitZ[2] ) { LitZ[0] = Abc_LitNot(LitA[0]); LitZ[1] = LitA[1]; - + if ( fForceZero ) LitZ[0] = Gia_ManHashAnd( p, LitZ[0], Abc_LitNot(LitZ[1]) ); } // computes Z = XOR(A, B) where A, B, Z belong to {0,1,x} encoded as 0=00, 1=01, x=1- @@ -153,7 +153,7 @@ void Gia_ManDualXor2( Gia_Man_t * p, int LitA[2], int LitB[2], int LitZ[2] ) { LitZ[0] = Gia_ManHashXor( p, LitA[0], LitB[0] ); LitZ[1] = Gia_ManHashOr( p, LitA[1], LitB[1] ); - + if ( fForceZero ) LitZ[0] = Gia_ManHashAnd( p, LitZ[0], Abc_LitNot(LitZ[1]) ); } void Gia_ManDualXorN( Gia_Man_t * p, int * pLits, int n, int LitZ[2] ) @@ -192,7 +192,7 @@ void Gia_ManDualAndN( Gia_Man_t * p, int * pLits, int n, int LitZ[2] ) LitZ[0] = Gia_ManHashAnd( p, LitZ[0], pLits[2*i] ); } LitZ[1] = Gia_ManHashAnd( p, LitOne, Abc_LitNot(LitZero) ); - + if ( fForceZero ) LitZ[0] = Gia_ManHashAnd( p, LitZ[0], Abc_LitNot(LitZ[1]) ); } /* @@ -207,7 +207,7 @@ void Gia_ManDualDc( Gia_Man_t * p, int LitC[2], int LitD[2], int LitZ[2] ) LitZ[0] = LitC[0]; // LitZ[0] = Gia_ManHashMux( p, LitD[0], 0, LitC[0] ); LitZ[1] = Gia_ManHashOr(p, Gia_ManHashOr(p,LitD[0],LitD[1]), LitC[1] ); - + if ( fForceZero ) LitZ[0] = Gia_ManHashAnd( p, LitZ[0], Abc_LitNot(LitZ[1]) ); } void Gia_ManDualMux( Gia_Man_t * p, int LitC[2], int LitT[2], int LitE[2], int LitZ[2] ) @@ -235,7 +235,7 @@ void Gia_ManDualMux( Gia_Man_t * p, int LitC[2], int LitT[2], int LitE[2], int L if ( fForceZero ) LitZ[0] = Gia_ManHashAnd( p, LitZ[0], Abc_LitNot(LitZ[1]) ); } -int Gia_ManDualCompare( Gia_Man_t * p, int LitF[2], int LitS[2] ) +int Gia_ManDualCompare( Gia_Man_t * p, unsigned int LitF[2], unsigned int LitS[2] ) { int iMiter = Gia_ManHashXor( p, LitF[0], LitS[0] ); iMiter = Gia_ManHashOr( p, LitF[1], iMiter ); @@ -248,7 +248,7 @@ int Gia_ManDualCompare( Gia_Man_t * p, int LitF[2], int LitS[2] ) Synopsis [] Description [] - + SideEffects [] SeeAlso [] @@ -267,36 +267,36 @@ void Acb_ObjToGiaDual( Gia_Man_t * pNew, Acb_Ntk_t * p, int iObj, Vec_Int_t * vT Vec_IntPushTwo( vTemp, pLits[0], pLits[1] ); } Type = Acb_ObjType( p, iObj ); - if ( Type == ABC_OPER_CONST_F ) + if ( Type == ABC_OPER_CONST_F ) { pRes[0] = 0; pRes[1] = 0; return; } - if ( Type == ABC_OPER_CONST_T ) + if ( Type == ABC_OPER_CONST_T ) { pRes[0] = 1; pRes[1] = 0; return; } - if ( Type == ABC_OPER_CONST_X ) + if ( Type == ABC_OPER_CONST_X ) { pRes[0] = 0; pRes[1] = 1; return; } - if ( Type == ABC_OPER_BIT_BUF ) + if ( Type == ABC_OPER_BIT_BUF ) { pRes[0] = Vec_IntEntry(vTemp, 0); pRes[1] = Vec_IntEntry(vTemp, 1); return; } - if ( Type == ABC_OPER_BIT_INV ) + if ( Type == ABC_OPER_BIT_INV ) { Gia_ManDualNot( pNew, Vec_IntArray(vTemp), pRes ); return; } - if ( Type == ABC_OPER_TRI ) + if ( Type == ABC_OPER_TRI ) { // in the file inputs are ordered as follows: _DC \n6_5[9] ( .O(\108 ), .C(\96 ), .D(\107 )); // in this code, we expect them as follows: void Gia_ManDualDc( Gia_Man_t * p, int LitC[2], int LitD[2], int LitZ[2] ) @@ -304,7 +304,7 @@ void Acb_ObjToGiaDual( Gia_Man_t * pNew, Acb_Ntk_t * p, int iObj, Vec_Int_t * vT Gia_ManDualDc( pNew, Vec_IntArray(vTemp), Vec_IntArray(vTemp) + 2, pRes ); return; } - if ( Type == ABC_OPER_BIT_MUX ) + if ( Type == ABC_OPER_BIT_MUX ) { // in the file inputs are ordered as follows: _HMUX \U$1 ( .O(\282 ), .I0(1'b1), .I1(\277 ), .S(\281 )); // in this code, we expect them as follows: void Gia_ManDualMux( Gia_Man_t * p, int LitC[2], int LitT[2], int LitE[2], int LitZ[2] ) @@ -386,7 +386,7 @@ Gia_Man_t * Acb_NtkGiaDeriveDual( Acb_Ntk_t * p ) Synopsis [] Description [] - + SideEffects [] SeeAlso [] @@ -421,8 +421,8 @@ Gia_Man_t * Acb_NtkGiaDeriveMiter( Gia_Man_t * pOne, Gia_Man_t * pTwo, int Type { for ( i = 0; i < Gia_ManCoNum(pOne); i += 2 ) { - unsigned pLitsF[2] = { Gia_ManCo(pOne, i)->Value, Gia_ManCo(pOne, i+1)->Value }; - unsigned pLitsS[2] = { Gia_ManCo(pTwo, i)->Value, Gia_ManCo(pTwo, i+1)->Value }; + unsigned int pLitsF[2] = { Gia_ManCo(pOne, i)->Value, Gia_ManCo(pOne, i+1)->Value }; + unsigned int pLitsS[2] = { Gia_ManCo(pTwo, i)->Value, Gia_ManCo(pTwo, i+1)->Value }; Gia_ManAppendCo( pNew, pLitsF[0] ); Gia_ManAppendCo( pNew, pLitsS[0] ); } @@ -431,8 +431,8 @@ Gia_Man_t * Acb_NtkGiaDeriveMiter( Gia_Man_t * pOne, Gia_Man_t * pTwo, int Type { for ( i = 0; i < Gia_ManCoNum(pOne); i += 2 ) { - unsigned pLitsF[2] = { Gia_ManCo(pOne, i)->Value, Gia_ManCo(pOne, i+1)->Value }; - unsigned pLitsS[2] = { Gia_ManCo(pTwo, i)->Value, Gia_ManCo(pTwo, i+1)->Value }; + unsigned int pLitsF[2] = { Gia_ManCo(pOne, i)->Value, Gia_ManCo(pOne, i+1)->Value }; + unsigned int pLitsS[2] = { Gia_ManCo(pTwo, i)->Value, Gia_ManCo(pTwo, i+1)->Value }; Gia_ManAppendCo( pNew, pLitsF[1] ); Gia_ManAppendCo( pNew, pLitsS[1] ); } @@ -443,7 +443,7 @@ Gia_Man_t * Acb_NtkGiaDeriveMiter( Gia_Man_t * pOne, Gia_Man_t * pTwo, int Type { int pLitsF[2] = { (int)Gia_ManCo(pOne, i)->Value, (int)Gia_ManCo(pOne, i+1)->Value }; int pLitsS[2] = { (int)Gia_ManCo(pTwo, i)->Value, (int)Gia_ManCo(pTwo, i+1)->Value }; - Gia_ManAppendCo( pNew, Gia_ManDualCompare( pNew, pLitsF, pLitsS ) ); + Gia_ManAppendCo( pNew, Gia_ManDualCompare( pNew, (unsigned int *)pLitsF, (unsigned int *)pLitsS ) ); } } Gia_ManHashStop( pNew ); @@ -458,7 +458,7 @@ Gia_Man_t * Acb_NtkGiaDeriveMiter( Gia_Man_t * pOne, Gia_Man_t * pTwo, int Type Synopsis [] Description [] - + SideEffects [] SeeAlso [] @@ -475,7 +475,7 @@ void Acb_OutputFile( char * pFileName, Acb_Ntk_t * pNtkF, int * pModel ) } if ( pModel == NULL ) fprintf( pFile, "EQ\n" ); - else + else { /* NEQ @@ -521,7 +521,7 @@ int * Acb_NtkSolve( Gia_Man_t * p ) Synopsis [Various statistics.] Description [] - + SideEffects [] SeeAlso [] @@ -549,7 +549,7 @@ void Acb_NtkPrintCecStats( Acb_Ntk_t * pNtk ) Synopsis [Changing the PI order.] Description [] - + SideEffects [] SeeAlso [] @@ -601,7 +601,7 @@ int Acb_NtkCheckPiOrder( Acb_Ntk_t * pNtkF, Acb_Ntk_t * pNtkG ) Synopsis [] Description [] - + SideEffects [] SeeAlso [] @@ -621,7 +621,7 @@ void Acb_NtkRunTest( char * pFileNames[4], int fFancy, int fVerbose ) Acb_Ntk_t * pNtkG = Acb_VerilogSimpleRead( pFileNames[1], NULL ); if ( !pNtkF || !pNtkG ) return; - + assert( Acb_NtkCiNum(pNtkF) == Acb_NtkCiNum(pNtkG) ); assert( Acb_NtkCoNum(pNtkF) == Acb_NtkCoNum(pNtkG) ); diff --git a/src/base/bac/CMakeLists.txt b/src/base/bac/CMakeLists.txt new file mode 100644 index 0000000000..3073db56c4 --- /dev/null +++ b/src/base/bac/CMakeLists.txt @@ -0,0 +1,19 @@ +abc_libabc_add_sources( + NAME base_bac + SOURCES + bacLib.c + bacPrsTrans.c + bacPtr.c + bacReadSmt.c + bacNtk.c + bacBlast.c + bacWriteVer.c + bacPrsBuild.c + bacWriteSmt.c + bacReadVer.c + bacCom.c + bacBac.c + bacPtrAbc.c + bacReadBlif.c + bacWriteBlif.c +) diff --git a/src/base/cba/CMakeLists.txt b/src/base/cba/CMakeLists.txt new file mode 100644 index 0000000000..2d5aa506c2 --- /dev/null +++ b/src/base/cba/CMakeLists.txt @@ -0,0 +1,12 @@ +abc_libabc_add_sources( + NAME base_cba + SOURCES + cbaBlast.c + cbaWriteBlif.c + cbaCba.c + cbaCom.c + cbaReadVer.c + cbaNtk.c + cbaWriteVer.c + cbaReadBlif.c +) diff --git a/src/base/cmd/CMakeLists.txt b/src/base/cmd/CMakeLists.txt new file mode 100644 index 0000000000..cf36a88fb6 --- /dev/null +++ b/src/base/cmd/CMakeLists.txt @@ -0,0 +1,14 @@ +abc_libabc_add_sources( + NAME base_cmd + SOURCES + cmdHist.c + cmdAuto.c + cmdAlias.c + cmdStarter.c + cmdFlag.c + cmd.c + cmdLoad.c + cmdUtils.c + cmdPlugin.c + cmdApi.c +) diff --git a/src/base/cmd/cmd.c b/src/base/cmd/cmd.c index 20d0f0c38f..ce27393597 100644 --- a/src/base/cmd/cmd.c +++ b/src/base/cmd/cmd.c @@ -9,7 +9,7 @@ Synopsis [Command file.] Author [Alan Mishchenko] - + Affiliation [UC Berkeley] Date [Ver. 1.0. Started - June 20, 2005.] @@ -18,11 +18,11 @@ ***********************************************************************/ -#ifdef WIN32 +#if (defined(WIN32) || defined(__MINGW32__)) #include #else -#include #include +#include #endif #include "base/abc/abc.h" @@ -51,7 +51,7 @@ static int CmdCommandUnsetVariable ( Abc_Frame_t * pAbc, int argc, char ** argv static int CmdCommandUndo ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int CmdCommandRecall ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int CmdCommandEmpty ( Abc_Frame_t * pAbc, int argc, char ** argv ); -#if defined(WIN32) +#if (defined(WIN32) || defined(__MINGW32__)) static int CmdCommandScanDir ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int CmdCommandRenameFiles ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int CmdCommandLs ( Abc_Frame_t * pAbc, int argc, char ** argv ); @@ -105,7 +105,7 @@ void Cmd_Init( Abc_Frame_t * pAbc ) Cmd_CommandAdd( pAbc, "Basic", "undo", CmdCommandUndo, 0 ); Cmd_CommandAdd( pAbc, "Basic", "recall", CmdCommandRecall, 0 ); Cmd_CommandAdd( pAbc, "Basic", "empty", CmdCommandEmpty, 0 ); -#if defined(WIN32) +#if (defined(WIN32) || defined(__MINGW32__)) Cmd_CommandAdd( pAbc, "Basic", "scandir", CmdCommandScanDir, 0 ); Cmd_CommandAdd( pAbc, "Basic", "renamefiles", CmdCommandRenameFiles, 0 ); Cmd_CommandAdd( pAbc, "Basic", "ls", CmdCommandLs, 0 ); @@ -1217,7 +1217,7 @@ int CmdCommandUndo( Abc_Frame_t * pAbc, int argc, char **argv ) #endif -#if defined(WIN32) +#if (defined(WIN32) || defined(__MINGW32__)) #include #include @@ -1905,7 +1905,7 @@ int CmdCommandScrGen( Abc_Frame_t * pAbc, int argc, char **argv ) #else -Vec_Ptr_t * CmdReturnFileNames( char * pDirStr ) +Vec_Ptr_t * CmdReturnFileNames( char * pDirStr ) { Vec_Ptr_t * vRes = Vec_PtrAlloc( 100 ); struct dirent **namelist; @@ -1917,7 +1917,7 @@ Vec_Ptr_t * CmdReturnFileNames( char * pDirStr ) for (int i = 0; i < num_files; i++) { char * pExt = strstr(namelist[i]->d_name, "."); if ( !pExt || !strcmp(pExt, ".") || !strcmp(pExt, "..") || !strcmp(pExt, ".s") || !strcmp(pExt, ".txt") ) - continue; + continue; Vec_PtrPush( vRes, Abc_UtilStrsav(namelist[i]->d_name) ); free(namelist[i]); } @@ -1933,7 +1933,7 @@ int CmdCommandScrGenLinux( Abc_Frame_t * pAbc, int argc, char **argv ) char * pDirStr = (char *)"."; char * pComStr = (char *)"ps"; char * pWriteStr = NULL; - char * pWriteExt = NULL; + char * pWriteExt = NULL; char Line[2000], * pName; int nFileNameMax; int fBatch = 0; @@ -1988,7 +1988,7 @@ int CmdCommandScrGenLinux( Abc_Frame_t * pAbc, int argc, char **argv ) } pWriteExt = argv[globalUtilOptind]; globalUtilOptind++; - break; + break; case 'b': fBatch ^= 1; break; @@ -2018,8 +2018,8 @@ int CmdCommandScrGenLinux( Abc_Frame_t * pAbc, int argc, char **argv ) int fAndSpace = pComStr[0] == '&'; fprintf( pFile, "# Script file produced by ABC on %s\n", Extra_TimeStamp() ); fprintf( pFile, "# Command line was: scrgen -F %s -D %s -C \"%s\"%s%s%s%s\n", - pFileStr, pDirStr, pComStr, - pWriteStr?" -W ":"", pWriteStr?pWriteStr:"", + pFileStr, pDirStr, pComStr, + pWriteStr?" -W ":"", pWriteStr?pWriteStr:"", pWriteExt?" -E ":"", pWriteExt?pWriteExt:"" ); Vec_PtrForEachEntry( char *, vNames, pName, k ) { char * pExt = strstr(pName, "."); @@ -2057,7 +2057,7 @@ int CmdCommandScrGenLinux( Abc_Frame_t * pAbc, int argc, char **argv ) fprintf( pAbc->Err, "\t-C str : the sequence of commands to run [default = \"ps\"]\n" ); fprintf( pAbc->Err, "\t-W str : the directory to write the resulting files [default = no writing]\n" ); fprintf( pAbc->Err, "\t-E str : the output files extension (with \".\") [default = the same as input files]\n" ); - fprintf( pAbc->Err, "\t-b : toggles adding batch mode support [default = %s]\n", fBatch? "yes": "no" ); + fprintf( pAbc->Err, "\t-b : toggles adding batch mode support [default = %s]\n", fBatch? "yes": "no" ); fprintf( pAbc->Err, "\t-h : print the command usage\n\n"); fprintf( pAbc->Err, "\tExample : scrgen -F test1.s -R a/in -C \"ps; st; ps\" -W a/out -E .blif\n" ); return 1; @@ -2614,7 +2614,7 @@ int CmdCommandCapo( Abc_Frame_t * pAbc, int argc, char **argv ) Synopsis [] Description [] - + SideEffects [] SeeAlso [] @@ -2641,7 +2641,7 @@ int CmdCommandStarter( Abc_Frame_t * pAbc, int argc, char ** argv ) } nCores = atoi(argv[globalUtilOptind]); globalUtilOptind++; - if ( nCores < 0 ) + if ( nCores < 0 ) goto usage; break; case 'C': @@ -2699,7 +2699,7 @@ int CmdCommandStarter( Abc_Frame_t * pAbc, int argc, char ** argv ) Synopsis [] Description [] - + SideEffects [] SeeAlso [] @@ -2727,7 +2727,7 @@ int CmdCommandAutoTuner( Abc_Frame_t * pAbc, int argc, char ** argv ) } nCores = atoi(argv[globalUtilOptind]); globalUtilOptind++; - if ( nCores < 0 ) + if ( nCores < 0 ) goto usage; break; case 'C': @@ -2848,7 +2848,7 @@ int CmdCommandVersion( Abc_Frame_t * pAbc, int argc, char **argv ) Synopsis [] Description [] - + SideEffects [] SeeAlso [] @@ -2873,7 +2873,7 @@ int CmdCommandSGen( Abc_Frame_t * pAbc, int argc, char ** argv ) } nParts = atoi(argv[globalUtilOptind]); globalUtilOptind++; - if ( nParts < 0 ) + if ( nParts < 0 ) goto usage; break; case 'I': @@ -2899,7 +2899,7 @@ int CmdCommandSGen( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_Print( -2, "There is no current network.\n" ); return 1; } - if ( !Abc_NtkIsStrash(Abc_FrameReadNtk(pAbc)) ) + if ( !Abc_NtkIsStrash(Abc_FrameReadNtk(pAbc)) ) { Abc_Print( -2, "The current network is not an AIG.\n" ); return 1; diff --git a/src/base/cmd/cmd.h b/src/base/cmd/cmd.h index 4d412bac80..e2b56c283c 100644 --- a/src/base/cmd/cmd.h +++ b/src/base/cmd/cmd.h @@ -9,7 +9,7 @@ Synopsis [External declarations of the command package.] Author [Alan Mishchenko] - + Affiliation [UC Berkeley] Date [Ver. 1.0. Started - June 20, 2005.] @@ -60,7 +60,7 @@ extern char * Cmd_FlagReadByName( Abc_Frame_t * pAbc, char * flag ); extern void Cmd_FlagDeleteByName( Abc_Frame_t * pAbc, const char * key ); extern void Cmd_FlagUpdateValue( Abc_Frame_t * pAbc, const char * key, char * value ); /*=== cmdHist.c ========================================================*/ -extern void Cmd_HistoryAddCommand( Abc_Frame_t * pAbc, const char * command ); +extern void Cmd_HistoryAddCommand( Abc_Frame_t * pAbc, const char * command ); extern void Cmd_HistoryRead( Abc_Frame_t * p ); extern void Cmd_HistoryWrite( Abc_Frame_t * p, int Limit ); extern void Cmd_HistoryPrint( Abc_Frame_t * p, int Limit ); @@ -78,4 +78,3 @@ ABC_NAMESPACE_HEADER_END //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// - diff --git a/src/base/cmd/cmdAuto.c b/src/base/cmd/cmdAuto.c index 8151c2e534..ecbe094362 100644 --- a/src/base/cmd/cmdAuto.c +++ b/src/base/cmd/cmdAuto.c @@ -29,7 +29,7 @@ #ifdef ABC_USE_PTHREADS -#ifdef _WIN32 +#ifdef _MSC_VER #include "../lib/pthread.h" #else #include diff --git a/src/base/cmd/cmdInt.h b/src/base/cmd/cmdInt.h index dc6a46f659..dffdd27944 100644 --- a/src/base/cmd/cmdInt.h +++ b/src/base/cmd/cmdInt.h @@ -9,7 +9,7 @@ Synopsis [Internal declarations of the command package.] Author [Alan Mishchenko] - + Affiliation [UC Berkeley] Date [Ver. 1.0. Started - June 20, 2005.] @@ -26,6 +26,7 @@ /// INCLUDES /// //////////////////////////////////////////////////////////////////////// +#include "base/io/ioAbc.h" #include "base/main/mainInt.h" #include "cmd.h" @@ -42,8 +43,8 @@ ABC_NAMESPACE_HEADER_START struct MvCommand { - char * sName; // the command name - char * sGroup; // the group name + char * sName; // the command name + char * sGroup; // the group name Cmd_CommandFuncType pFunc; // the function to execute the command int fChange; // set to 1 to mark that the network is changed }; @@ -89,4 +90,3 @@ extern void CmdPrintTable( st__table * tTable, int fAliases ); ABC_NAMESPACE_HEADER_END #endif - diff --git a/src/base/cmd/cmdStarter.c b/src/base/cmd/cmdStarter.c index bfbe5533d2..ef34ac8bc2 100644 --- a/src/base/cmd/cmdStarter.c +++ b/src/base/cmd/cmdStarter.c @@ -27,7 +27,7 @@ #ifdef ABC_USE_PTHREADS -#ifdef _WIN32 +#ifdef _MSC_VER #include "../lib/pthread.h" #else #include diff --git a/src/base/exor/CMakeLists.txt b/src/base/exor/CMakeLists.txt new file mode 100644 index 0000000000..151d021db6 --- /dev/null +++ b/src/base/exor/CMakeLists.txt @@ -0,0 +1,10 @@ +abc_libabc_add_sources( + NAME base_exor + SOURCES + exor.c + exorCubes.c + exorBits.c + exorUtil.c + exorLink.c + exorList.c +) diff --git a/src/base/io/CMakeLists.txt b/src/base/io/CMakeLists.txt new file mode 100644 index 0000000000..9c4219178e --- /dev/null +++ b/src/base/io/CMakeLists.txt @@ -0,0 +1,37 @@ +abc_libabc_add_sources( + NAME base_io + SOURCES + ioReadBblif.c + ioWriteList.c + ioReadBaf.c + ioWriteBlifMv.c + ioReadDsd.c + ioWriteAiger.c + ioReadBlifMv.c + io.c + ioWriteBlif.c + ioWriteBench.c + ioReadEqn.c + ioReadBlif.c + ioWriteDot.c + ioWriteVerilog.c + ioWriteHMetis.c + ioWriteEqn.c + ioWriteBook.c + ioWriteEdgelist.c + ioReadVerilog.c + ioWriteSmv.c + ioJson.c + ioReadBench.c + ioUtil.c + ioWritePla.c + ioReadBlifAig.c + ioWriteBblif.c + ioReadPlaMo.c + ioReadAiger.c + ioWriteGml.c + ioWriteCnf.c + ioReadEdif.c + ioReadPla.c + ioWriteBaf.c +) diff --git a/src/base/io/ioAbc.h b/src/base/io/ioAbc.h index 77c7dc2920..b5ebcae476 100644 --- a/src/base/io/ioAbc.h +++ b/src/base/io/ioAbc.h @@ -9,7 +9,7 @@ Synopsis [External declarations.] Author [Alan Mishchenko] - + Affiliation [UC Berkeley] Date [Ver. 1.0. Started - June 20, 2005.] @@ -44,28 +44,28 @@ ABC_NAMESPACE_HEADER_START //////////////////////////////////////////////////////////////////////// // network functionality -typedef enum { - IO_FILE_NONE = 0, - IO_FILE_AIGER, - IO_FILE_BAF, - IO_FILE_BBLIF, - IO_FILE_BLIF, - IO_FILE_BLIFMV, - IO_FILE_BENCH, +typedef enum { + IO_FILE_NONE = 0, + IO_FILE_AIGER, + IO_FILE_BAF, + IO_FILE_BBLIF, + IO_FILE_BLIF, + IO_FILE_BLIFMV, + IO_FILE_BENCH, IO_FILE_BOOK, - IO_FILE_CNF, - IO_FILE_DOT, - IO_FILE_EDIF, - IO_FILE_EQN, + IO_FILE_CNF, + IO_FILE_DOT, + IO_FILE_EDIF, + IO_FILE_EQN, IO_FILE_GML, - IO_FILE_HMETIS, - IO_FILE_JSON, - IO_FILE_LIST, - IO_FILE_PLA, - IO_FILE_MOPLA, - IO_FILE_SMV, - IO_FILE_VERILOG, - IO_FILE_UNKNOWN + IO_FILE_HMETIS, + IO_FILE_JSON, + IO_FILE_LIST, + IO_FILE_PLA, + IO_FILE_MOPLA, + IO_FILE_SMV, + IO_FILE_VERILOG, + IO_FILE_UNKNOWN } Io_FileType_t; //////////////////////////////////////////////////////////////////////// @@ -111,7 +111,7 @@ extern void Io_WriteBlifLogic( Abc_Ntk_t * pNtk, char * pFileName, extern void Io_WriteBlif( Abc_Ntk_t * pNtk, char * pFileName, int fWriteLatches, int fBb2Wb, int fSeq ); extern void Io_WriteTimingInfo( FILE * pFile, Abc_Ntk_t * pNtk ); extern void Io_WriteBlifSpecial( Abc_Ntk_t * pNtk, char * FileName, char * pLutStruct, int fUseHie ); -/*=== abcWriteBlifMv.c ==========================================================*/ +/*=== abcWriteBlifMv.c ==========================================================*/ extern void Io_WriteBlifMv( Abc_Ntk_t * pNtk, char * FileName ); /*=== abcWriteBench.c =========================================================*/ extern int Io_WriteBench( Abc_Ntk_t * pNtk, const char * FileName ); @@ -162,7 +162,8 @@ extern FILE * Io_FileOpen( const char * FileName, const char * PathV /*=== ioJson.c ===========================================================*/ extern void Io_ReadJson( char * pFileName ); extern void Io_WriteJson( char * pFileName ); - +/*=== ioReadBlifMv.c =====================================================*/ +extern char * Io_MvLoadFileBz2( char * pFileName, long * pnFileSize ); ABC_NAMESPACE_HEADER_END @@ -174,4 +175,3 @@ ABC_NAMESPACE_HEADER_END //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// - diff --git a/src/base/io/ioInt.h b/src/base/io/ioInt.h index fed639a477..b902c587cb 100644 --- a/src/base/io/ioInt.h +++ b/src/base/io/ioInt.h @@ -9,7 +9,7 @@ Synopsis [External declarations.] Author [Alan Mishchenko] - + Affiliation [UC Berkeley] Date [Ver. 1.0. Started - June 20, 2005.] @@ -46,7 +46,6 @@ ABC_NAMESPACE_HEADER_START //////////////////////////////////////////////////////////////////////// - ABC_NAMESPACE_HEADER_END #endif @@ -54,4 +53,3 @@ ABC_NAMESPACE_HEADER_END //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// - diff --git a/src/base/io/ioReadBlifMv.c b/src/base/io/ioReadBlifMv.c index 77ae184151..f437a3d102 100644 --- a/src/base/io/ioReadBlifMv.c +++ b/src/base/io/ioReadBlifMv.c @@ -9,7 +9,7 @@ Synopsis [Procedures to read BLIF-MV file.] Author [Alan Mishchenko] - + Affiliation [UC Berkeley] Date [Ver. 1.0. Started - January 8, 2007.] @@ -41,7 +41,7 @@ Vec_Ptr_t *vGlobalLtlArray; struct Io_MvVar_t_ { - int nValues; // the number of values + int nValues; // the number of values char ** pNames; // the value names }; @@ -63,10 +63,10 @@ struct Io_MvMod_t_ Vec_Ptr_t * vLtlProperties; int fBlackBox; // indicates blackbox model // the resulting network - Abc_Ntk_t * pNtk; - Abc_Obj_t * pResetLatch; + Abc_Ntk_t * pNtk; + Abc_Obj_t * pResetLatch; // the parent manager - Io_MvMan_t * pMan; + Io_MvMan_t * pMan; }; struct Io_MvMan_t_ @@ -89,7 +89,7 @@ struct Io_MvMan_t_ Vec_Str_t * vFunc; // the local function // error reporting char sError[512]; // the error string generated during parsing - // statistics + // statistics int nTablesRead; // the number of processed tables int nTablesLeft; // the number of dangling tables }; @@ -115,7 +115,7 @@ static int Io_MvParseLineMv( Io_MvMod_t * p, char * pLine ); static int Io_MvParseLineNamesMv( Io_MvMod_t * p, char * pLine, int fReset ); static int Io_MvParseLineNamesBlif( Io_MvMod_t * p, char * pLine ); static int Io_MvParseLineShortBlif( Io_MvMod_t * p, char * pLine ); -static int Io_MvParseLineLtlProperty( Io_MvMod_t * p, char * pLine ); +static int Io_MvParseLineLtlProperty( Io_MvMod_t * p, char * pLine ); static int Io_MvParseLineGateBlif( Io_MvMod_t * p, Vec_Ptr_t * vTokens ); static Io_MvVar_t * Abc_NtkMvVarDup( Abc_Ntk_t * pNtk, Io_MvVar_t * pVar ); @@ -133,7 +133,7 @@ extern void Abc_NtkStartMvVars( Abc_Ntk_t * pNtk ); Synopsis [Reads the network from the BLIF or BLIF-MV file.] Description [] - + SideEffects [] SeeAlso [] @@ -144,7 +144,7 @@ Abc_Ntk_t * Io_ReadBlifMv( char * pFileName, int fBlifMv, int fCheck ) FILE * pFile; Io_MvMan_t * p; Abc_Ntk_t * pNtk, * pExdc; - Abc_Des_t * pDesign = NULL; + Abc_Des_t * pDesign = NULL; char * pDesignName; int RetValue, i; char * pLtlProp; @@ -260,7 +260,7 @@ Abc_Ntk_t * Io_ReadBlifMv( char * pFileName, int fBlifMv, int fCheck ) Synopsis [Allocates the BLIF parsing structure.] Description [] - + SideEffects [] SeeAlso [] @@ -284,7 +284,7 @@ static Io_MvMan_t * Io_MvAlloc() Synopsis [Frees the BLIF parsing structure.] Description [] - + SideEffects [] SeeAlso [] @@ -296,7 +296,7 @@ static void Io_MvFree( Io_MvMan_t * p ) int i; if ( p->pDesign ) Abc_DesFree( p->pDesign, NULL ); - if ( p->pBuffer ) + if ( p->pBuffer ) ABC_FREE( p->pBuffer ); if ( p->vLines ) Vec_PtrFree( p->vLines ); @@ -317,7 +317,7 @@ static void Io_MvFree( Io_MvMan_t * p ) Synopsis [Allocates the BLIF parsing structure for one model.] Description [] - + SideEffects [] SeeAlso [] @@ -348,7 +348,7 @@ static Io_MvMod_t * Io_MvModAlloc() Synopsis [Allocates the BLIF parsing structure for one model.] Description [] - + SideEffects [] SeeAlso [] @@ -380,7 +380,7 @@ static void Io_MvModFree( Io_MvMod_t * p ) Synopsis [Counts the number of given chars.] Description [] - + SideEffects [] SeeAlso [] @@ -401,7 +401,7 @@ static int Io_MvCountChars( char * pLine, char Char ) Synopsis [Returns the place where the arrow is hiding.] Description [] - + SideEffects [] SeeAlso [] @@ -425,7 +425,7 @@ static char * Io_MvFindArrow( char * pLine ) Synopsis [Collects the already split tokens.] Description [] - + SideEffects [] SeeAlso [] @@ -449,7 +449,7 @@ static void Io_MvCollectTokens( Vec_Ptr_t * vTokens, char * pInput, char * pOutp Synopsis [Splits the line into tokens.] Description [] - + SideEffects [] SeeAlso [] @@ -471,7 +471,7 @@ static void Io_MvSplitIntoTokens( Vec_Ptr_t * vTokens, char * pLine, char Stop ) Synopsis [Splits the line into tokens when .default may be present.] Description [] - + SideEffects [] SeeAlso [] @@ -493,7 +493,7 @@ static void Io_MvSplitIntoTokensMv( Vec_Ptr_t * vTokens, char * pLine ) Synopsis [Splits the line into tokens.] Description [] - + SideEffects [] SeeAlso [] @@ -515,7 +515,7 @@ static void Io_MvSplitIntoTokensAndClear( Vec_Ptr_t * vTokens, char * pLine, cha Synopsis [Returns the 1-based number of the line in which the token occurs.] Description [] - + SideEffects [] SeeAlso [] @@ -536,7 +536,7 @@ static int Io_MvGetLine( Io_MvMan_t * p, char * pToken ) Synopsis [Reads the file into a character buffer.] Description [] - + SideEffects [] SeeAlso [] @@ -604,7 +604,7 @@ char * Io_MvLoadFileBz2( char * pFileName, long * pnFileSize ) pContents = ABC_ALLOC( char, nFileSize + 10 ); rewind( pFile ); RetValue = fread( pContents, nFileSize, 1, pFile ); - } else { + } else { // Some other error. Abc_Print( -1, "Io_MvLoadFileBz2(): Unable to read the compressed BLIF.\n" ); return NULL; @@ -622,7 +622,7 @@ char * Io_MvLoadFileBz2( char * pFileName, long * pnFileSize ) Synopsis [Reads the file into a character buffer.] Description [] - + SideEffects [] SeeAlso [] @@ -635,7 +635,7 @@ static char * Io_MvLoadFileGz( char * pFileName, long * pnFileSize ) char * pContents; long amtRead, readBlock, nFileSize = READ_BLOCK_SIZE; pFile = gzopen( pFileName, "rb" ); // if pFileName doesn't end in ".gz" then this acts as a passthrough to fopen - pContents = ABC_ALLOC( char, nFileSize ); + pContents = ABC_ALLOC( char, nFileSize ); readBlock = 0; while ((amtRead = gzread(pFile, pContents + readBlock * READ_BLOCK_SIZE, READ_BLOCK_SIZE)) == READ_BLOCK_SIZE) { //Abc_Print( 1,"%d: read %d bytes\n", readBlock, amtRead); @@ -656,7 +656,7 @@ static char * Io_MvLoadFileGz( char * pFileName, long * pnFileSize ) Synopsis [Reads the file into a character buffer.] Description [] - + SideEffects [] SeeAlso [] @@ -678,8 +678,8 @@ static char * Io_MvLoadFile( char * pFileName ) printf( "Io_MvLoadFile(): The file is unavailable (absent or open).\n" ); return NULL; } - fseek( pFile, 0, SEEK_END ); - nFileSize = ftell( pFile ); + fseek( pFile, 0, SEEK_END ); + nFileSize = ftell( pFile ); if ( nFileSize == 0 ) { fclose( pFile ); @@ -707,7 +707,7 @@ static char * Io_MvLoadFile( char * pFileName ) - Estimates the number of objects. - Allocates room for the objects. - Allocates room for the hash table.] - + SideEffects [] SeeAlso [] @@ -786,7 +786,7 @@ static void Io_MvReadPreparse( Io_MvMan_t * p ) Vec_PtrPush( p->pLatest->vConstrs, pCur ); else if ( !strncmp(pCur, "blackbox", 8) ) p->pLatest->fBlackBox = 1; - else if ( !strncmp(pCur, "model", 5) ) + else if ( !strncmp(pCur, "model", 5) ) { p->pLatest = Io_MvModAlloc(); p->pLatest->pName = pCur; @@ -837,7 +837,7 @@ static void Io_MvReadPreparse( Io_MvMan_t * p ) Synopsis [Parses interfaces of the models.] Description [] - + SideEffects [] SeeAlso [] @@ -880,7 +880,7 @@ static int Io_MvReadInterfaces( Io_MvMan_t * p ) // report the results #ifdef IO_VERBOSE_OUTPUT if ( Vec_PtrSize(p->vModels) > 1 ) - printf( "Parsed %-32s: PI =%6d PO =%6d ND =%8d FF =%6d B =%6d\n", + printf( "Parsed %-32s: PI =%6d PO =%6d ND =%8d FF =%6d B =%6d\n", pMod->pNtk->pName, Abc_NtkPiNum(pMod->pNtk), Abc_NtkPoNum(pMod->pNtk), Vec_PtrSize(pMod->vNames), Vec_PtrSize(pMod->vLatches), Vec_PtrSize(pMod->vSubckts) ); #endif @@ -894,7 +894,7 @@ static int Io_MvReadInterfaces( Io_MvMan_t * p ) Synopsis [] Description [] - + SideEffects [] SeeAlso [] @@ -908,7 +908,7 @@ static Abc_Des_t * Io_MvParse( Io_MvMan_t * p ) int i, k; // iterate through the models Vec_PtrForEachEntry( Io_MvMod_t *, p->vModels, pMod, i ) - { + { #ifdef IO_VERBOSE_OUTPUT if ( Vec_PtrSize(p->vModels) > 1 ) printf( "Parsing model %s...\n", pMod->pNtk->pName ); @@ -926,12 +926,12 @@ static Abc_Des_t * Io_MvParse( Io_MvMan_t * p ) { if ( Vec_PtrSize(pMod->vLatches) != Vec_PtrSize(pMod->vResets) ) { - sprintf( p->sError, "Line %d: Model %s has different number of latches (%d) and reset nodes (%d).", + sprintf( p->sError, "Line %d: Model %s has different number of latches (%d) and reset nodes (%d).", Io_MvGetLine(p, pMod->pName), Abc_NtkName(pMod->pNtk), Vec_PtrSize(pMod->vLatches), Vec_PtrSize(pMod->vResets) ); return NULL; } // create binary latch with 1-data and 0-init - if ( p->fUseReset ) + if ( p->fUseReset ) pMod->pResetLatch = Io_ReadCreateResetLatch( pMod->pNtk, p->fBlifMv ); } // parse the flops @@ -984,7 +984,7 @@ static Abc_Des_t * Io_MvParse( Io_MvMan_t * p ) // read the one-hotness lines if ( Vec_PtrSize(pMod->vOnehots) > 0 ) { - Vec_Int_t * vLine; + Vec_Int_t * vLine; Abc_Obj_t * pObj; // set register numbers Abc_NtkForEachLatch( pMod->pNtk, pObj, k ) @@ -1007,8 +1007,8 @@ static Abc_Des_t * Io_MvParse( Io_MvMan_t * p ) Vec_PtrForEachEntry( Vec_Int_t *, pMod->pNtk->vOnehots, vLine, k ) printf( "%d ", Vec_IntSize(vLine) ); printf( "}\n" ); - printf( "The total number of 1-hot registers = %d. (%.2f %%)\n", - Vec_VecSizeSize( (Vec_Vec_t *)pMod->pNtk->vOnehots ), + printf( "The total number of 1-hot registers = %d. (%.2f %%)\n", + Vec_VecSizeSize( (Vec_Vec_t *)pMod->pNtk->vOnehots ), 100.0 * Vec_VecSizeSize( (Vec_Vec_t *)pMod->pNtk->vOnehots ) / Abc_NtkLatchNum(pMod->pNtk) ); { extern void Abc_GenOneHotIntervals( char * pFileName, int nPis, int nRegs, Vec_Ptr_t * vOnehots ); @@ -1038,7 +1038,7 @@ static Abc_Des_t * Io_MvParse( Io_MvMan_t * p ) Synopsis [Parses the model line.] Description [] - + SideEffects [] SeeAlso [] @@ -1066,7 +1066,7 @@ static int Io_MvParseLineModel( Io_MvMod_t * p, char * pLine ) p->pNtk = Abc_NtkAlloc( ABC_NTK_NETLIST, ABC_FUNC_BLACKBOX, 1 ); else if ( p->pMan->fBlifMv ) p->pNtk = Abc_NtkAlloc( ABC_NTK_NETLIST, ABC_FUNC_BLIFMV, 1 ); - else + else p->pNtk = Abc_NtkAlloc( ABC_NTK_NETLIST, ABC_FUNC_SOP, 1 ); // for ( pPivot = pToken = Vec_PtrEntry(vTokens, 1); *pToken; pToken++ ) // if ( *pToken == '/' || *pToken == '\\' ) @@ -1081,7 +1081,7 @@ static int Io_MvParseLineModel( Io_MvMod_t * p, char * pLine ) Synopsis [Parses the inputs line.] Description [] - + SideEffects [] SeeAlso [] @@ -1105,7 +1105,7 @@ static int Io_MvParseLineInputs( Io_MvMod_t * p, char * pLine ) Synopsis [Parses the outputs line.] Description [] - + SideEffects [] SeeAlso [] @@ -1129,7 +1129,7 @@ static int Io_MvParseLineOutputs( Io_MvMod_t * p, char * pLine ) Synopsis [Parses the outputs line.] Description [] - + SideEffects [] SeeAlso [] @@ -1153,7 +1153,7 @@ static int Io_MvParseLineConstrs( Io_MvMod_t * p, char * pLine ) Synopsis [Parses the LTL property line.] Description [] - + SideEffects [] SeeAlso [] @@ -1196,7 +1196,7 @@ static int Io_MvParseLineLtlProperty( Io_MvMod_t * p, char * pLine ) Synopsis [Parses the latches line.] Description [] - + SideEffects [] SeeAlso [] @@ -1226,8 +1226,8 @@ static int Io_MvParseLineLatch( Io_MvMod_t * p, char * pLine ) else { if ( Vec_PtrSize(vTokens) > 6 ) - printf( "Warning: Line %d has .latch directive with unrecognized entries (the total of %d entries).\n", - Io_MvGetLine(p->pMan, pToken), Vec_PtrSize(vTokens) ); + printf( "Warning: Line %d has .latch directive with unrecognized entries (the total of %d entries).\n", + Io_MvGetLine(p->pMan, pToken), Vec_PtrSize(vTokens) ); if ( Vec_PtrSize(vTokens) > 3 ) Init = atoi( (char *)Vec_PtrEntryLast(vTokens) ); else @@ -1264,7 +1264,7 @@ static int Io_MvParseLineLatch( Io_MvMod_t * p, char * pLine ) Synopsis [Parses the latches line.] Description [] - + SideEffects [] SeeAlso [] @@ -1339,7 +1339,7 @@ static int Io_MvParseLineFlop( Io_MvMod_t * p, char * pLine ) Synopsis [Parses the subckt line.] Description [] - + SideEffects [] SeeAlso [] @@ -1381,7 +1381,7 @@ static int Io_MvParseLineSubckt( Io_MvMod_t * p, char * pLine ) // check if the number of tokens is correct if ( nEquals != Abc_NtkPiNum(pModel) + Abc_NtkPoNum(pModel) ) { - sprintf( p->pMan->sError, "Line %d: The number of ports (%d) in .subckt differs from the sum of PIs and POs of the model (%d).", + sprintf( p->pMan->sError, "Line %d: The number of ports (%d) in .subckt differs from the sum of PIs and POs of the model (%d).", Io_MvGetLine(p->pMan, pToken), nEquals, Abc_NtkPiNum(pModel) + Abc_NtkPoNum(pModel) ); return 0; } @@ -1400,7 +1400,7 @@ static int Io_MvParseLineSubckt( Io_MvMod_t * p, char * pLine ) // go through formal inputs Last = 0; Abc_NtkForEachPi( pModel, pTerm, i ) - { + { // find this terminal among the actual inputs of the subcircuit pName2 = NULL; pName = Abc_ObjName(Abc_ObjFanout0(pTerm)); @@ -1414,7 +1414,7 @@ static int Io_MvParseLineSubckt( Io_MvMod_t * p, char * pLine ) if ( k == nEquals ) { - sprintf( p->pMan->sError, "Line %d: Cannot find PI \"%s\" of the model \"%s\" as a formal input of the subcircuit.", + sprintf( p->pMan->sError, "Line %d: Cannot find PI \"%s\" of the model \"%s\" as a formal input of the subcircuit.", Io_MvGetLine(p->pMan, pToken), pName, Abc_NtkName(pModel) ); return 0; } @@ -1431,7 +1431,7 @@ static int Io_MvParseLineSubckt( Io_MvMod_t * p, char * pLine ) continue; } assert( pName2 != NULL ); - + // create the BI with the actual name pNet = Abc_NtkFindOrCreateNet( p->pNtk, pName2 ); pTerm = Abc_NtkCreateBi( p->pNtk ); @@ -1455,7 +1455,7 @@ static int Io_MvParseLineSubckt( Io_MvMod_t * p, char * pLine ) /* if ( k == nEquals ) { - sprintf( p->pMan->sError, "Line %d: Cannot find PO \"%s\" of the modell \"%s\" as a formal output of the subcircuit.", + sprintf( p->pMan->sError, "Line %d: Cannot find PO \"%s\" of the modell \"%s\" as a formal output of the subcircuit.", Io_MvGetLine(p->pMan, pToken), pName, Abc_NtkName(pModel) ); return 0; } @@ -1475,7 +1475,7 @@ static int Io_MvParseLineSubckt( Io_MvMod_t * p, char * pLine ) Synopsis [Parses the subckt line.] Description [] - + SideEffects [] SeeAlso [] @@ -1505,7 +1505,7 @@ static Vec_Int_t * Io_MvParseLineOnehot( Io_MvMod_t * p, char * pLine ) pNet = Abc_NtkFindNet( p->pNtk, pToken ); if ( pNet == NULL ) { - sprintf( p->pMan->sError, "Line %d: Signal with name \"%s\" does not exist in the model \"%s\".", + sprintf( p->pMan->sError, "Line %d: Signal with name \"%s\" does not exist in the model \"%s\".", Io_MvGetLine(p->pMan, pToken), pToken, Abc_NtkName(p->pNtk) ); return NULL; } @@ -1513,7 +1513,7 @@ static Vec_Int_t * Io_MvParseLineOnehot( Io_MvMod_t * p, char * pLine ) pTerm = Abc_ObjFanin0( pNet ); if ( pTerm == NULL || Abc_ObjFanin0(pTerm) == NULL || !Abc_ObjIsLatch(Abc_ObjFanin0(pTerm)) ) { - sprintf( p->pMan->sError, "Line %d: Signal with name \"%s\" is not a register in the model \"%s\".", + sprintf( p->pMan->sError, "Line %d: Signal with name \"%s\" is not a register in the model \"%s\".", Io_MvGetLine(p->pMan, pToken), pToken, Abc_NtkName(p->pNtk) ); return NULL; } @@ -1533,7 +1533,7 @@ static Vec_Int_t * Io_MvParseLineOnehot( Io_MvMod_t * p, char * pLine ) Synopsis [Parses the mv line.] Description [] - + SideEffects [] SeeAlso [] @@ -1561,7 +1561,7 @@ static int Io_MvParseLineMv( Io_MvMod_t * p, char * pLine ) nValues = atoi( (char *)Vec_PtrEntry(vTokens,nCommas+2) ); if ( nValues < 2 || nValues > IO_BLIFMV_MAXVALUES ) { - sprintf( p->pMan->sError, "Line %d: The number of values (%d) is incorrect (should be >= 2 and <= %d).", + sprintf( p->pMan->sError, "Line %d: The number of values (%d) is incorrect (should be >= 2 and <= %d).", Io_MvGetLine(p->pMan, pName), nValues, IO_BLIFMV_MAXVALUES ); return 0; } @@ -1570,7 +1570,7 @@ static int Io_MvParseLineMv( Io_MvMod_t * p, char * pLine ) return 1; if ( Vec_PtrSize(vTokens) > nCommas + 3 && Vec_PtrSize(vTokens) - (nCommas + 3) != nValues ) { - sprintf( p->pMan->sError, "Line %d: Wrong number (%d) of symbolic value names (should be %d).", + sprintf( p->pMan->sError, "Line %d: Wrong number (%d) of symbolic value names (should be %d).", Io_MvGetLine(p->pMan, pName), Vec_PtrSize(vTokens) - (nCommas + 3), nValues ); return 0; } @@ -1606,7 +1606,7 @@ static int Io_MvParseLineMv( Io_MvMod_t * p, char * pLine ) if ( !strcmp(pVar->pNames[i], pVar->pNames[k]) ) { pName = (char *)Vec_PtrEntry(vTokens,0); - sprintf( p->pMan->sError, "Line %d: Symbolic value name \"%s\" is repeated in .mv line.", + sprintf( p->pMan->sError, "Line %d: Symbolic value name \"%s\" is repeated in .mv line.", Io_MvGetLine(p->pMan, pName), pVar->pNames[i] ); return 0; } @@ -1619,7 +1619,7 @@ static int Io_MvParseLineMv( Io_MvMod_t * p, char * pLine ) Synopsis [Writes the values into the BLIF-MV representation for the node.] Description [] - + SideEffects [] SeeAlso [] @@ -1649,7 +1649,7 @@ static int Io_MvWriteValues( Abc_Obj_t * pNode, Vec_Str_t * vFunc ) Synopsis [Translated one literal.] Description [] - + SideEffects [] SeeAlso [] @@ -1671,7 +1671,7 @@ static int Io_MvParseLiteralMv( Io_MvMod_t * p, Abc_Obj_t * pNode, char * pToken break; if ( i == Abc_ObjFaninNum(pNode) ) { - sprintf( p->pMan->sError, "Line %d: Node name in the table \"%s\" cannot be found on .names line.", + sprintf( p->pMan->sError, "Line %d: Node name in the table \"%s\" cannot be found on .names line.", Io_MvGetLine(p->pMan, pToken), pToken + 1 ); return 0; } @@ -1711,7 +1711,7 @@ static int Io_MvParseLiteralMv( Io_MvMod_t * p, Abc_Obj_t * pNode, char * pToken if ( i == pVar->nValues ) { *pNext = 0; - sprintf( p->pMan->sError, "Line %d: Cannot find value name \"%s\" among the value names of variable \"%s\".", + sprintf( p->pMan->sError, "Line %d: Cannot find value name \"%s\" among the value names of variable \"%s\".", Io_MvGetLine(p->pMan, pToken), pCur, Abc_ObjName(pNet) ); return 0; } @@ -1730,7 +1730,7 @@ static int Io_MvParseLiteralMv( Io_MvMod_t * p, Abc_Obj_t * pNode, char * pToken Synopsis [Constructs the MV-SOP cover from the file parsing info.] Description [] - + SideEffects [] SeeAlso [] @@ -1774,7 +1774,7 @@ static char * Io_MvParseTableMv( Io_MvMod_t * p, Abc_Obj_t * pNode, Vec_Ptr_t * return NULL; // update the counter iStart += nInputs + nOutputs; - } + } Vec_StrPush( vFunc, '\0' ); return Vec_StrArray( vFunc ); } @@ -1784,7 +1784,7 @@ static char * Io_MvParseTableMv( Io_MvMod_t * p, Abc_Obj_t * pNode, Vec_Ptr_t * Synopsis [Adds reset circuitry corresponding to latch with pName.] Description [Returns the reset node's net.] - + SideEffects [] SeeAlso [] @@ -1838,7 +1838,7 @@ static Abc_Obj_t * Io_MvParseAddResetCircuit( Io_MvMod_t * p, char * pName ) Synopsis [Parses the nodes line.] Description [] - + SideEffects [] SeeAlso [] @@ -1896,7 +1896,7 @@ static int Io_MvParseLineNamesMvOne( Io_MvMod_t * p, Vec_Ptr_t * vTokens, Vec_Pt Synopsis [Parses the nodes line.] Description [] - + SideEffects [] SeeAlso [] @@ -1912,7 +1912,7 @@ static int Io_MvParseLineNamesMv( Io_MvMod_t * p, char * pLine, int fReset ) assert( p->pMan->fBlifMv ); // get the arrow if it is present pArrow = Io_MvFindArrow( pLine ); - if ( !p->pMan->fBlifMv && pArrow ) + if ( !p->pMan->fBlifMv && pArrow ) { sprintf( p->pMan->sError, "Line %d: Multi-output node symbol (->) in binary BLIF file.", Io_MvGetLine(p->pMan, pLine) ); return 0; @@ -1991,7 +1991,7 @@ static int Io_MvParseLineNamesMv( Io_MvMod_t * p, char * pLine, int fReset ) Synopsis [Constructs the SOP cover from the file parsing info.] Description [] - + SideEffects [] SeeAlso [] @@ -2050,7 +2050,7 @@ static char * Io_MvParseTableBlif( Io_MvMod_t * p, char * pTable, int nFanins ) sprintf( p->pMan->sError, "Line %d: Output value \"%s\" differs from the value in the first line of the table (%d).", Io_MvGetLine(p->pMan, pProduct), pOutput, Polarity ); return NULL; } - // parse one product + // parse one product Vec_StrPrintStr( vFunc, pProduct ); Vec_StrPush( vFunc, ' ' ); Vec_StrPush( vFunc, pOutput[0] ); @@ -2065,7 +2065,7 @@ static char * Io_MvParseTableBlif( Io_MvMod_t * p, char * pTable, int nFanins ) Synopsis [Parses the nodes line.] Description [] - + SideEffects [] SeeAlso [] @@ -2113,7 +2113,7 @@ ABC_NAMESPACE_IMPL_START Synopsis [Parses the nodes line.] Description [] - + SideEffects [] SeeAlso [] @@ -2145,7 +2145,7 @@ static int Io_MvParseLineShortBlif( Io_MvMod_t * p, char * pLine ) // parse the table of this node if ( p->pNtk->ntkFunc == ABC_FUNC_MAP ) { - Mio_Library_t * pGenlib; + Mio_Library_t * pGenlib; Mio_Gate_t * pGate; // check that the library is available pGenlib = (Mio_Library_t *)Abc_FrameReadLibGen(); @@ -2173,7 +2173,7 @@ static int Io_MvParseLineShortBlif( Io_MvMod_t * p, char * pLine ) Synopsis [Duplicate the MV variable.] Description [] - + SideEffects [] SeeAlso [] @@ -2207,7 +2207,7 @@ Io_MvVar_t * Abc_NtkMvVarDup( Abc_Ntk_t * pNtk, Io_MvVar_t * pVar ) Synopsis [] Description [] - + SideEffects [] SeeAlso [] @@ -2228,7 +2228,7 @@ static char * Io_ReadBlifCleanName( char * pName ) Synopsis [] Description [] - + SideEffects [] SeeAlso [] @@ -2237,7 +2237,7 @@ static char * Io_ReadBlifCleanName( char * pName ) static int Io_MvParseLineGateBlif( Io_MvMod_t * p, Vec_Ptr_t * vTokens ) { extern int Io_ReadBlifReorderFormalNames( Vec_Ptr_t * vTokens, Mio_Gate_t * pGate, Mio_Gate_t * pTwin ); - Mio_Library_t * pGenlib; + Mio_Library_t * pGenlib; Mio_Gate_t * pGate; Abc_Obj_t * pNode; char ** ppNames, * pName; @@ -2343,7 +2343,7 @@ static int Io_MvParseLineGateBlif( Io_MvMod_t * p, Vec_Ptr_t * vTokens ) Synopsis [Box mapping procedures.] Description [] - + SideEffects [] SeeAlso [] @@ -2374,4 +2374,3 @@ static inline int Abc_MapBox2Prev( Vec_Ptr_t * vDrivers, Vec_Int_t * vMapIn, Vec ABC_NAMESPACE_IMPL_END - diff --git a/src/base/main/CMakeLists.txt b/src/base/main/CMakeLists.txt new file mode 100644 index 0000000000..77c52564f1 --- /dev/null +++ b/src/base/main/CMakeLists.txt @@ -0,0 +1,26 @@ +abc_libabc_add_sources( + NAME base_main_mod + SOURCES + mainFrame.c + mainInit.c + mainLib.c + mainReal.c + libSupport.c + mainUtils.c +) + +if(BUILD_MAIN_EXE) + abc_add_executable( + NAME abc + SOURCES + main.c + ) + + install(TARGETS abc + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + ) +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + install(FILES $ DESTINATION bin OPTIONAL) +endif() diff --git a/src/base/main/abcapis.h b/src/base/main/abcapis.h index 1601cb301d..3b759dee6c 100644 --- a/src/base/main/abcapis.h +++ b/src/base/main/abcapis.h @@ -9,7 +9,7 @@ Synopsis [External declarations.] Author [Alan Mishchenko] - + Affiliation [UC Berkeley] Date [Ver. 1.0. Started - September 29, 2012.] @@ -17,7 +17,7 @@ Revision [$Id: abcapis.h,v 1.00 2012/09/29 00:00:00 alanmi Exp $] ***********************************************************************/ - + #ifndef MINI_AIG__abc_apis_h #define MINI_AIG__abc_apis_h @@ -51,10 +51,15 @@ typedef struct Abc_Frame_t_ Abc_Frame_t; #endif #else /* defined(WIN32) */ #define ABC_DLLIMPORT +#define ABC_DLLEXPORT __attribute__((visibility("default"))) #endif /* defined(WIN32) */ #ifndef ABC_DLL -#define ABC_DLL ABC_DLLIMPORT + #ifdef ABC_NAMESPACE + #define ABC_DLL ABC_DLLEXPORT + #else + #define ABC_DLL ABC_DLLIMPORT + #endif #endif //////////////////////////////////////////////////////////////////////// @@ -62,58 +67,58 @@ typedef struct Abc_Frame_t_ Abc_Frame_t; //////////////////////////////////////////////////////////////////////// // procedures to start and stop the ABC framework -extern ABC_DLL void Abc_Start(); -extern ABC_DLL void Abc_Stop(); +ABC_DLL extern void Abc_Start(); +ABC_DLL extern void Abc_Stop(); // procedures to get the ABC framework (pAbc) and execute commands in it -extern ABC_DLL Abc_Frame_t * Abc_FrameGetGlobalFrame(); -extern ABC_DLL int Cmd_CommandExecute( Abc_Frame_t * pAbc, const char * pCommandLine ); +ABC_DLL extern Abc_Frame_t * Abc_FrameGetGlobalFrame(); +ABC_DLL extern int Cmd_CommandExecute( Abc_Frame_t * pAbc, const char * pCommandLine ); // procedures to input/output 'mini AIG' -extern ABC_DLL void Abc_NtkInputMiniAig( Abc_Frame_t * pAbc, void * pMiniAig ); -extern ABC_DLL void * Abc_NtkOutputMiniAig( Abc_Frame_t * pAbc ); -extern ABC_DLL void Abc_FrameGiaInputMiniAig( Abc_Frame_t * pAbc, void * p ); -extern ABC_DLL void * Abc_FrameGiaOutputMiniAig( Abc_Frame_t * pAbc ); -extern ABC_DLL void Abc_NtkSetFlopNum( Abc_Frame_t * pAbc, int nFlops ); +ABC_DLL extern void Abc_NtkInputMiniAig( Abc_Frame_t * pAbc, void * pMiniAig ); +ABC_DLL extern void * Abc_NtkOutputMiniAig( Abc_Frame_t * pAbc ); +ABC_DLL extern void Abc_FrameGiaInputMiniAig( Abc_Frame_t * pAbc, void * p ); +ABC_DLL extern void * Abc_FrameGiaOutputMiniAig( Abc_Frame_t * pAbc ); +ABC_DLL extern void Abc_NtkSetFlopNum( Abc_Frame_t * pAbc, int nFlops ); // procedures to input/output 'mini LUT' -extern ABC_DLL void Abc_FrameGiaInputMiniLut( Abc_Frame_t * pAbc, void * pMiniLut ); -extern ABC_DLL void Abc_FrameGiaInputMiniLut2( Abc_Frame_t * pAbc, void * pMiniLut ); -extern ABC_DLL void * Abc_FrameGiaOutputMiniLut( Abc_Frame_t * pAbc ); -extern ABC_DLL char * Abc_FrameGiaOutputMiniLutAttr( Abc_Frame_t * pAbc, void * pMiniLut ); -extern ABC_DLL int * Abc_FrameGiaOutputMiniLutObj( Abc_Frame_t * pAbc ); -extern ABC_DLL void Abc_FrameSetObjDelays( Abc_Frame_t * pAbc, int * pDelays, int nDelays ); -extern ABC_DLL int * Abc_FrameReadMiniLutSwitching( Abc_Frame_t * pAbc ); -extern ABC_DLL int * Abc_FrameReadMiniLutSwitching2( Abc_Frame_t * pAbc, int nRandPiFactor ); -extern ABC_DLL int * Abc_FrameReadMiniLutSwitchingPo( Abc_Frame_t * pAbc ); +ABC_DLL extern void Abc_FrameGiaInputMiniLut( Abc_Frame_t * pAbc, void * pMiniLut ); +ABC_DLL extern void Abc_FrameGiaInputMiniLut2( Abc_Frame_t * pAbc, void * pMiniLut ); +ABC_DLL extern void * Abc_FrameGiaOutputMiniLut( Abc_Frame_t * pAbc ); +ABC_DLL extern char * Abc_FrameGiaOutputMiniLutAttr( Abc_Frame_t * pAbc, void * pMiniLut ); +ABC_DLL extern int * Abc_FrameGiaOutputMiniLutObj( Abc_Frame_t * pAbc ); +ABC_DLL extern void Abc_FrameSetObjDelays( Abc_Frame_t * pAbc, int * pDelays, int nDelays ); +ABC_DLL extern int * Abc_FrameReadMiniLutSwitching( Abc_Frame_t * pAbc ); +ABC_DLL extern int * Abc_FrameReadMiniLutSwitching2( Abc_Frame_t * pAbc, int nRandPiFactor ); +ABC_DLL extern int * Abc_FrameReadMiniLutSwitchingPo( Abc_Frame_t * pAbc ); // procedures to input/output NDR data-structure -extern ABC_DLL void Abc_FrameInputNdr( Abc_Frame_t * pAbc, void * pData ); -extern ABC_DLL void * Abc_FrameOutputNdr( Abc_Frame_t * pAbc ); -extern ABC_DLL int * Abc_FrameOutputNdrArray( Abc_Frame_t * pAbc ); +ABC_DLL extern void Abc_FrameInputNdr( Abc_Frame_t * pAbc, void * pData ); +ABC_DLL extern void * Abc_FrameOutputNdr( Abc_Frame_t * pAbc ); +ABC_DLL extern int * Abc_FrameOutputNdrArray( Abc_Frame_t * pAbc ); // procedures to set CI/CO arrival/required times -extern ABC_DLL void Abc_NtkSetCiArrivalTime( Abc_Frame_t * pAbc, int iCi, float Rise, float Fall ); -extern ABC_DLL void Abc_NtkSetCoRequiredTime( Abc_Frame_t * pAbc, int iCo, float Rise, float Fall ); +ABC_DLL extern void Abc_NtkSetCiArrivalTime( Abc_Frame_t * pAbc, int iCi, float Rise, float Fall ); +ABC_DLL extern void Abc_NtkSetCoRequiredTime( Abc_Frame_t * pAbc, int iCo, float Rise, float Fall ); // procedure to set AND-gate delay to tech-independent synthesis and mapping -extern ABC_DLL void Abc_NtkSetAndGateDelay( Abc_Frame_t * pAbc, float Delay ); +ABC_DLL extern void Abc_NtkSetAndGateDelay( Abc_Frame_t * pAbc, float Delay ); // procedures to return the mapped network -extern ABC_DLL int * Abc_NtkOutputMiniMapping( Abc_Frame_t * pAbc ); -extern ABC_DLL void Abc_NtkPrintMiniMapping( int * pArray ); -extern ABC_DLL int * Abc_FrameReadArrayMapping( Abc_Frame_t * pAbc ); -extern ABC_DLL int * Abc_FrameReadBoxes( Abc_Frame_t * pAbc ); +ABC_DLL extern int * Abc_NtkOutputMiniMapping( Abc_Frame_t * pAbc ); +ABC_DLL extern void Abc_NtkPrintMiniMapping( int * pArray ); +ABC_DLL extern int * Abc_FrameReadArrayMapping( Abc_Frame_t * pAbc ); +ABC_DLL extern int * Abc_FrameReadBoxes( Abc_Frame_t * pAbc ); // procedures to access verifization status and a counter-example -extern ABC_DLL int Abc_FrameReadProbStatus( Abc_Frame_t * pAbc ); -extern ABC_DLL void * Abc_FrameReadCex( Abc_Frame_t * pAbc ); +ABC_DLL extern int Abc_FrameReadProbStatus( Abc_Frame_t * pAbc ); +ABC_DLL extern void * Abc_FrameReadCex( Abc_Frame_t * pAbc ); // procedure to set retiming data -extern ABC_DLL void Abc_FrameSetRetimingData( Abc_Frame_t * pAbc, int * pRst, int * pSet, int * pEna, int nRegs ); +ABC_DLL extern void Abc_FrameSetRetimingData( Abc_Frame_t * pAbc, int * pRst, int * pSet, int * pEna, int nRegs ); // procedure to return sequential equivalences -extern ABC_DLL int * Abc_FrameReadMiniAigEquivClasses( Abc_Frame_t * pAbc ); +ABC_DLL extern int * Abc_FrameReadMiniAigEquivClasses( Abc_Frame_t * pAbc ); ABC_NAMESPACE_HEADER_END diff --git a/src/base/main/main.c b/src/base/main/main.c index 7832bada72..6cec4aba3e 100644 --- a/src/base/main/main.c +++ b/src/base/main/main.c @@ -2,7 +2,7 @@ ABC_NAMESPACE_IMPL_START -int Abc_RealMain(int argc, char *argv[]); +extern int Abc_RealMain(int argc, char *argv[]); ABC_NAMESPACE_IMPL_END diff --git a/src/base/main/main.h b/src/base/main/main.h index f3457e27f6..f95a475fcf 100644 --- a/src/base/main/main.h +++ b/src/base/main/main.h @@ -9,7 +9,7 @@ Synopsis [External declarations of the main package.] Author [Alan Mishchenko] - + Affiliation [UC Berkeley] Date [Ver. 1.0. Started - June 20, 2005.] @@ -67,106 +67,106 @@ ABC_NAMESPACE_HEADER_START //////////////////////////////////////////////////////////////////////// /*=== main.c ===========================================================*/ -extern ABC_DLL void Abc_Start(); -extern ABC_DLL void Abc_Stop(); +ABC_DLL extern void Abc_Start(); +ABC_DLL extern void Abc_Stop(); /*=== mainFrame.c ===========================================================*/ -extern ABC_DLL Abc_Ntk_t * Abc_FrameReadNtk( Abc_Frame_t * p ); -extern ABC_DLL Gia_Man_t * Abc_FrameReadGia( Abc_Frame_t * p ); -extern ABC_DLL FILE * Abc_FrameReadOut( Abc_Frame_t * p ); -extern ABC_DLL FILE * Abc_FrameReadErr( Abc_Frame_t * p ); -extern ABC_DLL int Abc_FrameReadMode( Abc_Frame_t * p ); -extern ABC_DLL int Abc_FrameSetMode( Abc_Frame_t * p, int fNameMode ); -extern ABC_DLL void Abc_FrameRestart( Abc_Frame_t * p ); -extern ABC_DLL int Abc_FrameShowProgress( Abc_Frame_t * p ); -extern ABC_DLL void Abc_FrameClearVerifStatus( Abc_Frame_t * p ); -extern ABC_DLL void Abc_FrameUpdateGia( Abc_Frame_t * p, Gia_Man_t * pNew ); -extern ABC_DLL Gia_Man_t * Abc_FrameGetGia( Abc_Frame_t * p ); - -extern ABC_DLL void Abc_FrameSetCurrentNetwork( Abc_Frame_t * p, Abc_Ntk_t * pNet ); -extern ABC_DLL void Abc_FrameSwapCurrentAndBackup( Abc_Frame_t * p ); -extern ABC_DLL void Abc_FrameReplaceCurrentNetwork( Abc_Frame_t * p, Abc_Ntk_t * pNet ); -extern ABC_DLL void Abc_FrameUnmapAllNetworks( Abc_Frame_t * p ); -extern ABC_DLL void Abc_FrameDeleteAllNetworks( Abc_Frame_t * p ); - -extern ABC_DLL void Abc_FrameSetGlobalFrame( Abc_Frame_t * p ); -extern ABC_DLL Abc_Frame_t * Abc_FrameGetGlobalFrame(); -extern ABC_DLL Abc_Frame_t * Abc_FrameReadGlobalFrame(); - -extern ABC_DLL Vec_Ptr_t * Abc_FrameReadStore(); -extern ABC_DLL int Abc_FrameReadStoreSize(); -extern ABC_DLL void * Abc_FrameReadLibLut(); -extern ABC_DLL void * Abc_FrameReadLibBox(); -extern ABC_DLL void * Abc_FrameReadLibGen(); -extern ABC_DLL void * Abc_FrameReadLibGen2(); -extern ABC_DLL void * Abc_FrameReadLibSuper(); -extern ABC_DLL void * Abc_FrameReadLibScl(); -extern ABC_DLL void * Abc_FrameReadManDd(); -extern ABC_DLL void * Abc_FrameReadManDec(); -extern ABC_DLL void * Abc_FrameReadManDsd(); -extern ABC_DLL void * Abc_FrameReadManDsd2(); -extern ABC_DLL Vec_Ptr_t * Abc_FrameReadSignalNames(); -extern ABC_DLL char * Abc_FrameReadSpecName(); - -extern ABC_DLL char * Abc_FrameReadFlag( char * pFlag ); -extern ABC_DLL int Abc_FrameIsFlagEnabled( char * pFlag ); -extern ABC_DLL int Abc_FrameIsBatchMode(); -extern ABC_DLL void Abc_FrameSetBatchMode( int Mode ); -extern ABC_DLL int Abc_FrameIsBridgeMode(); -extern ABC_DLL void Abc_FrameSetBridgeMode(); - -extern ABC_DLL int Abc_FrameReadBmcFrames( Abc_Frame_t * p ); -extern ABC_DLL int Abc_FrameReadProbStatus( Abc_Frame_t * p ); -extern ABC_DLL void * Abc_FrameReadCex( Abc_Frame_t * p ); -extern ABC_DLL Vec_Ptr_t * Abc_FrameReadCexVec( Abc_Frame_t * p ); -extern ABC_DLL Vec_Int_t * Abc_FrameReadStatusVec( Abc_Frame_t * p ); -extern ABC_DLL Vec_Ptr_t * Abc_FrameReadPoEquivs( Abc_Frame_t * p ); -extern ABC_DLL Vec_Int_t * Abc_FrameReadPoStatuses( Abc_Frame_t * p ); -extern ABC_DLL Vec_Int_t * Abc_FrameReadObjIds( Abc_Frame_t * p ); -extern ABC_DLL Abc_Nam_t * Abc_FrameReadJsonStrs( Abc_Frame_t * p ); -extern ABC_DLL Vec_Wec_t * Abc_FrameReadJsonObjs( Abc_Frame_t * p ); - -extern ABC_DLL int Abc_FrameReadCexPiNum( Abc_Frame_t * p ); -extern ABC_DLL int Abc_FrameReadCexRegNum( Abc_Frame_t * p ); -extern ABC_DLL int Abc_FrameReadCexPo( Abc_Frame_t * p ); -extern ABC_DLL int Abc_FrameReadCexFrame( Abc_Frame_t * p ); - -extern ABC_DLL void Abc_FrameSetNtkStore( Abc_Ntk_t * pNtk ); -extern ABC_DLL void Abc_FrameSetNtkStoreSize( int nStored ); -extern ABC_DLL void Abc_FrameSetLibLut( void * pLib ); -extern ABC_DLL void Abc_FrameSetLibBox( void * pLib ); -extern ABC_DLL void Abc_FrameSetLibGen( void * pLib ); -extern ABC_DLL void Abc_FrameSetLibGen2( void * pLib ); -extern ABC_DLL void Abc_FrameSetLibSuper( void * pLib ); -extern ABC_DLL void Abc_FrameSetLibVer( void * pLib ); -extern ABC_DLL void Abc_FrameSetFlag( char * pFlag, char * pValue ); -extern ABC_DLL void Abc_FrameSetCex( Abc_Cex_t * pCex ); -extern ABC_DLL void Abc_FrameSetNFrames( int nFrames ); -extern ABC_DLL void Abc_FrameSetStatus( int Status ); -extern ABC_DLL void Abc_FrameSetManDsd( void * pMan ); -extern ABC_DLL void Abc_FrameSetManDsd2( void * pMan ); -extern ABC_DLL void Abc_FrameSetInv( Vec_Int_t * vInv ); -extern ABC_DLL void Abc_FrameSetCnf( Vec_Int_t * vInv ); -extern ABC_DLL void Abc_FrameSetStr( Vec_Str_t * vInv ); -extern ABC_DLL void Abc_FrameSetJsonStrs( Abc_Nam_t * pStrs ); -extern ABC_DLL void Abc_FrameSetJsonObjs( Vec_Wec_t * vObjs ); -extern ABC_DLL void Abc_FrameSetSignalNames( Vec_Ptr_t * vNames ); -extern ABC_DLL void Abc_FrameSetSpecName( char * pFileName ); - -extern ABC_DLL int Abc_FrameCheckPoConst( Abc_Frame_t * p, int iPoNum ); - -extern ABC_DLL void Abc_FrameReplaceCex( Abc_Frame_t * pAbc, Abc_Cex_t ** ppCex ); -extern ABC_DLL void Abc_FrameReplaceCexVec( Abc_Frame_t * pAbc, Vec_Ptr_t ** pvCexVec ); -extern ABC_DLL void Abc_FrameReplacePoEquivs( Abc_Frame_t * pAbc, Vec_Ptr_t ** pvPoEquivs ); -extern ABC_DLL void Abc_FrameReplacePoStatuses( Abc_Frame_t * pAbc, Vec_Int_t ** pvStatuses ); - -extern ABC_DLL char * Abc_FrameReadDrivingCell(); -extern ABC_DLL float Abc_FrameReadMaxLoad(); -extern ABC_DLL void Abc_FrameSetDrivingCell( char * pName ); -extern ABC_DLL void Abc_FrameSetMaxLoad( float Load ); - -extern ABC_DLL void Abc_FrameSetArrayMapping( int * p ); -extern ABC_DLL void Abc_FrameSetBoxes( int * p ); +ABC_DLL extern Abc_Ntk_t * Abc_FrameReadNtk( Abc_Frame_t * p ); +ABC_DLL extern Gia_Man_t * Abc_FrameReadGia( Abc_Frame_t * p ); +ABC_DLL extern FILE * Abc_FrameReadOut( Abc_Frame_t * p ); +ABC_DLL extern FILE * Abc_FrameReadErr( Abc_Frame_t * p ); +ABC_DLL extern int Abc_FrameReadMode( Abc_Frame_t * p ); +ABC_DLL extern int Abc_FrameSetMode( Abc_Frame_t * p, int fNameMode ); +ABC_DLL extern void Abc_FrameRestart( Abc_Frame_t * p ); +ABC_DLL extern int Abc_FrameShowProgress( Abc_Frame_t * p ); +ABC_DLL extern void Abc_FrameClearVerifStatus( Abc_Frame_t * p ); +ABC_DLL extern void Abc_FrameUpdateGia( Abc_Frame_t * p, Gia_Man_t * pNew ); +ABC_DLL extern Gia_Man_t * Abc_FrameGetGia( Abc_Frame_t * p ); + +ABC_DLL extern void Abc_FrameSetCurrentNetwork( Abc_Frame_t * p, Abc_Ntk_t * pNet ); +ABC_DLL extern void Abc_FrameSwapCurrentAndBackup( Abc_Frame_t * p ); +ABC_DLL extern void Abc_FrameReplaceCurrentNetwork( Abc_Frame_t * p, Abc_Ntk_t * pNet ); +ABC_DLL extern void Abc_FrameUnmapAllNetworks( Abc_Frame_t * p ); +ABC_DLL extern void Abc_FrameDeleteAllNetworks( Abc_Frame_t * p ); + +ABC_DLL extern void Abc_FrameSetGlobalFrame( Abc_Frame_t * p ); +ABC_DLL extern Abc_Frame_t * Abc_FrameGetGlobalFrame(); +ABC_DLL extern Abc_Frame_t * Abc_FrameReadGlobalFrame(); + +ABC_DLL extern Vec_Ptr_t * Abc_FrameReadStore(); +ABC_DLL extern int Abc_FrameReadStoreSize(); +ABC_DLL extern void * Abc_FrameReadLibLut(); +ABC_DLL extern void * Abc_FrameReadLibBox(); +ABC_DLL extern void * Abc_FrameReadLibGen(); +ABC_DLL extern void * Abc_FrameReadLibGen2(); +ABC_DLL extern void * Abc_FrameReadLibSuper(); +ABC_DLL extern void * Abc_FrameReadLibScl(); +ABC_DLL extern void * Abc_FrameReadManDd(); +ABC_DLL extern void * Abc_FrameReadManDec(); +ABC_DLL extern void * Abc_FrameReadManDsd(); +ABC_DLL extern void * Abc_FrameReadManDsd2(); +ABC_DLL extern Vec_Ptr_t * Abc_FrameReadSignalNames(); +ABC_DLL extern char * Abc_FrameReadSpecName(); + +ABC_DLL extern char * Abc_FrameReadFlag( char * pFlag ); +ABC_DLL extern int Abc_FrameIsFlagEnabled( char * pFlag ); +ABC_DLL extern int Abc_FrameIsBatchMode(); +ABC_DLL extern void Abc_FrameSetBatchMode( int Mode ); +ABC_DLL extern int Abc_FrameIsBridgeMode(); +ABC_DLL extern void Abc_FrameSetBridgeMode(); + +ABC_DLL extern int Abc_FrameReadBmcFrames( Abc_Frame_t * p ); +ABC_DLL extern int Abc_FrameReadProbStatus( Abc_Frame_t * p ); +ABC_DLL extern void * Abc_FrameReadCex( Abc_Frame_t * p ); +ABC_DLL extern Vec_Ptr_t * Abc_FrameReadCexVec( Abc_Frame_t * p ); +ABC_DLL extern Vec_Int_t * Abc_FrameReadStatusVec( Abc_Frame_t * p ); +ABC_DLL extern Vec_Ptr_t * Abc_FrameReadPoEquivs( Abc_Frame_t * p ); +ABC_DLL extern Vec_Int_t * Abc_FrameReadPoStatuses( Abc_Frame_t * p ); +ABC_DLL extern Vec_Int_t * Abc_FrameReadObjIds( Abc_Frame_t * p ); +ABC_DLL extern Abc_Nam_t * Abc_FrameReadJsonStrs( Abc_Frame_t * p ); +ABC_DLL extern Vec_Wec_t * Abc_FrameReadJsonObjs( Abc_Frame_t * p ); + +ABC_DLL extern int Abc_FrameReadCexPiNum( Abc_Frame_t * p ); +ABC_DLL extern int Abc_FrameReadCexRegNum( Abc_Frame_t * p ); +ABC_DLL extern int Abc_FrameReadCexPo( Abc_Frame_t * p ); +ABC_DLL extern int Abc_FrameReadCexFrame( Abc_Frame_t * p ); + +ABC_DLL extern void Abc_FrameSetNtkStore( Abc_Ntk_t * pNtk ); +ABC_DLL extern void Abc_FrameSetNtkStoreSize( int nStored ); +ABC_DLL extern void Abc_FrameSetLibLut( void * pLib ); +ABC_DLL extern void Abc_FrameSetLibBox( void * pLib ); +ABC_DLL extern void Abc_FrameSetLibGen( void * pLib ); +ABC_DLL extern void Abc_FrameSetLibGen2( void * pLib ); +ABC_DLL extern void Abc_FrameSetLibSuper( void * pLib ); +ABC_DLL extern void Abc_FrameSetLibVer( void * pLib ); +ABC_DLL extern void Abc_FrameSetFlag( char * pFlag, char * pValue ); +ABC_DLL extern void Abc_FrameSetCex( Abc_Cex_t * pCex ); +ABC_DLL extern void Abc_FrameSetNFrames( int nFrames ); +ABC_DLL extern void Abc_FrameSetStatus( int Status ); +ABC_DLL extern void Abc_FrameSetManDsd( void * pMan ); +ABC_DLL extern void Abc_FrameSetManDsd2( void * pMan ); +ABC_DLL extern void Abc_FrameSetInv( Vec_Int_t * vInv ); +ABC_DLL extern void Abc_FrameSetCnf( Vec_Int_t * vInv ); +ABC_DLL extern void Abc_FrameSetStr( Vec_Str_t * vInv ); +ABC_DLL extern void Abc_FrameSetJsonStrs( Abc_Nam_t * pStrs ); +ABC_DLL extern void Abc_FrameSetJsonObjs( Vec_Wec_t * vObjs ); +ABC_DLL extern void Abc_FrameSetSignalNames( Vec_Ptr_t * vNames ); +ABC_DLL extern void Abc_FrameSetSpecName( char * pFileName ); + +ABC_DLL extern int Abc_FrameCheckPoConst( Abc_Frame_t * p, int iPoNum ); + +ABC_DLL extern void Abc_FrameReplaceCex( Abc_Frame_t * pAbc, Abc_Cex_t ** ppCex ); +ABC_DLL extern void Abc_FrameReplaceCexVec( Abc_Frame_t * pAbc, Vec_Ptr_t ** pvCexVec ); +ABC_DLL extern void Abc_FrameReplacePoEquivs( Abc_Frame_t * pAbc, Vec_Ptr_t ** pvPoEquivs ); +ABC_DLL extern void Abc_FrameReplacePoStatuses( Abc_Frame_t * pAbc, Vec_Int_t ** pvStatuses ); + +ABC_DLL extern char * Abc_FrameReadDrivingCell(); +ABC_DLL extern float Abc_FrameReadMaxLoad(); +ABC_DLL extern void Abc_FrameSetDrivingCell( char * pName ); +ABC_DLL extern void Abc_FrameSetMaxLoad( float Load ); + +ABC_DLL extern void Abc_FrameSetArrayMapping( int * p ); +ABC_DLL extern void Abc_FrameSetBoxes( int * p ); ABC_NAMESPACE_HEADER_END diff --git a/src/base/main/mainLib.c b/src/base/main/mainLib.c index 5af63d79db..79c9abbc1b 100644 --- a/src/base/main/mainLib.c +++ b/src/base/main/mainLib.c @@ -9,7 +9,7 @@ Synopsis [Here everything starts.] Author [Alan Mishchenko] - + Affiliation [UC Berkeley] Date [Ver. 1.0. Started - June 20, 2005.] @@ -27,7 +27,7 @@ ABC_NAMESPACE_IMPL_START //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// - + //////////////////////////////////////////////////////////////////////// /// FUNCTION DEFINITIONS /// //////////////////////////////////////////////////////////////////////// @@ -37,23 +37,23 @@ ABC_NAMESPACE_IMPL_START Synopsis [Initialization procedure for the library project.] Description [Note that when Abc_Start() is run in a static library - project, it does not load the resource file by default. As a result, - ABC is not set up the same way, as when it is run on a command line. - For example, some error messages while parsing files will not be - produced, and intermediate networks will not be checked for consistancy. + project, it does not load the resource file by default. As a result, + ABC is not set up the same way, as when it is run on a command line. + For example, some error messages while parsing files will not be + produced, and intermediate networks will not be checked for consistancy. One possibility is to load the resource file after Abc_Start() as follows: Abc_UtilsSource( Abc_FrameGetGlobalFrame() );] - + SideEffects [] SeeAlso [] ***********************************************************************/ -void Abc_Start() +ABC_DLL void Abc_Start() { Abc_Frame_t * pAbc; // added to detect memory leaks: -#if defined(_DEBUG) && defined(_MSC_VER) +#if defined(_DEBUG) && defined(_MSC_VER) _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); #endif // start the glocal frame @@ -67,13 +67,13 @@ void Abc_Start() Synopsis [Deallocation procedure for the library project.] Description [] - + SideEffects [] SeeAlso [] ***********************************************************************/ -void Abc_Stop() +ABC_DLL void Abc_Stop() { Abc_Frame_t * pAbc; pAbc = Abc_FrameGetGlobalFrame(); diff --git a/src/base/main/mainReal.c b/src/base/main/mainReal.c index 420f2cf101..0e9e46e676 100644 --- a/src/base/main/mainReal.c +++ b/src/base/main/mainReal.c @@ -35,7 +35,7 @@ SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. Synopsis [Here everything starts.] Author [Alan Mishchenko] - + Affiliation [UC Berkeley] Date [Ver. 1.0. Started - June 20, 2005.] @@ -45,12 +45,12 @@ SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ***********************************************************************/ #ifndef WIN32 -#include -#include +#include +#include #include -#include +#include #if !defined(__wasm) -#include +#include #endif #include #endif @@ -61,31 +61,31 @@ SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ABC_NAMESPACE_IMPL_START - //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// static int TypeCheck( Abc_Frame_t * pAbc, const char * s); +ABC_DLL extern int Abc_RealMain(int argc, char *argv[]); //////////////////////////////////////////////////////////////////////// /// FUNCTION DEFINITIONS /// //////////////////////////////////////////////////////////////////////// -unsigned enable_dbg_outs = 1; +unsigned enable_dbg_outs = 1; /**Function************************************************************* Synopsis [The main() procedure.] Description [] - + SideEffects [] SeeAlso [] ***********************************************************************/ -int Abc_RealMain( int argc, char * argv[] ) +extern int Abc_RealMain( int argc, char * argv[] ) { Abc_Frame_t * pAbc; Vec_Str_t* sCommandUsr = Vec_StrAlloc(1000); @@ -129,34 +129,34 @@ int Abc_RealMain( int argc, char * argv[] ) while ((c = Extra_UtilGetopt(argc, argv, "dm:l:c:q:C:Q:S:hf:F:o:st:T:xb")) != EOF) { switch(c) { - case 'd': - enable_dbg_outs ^= 1; - break; + case 'd': + enable_dbg_outs ^= 1; + break; case 'm': { #if !defined(WIN32) && !defined(ABC_NO_RLIMIT) - int maxMb = atoi(globalUtilOptarg); + int maxMb = atoi(globalUtilOptarg); printf("Limiting memory use to %d MB\n", maxMb); - struct rlimit limit = { - maxMb * (1llu << 20), /* soft limit */ - maxMb * (1llu << 20) /* hard limit */ - }; - setrlimit(RLIMIT_AS, &limit); + struct rlimit limit = { + maxMb * (1llu << 20), /* soft limit */ + maxMb * (1llu << 20) /* hard limit */ + }; + setrlimit(RLIMIT_AS, &limit); #endif - break; - } + break; + } case 'l': { #if !defined(WIN32) && !defined(ABC_NO_RLIMIT) - rlim_t maxTime = atoi(globalUtilOptarg); + rlim_t maxTime = atoi(globalUtilOptarg); printf("Limiting time to %d seconds\n", (int)maxTime); - struct rlimit limit = { - maxTime, /* soft limit */ - maxTime /* hard limit */ - }; - setrlimit(RLIMIT_CPU, &limit); + struct rlimit limit = { + maxTime, /* soft limit */ + maxTime /* hard limit */ + }; + setrlimit(RLIMIT_CPU, &limit); #endif - break; - } + break; + } case 'c': if( Vec_StrSize(sCommandUsr) > 0 ) { @@ -377,7 +377,7 @@ int Abc_RealMain( int argc, char * argv[] ) } // if the memory should be freed, quit packages -// if ( fStatus < 0 ) +// if ( fStatus < 0 ) { Abc_Stop(); } @@ -393,7 +393,7 @@ int Abc_RealMain( int argc, char * argv[] ) Synopsis [Returns 1 if s is a file type recognized, else returns 0.] - Description [Returns 1 if s is a file type recognized by ABC, else returns 0. + Description [Returns 1 if s is a file type recognized by ABC, else returns 0. Recognized types are "blif", "bench", "pla", and "none".] SideEffects [] diff --git a/src/base/pla/CMakeLists.txt b/src/base/pla/CMakeLists.txt new file mode 100644 index 0000000000..57fc27f528 --- /dev/null +++ b/src/base/pla/CMakeLists.txt @@ -0,0 +1,11 @@ +abc_libabc_add_sources( + NAME base_pla + SOURCES + plaMan.c + plaSimple.c + plaHash.c + plaMerge.c + plaCom.c + plaRead.c + plaWrite.c +) diff --git a/src/base/test/CMakeLists.txt b/src/base/test/CMakeLists.txt new file mode 100644 index 0000000000..70ed6f07fa --- /dev/null +++ b/src/base/test/CMakeLists.txt @@ -0,0 +1,5 @@ +abc_libabc_add_sources( + NAME base_test + SOURCES + test.c +) diff --git a/src/base/ver/CMakeLists.txt b/src/base/ver/CMakeLists.txt new file mode 100644 index 0000000000..a1ccc153bc --- /dev/null +++ b/src/base/ver/CMakeLists.txt @@ -0,0 +1,8 @@ +abc_libabc_add_sources( + NAME base_ver + SOURCES + verParse.c + verCore.c + verStream.c + verFormula.c +) diff --git a/src/base/wlc/CMakeLists.txt b/src/base/wlc/CMakeLists.txt new file mode 100644 index 0000000000..6b674193b9 --- /dev/null +++ b/src/base/wlc/CMakeLists.txt @@ -0,0 +1,23 @@ +abc_libabc_add_sources( + NAME base_wlc + SOURCES + wlcAbc.c + wlcWriteVer.c + wlcNtk.c + wlcCom.c + wlcNdr.c + wlcStdin.c + wlcPth.c + wlcUif.c + wlcSim.c + wlcBlast.c + wlcReadSmt.c + wlcAbs.c + wlcShow.c + wlcReadVer.c + wlcMem.c + wlcGraft.c + wlcWin.c + wlcJson.c + wlcAbs2.c +) diff --git a/src/base/wlc/wlcPth.c b/src/base/wlc/wlcPth.c index ddafab23ca..364f857cda 100644 --- a/src/base/wlc/wlcPth.c +++ b/src/base/wlc/wlcPth.c @@ -23,7 +23,7 @@ #ifdef ABC_USE_PTHREADS -#ifdef _WIN32 +#ifdef _MSC_VER #include "../lib/pthread.h" #else #include diff --git a/src/base/wlc/wlcReadSmt.c b/src/base/wlc/wlcReadSmt.c index 768ceb3ee8..9a44f01fba 100644 --- a/src/base/wlc/wlcReadSmt.c +++ b/src/base/wlc/wlcReadSmt.c @@ -548,7 +548,7 @@ static inline char * Smt_GetHexFromDecimalString(char * pStr) for (k=0;kindex == CUDD_MAXINDEX ) { // write the terminal node - fprintf( pFile, ".names %s%lx\n", Prefix, ( mask & (long)Node ) / sizeof(DdNode) ); + fprintf( pFile, ".names %s%lx\n", Prefix, ( mask & (ABC_PTRINT_T)Node ) / sizeof(DdNode) ); fprintf( pFile, " %s\n", (cuddV(Node) == 0.0)? "0": "1" ); continue; } @@ -875,9 +875,9 @@ void WriteDDintoBLIFfile( FILE * pFile, DdNode * Func, char * OutputName, char * if ( Else == ElseR ) { // no inverter fprintf( pFile, ".names %s %s%lx %s%lx %s%lx\n", InputNames[Node->index], - Prefix, ( mask & (long)ElseR ) / sizeof(DdNode), - Prefix, ( mask & (long)Then ) / sizeof(DdNode), - Prefix, ( mask & (long)Node ) / sizeof(DdNode) ); + Prefix, ( mask & (ABC_PTRINT_T)ElseR ) / sizeof(DdNode), + Prefix, ( mask & (ABC_PTRINT_T)Then ) / sizeof(DdNode), + Prefix, ( mask & (ABC_PTRINT_T)Node ) / sizeof(DdNode) ); fprintf( pFile, "01- 1\n" ); fprintf( pFile, "1-1 1\n" ); } @@ -885,9 +885,9 @@ void WriteDDintoBLIFfile( FILE * pFile, DdNode * Func, char * OutputName, char * { // inverter int * pSlot; fprintf( pFile, ".names %s %s%lx_i %s%lx %s%lx\n", InputNames[Node->index], - Prefix, ( mask & (long)ElseR ) / sizeof(DdNode), - Prefix, ( mask & (long)Then ) / sizeof(DdNode), - Prefix, ( mask & (long)Node ) / sizeof(DdNode) ); + Prefix, ( mask & (ABC_PTRINT_T)ElseR ) / sizeof(DdNode), + Prefix, ( mask & (ABC_PTRINT_T)Then ) / sizeof(DdNode), + Prefix, ( mask & (ABC_PTRINT_T)Node ) / sizeof(DdNode) ); fprintf( pFile, "01- 1\n" ); fprintf( pFile, "1-1 1\n" ); @@ -899,8 +899,8 @@ void WriteDDintoBLIFfile( FILE * pFile, DdNode * Func, char * OutputName, char * *pSlot = 1; fprintf( pFile, ".names %s%lx %s%lx_i\n", - Prefix, ( mask & (long)ElseR ) / sizeof(DdNode), - Prefix, ( mask & (long)ElseR ) / sizeof(DdNode) ); + Prefix, ( mask & (ABC_PTRINT_T)ElseR ) / sizeof(DdNode), + Prefix, ( mask & (ABC_PTRINT_T)ElseR ) / sizeof(DdNode) ); fprintf( pFile, "0 1\n" ); } } @@ -977,12 +977,12 @@ void WriteDDintoBLIFfileReorder( DdManager * dd, FILE * pFile, DdNode * Func, ch */ /* Find the bits that are different. */ - refAddr = ( long )Cudd_Regular(bFmin); + refAddr = ( ABC_PTRINT_T )Cudd_Regular(bFmin); diff = 0; gen = st__init_gen( visited ); while ( st__gen( gen, ( const char ** ) &Node, NULL ) ) { - diff |= refAddr ^ ( long ) Node; + diff |= refAddr ^ ( ABC_PTRINT_T ) Node; } st__free_gen( gen ); gen = NULL; @@ -997,7 +997,7 @@ void WriteDDintoBLIFfileReorder( DdManager * dd, FILE * pFile, DdNode * Func, ch // write the buffer for the output - fprintf( pFile, ".names %s%lx %s\n", Prefix, ( mask & (long)Cudd_Regular(bFmin) ) / sizeof(DdNode), OutputName ); + fprintf( pFile, ".names %s%lx %s\n", Prefix, ( mask & (ABC_PTRINT_T)Cudd_Regular(bFmin) ) / sizeof(DdNode), OutputName ); fprintf( pFile, "%s 1\n", (Cudd_IsComplement(bFmin))? "0": "1" ); @@ -1007,7 +1007,7 @@ void WriteDDintoBLIFfileReorder( DdManager * dd, FILE * pFile, DdNode * Func, ch if ( Node->index == CUDD_MAXINDEX ) { // write the terminal node - fprintf( pFile, ".names %s%lx\n", Prefix, ( mask & (long)Node ) / sizeof(DdNode) ); + fprintf( pFile, ".names %s%lx\n", Prefix, ( mask & (ABC_PTRINT_T)Node ) / sizeof(DdNode) ); fprintf( pFile, " %s\n", (cuddV(Node) == 0.0)? "0": "1" ); continue; } @@ -1020,24 +1020,24 @@ void WriteDDintoBLIFfileReorder( DdManager * dd, FILE * pFile, DdNode * Func, ch if ( Else == ElseR ) { // no inverter fprintf( pFile, ".names %s %s%lx %s%lx %s%lx\n", InputNames[Node->index], - Prefix, ( mask & (long)ElseR ) / sizeof(DdNode), - Prefix, ( mask & (long)Then ) / sizeof(DdNode), - Prefix, ( mask & (long)Node ) / sizeof(DdNode) ); + Prefix, ( mask & (ABC_PTRINT_T)ElseR ) / sizeof(DdNode), + Prefix, ( mask & (ABC_PTRINT_T)Then ) / sizeof(DdNode), + Prefix, ( mask & (ABC_PTRINT_T)Node ) / sizeof(DdNode) ); fprintf( pFile, "01- 1\n" ); fprintf( pFile, "1-1 1\n" ); } else { // inverter fprintf( pFile, ".names %s %s%lx_i %s%lx %s%lx\n", InputNames[Node->index], - Prefix, ( mask & (long)ElseR ) / sizeof(DdNode), - Prefix, ( mask & (long)Then ) / sizeof(DdNode), - Prefix, ( mask & (long)Node ) / sizeof(DdNode) ); + Prefix, ( mask & (ABC_PTRINT_T)ElseR ) / sizeof(DdNode), + Prefix, ( mask & (ABC_PTRINT_T)Then ) / sizeof(DdNode), + Prefix, ( mask & (ABC_PTRINT_T)Node ) / sizeof(DdNode) ); fprintf( pFile, "01- 1\n" ); fprintf( pFile, "1-1 1\n" ); fprintf( pFile, ".names %s%lx %s%lx_i\n", - Prefix, ( mask & (long)ElseR ) / sizeof(DdNode), - Prefix, ( mask & (long)ElseR ) / sizeof(DdNode) ); + Prefix, ( mask & (ABC_PTRINT_T)ElseR ) / sizeof(DdNode), + Prefix, ( mask & (ABC_PTRINT_T)ElseR ) / sizeof(DdNode) ); fprintf( pFile, "0 1\n" ); } } diff --git a/src/bdd/cudd/CMakeLists.txt b/src/bdd/cudd/CMakeLists.txt new file mode 100644 index 0000000000..ba90876eec --- /dev/null +++ b/src/bdd/cudd/CMakeLists.txt @@ -0,0 +1,65 @@ +abc_libabc_add_sources( + NAME bdd_cudd + SOURCES + cuddZddIsop.c + cuddGroup.c + cuddAndAbs.c + cuddSubsetSP.c + cuddAddAbs.c + cuddLinear.c + cuddZddLin.c + cuddAddNeg.c + cuddWindow.c + cuddBddIte.c + cuddAddWalsh.c + cuddGenetic.c + cuddRef.c + cuddUtil.c + cuddSubsetHB.c + cuddLCache.c + cuddMatMult.c + cuddZddPort.c + cuddZddReord.c + cuddInteract.c + cuddZddSetop.c + cuddExact.c + cuddCheck.c + cuddAddInv.c + cuddInit.c + cuddPriority.c + cuddApa.c + cuddAPI.c + cuddBddCorr.c + cuddAddFind.c + cuddEssent.c + cuddSat.c + cuddLiteral.c + cuddBridge.c + cuddRead.c + cuddSymmetry.c + cuddApprox.c + cuddSolve.c + cuddZddGroup.c + cuddBddAbs.c + cuddTable.c + cuddReorder.c + cuddZddCount.c + cuddCompose.c + cuddSign.c + cuddLevelQ.c + cuddDecomp.c + cuddZddMisc.c + cuddHarwell.c + cuddZddSymm.c + cuddSplit.c + cuddCof.c + cuddAddApply.c + cuddCache.c + cuddAddIte.c + cuddZddFuncs.c + cuddZddUtil.c + cuddClip.c + cuddExport.c + cuddAnneal.c + cuddGenCof.c +) diff --git a/src/bdd/cudd/cuddAPI.c b/src/bdd/cudd/cuddAPI.c index 155202736c..7f28733d00 100644 --- a/src/bdd/cudd/cuddAPI.c +++ b/src/bdd/cudd/cuddAPI.c @@ -3503,7 +3503,7 @@ Cudd_StdPostReordHook( const char *str, void *data) { - long initialTime = (long) data; + long initialTime = (ABC_PTRINT_T) data; int retval; long finalTime = util_cpu_time(); double totalTimeSec = (double)(finalTime - initialTime) / 1000.0; diff --git a/src/bdd/cudd/cuddBddCorr.c b/src/bdd/cudd/cuddBddCorr.c index 72c57c9540..b4a1d5b84c 100644 --- a/src/bdd/cudd/cuddBddCorr.c +++ b/src/bdd/cudd/cuddBddCorr.c @@ -472,7 +472,7 @@ CorrelHash( entry = (HashEntry *) key; #if SIZEOF_VOID_P == 8 && SIZEOF_INT == 4 - val = ((int) ((long)entry->f))*997 + ((int) ((long)entry->g)); + val = ((int) ((ABC_PTRINT_T)entry->f))*997 + ((int) ((ABC_PTRINT_T)entry->g)); #else val = ((int) entry->f)*997 + ((int) entry->g); #endif diff --git a/src/bdd/cudd/cuddDecomp.c b/src/bdd/cudd/cuddDecomp.c index 1d534670ca..2dd5cad01d 100644 --- a/src/bdd/cudd/cuddDecomp.c +++ b/src/bdd/cudd/cuddDecomp.c @@ -117,11 +117,11 @@ long lastTimeG; /*---------------------------------------------------------------------------*/ -#define FactorsNotStored(factors) ((int)((long)(factors) & 01)) +#define FactorsNotStored(factors) ((int)((ABC_PTRINT_T)(factors) & 01)) -#define FactorsComplement(factors) ((Conjuncts *)((long)(factors) | 01)) +#define FactorsComplement(factors) ((Conjuncts *)((ABC_PTRINT_T)(factors) | 01)) -#define FactorsUncomplement(factors) ((Conjuncts *)((long)(factors) ^ 01)) +#define FactorsUncomplement(factors) ((Conjuncts *)((ABC_PTRINT_T)(factors) ^ 01)) /**AutomaticStart*************************************************************/ diff --git a/src/bdd/cudd/cuddExport.c b/src/bdd/cudd/cuddExport.c index 41735a8c8f..9fbdfaa42f 100644 --- a/src/bdd/cudd/cuddExport.c +++ b/src/bdd/cudd/cuddExport.c @@ -403,12 +403,12 @@ Cudd_DumpDot( */ /* Find the bits that are different. */ - refAddr = (long) Cudd_Regular(f[0]); + refAddr = (ABC_PTRINT_T) Cudd_Regular(f[0]); diff = 0; gen = st__init_gen(visited); if (gen == NULL) goto failure; while ( st__gen(gen, (const char **)&scan, NULL)) { - diff |= refAddr ^ (long) scan; + diff |= refAddr ^ (ABC_PTRINT_T) scan; } st__free_gen(gen); gen = NULL; diff --git a/src/bdd/cudd/cuddReorder.c b/src/bdd/cudd/cuddReorder.c index c48b0c1385..bcbb098411 100644 --- a/src/bdd/cudd/cuddReorder.c +++ b/src/bdd/cudd/cuddReorder.c @@ -457,7 +457,7 @@ cuddDynamicAllocNode( ** as well. */ // offset = (unsigned long) mem & (sizeof(DdNode) - 1); // mem += (sizeof(DdNode) - offset) / sizeof(DdNodePtr); - offset = (unsigned long) mem & (32 - 1); + offset = (ABC_PTRUINT_T) mem & (32 - 1); mem += (32 - offset) / sizeof(DdNodePtr); #ifdef DD_DEBUG // assert(((unsigned long) mem & (sizeof(DdNode) - 1)) == 0); diff --git a/src/bdd/cudd/cuddUtil.c b/src/bdd/cudd/cuddUtil.c index fe913fee32..4b2e1ebb7d 100644 --- a/src/bdd/cudd/cuddUtil.c +++ b/src/bdd/cudd/cuddUtil.c @@ -2634,13 +2634,13 @@ Cudd_AverageDistance( for (j = 0; j < slots; j++) { scan = nodelist[j]; while (scan != sentinel) { - diff = (long) scan - (long) cuddT(scan); + diff = (ABC_PTRINT_T) scan - (ABC_PTRINT_T) cuddT(scan); tesubtotal += (double) ddAbs(diff); - diff = (long) scan - (long) Cudd_Regular(cuddE(scan)); + diff = (ABC_PTRINT_T) scan - (ABC_PTRINT_T) Cudd_Regular(cuddE(scan)); tesubtotal += (double) ddAbs(diff); temeasured += 2.0; if (scan->next != sentinel) { - diff = (long) scan - (long) scan->next; + diff = (ABC_PTRINT_T) scan - (ABC_PTRINT_T) scan->next; nextsubtotal += (double) ddAbs(diff); nextmeasured += 1.0; } @@ -2659,7 +2659,7 @@ Cudd_AverageDistance( scan = nodelist[j]; while (scan != NULL) { if (scan->next != NULL) { - diff = (long) scan - (long) scan->next; + diff = (ABC_PTRINT_T) scan - (ABC_PTRINT_T) scan->next; nextsubtotal += (double) ddAbs(diff); nextmeasured += 1.0; } diff --git a/src/bdd/cudd/cuddZddUtil.c b/src/bdd/cudd/cuddZddUtil.c index 6a63227f44..0835aa8ec3 100644 --- a/src/bdd/cudd/cuddZddUtil.c +++ b/src/bdd/cudd/cuddZddUtil.c @@ -610,11 +610,11 @@ Cudd_zddDumpDot( */ /* Find the bits that are different. */ - refAddr = (long) f[0]; + refAddr = (ABC_PTRINT_T) f[0]; diff = 0; gen = st__init_gen(visited); while ( st__gen(gen, (const char **)&scan, NULL)) { - diff |= refAddr ^ (long) scan; + diff |= refAddr ^ (ABC_PTRINT_T) scan; } st__free_gen(gen); diff --git a/src/bdd/dsd/CMakeLists.txt b/src/bdd/dsd/CMakeLists.txt new file mode 100644 index 0000000000..1954d2f4ca --- /dev/null +++ b/src/bdd/dsd/CMakeLists.txt @@ -0,0 +1,10 @@ +abc_libabc_add_sources( + NAME bdd_dsd + SOURCES + dsdCheck.c + dsdApi.c + dsdTree.c + dsdMan.c + dsdProc.c + dsdLocal.c +) diff --git a/src/bdd/epd/CMakeLists.txt b/src/bdd/epd/CMakeLists.txt new file mode 100644 index 0000000000..61a632ff7c --- /dev/null +++ b/src/bdd/epd/CMakeLists.txt @@ -0,0 +1,5 @@ +abc_libabc_add_sources( + NAME bdd_epd + SOURCES + epd.c +) diff --git a/src/bdd/extrab/CMakeLists.txt b/src/bdd/extrab/CMakeLists.txt new file mode 100644 index 0000000000..e9425d920a --- /dev/null +++ b/src/bdd/extrab/CMakeLists.txt @@ -0,0 +1,15 @@ +abc_libabc_add_sources( + NAME bdd_extrab + SOURCES + extraBddMaxMin.c + extraBddMisc.c + extraBddTime.c + extraBddSymm.c + extraBddThresh.c + extraBddUnate.c + extraBddKmap.c + extraBddCas.c + extraBddSet.c + extraBddAuto.c + extraBddImage.c +) diff --git a/src/bdd/llb/CMakeLists.txt b/src/bdd/llb/CMakeLists.txt new file mode 100644 index 0000000000..ce4a37cad1 --- /dev/null +++ b/src/bdd/llb/CMakeLists.txt @@ -0,0 +1,26 @@ +abc_libabc_add_sources( + NAME bdd_llb + SOURCES + llb1Reach.c + llb2Dump.c + llb3Image.c + llb2Driver.c + llb4Cex.c + llb1Cluster.c + llb1Group.c + llb2Core.c + llb4Sweep.c + llb3Nonlin.c + llb2Image.c + llb4Nonlin.c + llb1Man.c + llb1Core.c + llb1Pivot.c + llb2Flow.c + llb1Sched.c + llb4Image.c + llb1Matrix.c + llb1Hint.c + llb2Bad.c + llb1Constr.c +) diff --git a/src/bdd/mtr/CMakeLists.txt b/src/bdd/mtr/CMakeLists.txt new file mode 100644 index 0000000000..634875995a --- /dev/null +++ b/src/bdd/mtr/CMakeLists.txt @@ -0,0 +1,6 @@ +abc_libabc_add_sources( + NAME bdd_mtr + SOURCES + mtrBasic.c + mtrGroup.c +) diff --git a/src/bdd/mtr/mtrBasic.c b/src/bdd/mtr/mtrBasic.c index 1855dfe76a..a0e1bafff0 100644 --- a/src/bdd/mtr/mtrBasic.c +++ b/src/bdd/mtr/mtrBasic.c @@ -427,9 +427,9 @@ Mtr_PrintTree( (void) fprintf(stdout, #if SIZEOF_VOID_P == 8 "N=0x%-8lx C=0x%-8lx Y=0x%-8lx E=0x%-8lx P=0x%-8lx F=%x L=%u S=%u\n", - (unsigned long) node, (unsigned long) node->child, - (unsigned long) node->younger, (unsigned long) node->elder, - (unsigned long) node->parent, node->flags, node->low, node->size); + (ABC_PTRUINT_T) node, (ABC_PTRUINT_T) node->child, + (ABC_PTRUINT_T) node->younger, (ABC_PTRUINT_T) node->elder, + (ABC_PTRUINT_T) node->parent, node->flags, node->low, node->size); #else "N=0x%-8x C=0x%-8x Y=0x%-8x E=0x%-8x P=0x%-8x F=%x L=%hu S=%hu\n", (unsigned) node, (unsigned) node->child, diff --git a/src/bdd/reo/CMakeLists.txt b/src/bdd/reo/CMakeLists.txt new file mode 100644 index 0000000000..d1ce74ce63 --- /dev/null +++ b/src/bdd/reo/CMakeLists.txt @@ -0,0 +1,12 @@ +abc_libabc_add_sources( + NAME bdd_reo + SOURCES + reoTransfer.c + reoSwap.c + reoShuffle.c + reoSift.c + reoApi.c + reoProfile.c + reoUnits.c + reoCore.c +) diff --git a/src/bool/bdc/CMakeLists.txt b/src/bool/bdc/CMakeLists.txt new file mode 100644 index 0000000000..77b3c7d009 --- /dev/null +++ b/src/bool/bdc/CMakeLists.txt @@ -0,0 +1,8 @@ +abc_libabc_add_sources( + NAME bool_bdc + SOURCES + bdcSpfd.c + bdcCore.c + bdcDec.c + bdcTable.c +) diff --git a/src/bool/dec/CMakeLists.txt b/src/bool/dec/CMakeLists.txt new file mode 100644 index 0000000000..31b6142968 --- /dev/null +++ b/src/bool/dec/CMakeLists.txt @@ -0,0 +1,9 @@ +abc_libabc_add_sources( + NAME bool_dec + SOURCES + decPrint.c + decUtil.c + decFactor.c + decAbc.c + decMan.c +) diff --git a/src/bool/deco/CMakeLists.txt b/src/bool/deco/CMakeLists.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/bool/kit/CMakeLists.txt b/src/bool/kit/CMakeLists.txt new file mode 100644 index 0000000000..46783c3a90 --- /dev/null +++ b/src/bool/kit/CMakeLists.txt @@ -0,0 +1,16 @@ +abc_libabc_add_sources( + NAME bool_kit + SOURCES + kitSop.c + cloud.c + kitHop.c + kitAig.c + kitBdd.c + kitIsop.c + kitGraph.c + kitDsd.c + kitCloud.c + kitTruth.c + kitFactor.c + kitPla.c +) diff --git a/src/bool/kit/kitGraph.c b/src/bool/kit/kitGraph.c index a81b640459..b14f170a45 100644 --- a/src/bool/kit/kitGraph.c +++ b/src/bool/kit/kitGraph.c @@ -325,17 +325,17 @@ unsigned Kit_GraphToTruth( Kit_Graph_t * pGraph ) // assign the elementary variables Kit_GraphForEachLeaf( pGraph, pNode, i ) - pNode->pFunc = (void *)(long)uTruths[i]; + pNode->pFunc = (void *)(ABC_PTRUINT_T)uTruths[i]; // compute the function for each internal node Kit_GraphForEachNode( pGraph, pNode, i ) { - uTruth0 = (unsigned)(long)Kit_GraphNode(pGraph, pNode->eEdge0.Node)->pFunc; - uTruth1 = (unsigned)(long)Kit_GraphNode(pGraph, pNode->eEdge1.Node)->pFunc; + uTruth0 = (unsigned)(ABC_PTRUINT_T)Kit_GraphNode(pGraph, pNode->eEdge0.Node)->pFunc; + uTruth1 = (unsigned)(ABC_PTRUINT_T)Kit_GraphNode(pGraph, pNode->eEdge1.Node)->pFunc; uTruth0 = pNode->eEdge0.fCompl? ~uTruth0 : uTruth0; uTruth1 = pNode->eEdge1.fCompl? ~uTruth1 : uTruth1; uTruth = uTruth0 & uTruth1; - pNode->pFunc = (void *)(long)uTruth; + pNode->pFunc = (void *)(ABC_PTRUINT_T)uTruth; } // complement the result if necessary diff --git a/src/bool/lucky/CMakeLists.txt b/src/bool/lucky/CMakeLists.txt new file mode 100644 index 0000000000..f579c8cb70 --- /dev/null +++ b/src/bool/lucky/CMakeLists.txt @@ -0,0 +1,11 @@ +abc_libabc_add_sources( + NAME bool_lucky + SOURCES + luckySwapIJ.c + luckyRead.c + luckyFast16.c + lucky.c + luckySwap.c + luckyFast6.c + luckySimple.c +) diff --git a/src/bool/rpo/CMakeLists.txt b/src/bool/rpo/CMakeLists.txt new file mode 100644 index 0000000000..fc411f118d --- /dev/null +++ b/src/bool/rpo/CMakeLists.txt @@ -0,0 +1,5 @@ +abc_libabc_add_sources( + NAME bool_rpo + SOURCES + rpo.c +) diff --git a/src/bool/rsb/CMakeLists.txt b/src/bool/rsb/CMakeLists.txt new file mode 100644 index 0000000000..57bf6b8fa0 --- /dev/null +++ b/src/bool/rsb/CMakeLists.txt @@ -0,0 +1,6 @@ +abc_libabc_add_sources( + NAME bool_rsb + SOURCES + rsbMan.c + rsbDec6.c +) diff --git a/src/demo.c b/src/demo.c index e6616d4b71..c6284f764f 100644 --- a/src/demo.c +++ b/src/demo.c @@ -9,7 +9,7 @@ Synopsis [A demo program illustrating the use of ABC as a static library.] Author [Alan Mishchenko] - + Affiliation [UC Berkeley] Date [Ver. 1.0. Started - June 20, 2005.] @@ -59,12 +59,12 @@ using namespace ABC_NAMESPACE; Synopsis [The main() procedure.] - Description [This procedure compiles into a stand-alone program for + Description [This procedure compiles into a stand-alone program for DAG-aware rewriting of the AIGs. A BLIF or PLA file to be considered - for rewriting should be given as a command-line argument. Implementation - of the rewriting is inspired by the paper: Per Bjesse, Arne Boralv, + for rewriting should be given as a command-line argument. Implementation + of the rewriting is inspired by the paper: Per Bjesse, Arne Boralv, "DAG-aware circuit compression for formal verification", Proc. ICCAD 2004.] - + SideEffects [] SeeAlso [] diff --git a/src/map/amap/CMakeLists.txt b/src/map/amap/CMakeLists.txt new file mode 100644 index 0000000000..853c9ec00a --- /dev/null +++ b/src/map/amap/CMakeLists.txt @@ -0,0 +1,17 @@ +abc_libabc_add_sources( + NAME map_amap + SOURCES + amapLiberty.c + amapOutput.c + amapRule.c + amapCore.c + amapRead.c + amapGraph.c + amapParse.c + amapLib.c + amapUniq.c + amapPerm.c + amapMatch.c + amapMan.c + amapMerge.c +) diff --git a/src/map/cov/CMakeLists.txt b/src/map/cov/CMakeLists.txt new file mode 100644 index 0000000000..323f897e9e --- /dev/null +++ b/src/map/cov/CMakeLists.txt @@ -0,0 +1,11 @@ +abc_libabc_add_sources( + NAME map_cov + SOURCES + covMinEsop.c + covMinUtil.c + covMinSop.c + covMinMan.c + covCore.c + covMan.c + covBuild.c +) diff --git a/src/map/fpga/CMakeLists.txt b/src/map/fpga/CMakeLists.txt new file mode 100644 index 0000000000..939645a323 --- /dev/null +++ b/src/map/fpga/CMakeLists.txt @@ -0,0 +1,17 @@ +abc_libabc_add_sources( + NAME map_fpga + SOURCES + fpgaCreate.c + fpgaMatch.c + fpgaUtils.c + fpgaFanout.c + fpgaCut.c + fpgaSwitch.c + fpgaTruth.c + fpgaLib.c + fpga.c + fpgaCutUtils.c + fpgaCore.c + fpgaVec.c + fpgaTime.c +) diff --git a/src/map/if/CMakeLists.txt b/src/map/if/CMakeLists.txt new file mode 100644 index 0000000000..62ef5b6ba1 --- /dev/null +++ b/src/map/if/CMakeLists.txt @@ -0,0 +1,31 @@ +abc_libabc_add_sources( + NAME map_if + SOURCES + ifMatch2.c + ifCom.c + ifSelect.c + ifLibBox.c + ifDsd.c + ifReduce.c + ifDec16.c + ifTruth.c + ifSat.c + ifSeq.c + ifTest.c + ifUtil.c + ifDelay.c + ifData2.c + ifTune.c + ifDec10.c + ifLibLut.c + ifCore.c + ifDec66.c + ifCache.c + ifMap.c + ifDec75.c + ifCut.c + ifTime.c + ifMan.c + ifDec07.c + ifDec08.c +) diff --git a/src/map/if/acd/CMakeLists.txt b/src/map/if/acd/CMakeLists.txt new file mode 100644 index 0000000000..4884dd1228 --- /dev/null +++ b/src/map/if/acd/CMakeLists.txt @@ -0,0 +1,5 @@ +abc_libabc_add_sources( + NAME map_if_acd + SOURCES + ac_wrapper.cpp +) diff --git a/src/map/if/ifDsd.c b/src/map/if/ifDsd.c index c25873a9f4..ead4f22ff7 100644 --- a/src/map/if/ifDsd.c +++ b/src/map/if/ifDsd.c @@ -32,7 +32,7 @@ #ifdef ABC_USE_PTHREADS -#ifdef _WIN32 +#ifdef _MSC_VER #include "../lib/pthread.h" #else #include diff --git a/src/map/if/ifTest.c b/src/map/if/ifTest.c index fa9a644437..626cb9a6e6 100644 --- a/src/map/if/ifTest.c +++ b/src/map/if/ifTest.c @@ -23,7 +23,7 @@ #ifdef ABC_USE_PTHREADS -#ifdef _WIN32 +#ifdef _MSC_VER #include "../lib/pthread.h" #else #include diff --git a/src/map/mapper/CMakeLists.txt b/src/map/mapper/CMakeLists.txt new file mode 100644 index 0000000000..fcec6bb23a --- /dev/null +++ b/src/map/mapper/CMakeLists.txt @@ -0,0 +1,21 @@ +abc_libabc_add_sources( + NAME map_mapper + SOURCES + mapperTime.c + mapperTruth.c + mapperCut.c + mapperSuper.c + mapperTree.c + mapperUtils.c + mapperLib.c + mapperCanon.c + mapperTable.c + mapperVec.c + mapperMatch.c + mapperRefs.c + mapperCutUtils.c + mapperCore.c + mapperSwitch.c + mapper.c + mapperCreate.c +) diff --git a/src/map/mio/CMakeLists.txt b/src/map/mio/CMakeLists.txt new file mode 100644 index 0000000000..95274db790 --- /dev/null +++ b/src/map/mio/CMakeLists.txt @@ -0,0 +1,11 @@ +abc_libabc_add_sources( + NAME map_mio + SOURCES + mioApi.c + mioParse.c + mio.c + mioFunc.c + mioSop.c + mioUtils.c + mioRead.c +) diff --git a/src/map/mpm/CMakeLists.txt b/src/map/mpm/CMakeLists.txt new file mode 100644 index 0000000000..ebaaf9a602 --- /dev/null +++ b/src/map/mpm/CMakeLists.txt @@ -0,0 +1,15 @@ +abc_libabc_add_sources( + NAME map_mpm + SOURCES + mpmLib.c + mpmAbc.c + mpmMig.c + mpmUtil.c + mpmCore.c + mpmDsd.c + mpmTruth.c + mpmMap.c + mpmPre.c + mpmGates.c + mpmMan.c +) diff --git a/src/map/scl/CMakeLists.txt b/src/map/scl/CMakeLists.txt new file mode 100644 index 0000000000..07b4e9d8f5 --- /dev/null +++ b/src/map/scl/CMakeLists.txt @@ -0,0 +1,15 @@ +abc_libabc_add_sources( + NAME map_scl + SOURCES + sclBufSize.c + sclLoad.c + sclLibScl.c + sclUpsize.c + scl.c + sclBuffer.c + sclLibUtil.c + sclUtil.c + sclLiberty.c + sclSize.c + sclDnsize.c +) diff --git a/src/map/super/CMakeLists.txt b/src/map/super/CMakeLists.txt new file mode 100644 index 0000000000..83d6098c20 --- /dev/null +++ b/src/map/super/CMakeLists.txt @@ -0,0 +1,7 @@ +abc_libabc_add_sources( + NAME map_super + SOURCES + super.c + superGate.c + superAnd.c +) diff --git a/src/misc/bar/CMakeLists.txt b/src/misc/bar/CMakeLists.txt new file mode 100644 index 0000000000..98918a4bab --- /dev/null +++ b/src/misc/bar/CMakeLists.txt @@ -0,0 +1,5 @@ +abc_libabc_add_sources( + NAME misc_bar + SOURCES + bar.c +) diff --git a/src/misc/bbl/CMakeLists.txt b/src/misc/bbl/CMakeLists.txt new file mode 100644 index 0000000000..36adefa0cd --- /dev/null +++ b/src/misc/bbl/CMakeLists.txt @@ -0,0 +1,5 @@ +abc_libabc_add_sources( + NAME misc_bbl + SOURCES + bblif.c +) diff --git a/src/misc/bzlib/CMakeLists.txt b/src/misc/bzlib/CMakeLists.txt new file mode 100644 index 0000000000..314b892607 --- /dev/null +++ b/src/misc/bzlib/CMakeLists.txt @@ -0,0 +1,11 @@ +abc_libabc_add_sources( + NAME misc_bzlib + SOURCES + decompress.c + blocksort.c + bzlib.c + crctable.c + compress.c + huffman.c + randtable.c +) diff --git a/src/misc/espresso/CMakeLists.txt b/src/misc/espresso/CMakeLists.txt new file mode 100644 index 0000000000..668c400426 --- /dev/null +++ b/src/misc/espresso/CMakeLists.txt @@ -0,0 +1,43 @@ +abc_libabc_add_sources( + NAME misc_espresso + SOURCES + cols.c + reduce.c + irred.c + hack.c + matrix.c + gasp.c + cubehack.c + solution.c + setc.c + compl.c + essen.c + exact.c + sparse.c + part.c + mincov.c + unate.c + equiv.c + globals.c + gimpel.c + set.c + opo.c + sminterf.c + cvrout.c + expand.c + primes.c + cvrin.c + map.c + verify.c + indep.c + dominate.c + cvrmisc.c + cvrm.c + rows.c + cubestr.c + pair.c + cofactor.c + espresso.c + contain.c + sharp.c +) diff --git a/src/misc/extra/CMakeLists.txt b/src/misc/extra/CMakeLists.txt new file mode 100644 index 0000000000..61b8d99d4d --- /dev/null +++ b/src/misc/extra/CMakeLists.txt @@ -0,0 +1,24 @@ +abc_libabc_add_sources( + NAME misc_extra + SOURCES + extraUtilCfs.c + extraUtilPath.c + extraUtilDsd.c + extraUtilMemory.c + extraUtilMacc.c + extraUtilMaj.c + extraUtilMult.c + extraUtilTruth.c + extraUtilSupp.c + extraUtilBitMatrix.c + extraUtilCanon.c + extraUtilCube.c + extraUtilPerm.c + extraUtilReader.c + extraUtilMisc.c + extraUtilProgress.c + extraUtilUtil.c + extraUtilEnum.c + extraUtilGen.c + extraUtilFile.c +) diff --git a/src/misc/hash/CMakeLists.txt b/src/misc/hash/CMakeLists.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/misc/mem/CMakeLists.txt b/src/misc/mem/CMakeLists.txt new file mode 100644 index 0000000000..6aa0df3110 --- /dev/null +++ b/src/misc/mem/CMakeLists.txt @@ -0,0 +1,5 @@ +abc_libabc_add_sources( + NAME misc_mem + SOURCES + mem.c +) diff --git a/src/misc/mvc/CMakeLists.txt b/src/misc/mvc/CMakeLists.txt new file mode 100644 index 0000000000..95e404c1b8 --- /dev/null +++ b/src/misc/mvc/CMakeLists.txt @@ -0,0 +1,19 @@ +abc_libabc_add_sources( + NAME misc_mvc + SOURCES + mvcContain.c + mvcCube.c + mvcUtils.c + mvcCover.c + mvcDivisor.c + mvcList.c + mvcApi.c + mvcLits.c + mvcMan.c + mvcCompare.c + mvcDivide.c + mvcPrint.c + mvcOpAlg.c + mvcSort.c + mvcOpBool.c +) diff --git a/src/misc/nm/CMakeLists.txt b/src/misc/nm/CMakeLists.txt new file mode 100644 index 0000000000..bf4706f5fd --- /dev/null +++ b/src/misc/nm/CMakeLists.txt @@ -0,0 +1,6 @@ +abc_libabc_add_sources( + NAME misc_nm + SOURCES + nmTable.c + nmApi.c +) diff --git a/src/misc/parse/CMakeLists.txt b/src/misc/parse/CMakeLists.txt new file mode 100644 index 0000000000..69b9471c5d --- /dev/null +++ b/src/misc/parse/CMakeLists.txt @@ -0,0 +1,6 @@ +abc_libabc_add_sources( + NAME misc_parse + SOURCES + parseStack.c + parseEqn.c +) diff --git a/src/misc/st/CMakeLists.txt b/src/misc/st/CMakeLists.txt new file mode 100644 index 0000000000..5bde0b50ab --- /dev/null +++ b/src/misc/st/CMakeLists.txt @@ -0,0 +1,6 @@ +abc_libabc_add_sources( + NAME misc_st + SOURCES + stmm.c + st.c +) diff --git a/src/misc/st/st.c b/src/misc/st/st.c index b54509d6e2..cb1ee8dfec 100644 --- a/src/misc/st/st.c +++ b/src/misc/st/st.c @@ -17,7 +17,7 @@ ABC_NAMESPACE_IMPL_START #define st__NUMCMP(x,y) ((x) != (y)) -#define st__NUMHASH(x,size) (Abc_AbsInt((long)x)%(size)) +#define st__NUMHASH(x,size) (Abc_AbsInt((ABC_PTRINT_T)x)%(size)) //#define st__PTRHASH(x,size) ((int)((ABC_PTRUINT_T)(x)>>2)%size) // 64-bit bug fix 9/17/2007 #define st__PTRHASH(x,size) ((int)(((ABC_PTRUINT_T)(x)>>2)%size)) #define EQUAL(func, x, y) \ @@ -144,7 +144,7 @@ int return 0; } else { if (value != 0) { - *value = (long) ptr->record; + *value = (ABC_PTRINT_T) ptr->record; } return 1; } @@ -411,7 +411,7 @@ int *last = ptr->next; if (value != NULL) *value = ptr->record; - *keyp = (long) ptr->key; + *keyp = (ABC_PTRINT_T) ptr->key; ABC_FREE(ptr); table->num_entries--; return 1; @@ -544,7 +544,7 @@ int } *key_p = gen->entry->key; if (value_p != 0) { - *value_p = (long) gen->entry->record; + *value_p = (ABC_PTRINT_T) gen->entry->record; } gen->entry = gen->entry->next; return 1; diff --git a/src/misc/st/stmm.c b/src/misc/st/stmm.c index 99d78ae19c..8916df5d44 100644 --- a/src/misc/st/stmm.c +++ b/src/misc/st/stmm.c @@ -15,7 +15,7 @@ ABC_NAMESPACE_IMPL_START #define STMM_NUMCMP(x,y) ((x) != (y)) -#define STMM_NUMHASH(x,size) (Abc_AbsInt((long)x)%(size)) +#define STMM_NUMHASH(x,size) (Abc_AbsInt((ABC_PTRINT_T)x)%(size)) //#define STMM_PTRHASH(x,size) ((int)((ABC_PTRUINT_T)(x)>>2)%size) // 64-bit bug fix 9/17/2007 #define STMM_PTRHASH(x,size) ((int)(((ABC_PTRUINT_T)(x)>>2)%size)) #define EQUAL(func, x, y) \ @@ -168,7 +168,7 @@ stmm_lookup_int (stmm_table *table, char *key, int *value) else { if (value != 0) { - *value = (long) ptr->record; + *value = (ABC_PTRINT_T) ptr->record; } return 1; } @@ -470,7 +470,7 @@ stmm_delete_int (stmm_table *table, long *keyp, char **value) *last = ptr->next; if (value != NULL) *value = ptr->record; - *keyp = (long) ptr->key; + *keyp = (ABC_PTRINT_T) ptr->key; // ABC_FREE( ptr ); Extra_MmFixedEntryRecycle ((Extra_MmFixed_t *)table->pMemMan, (char *) ptr); @@ -611,7 +611,7 @@ stmm_gen_int (stmm_generator *gen, char **key_p, long *value_p) *key_p = gen->entry->key; if (value_p != 0) { - *value_p = (long) gen->entry->record; + *value_p = (ABC_PTRINT_T) gen->entry->record; } gen->entry = gen->entry->next; return 1; diff --git a/src/misc/tim/CMakeLists.txt b/src/misc/tim/CMakeLists.txt new file mode 100644 index 0000000000..ff1190ca70 --- /dev/null +++ b/src/misc/tim/CMakeLists.txt @@ -0,0 +1,9 @@ +abc_libabc_add_sources( + NAME misc_tim + SOURCES + timTime.c + timBox.c + timTrav.c + timMan.c + timDump.c +) diff --git a/src/misc/util/CMakeLists.txt b/src/misc/util/CMakeLists.txt new file mode 100644 index 0000000000..fac455db78 --- /dev/null +++ b/src/misc/util/CMakeLists.txt @@ -0,0 +1,14 @@ +abc_libabc_add_sources( + NAME misc_util + SOURCES + utilSort.c + utilBSet.c + utilNam.c + utilBridge.c + utilColor.c + utilCex.c + utilFile.c + utilIsop.c + utilPth.c + utilSignal.c +) diff --git a/src/misc/util/abc_global.h b/src/misc/util/abc_global.h index b666fca01e..81982e685d 100644 --- a/src/misc/util/abc_global.h +++ b/src/misc/util/abc_global.h @@ -9,7 +9,7 @@ Synopsis [Global declarations.] Author [Alan Mishchenko] - + Affiliation [UC Berkeley] Date [Ver. 1.0. Started - Jan 30, 2009.] @@ -51,10 +51,15 @@ #endif #else /* defined(WIN32) */ #define ABC_DLLIMPORT +#define ABC_DLLEXPORT __attribute__((visibility("default"))) #endif /* defined(WIN32) */ #ifndef ABC_DLL -#define ABC_DLL ABC_DLLIMPORT + #ifdef ABC_NAMESPACE + #define ABC_DLL ABC_DLLEXPORT + #else + #define ABC_DLL ABC_DLLIMPORT + #endif #endif #if !defined(___unused) @@ -235,7 +240,7 @@ typedef unsigned __int64 ABC_UINT64_T; #endif /* defined(PLATFORM) */ #ifdef LIN - #define ABC_CONST(number) number ## ULL + #define ABC_CONST(number) number ## ULL #else // LIN64 and windows #define ABC_CONST(number) number #endif @@ -340,7 +345,7 @@ static inline abctime Abc_Clock() #endif #if (defined(LIN) || defined(LIN64)) && !APPLE_MACH && !defined(__MINGW32__) && !defined(__wasm) struct timespec ts; - if ( clock_gettime(CLOCK_MONOTONIC, &ts) < 0 ) + if ( clock_gettime(CLOCK_MONOTONIC, &ts) < 0 ) return (abctime)-1; abctime res = ((abctime) ts.tv_sec) * CLOCKS_PER_SEC; res += (((abctime) ts.tv_nsec) * CLOCKS_PER_SEC) / 1000000000; @@ -359,7 +364,7 @@ static inline abctime Abc_ThreadClock() #endif #if (defined(LIN) || defined(LIN64)) && !APPLE_MACH && !defined(__MINGW32__) && !defined(__wasm) struct timespec ts; - if ( clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts) < 0 ) + if ( clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts) < 0 ) return (abctime)-1; abctime res = ((abctime) ts.tv_sec) * CLOCKS_PER_SEC; res += (((abctime) ts.tv_nsec) * CLOCKS_PER_SEC) / 1000000000; @@ -396,7 +401,7 @@ static inline void Abc_Print( int level, const char * format, ... ) { extern ABC_DLL int Abc_FrameIsBridgeMode(); va_list args; - extern unsigned enable_dbg_outs; + extern unsigned enable_dbg_outs; if ( !enable_dbg_outs ) return; @@ -507,7 +512,7 @@ static inline int Abc_PrimeCudd( unsigned int p ) } while (!pn); return (int)(p); -} // end of Cudd_Prime +} // end of Cudd_Prime // the returned buffer has 32 unused bytes at the end, filled with zeros static inline void * Abc_FileReadContents( char * pFileName, int * pnFileSize ) diff --git a/src/misc/util/utilDouble.h b/src/misc/util/utilDouble.h index 0d02378183..ab32d33c05 100644 --- a/src/misc/util/utilDouble.h +++ b/src/misc/util/utilDouble.h @@ -179,8 +179,8 @@ static inline void Xdbl_Test() xdbl b = Xdbl_FromDouble(10.28828287); xdbl ab = Xdbl_Mul(a, b); - xdbl ten100 = Xdbl_FromDouble( 1e100 ); - xdbl ten100_ = ABC_CONST(0x014c924d692ca61b); + xdbl ten100 ___unused = Xdbl_FromDouble( 1e100 ); + xdbl ten100_ ___unused = ABC_CONST(0x014c924d692ca61b); assert( ten100 == ten100_ ); diff --git a/src/misc/util/utilFile.c b/src/misc/util/utilFile.c index f64d71c24a..696b9f75ad 100644 --- a/src/misc/util/utilFile.c +++ b/src/misc/util/utilFile.c @@ -202,7 +202,7 @@ char* vnsprintf(const char* format, va_list args) static FILE* dummy_file = NULL; if (!dummy_file) { -#if !defined(_MSC_VER) && !defined(__MINGW32) +#if !defined(_MSC_VER) && !defined(__MINGW32__) dummy_file = fopen("/dev/null", "wb"); #else dummy_file = fopen("NUL", "wb"); diff --git a/src/misc/util/utilTruth.h b/src/misc/util/utilTruth.h index cf3d6cedf6..28a899988e 100644 --- a/src/misc/util/utilTruth.h +++ b/src/misc/util/utilTruth.h @@ -1800,7 +1800,7 @@ static inline int Abc_TtCheckCondDep2( word * pTruth, int nVars, int nSuppLim ) } static inline int Abc_TtCheckCondDep( word * pTruth, int nVars, int nSuppLim ) { - int nVarsMax = 13; + int nVarsMax ___unused = 13; word Cof0[128], Cof1[128]; // pow( 2, nVarsMax-6 ) int v, d, nWords = Abc_TtWordNum(nVars); assert( nVars <= nVarsMax ); diff --git a/src/misc/vec/CMakeLists.txt b/src/misc/vec/CMakeLists.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/misc/zlib/CMakeLists.txt b/src/misc/zlib/CMakeLists.txt new file mode 100644 index 0000000000..3d85c00f16 --- /dev/null +++ b/src/misc/zlib/CMakeLists.txt @@ -0,0 +1,19 @@ +abc_libabc_add_sources( + NAME misc_zlib + SOURCES + gzread.c + uncompr.c + trees.c + gzwrite.c + gzclose.c + inffast.c + inftrees.c + infback.c + gzlib.c + adler32.c + crc32.c + inflate.c + zutil.c + compress_.c + deflate.c +) diff --git a/src/opt/cgt/CMakeLists.txt b/src/opt/cgt/CMakeLists.txt new file mode 100644 index 0000000000..6890c1b9d7 --- /dev/null +++ b/src/opt/cgt/CMakeLists.txt @@ -0,0 +1,9 @@ +abc_libabc_add_sources( + NAME opt_cgt + SOURCES + cgtAig.c + cgtSat.c + cgtCore.c + cgtDecide.c + cgtMan.c +) diff --git a/src/opt/csw/CMakeLists.txt b/src/opt/csw/CMakeLists.txt new file mode 100644 index 0000000000..882d8b5473 --- /dev/null +++ b/src/opt/csw/CMakeLists.txt @@ -0,0 +1,8 @@ +abc_libabc_add_sources( + NAME opt_csw + SOURCES + cswTable.c + cswMan.c + cswCore.c + cswCut.c +) diff --git a/src/opt/cut/CMakeLists.txt b/src/opt/cut/CMakeLists.txt new file mode 100644 index 0000000000..fba1c938a4 --- /dev/null +++ b/src/opt/cut/CMakeLists.txt @@ -0,0 +1,13 @@ +abc_libabc_add_sources( + NAME opt_cut + SOURCES + cutCut.c + cutPre22.c + cutMan.c + cutSeq.c + cutNode.c + cutOracle.c + cutMerge.c + cutTruth.c + cutApi.c +) diff --git a/src/opt/dar/CMakeLists.txt b/src/opt/dar/CMakeLists.txt new file mode 100644 index 0000000000..dae978c6ac --- /dev/null +++ b/src/opt/dar/CMakeLists.txt @@ -0,0 +1,13 @@ +abc_libabc_add_sources( + NAME opt_dar + SOURCES + darBalance.c + darPrec.c + darData.c + darMan.c + darCut.c + darLib.c + darScript.c + darCore.c + darRefact.c +) diff --git a/src/opt/dau/CMakeLists.txt b/src/opt/dau/CMakeLists.txt new file mode 100644 index 0000000000..a2fa3d97cd --- /dev/null +++ b/src/opt/dau/CMakeLists.txt @@ -0,0 +1,16 @@ +abc_libabc_add_sources( + NAME opt_dau + SOURCES + dauEnum.c + dauTree.c + dauNonDsd.c + dauMerge.c + dauDsd.c + dauDivs.c + dauCount.c + dauCanon.c + dauNpn2.c + dauGia.c + dauNpn.c + dauCore.c +) diff --git a/src/opt/dau/dauCanon.c b/src/opt/dau/dauCanon.c index bd97c280c0..26452677f8 100644 --- a/src/opt/dau/dauCanon.c +++ b/src/opt/dau/dauCanon.c @@ -1506,7 +1506,7 @@ SeeAlso [] ***********************************************************************/ -// Johnson¨CTrotter algorithm +// Johnson\A8CTrotter algorithm static int Abc_NextPermSwapC(char * pData, signed char * pDir, int size) { int i, j, k = -1; diff --git a/src/opt/dsc/CMakeLists.txt b/src/opt/dsc/CMakeLists.txt new file mode 100644 index 0000000000..11e9042073 --- /dev/null +++ b/src/opt/dsc/CMakeLists.txt @@ -0,0 +1,5 @@ +abc_libabc_add_sources( + NAME opt_dsc + SOURCES + dsc.c +) diff --git a/src/opt/eslim/CMakeLists.txt b/src/opt/eslim/CMakeLists.txt new file mode 100644 index 0000000000..5781fc7240 --- /dev/null +++ b/src/opt/eslim/CMakeLists.txt @@ -0,0 +1,6 @@ +abc_libabc_add_sources( + NAME opt_eslim + SOURCES + eSLIM.cpp + relationGeneration.cpp +) diff --git a/src/opt/eslim/eSLIMMan.tpp b/src/opt/eslim/eSLIMMan.tpp index 8eb46db5ca..0054cc9d9e 100644 --- a/src/opt/eslim/eSLIMMan.tpp +++ b/src/opt/eslim/eSLIMMan.tpp @@ -9,7 +9,7 @@ Synopsis [eSLIM manager.] Author [Franz-Xaver Reichl] - + Affiliation [University of Freiburg] Date [Ver. 1.0. Started - March 2025.] @@ -52,8 +52,8 @@ namespace eSLIM { template - eSLIM_Man::eSLIM_Man(Gia_Man_t * pGia, const eSLIMConfig& cfg, eSLIMLog& log) - : gia_man(pGia), cfg(cfg), log(log), + eSLIM_Man::eSLIM_Man(Gia_Man_t * pGia, const eSLIMConfig& cfg, eSLIMLog& log) + : gia_man(pGia), cfg(cfg), log(log), subcircuit_selection(gia_man, cfg, log) { if (cfg.fix_seed) { subcircuit_selection.setSeed(cfg.seed); @@ -61,7 +61,7 @@ namespace eSLIM { relation_generation_time = log.relation_generation_time; synthesis_time = log.synthesis_time; } - + template void eSLIM_Man::minimize() { abctime clkStart = Abc_Clock(); @@ -117,7 +117,7 @@ namespace eSLIM { } return vSimsDiv; } - + template Vec_Wrd_t* eSLIM_Man::getSimsOut(Abc_RData_t* relation) { Vec_Wrd_t* vSimsOut = Vec_WrdStart(relation->nPats); @@ -145,7 +145,7 @@ namespace eSLIM { insertReplacement(replacement, subcir); Mini_AigStop(replacement); } - subcir.free(); + subcir._free(); } // Based on Exa_ManExactSynthesis6Int and Exa_ManExactSynthesis6 @@ -191,11 +191,11 @@ namespace eSLIM { log.nof_reduced_circuits_per_size.resize(original_size + 1, 0); } log.nof_analyzed_circuits_per_size[original_size]++; - + abctime synthesis_start = Abc_Clock(); std::tie(size, pMini) = reduce(vSimsDiv2, vSimsOut2, subcir.forbidden_pairs, nVars, nDivs, nOuts, size); log.synthesis_time += (double)1.0*(Abc_Clock() - synthesis_start)/CLOCKS_PER_SEC; - + if (size > original_size) { // Could not find a replacement. This can be caused by a timeout. Abc_RDataStop(relation); @@ -232,7 +232,7 @@ namespace eSLIM { if (pMini != nullptr) { Mini_Aig_t* pTemp = pMini; pMini = Mini_AigDupCompl(pTemp, DivCompl, OutCompl); - Mini_AigStop(pTemp); + Mini_AigStop(pTemp); log.nof_replaced_circuits_per_size[original_size]++; if (size < original_size) { @@ -272,7 +272,7 @@ namespace eSLIM { } else { valuefanin0 = false; } - valuefanin0 = valuefanin0 != pObj->fCompl0; + valuefanin0 = valuefanin0 != pObj->fCompl0; if (Gia_ObjIsTravIdCurrent(gia_man, Gia_ObjFanin1(pObj))) { valuefanin1 = getAllFalseBehaviourRec(Gia_ObjFanin1(pObj)); } else { @@ -288,7 +288,7 @@ namespace eSLIM { bool fanin_negated = Abc_LitIsCompl(fanin_lit); int fanin_value; if (fanin_idx == 0) { // constant fanin - fanin_value = 0; + fanin_value = 0; } else if (fanin_idx <= subcir.nof_inputs) { Gia_Obj_t* pObj = Gia_ManObj(gia_man, Vec_IntEntry(subcir.io, fanin_idx - 1)); if (Gia_ObjIsTravIdCurrent(gia_man, pObj)) { //the node has already been added @@ -432,7 +432,7 @@ namespace eSLIM { } po_idx++; } - + Gia_ManForEachPo( gia_man, pObj, i ) { assert(Gia_ObjIsTravIdCurrent(gia_man, Gia_ObjFanin0(pObj))); bool fanin_negated = Gia_ObjFaninC0(pObj) ^ Gia_ObjFanin0(pObj)->fMark0; @@ -444,7 +444,7 @@ namespace eSLIM { } template - std::pair eSLIM_Man::reduce(Vec_Wrd_t* vSimsDiv, Vec_Wrd_t* vSimsOut, const std::unordered_map>& forbidden_pairs, + std::pair eSLIM_Man::reduce(Vec_Wrd_t* vSimsDiv, Vec_Wrd_t* vSimsOut, const std::unordered_map>& forbidden_pairs, int nVars, int nDivs, int nOuts, int size) { Y synth_man(vSimsDiv,vSimsOut,nVars,1+nVars+nDivs,nOuts,size, forbidden_pairs, log, cfg); Mini_Aig_t* result = nullptr; @@ -479,4 +479,4 @@ namespace eSLIM { } -ABC_NAMESPACE_CXX_HEADER_END \ No newline at end of file +ABC_NAMESPACE_CXX_HEADER_END diff --git a/src/opt/eslim/selectionStrategy.tpp b/src/opt/eslim/selectionStrategy.tpp index 94f656a5b3..909b3a4b86 100644 --- a/src/opt/eslim/selectionStrategy.tpp +++ b/src/opt/eslim/selectionStrategy.tpp @@ -9,7 +9,7 @@ Synopsis [Procedures for selecting subcircuits.] Author [Franz-Xaver Reichl] - + Affiliation [University of Freiburg] Date [Ver. 1.0. Started - March 2025.] @@ -35,7 +35,7 @@ namespace eSLIM { if (filterSubcircuit(subcir)) { return subcir; } else { - subcir.free(); + subcir._free(); } } status = false; @@ -76,12 +76,12 @@ namespace eSLIM { if (!Gia_ObjIsTravIdPrevious(gia_man, Gia_ObjFanin0(pObj)) && !Gia_ObjIsTravIdCurrent(gia_man, Gia_ObjFanin0(pObj))) { Gia_ObjSetTravIdCurrent(gia_man, Gia_ObjFanin0(pObj)); Vec_IntPush(io, Gia_ObjId(gia_man, Gia_ObjFanin0(pObj))); - } + } // fanin1 is not in the subcircuit and was not considered yet if (!Gia_ObjIsTravIdPrevious(gia_man, Gia_ObjFanin1(pObj)) && !Gia_ObjIsTravIdCurrent(gia_man, Gia_ObjFanin1(pObj))) { Gia_ObjSetTravIdCurrent(gia_man, Gia_ObjFanin1(pObj)); Vec_IntPush(io, Gia_ObjId(gia_man, Gia_ObjFanin1(pObj))); - } + } } int nof_inputs = Vec_IntSize(io); @@ -90,11 +90,11 @@ namespace eSLIM { // If there is an object that is not contained in the subcircuit that has a fanin in the subcircuit then this fanin is an output if (!Gia_ObjIsTravIdPrevious(gia_man, pObj)) { if (Gia_ObjIsTravIdPrevious(gia_man, Gia_ObjFanin0(pObj))) { - Gia_ObjSetTravIdCurrent(gia_man, Gia_ObjFanin0(pObj)); + Gia_ObjSetTravIdCurrent(gia_man, Gia_ObjFanin0(pObj)); Vec_IntPush(io, Gia_ObjId(gia_man, Gia_ObjFanin0(pObj))); } if (Gia_ObjIsTravIdPrevious(gia_man, Gia_ObjFanin1(pObj))) { - Gia_ObjSetTravIdCurrent(gia_man, Gia_ObjFanin1(pObj)); + Gia_ObjSetTravIdCurrent(gia_man, Gia_ObjFanin1(pObj)); Vec_IntPush(io, Gia_ObjId(gia_man, Gia_ObjFanin1(pObj))); } } @@ -102,7 +102,7 @@ namespace eSLIM { Gia_ManForEachPo( gia_man, pObj, i ) { if (Gia_ObjIsTravIdPrevious(gia_man, Gia_ObjFanin0(pObj))) { - Gia_ObjSetTravIdCurrent(gia_man, Gia_ObjFanin0(pObj)); + Gia_ObjSetTravIdCurrent(gia_man, Gia_ObjFanin0(pObj)); Vec_IntPush(io, Gia_ObjId(gia_man, Gia_ObjFanin0(pObj))); } } @@ -131,7 +131,7 @@ namespace eSLIM { template void SelectionStrategy::forbiddenPairsRec(Gia_Obj_t * pObj, int input, int min_level, std::unordered_map>& pairs, const std::unordered_map& out_id) { - if (Gia_ObjIsTravIdCurrent(gia_man, pObj)) { + if (Gia_ObjIsTravIdCurrent(gia_man, pObj)) { auto id = Gia_ObjId(gia_man, pObj); pairs[out_id.at(id)].insert(input); return; @@ -230,4 +230,4 @@ namespace eSLIM { } } -ABC_NAMESPACE_CXX_HEADER_END \ No newline at end of file +ABC_NAMESPACE_CXX_HEADER_END diff --git a/src/opt/eslim/utils.hpp b/src/opt/eslim/utils.hpp index fb942c417b..37b048e848 100644 --- a/src/opt/eslim/utils.hpp +++ b/src/opt/eslim/utils.hpp @@ -9,7 +9,7 @@ Synopsis [Utilities for the eSLIM package.] Author [Franz-Xaver Reichl] - + Affiliation [University of Freiburg] Date [Ver. 1.0. Started - March 2025.] @@ -33,21 +33,21 @@ ABC_NAMESPACE_CXX_HEADER_START namespace eSLIM { - struct eSLIMConfig { - bool extended_normality_processing = false; - bool apply_strash = true; - bool fix_seed = false; - bool fill_subcircuits = false; + struct eSLIMConfig { + bool extended_normality_processing = false; + bool apply_strash = true; + bool fix_seed = false; + bool fill_subcircuits = false; bool trial_limit_active = true; - bool allow_xors = false; + bool allow_xors = false; - unsigned int timeout = 3600; - unsigned int iterations = 0; - unsigned int subcircuit_size_bound = 6; - unsigned int strash_intervall = 100; + unsigned int timeout = 3600; + unsigned int iterations = 0; + unsigned int subcircuit_size_bound = 6; + unsigned int strash_intervall = 100; int seed = 0; unsigned int nselection_trials = 100; - double expansion_probability = 0.6; + double expansion_probability = 0.6; // times given in sec int minimum_sat_timeout = 1; @@ -81,18 +81,18 @@ namespace eSLIM { Vec_Int_t* io; unsigned int nof_inputs; std::unordered_map> forbidden_pairs; - void free(); + void _free(); }; - inline void Subcircuit::free() { + inline void Subcircuit::_free() { Vec_IntFree(nodes); Vec_IntFree(io); } - inline eSLIMLog::eSLIMLog(int size) + inline eSLIMLog::eSLIMLog(int size) : nof_analyzed_circuits_per_size(size + 1, 0), nof_replaced_circuits_per_size(size + 1, 0), nof_reduced_circuits_per_size(size + 1, 0), cummulative_sat_runtimes_per_size(size + 1, 0), - nof_sat_calls_per_size(size + 1, 0), cummulative_unsat_runtimes_per_size(size + 1, 0), + nof_sat_calls_per_size(size + 1, 0), cummulative_unsat_runtimes_per_size(size + 1, 0), nof_unsat_calls_per_size(size + 1, 0) { } @@ -100,4 +100,4 @@ namespace eSLIM { ABC_NAMESPACE_CXX_HEADER_END -#endif \ No newline at end of file +#endif diff --git a/src/opt/fret/CMakeLists.txt b/src/opt/fret/CMakeLists.txt new file mode 100644 index 0000000000..6a269c7897 --- /dev/null +++ b/src/opt/fret/CMakeLists.txt @@ -0,0 +1,8 @@ +abc_libabc_add_sources( + NAME opt_fret + SOURCES + fretFlow.c + fretInit.c + fretMain.c + fretTime.c +) diff --git a/src/opt/fsim/CMakeLists.txt b/src/opt/fsim/CMakeLists.txt new file mode 100644 index 0000000000..052b8d31b8 --- /dev/null +++ b/src/opt/fsim/CMakeLists.txt @@ -0,0 +1,10 @@ +abc_libabc_add_sources( + NAME opt_fsim + SOURCES + fsimMan.c + fsimFront.c + fsimSim.c + fsimCore.c + fsimTsim.c + fsimSwitch.c +) diff --git a/src/opt/fxch/CMakeLists.txt b/src/opt/fxch/CMakeLists.txt new file mode 100644 index 0000000000..ad4a264c69 --- /dev/null +++ b/src/opt/fxch/CMakeLists.txt @@ -0,0 +1,8 @@ +abc_libabc_add_sources( + NAME opt_fxch + SOURCES + FxchMan.c + FxchSCHashTable.c + FxchDiv.c + Fxch.c +) diff --git a/src/opt/fxu/CMakeLists.txt b/src/opt/fxu/CMakeLists.txt new file mode 100644 index 0000000000..7071c4a2be --- /dev/null +++ b/src/opt/fxu/CMakeLists.txt @@ -0,0 +1,16 @@ +abc_libabc_add_sources( + NAME opt_fxu + SOURCES + fxu.c + fxuMatrix.c + fxuCreate.c + fxuPrint.c + fxuSingle.c + fxuSelect.c + fxuUpdate.c + fxuList.c + fxuPair.c + fxuHeapS.c + fxuReduce.c + fxuHeapD.c +) diff --git a/src/opt/lpk/CMakeLists.txt b/src/opt/lpk/CMakeLists.txt new file mode 100644 index 0000000000..a30f70802b --- /dev/null +++ b/src/opt/lpk/CMakeLists.txt @@ -0,0 +1,15 @@ +abc_libabc_add_sources( + NAME opt_lpk + SOURCES + lpkAbcMux.c + lpkAbcDsd.c + lpkSets.c + lpkCut.c + lpkMan.c + lpkAbcDec.c + lpkMux.c + lpkMap.c + lpkCore.c + lpkAbcUtil.c + lpkMulti.c +) diff --git a/src/opt/mfs/CMakeLists.txt b/src/opt/mfs/CMakeLists.txt new file mode 100644 index 0000000000..ea77845b7c --- /dev/null +++ b/src/opt/mfs/CMakeLists.txt @@ -0,0 +1,12 @@ +abc_libabc_add_sources( + NAME opt_mfs + SOURCES + mfsInter.c + mfsWin.c + mfsSat.c + mfsResub.c + mfsStrash.c + mfsMan.c + mfsDiv.c + mfsCore.c +) diff --git a/src/opt/nwk/CMakeLists.txt b/src/opt/nwk/CMakeLists.txt new file mode 100644 index 0000000000..c0979cc550 --- /dev/null +++ b/src/opt/nwk/CMakeLists.txt @@ -0,0 +1,18 @@ +abc_libabc_add_sources( + NAME opt_nwk + SOURCES + nwkDfs.c + nwkFlow.c + nwkBidec.c + nwkMap.c + nwkFanio.c + nwkAig.c + nwkSpeedup.c + nwkStrash.c + nwkCheck.c + nwkTiming.c + nwkMerge.c + nwkObj.c + nwkUtil.c + nwkMan.c +) diff --git a/src/opt/rar/CMakeLists.txt b/src/opt/rar/CMakeLists.txt new file mode 100644 index 0000000000..01af6db8f5 --- /dev/null +++ b/src/opt/rar/CMakeLists.txt @@ -0,0 +1,8 @@ +abc_libabc_add_sources( + NAME opt_rar + SOURCES + rewire_miaig.cpp + rewire_map.c + rewire_rar.c + rewire_rng.c +) diff --git a/src/opt/res/CMakeLists.txt b/src/opt/res/CMakeLists.txt new file mode 100644 index 0000000000..fcb01910e3 --- /dev/null +++ b/src/opt/res/CMakeLists.txt @@ -0,0 +1,11 @@ +abc_libabc_add_sources( + NAME opt_res + SOURCES + resDivs.c + resSat.c + resFilter.c + resCore.c + resStrash.c + resWin.c + resSim.c +) diff --git a/src/opt/ret/CMakeLists.txt b/src/opt/ret/CMakeLists.txt new file mode 100644 index 0000000000..29e3c13ae7 --- /dev/null +++ b/src/opt/ret/CMakeLists.txt @@ -0,0 +1,11 @@ +abc_libabc_add_sources( + NAME opt_ret + SOURCES + retCore.c + retIncrem.c + retFlow.c + retLvalue.c + retDelay.c + retInit.c + retArea.c +) diff --git a/src/opt/rwr/CMakeLists.txt b/src/opt/rwr/CMakeLists.txt new file mode 100644 index 0000000000..c32588fc7c --- /dev/null +++ b/src/opt/rwr/CMakeLists.txt @@ -0,0 +1,11 @@ +abc_libabc_add_sources( + NAME opt_rwr + SOURCES + rwrExp.c + rwrUtil.c + rwrEva.c + rwrDec.c + rwrMan.c + rwrLib.c + rwrPrint.c +) diff --git a/src/opt/rwt/CMakeLists.txt b/src/opt/rwt/CMakeLists.txt new file mode 100644 index 0000000000..29f1e55cf4 --- /dev/null +++ b/src/opt/rwt/CMakeLists.txt @@ -0,0 +1,7 @@ +abc_libabc_add_sources( + NAME opt_rwt + SOURCES + rwtMan.c + rwtDec.c + rwtUtil.c +) diff --git a/src/opt/sbd/CMakeLists.txt b/src/opt/sbd/CMakeLists.txt new file mode 100644 index 0000000000..ac79cb96c2 --- /dev/null +++ b/src/opt/sbd/CMakeLists.txt @@ -0,0 +1,13 @@ +abc_libabc_add_sources( + NAME opt_sbd + SOURCES + sbdSat.c + sbd.c + sbdWin.c + sbdCut.c + sbdLut.c + sbdCore.c + sbdCut2.c + sbdCnf.c + sbdPath.c +) diff --git a/src/opt/sfm/CMakeLists.txt b/src/opt/sfm/CMakeLists.txt new file mode 100644 index 0000000000..39c4ec84af --- /dev/null +++ b/src/opt/sfm/CMakeLists.txt @@ -0,0 +1,14 @@ +abc_libabc_add_sources( + NAME opt_sfm + SOURCES + sfmArea.c + sfmNtk.c + sfmDec.c + sfmTim.c + sfmCnf.c + sfmMit.c + sfmWin.c + sfmCore.c + sfmSat.c + sfmLib.c +) diff --git a/src/opt/sim/CMakeLists.txt b/src/opt/sim/CMakeLists.txt new file mode 100644 index 0000000000..961f509577 --- /dev/null +++ b/src/opt/sim/CMakeLists.txt @@ -0,0 +1,13 @@ +abc_libabc_add_sources( + NAME opt_sim + SOURCES + simSymSim.c + simSymSat.c + simSupp.c + simUtils.c + simMan.c + simSym.c + simSymStr.c + simSwitch.c + simSeq.c +) diff --git a/src/phys/place/CMakeLists.txt b/src/phys/place/CMakeLists.txt new file mode 100644 index 0000000000..81bcc66cd7 --- /dev/null +++ b/src/phys/place/CMakeLists.txt @@ -0,0 +1,14 @@ +abc_libabc_add_sources( + NAME phys_place + SOURCES + place_base.c + place_qpsolver.c + place_legalize.c + place_bin.c + place_inc.c + place_pads.c + place_io.c + place_gordian.c + place_partition.c + place_genqp.c +) diff --git a/src/proof/abs/CMakeLists.txt b/src/proof/abs/CMakeLists.txt new file mode 100644 index 0000000000..7fb17e6a8b --- /dev/null +++ b/src/proof/abs/CMakeLists.txt @@ -0,0 +1,20 @@ +abc_libabc_add_sources( + NAME proof_abs + SOURCES + absOldRef.c + absGla.c + absGlaOld.c + absRpmOld.c + absUtil.c + absDup.c + absVta.c + absRef.c + absPth.c + absOldCex.c + absOldSat.c + absOut.c + absOldSim.c + absRpm.c + absRefSelect.c + absIter.c +) diff --git a/src/proof/abs/absPth.c b/src/proof/abs/absPth.c index f04a20d1c6..cd2301a2d8 100644 --- a/src/proof/abs/absPth.c +++ b/src/proof/abs/absPth.c @@ -17,7 +17,7 @@ Revision [$Id: absPth.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $] ***********************************************************************/ - + #include "abs.h" #include "proof/pdr/pdr.h" #include "proof/ssw/ssw.h" @@ -25,7 +25,7 @@ #ifdef ABC_USE_PTHREADS -#ifdef _WIN32 +#ifdef _MSC_VER #include "../lib/pthread.h" #else #include @@ -34,7 +34,7 @@ #endif -ABC_NAMESPACE_IMPL_START +ABC_NAMESPACE_IMPL_START //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// diff --git a/src/proof/acec/CMakeLists.txt b/src/proof/acec/CMakeLists.txt new file mode 100644 index 0000000000..748a8ffb1a --- /dev/null +++ b/src/proof/acec/CMakeLists.txt @@ -0,0 +1,23 @@ +abc_libabc_add_sources( + NAME proof_acec + SOURCES + acecPolyn.c + acecSt.c + acecNorm.c + acecTree.c + acecMult.c + acecXor.c + acecBo.c + acecCl.c + acecOrder.c + acecPo.c + acec2Mult.c + acecFadds.c + acecCo.c + acecCover.c + acecRe.c + acecPa.c + acecUtil.c + acecCore.c + acecPool.c +) diff --git a/src/proof/cec/CMakeLists.txt b/src/proof/cec/CMakeLists.txt new file mode 100644 index 0000000000..d04ab9f383 --- /dev/null +++ b/src/proof/cec/CMakeLists.txt @@ -0,0 +1,24 @@ +abc_libabc_add_sources( + NAME proof_cec + SOURCES + cecSynth.c + cecSatG2.c + cecCec.c + cecPat.c + cecMan.c + cecCore.c + cecIso.c + cecCorr.c + cecSplit.c + cecClass.c + cecSim.c + cecProve.c + cecSat.c + cecChoice.c + cecSolveG.c + cecSeq.c + cecSolve.c + cecSatG.c + cecSatG3.c + cecSweep.c +) diff --git a/src/proof/cec/cecSolveG.c b/src/proof/cec/cecSolveG.c index c4b01b5093..64fcac13d9 100644 --- a/src/proof/cec/cecSolveG.c +++ b/src/proof/cec/cecSolveG.c @@ -435,7 +435,7 @@ void CecG_CnfNodeAddToSolver( Cec_ManSat_t * p, Gia_Obj_t * pObj ) void CecG_ManSatSolverRecycle( Cec_ManSat_t * p ) { int Lit; - if ( p->pSat ) + if ( p->pSat2 ) { Gia_Obj_t * pObj; int i; @@ -443,20 +443,20 @@ void CecG_ManSatSolverRecycle( Cec_ManSat_t * p ) CecG_ObjSetSatNum( p, pObj, 0 ); Vec_PtrClear( p->vUsedNodes ); // memset( p->pSatVars, 0, sizeof(int) * Gia_ManObjNumMax(p->pAigTotal) ); - sat_solver_stop( p->pSat ); + sat_solver_stop( p->pSat2 ); } - p->pSat = (struct sat_solver_t*)sat_solver_start(); + p->pSat2 = sat_solver_start(); assert( 0 <= p->pPars->SolverType && p->pPars->SolverType <= 2 ); - sat_solver_set_jftr( p->pSat, p->pPars->SolverType ); + sat_solver_set_jftr( p->pSat2, p->pPars->SolverType ); //sat_solver_setnvars( p->pSat, 1000 ); // minisat only //p->pSat->factors = ABC_CALLOC( double, p->pSat->cap ); // var 0 is not used // var 1 is reserved for const0 node - add the clause // p->nSatVars = 0; - CecG_ObjSetSatNum( p, Gia_ManConst0(p->pAig), sat_solver_addvar( p->pSat ) ); + CecG_ObjSetSatNum( p, Gia_ManConst0(p->pAig), sat_solver_addvar( p->pSat2 ) ); Lit = toLitCond( CecG_ObjSatNum( p, Gia_ManConst0(p->pAig) ), 1 ); - sat_solver_addclause( p->pSat, &Lit, 1 ); + sat_solver_addclause( p->pSat2, &Lit, 1 ); // if ( p->pPars->fPolarFlip ) // no need to normalize const0 node (bug fix by SS on 9/17/2012) // Lit = lit_neg( Lit ); diff --git a/src/proof/cec/cecSplit.c b/src/proof/cec/cecSplit.c index 34a635b88f..30168e4902 100644 --- a/src/proof/cec/cecSplit.c +++ b/src/proof/cec/cecSplit.c @@ -28,7 +28,7 @@ #ifdef ABC_USE_PTHREADS -#ifdef _WIN32 +#ifdef _MSC_VER #include "../lib/pthread.h" #else #include diff --git a/src/proof/dch/CMakeLists.txt b/src/proof/dch/CMakeLists.txt new file mode 100644 index 0000000000..4d0278534b --- /dev/null +++ b/src/proof/dch/CMakeLists.txt @@ -0,0 +1,14 @@ +abc_libabc_add_sources( + NAME proof_dch + SOURCES + dchClass.c + dchSim.c + dchCore.c + dchMan.c + dchCnf.c + dchSweep.c + dchChoice.c + dchSimSat.c + dchSat.c + dchAig.c +) diff --git a/src/proof/fra/CMakeLists.txt b/src/proof/fra/CMakeLists.txt new file mode 100644 index 0000000000..189ceca7ff --- /dev/null +++ b/src/proof/fra/CMakeLists.txt @@ -0,0 +1,21 @@ +abc_libabc_add_sources( + NAME proof_fra + SOURCES + fraSim.c + fraCore.c + fraCnf.c + fraCec.c + fraClass.c + fraLcr.c + fraPart.c + fraClaus.c + fraIndVer.c + fraSat.c + fraMan.c + fraSec.c + fraInd.c + fraClau.c + fraBmc.c + fraImp.c + fraHot.c +) diff --git a/src/proof/fra/fraLcr.c b/src/proof/fra/fraLcr.c index b9e2ccb42f..e2d4ed0f76 100644 --- a/src/proof/fra/fraLcr.c +++ b/src/proof/fra/fraLcr.c @@ -208,8 +208,8 @@ int Fra_LcrNodesAreEqual( Aig_Obj_t * pObj0, Aig_Obj_t * pObj1 ) assert( Aig_ObjIsCi(pObj0) ); assert( Aig_ObjIsCi(pObj1) ); // find the partition to which these nodes belong - nPart0 = pLcr->pInToOutPart[(long)pObj0->pNext]; - nPart1 = pLcr->pInToOutPart[(long)pObj1->pNext]; + nPart0 = pLcr->pInToOutPart[(ABC_PTRINT_T)pObj0->pNext]; + nPart1 = pLcr->pInToOutPart[(ABC_PTRINT_T)pObj1->pNext]; // if this is the result of refinement of the class created const-1 nodes // the nodes may end up in different partions - we assume them equivalent if ( nPart0 != nPart1 ) @@ -220,8 +220,8 @@ int Fra_LcrNodesAreEqual( Aig_Obj_t * pObj0, Aig_Obj_t * pObj1 ) assert( nPart0 == nPart1 ); pFraig = (Aig_Man_t *)Vec_PtrEntry( pLcr->vFraigs, nPart0 ); // get the fraig outputs - pOut0 = Aig_ManCo( pFraig, pLcr->pInToOutNum[(long)pObj0->pNext] ); - pOut1 = Aig_ManCo( pFraig, pLcr->pInToOutNum[(long)pObj1->pNext] ); + pOut0 = Aig_ManCo( pFraig, pLcr->pInToOutNum[(ABC_PTRINT_T)pObj0->pNext] ); + pOut1 = Aig_ManCo( pFraig, pLcr->pInToOutNum[(ABC_PTRINT_T)pObj1->pNext] ); return Aig_ObjFanin0(pOut0) == Aig_ObjFanin0(pOut1); } @@ -245,10 +245,10 @@ int Fra_LcrNodeIsConst( Aig_Obj_t * pObj ) int nPart; assert( Aig_ObjIsCi(pObj) ); // find the partition to which these nodes belong - nPart = pLcr->pInToOutPart[(long)pObj->pNext]; + nPart = pLcr->pInToOutPart[(ABC_PTRINT_T)pObj->pNext]; pFraig = (Aig_Man_t *)Vec_PtrEntry( pLcr->vFraigs, nPart ); // get the fraig outputs - pOut = Aig_ManCo( pFraig, pLcr->pInToOutNum[(long)pObj->pNext] ); + pOut = Aig_ManCo( pFraig, pLcr->pInToOutNum[(ABC_PTRINT_T)pObj->pNext] ); return Aig_ObjFanin0(pOut) == Aig_ManConst1(pFraig); } @@ -316,7 +316,7 @@ Aig_Man_t * Fra_LcrDeriveAigForPartitioning( Fra_Lcr_t * pLcr ) for ( c = 0; ppClass[c]; c++ ) { assert( Aig_ObjIsCi(ppClass[c]) ); - pObjPo = Aig_ManCo( pLcr->pAig, Offset+(long)ppClass[c]->pNext ); + pObjPo = Aig_ManCo( pLcr->pAig, Offset+(ABC_PTRINT_T)ppClass[c]->pNext ); pObjNew = Fra_LcrManDup_rec( pNew, pLcr->pAig, Aig_ObjFanin0(pObjPo) ); pMiter = Aig_Exor( pNew, pMiter, pObjNew ); } @@ -326,7 +326,7 @@ Aig_Man_t * Fra_LcrDeriveAigForPartitioning( Fra_Lcr_t * pLcr ) Vec_PtrForEachEntry( Aig_Obj_t *, pLcr->pCla->vClasses1, pObj, i ) { assert( Aig_ObjIsCi(pObj) ); - pObjPo = Aig_ManCo( pLcr->pAig, Offset+(long)pObj->pNext ); + pObjPo = Aig_ManCo( pLcr->pAig, Offset+(ABC_PTRINT_T)pObj->pNext ); pMiter = Fra_LcrManDup_rec( pNew, pLcr->pAig, Aig_ObjFanin0(pObjPo) ); Aig_ObjCreateCo( pNew, pMiter ); } @@ -361,17 +361,17 @@ void Fra_LcrRemapPartitions( Vec_Ptr_t * vParts, Fra_Cla_t * pCla, int * pInToOu ppClass = (Aig_Obj_t **)Vec_PtrEntry( pCla->vClasses, Out ); for ( c = 0; ppClass[c]; c++ ) { - pInToOutPart[(long)ppClass[c]->pNext] = i; - pInToOutNum[(long)ppClass[c]->pNext] = Vec_IntSize(vOneNew); - Vec_IntPush( vOneNew, Offset+(long)ppClass[c]->pNext ); + pInToOutPart[(ABC_PTRINT_T)ppClass[c]->pNext] = i; + pInToOutNum[(ABC_PTRINT_T)ppClass[c]->pNext] = Vec_IntSize(vOneNew); + Vec_IntPush( vOneNew, Offset+(ABC_PTRINT_T)ppClass[c]->pNext ); } } else { pObjPi = (Aig_Obj_t *)Vec_PtrEntry( pCla->vClasses1, Out - Vec_PtrSize(pCla->vClasses) ); - pInToOutPart[(long)pObjPi->pNext] = i; - pInToOutNum[(long)pObjPi->pNext] = Vec_IntSize(vOneNew); - Vec_IntPush( vOneNew, Offset+(long)pObjPi->pNext ); + pInToOutPart[(ABC_PTRINT_T)pObjPi->pNext] = i; + pInToOutNum[(ABC_PTRINT_T)pObjPi->pNext] = Vec_IntSize(vOneNew); + Vec_IntPush( vOneNew, Offset+(ABC_PTRINT_T)pObjPi->pNext ); } } // replace the class @@ -471,14 +471,14 @@ void Fra_ClassNodesMark( Fra_Lcr_t * p ) // mark the nodes remaining in the classes Vec_PtrForEachEntry( Aig_Obj_t *, p->pCla->vClasses1, pObj, i ) { - pObj = Aig_ManCo( p->pCla->pAig, Offset+(long)pObj->pNext ); + pObj = Aig_ManCo( p->pCla->pAig, Offset+(ABC_PTRINT_T)pObj->pNext ); pObj->fMarkA = 1; } Vec_PtrForEachEntry( Aig_Obj_t **, p->pCla->vClasses, ppClass, i ) { for ( c = 0; ppClass[c]; c++ ) { - pObj = Aig_ManCo( p->pCla->pAig, Offset+(long)ppClass[c]->pNext ); + pObj = Aig_ManCo( p->pCla->pAig, Offset+(ABC_PTRINT_T)ppClass[c]->pNext ); pObj->fMarkA = 1; } } @@ -504,14 +504,14 @@ void Fra_ClassNodesUnmark( Fra_Lcr_t * p ) // mark the nodes remaining in the classes Vec_PtrForEachEntry( Aig_Obj_t *, p->pCla->vClasses1, pObj, i ) { - pObj = Aig_ManCo( p->pCla->pAig, Offset+(long)pObj->pNext ); + pObj = Aig_ManCo( p->pCla->pAig, Offset+(ABC_PTRINT_T)pObj->pNext ); pObj->fMarkA = 0; } Vec_PtrForEachEntry( Aig_Obj_t **, p->pCla->vClasses, ppClass, i ) { for ( c = 0; ppClass[c]; c++ ) { - pObj = Aig_ManCo( p->pCla->pAig, Offset+(long)ppClass[c]->pNext ); + pObj = Aig_ManCo( p->pCla->pAig, Offset+(ABC_PTRINT_T)ppClass[c]->pNext ); pObj->fMarkA = 0; } } diff --git a/src/proof/fraig/CMakeLists.txt b/src/proof/fraig/CMakeLists.txt new file mode 100644 index 0000000000..e8179b22bf --- /dev/null +++ b/src/proof/fraig/CMakeLists.txt @@ -0,0 +1,16 @@ +abc_libabc_add_sources( + NAME proof_fraig + SOURCES + fraigNode.c + fraigFanout.c + fraigMem.c + fraigTable.c + fraigPrime.c + fraigUtil.c + fraigSat.c + fraigVec.c + fraigMan.c + fraigCanon.c + fraigApi.c + fraigFeed.c +) diff --git a/src/proof/int/CMakeLists.txt b/src/proof/int/CMakeLists.txt new file mode 100644 index 0000000000..4176fa5f03 --- /dev/null +++ b/src/proof/int/CMakeLists.txt @@ -0,0 +1,14 @@ +abc_libabc_add_sources( + NAME proof_int + SOURCES + intCtrex.c + intInter.c + intM114.c + intCore.c + intDup.c + intFrames.c + intContain.c + intCheck.c + intUtil.c + intMan.c +) diff --git a/src/proof/int2/CMakeLists.txt b/src/proof/int2/CMakeLists.txt new file mode 100644 index 0000000000..8a4972b542 --- /dev/null +++ b/src/proof/int2/CMakeLists.txt @@ -0,0 +1,8 @@ +abc_libabc_add_sources( + NAME proof_int2 + SOURCES + int2Util.c + int2Core.c + int2Refine.c + int2Bmc.c +) diff --git a/src/proof/live/CMakeLists.txt b/src/proof/live/CMakeLists.txt new file mode 100644 index 0000000000..bbe53de2bf --- /dev/null +++ b/src/proof/live/CMakeLists.txt @@ -0,0 +1,13 @@ +abc_libabc_add_sources( + NAME proof_live + SOURCES + disjunctiveMonotone.c + liveness_sim.c + kliveness.c + kLiveConstraints.c + liveness.c + monotone.c + arenaViolation.c + combination.c + ltl_parser.c +) diff --git a/src/proof/pdr/CMakeLists.txt b/src/proof/pdr/CMakeLists.txt new file mode 100644 index 0000000000..88af4b2cab --- /dev/null +++ b/src/proof/pdr/CMakeLists.txt @@ -0,0 +1,14 @@ +abc_libabc_add_sources( + NAME proof_pdr + SOURCES + pdrCore.c + pdrInv.c + pdrUtil.c + pdrTsim3.c + pdrCnf.c + pdrTsim2.c + pdrSat.c + pdrTsim.c + pdrIncr.c + pdrMan.c +) diff --git a/src/proof/ssc/CMakeLists.txt b/src/proof/ssc/CMakeLists.txt new file mode 100644 index 0000000000..2fedf0a57d --- /dev/null +++ b/src/proof/ssc/CMakeLists.txt @@ -0,0 +1,9 @@ +abc_libabc_add_sources( + NAME proof_ssc + SOURCES + sscClass.c + sscCore.c + sscSat.c + sscUtil.c + sscSim.c +) diff --git a/src/proof/ssw/CMakeLists.txt b/src/proof/ssw/CMakeLists.txt new file mode 100644 index 0000000000..21a01f5e04 --- /dev/null +++ b/src/proof/ssw/CMakeLists.txt @@ -0,0 +1,24 @@ +abc_libabc_add_sources( + NAME proof_ssw + SOURCES + sswCore.c + sswClass.c + sswSat.c + sswRarity.c + sswAig.c + sswMan.c + sswSimSat.c + sswUnique.c + sswLcorr.c + sswConstr.c + sswBmc.c + sswCnf.c + sswPart.c + sswIslands.c + sswDyn.c + sswPairs.c + sswSweep.c + sswSemi.c + sswSim.c + sswFilter.c +) diff --git a/src/sat/bmc/CMakeLists.txt b/src/sat/bmc/CMakeLists.txt new file mode 100644 index 0000000000..186d19fe9b --- /dev/null +++ b/src/sat/bmc/CMakeLists.txt @@ -0,0 +1,36 @@ +abc_libabc_add_sources( + NAME sat_bmc + SOURCES + bmcCexTools.c + bmcBmc.c + bmcCexMin2.c + bmcFault.c + bmcBmci.c + bmcGen.c + bmcBmcS.c + bmcMesh.c + bmcCexCut.c + bmcBmcG.c + bmcChain.c + bmcMulti.c + bmcICheck.c + bmcBmc2.c + bmcMaj3.c + bmcBmc3.c + bmcMaxi.c + bmcBCore.c + bmcUnroll.c + bmcCexDepth.c + bmcBmcAnd.c + bmcCexMin1.c + bmcFx.c + bmcExpand.c + bmcMaj2.c + bmcCexCare.c + bmcClp.c + bmcEco.c + bmcMaj.c + bmcLoad.c + bmcMesh2.c + bmcInse.c +) diff --git a/src/sat/bmc/bmcBmcS.c b/src/sat/bmc/bmcBmcS.c index 8bfda56ba7..039527967d 100644 --- a/src/sat/bmc/bmcBmcS.c +++ b/src/sat/bmc/bmcBmcS.c @@ -48,7 +48,7 @@ #ifdef ABC_USE_PTHREADS -#ifdef _WIN32 +#ifdef _MSC_VER #include "../lib/pthread.h" #else #include diff --git a/src/sat/bsat/CMakeLists.txt b/src/sat/bsat/CMakeLists.txt new file mode 100644 index 0000000000..4644cd669b --- /dev/null +++ b/src/sat/bsat/CMakeLists.txt @@ -0,0 +1,18 @@ +abc_libabc_add_sources( + NAME sat_bsat + SOURCES + satInterB.c + satTruth.c + satInter.c + satSolver3.c + satStore.c + satProof.c + satSolver2i.c + satTrace.c + satSolver.c + satMem.c + satInterP.c + satSolver2.c + satInterA.c + satUtil.c +) diff --git a/src/sat/bsat2/CMakeLists.txt b/src/sat/bsat2/CMakeLists.txt new file mode 100644 index 0000000000..02b87e93dd --- /dev/null +++ b/src/sat/bsat2/CMakeLists.txt @@ -0,0 +1,9 @@ +abc_libabc_add_sources( + NAME sat_bsat2 + SOURCES + System.cpp + Options.cpp + AbcApi.cpp + Solver.cpp + SimpSolver.cpp +) diff --git a/src/sat/cadical/CMakeLists.txt b/src/sat/cadical/CMakeLists.txt new file mode 100644 index 0000000000..d32a7280d2 --- /dev/null +++ b/src/sat/cadical/CMakeLists.txt @@ -0,0 +1,95 @@ +abc_libabc_add_sources( + NAME sat_cadical + SOURCES + cadical_kitten.c + cadical_random.cpp + cadical_restart.cpp + cadicalSolver.c + cadical_ccadical.cpp + cadical_extend.cpp + cadical_resources.cpp + cadical_solver.cpp + cadical_ternary.cpp + cadical_assume.cpp + cadical_transred.cpp + cadical_internal.cpp + cadical_lrattracer.cpp + cadical_vivify.cpp + cadical_minimize.cpp + cadical_compact.cpp + cadical_arena.cpp + cadical_terminal.cpp + cadical_walk.cpp + cadical_backward.cpp + cadical_lratchecker.cpp + cadical_averages.cpp + cadical_reap.cpp + cadical_version.cpp + cadical_occs.cpp + cadical_stable.cpp + cadical_lookahead.cpp + cadical_backtrack.cpp + cadical_phases.cpp + cadical_elim.cpp + cadical_propagate.cpp + cadical_analyze.cpp + cadical_instantiate.cpp + cadical_lidruptracer.cpp + cadical_probe.cpp + cadical_clause.cpp + cadical_checker.cpp + cadical_score.cpp + cadical_restore.cpp + cadical_file.cpp + cadical_subsume.cpp + cadical_external.cpp + cadical_tier.cpp + cadical_message.cpp + cadical_shrink.cpp + cadical_ipasir.cpp + cadical_limit.cpp + cadical_collect.cpp + cadical_elimfast.cpp + cadical_condition.cpp + cadical_decide.cpp + cadical_watch.cpp + cadical_drattracer.cpp + cadical_format.cpp + cadical_gates.cpp + cadical_definition.cpp + cadical_congruence.cpp + cadical_flags.cpp + cadical_constrain.cpp + cadical_stats.cpp + cadical_reduce.cpp + cadical_sweep.cpp + cadicalTest.c + cadical_bins.cpp + cadical_parse.cpp + cadical_frattracer.cpp + cadical_external_propagate.cpp + cadical_unstable.cpp + cadical_block.cpp + cadical_util.cpp + cadical_veripbtracer.cpp + cadical_profile.cpp + cadical_rephase.cpp + cadical_queue.cpp + cadical_deduplicate.cpp + cadical_ema.cpp + cadical_signal.cpp + cadical_contract.cpp + cadical_lucky.cpp + cadical_decompose.cpp + cadical_report.cpp + cadical_proof.cpp + cadical_idruptracer.cpp + cadical_solution.cpp + cadical_cover.cpp + cadical_flip.cpp + cadical_logging.cpp + cadical_options.cpp + cadical_config.cpp + cadical_factor.cpp + cadical_var.cpp +) diff --git a/src/sat/cadical/cadical.hpp b/src/sat/cadical/cadical.hpp index c9ed413328..cba7aca0c3 100644 --- a/src/sat/cadical/cadical.hpp +++ b/src/sat/cadical/cadical.hpp @@ -486,8 +486,8 @@ class Solver { // Returns // - // 0 = UNKNOWN (unit propagation did not lead to a conflict nor to a - // complete assignment, or limit reached or interrupted + // 0 = UNKNOWN (unit propagation did not lead to a conflict nor to a + // complete assignment, or limit reached or interrupted // through 'terminate') // 10 = SATISFIABLE // 20 = UNSATISFIABLE @@ -1083,6 +1083,7 @@ class Solver { #ifndef PRINTF_FORMAT #ifdef __MINGW32__ +#undef __USE_MINGW_ANSI_STDIO #define __USE_MINGW_ANSI_STDIO 1 #define PRINTF_FORMAT __MINGW_PRINTF_FORMAT #else diff --git a/src/sat/cadical/cadical_congruence.cpp b/src/sat/cadical/cadical_congruence.cpp index 8fbceee24e..14a64e6636 100644 --- a/src/sat/cadical/cadical_congruence.cpp +++ b/src/sat/cadical/cadical_congruence.cpp @@ -1215,7 +1215,7 @@ void Closure::learn_congruence_unit_falsifies_lrat_chain ( LOG (proof_chain, "produced lrat chain so far"); } } - CADICAL_assert (!proof_chain.empty ()); + CADICAL_assert (!proof_chain.empty ()); } else { LOG ("degenerated AND gate with conflict without LHS"); for (const auto &litId : g->pos_lhs_ids) { @@ -1735,9 +1735,9 @@ bool Closure::merge_literals_lrat ( internal->lrat_chain.push_back ( internal->unit_id (val_smaller < 0 ? -smaller : smaller)); internal->lrat_chain.push_back ( - internal->unit_id (val_larger < 0 ? -larger : larger)); + internal->unit_id (val_larger < 0 ? -larger : larger)); for (auto id : (val_smaller < 0 ? *smaller_chain : *larger_chain)) { - internal->lrat_chain.push_back(id); + internal->lrat_chain.push_back(id); } } internal->learn_empty_clause (); @@ -2443,7 +2443,7 @@ void Closure::update_and_gate_build_lrat_chain ( for (auto &litId : h->pos_lhs_ids) { if (litId.current_lit == g->lhs) { CADICAL_assert (extra_reasons_ulit.empty ()); - CADICAL_assert (litId.clause); + CADICAL_assert (litId.clause); LOG (litId.clause, "binary clause to push into the reason"); litId.clause = produce_rewritten_clause_lrat (litId.clause, h->lhs, remove_units); @@ -2473,7 +2473,7 @@ void Closure::update_and_gate_build_lrat_chain ( // one direction: the binary clause already exists for (auto &litId : other->pos_lhs_ids) { if (litId.current_lit == tauto->lhs) { - CADICAL_assert (litId.clause); + CADICAL_assert (litId.clause); CADICAL_assert (extra_reasons_tauto.empty ()); LOG (litId.clause, "binary clause to push into the reason"); litId.clause = produce_rewritten_clause_lrat ( @@ -2493,12 +2493,12 @@ void Closure::update_and_gate_build_lrat_chain ( litId.current_lit, tauto->lhs); if (litId.current_lit != tauto->lhs) { LOG (litId.clause, "binary clause to push into the reason"); - CADICAL_assert (litId.clause); + CADICAL_assert (litId.clause); litId.clause = produce_rewritten_clause_lrat ( litId.clause, tauto->lhs, remove_units); if (!litId.clause) // degenerated but does not know yet - continue; - CADICAL_assert (litId.clause); + continue; + CADICAL_assert (litId.clause); extra_reasons_other.push_back (litId.clause->id); } tauto->pos_lhs_ids.erase (std::remove_if (begin (tauto->pos_lhs_ids), @@ -4880,10 +4880,10 @@ void Closure::reset_extraction () { const size_t size = watchers.size (); size_t j = 0; for (size_t i = 0; i != size; ++i) { - const auto w = watchers[i]; - watchers[j] = watchers[i]; - if (!w.clause->garbage) - ++j; + const auto w = watchers[i]; + watchers[j] = watchers[i]; + if (!w.clause->garbage) + ++j; } watchers.resize(j); } @@ -5730,7 +5730,7 @@ void Closure::rewrite_ite_gate (Gate *g, int dst, int src) { lrat_chain = reasons_unit; learn_congruence_unit (cond, true); if (then_lit != lhs) { - LOG ("special case, learning %d",cond == -lhs ? -then_lit : then_lit); + LOG ("special case, learning %d",cond == -lhs ? -then_lit : then_lit); if (internal->lrat) lrat_chain = reasons_implication; learn_congruence_unit (cond == -lhs ? -then_lit : then_lit, false, true); @@ -5981,7 +5981,7 @@ void Closure::rewrite_ite_gate (Gate *g, int dst, int src) { #endif } else { CADICAL_assert (false); -#ifdef WIN32 +#if defined(WIN32) && !defined(__MINGW32__) __assume(false); #else __builtin_unreachable (); @@ -6036,7 +6036,7 @@ void Closure::rewrite_ite_gate (Gate *g, int dst, int src) { } else { LOG (g, "rewritten"); if (internal->lrat) - update_ite_flags (g), check_correct_ite_flags(g); + update_ite_flags (g), check_correct_ite_flags(g); CADICAL_assert (rhs[0] != rhs[1]); CADICAL_assert (rhs[0] != rhs[2]); CADICAL_assert (rhs[1] != rhs[2]); @@ -6053,7 +6053,7 @@ void Closure::rewrite_ite_gate (Gate *g, int dst, int src) { g->lhs = -lhs; check_ite_lrat_reasons (g); if (internal->lrat) - check_correct_ite_flags (g); + check_correct_ite_flags (g); if (h) { garbage = true; check_ite_gate_implied (g); @@ -6695,7 +6695,7 @@ void Closure::add_ite_matching_proof_chain ( unsimplified.clear (); return; } - + LOG ("normal path"); CADICAL_assert (!internal->lrat || degenerated_g_then || (g_then_id && g_neg_then_id)); diff --git a/src/sat/cadical/cadical_decompose.cpp b/src/sat/cadical/cadical_decompose.cpp index 9081321b4b..133cc0e811 100644 --- a/src/sat/cadical/cadical_decompose.cpp +++ b/src/sat/cadical/cadical_decompose.cpp @@ -712,8 +712,8 @@ bool Internal::decompose_round () { mark_substituted (idx); } - reprs_delete.free (); - dfs_delete.free (); + reprs_delete._free (); + dfs_delete._free (); erase_vector (dfs_chains); if (substituted) diff --git a/src/sat/cadical/cadical_external.cpp b/src/sat/cadical/cadical_external.cpp index 67d1f918d8..b9f225bab3 100644 --- a/src/sat/cadical/cadical_external.cpp +++ b/src/sat/cadical/cadical_external.cpp @@ -858,7 +858,7 @@ void External::check_failing () { int res = checker->solve (); if (res != 20) FATAL ("failed assumptions do not form a core"); - delete_checker.free (); + delete_checker._free (); VERBOSE (1, "checked that %zd failing assumptions form a core", assumptions.size ()); } diff --git a/src/sat/cadical/cadical_file.cpp b/src/sat/cadical/cadical_file.cpp index 98f19f752d..e96ea64a31 100644 --- a/src/sat/cadical/cadical_file.cpp +++ b/src/sat/cadical/cadical_file.cpp @@ -27,8 +27,8 @@ extern "C" { #define R_OK 4 #define W_OK 2 #define S_IFIFO _S_IFIFO -#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO) -#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) +#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO) +#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) #else diff --git a/src/sat/cadical/cadical_vivify.cpp b/src/sat/cadical/cadical_vivify.cpp index 8d99c29323..5ec6401cff 100644 --- a/src/sat/cadical/cadical_vivify.cpp +++ b/src/sat/cadical/cadical_vivify.cpp @@ -1501,7 +1501,7 @@ inline std::vector ¤t_refs_schedule (Vivifier &vivifier) { return vivifier.refs_schedule_irred; break; } -#ifdef WIN32 +#if defined(WIN32) && !defined(__MINGW32__) __assume(false); #else __builtin_unreachable (); @@ -1523,7 +1523,7 @@ inline std::vector ¤t_schedule (Vivifier &vivifier) { return vivifier.schedule_irred; break; } -#ifdef WIN32 +#if defined(WIN32) && !defined(__MINGW32__) __assume(false); #else __builtin_unreachable (); diff --git a/src/sat/cadical/inttypes.hpp b/src/sat/cadical/inttypes.hpp index 2f7cb74a4d..ff4d722785 100644 --- a/src/sat/cadical/inttypes.hpp +++ b/src/sat/cadical/inttypes.hpp @@ -18,6 +18,7 @@ #ifndef PRINTF_FORMAT #ifdef __MINGW32__ +#undef __USE_MINGW_ANSI_STDIO #define __USE_MINGW_ANSI_STDIO 1 #define PRINTF_FORMAT __MINGW_PRINTF_FORMAT #else diff --git a/src/sat/cadical/util.hpp b/src/sat/cadical/util.hpp index 3882c6ede8..4533461ac5 100644 --- a/src/sat/cadical/util.hpp +++ b/src/sat/cadical/util.hpp @@ -127,7 +127,7 @@ template struct DeferDeleteArray { DeferDeleteArray (T *t) : data (t) {} ~DeferDeleteArray () { delete[] data; } void release () { data = nullptr; } - void free () { + void _free () { delete[] data; data = nullptr; } @@ -138,7 +138,7 @@ template struct DeferDeletePtr { DeferDeletePtr (T *t) : data (t) {} ~DeferDeletePtr () { delete data; } void release () { data = nullptr; } - void free () { + void _free () { delete data; data = nullptr; } diff --git a/src/sat/cnf/CMakeLists.txt b/src/sat/cnf/CMakeLists.txt new file mode 100644 index 0000000000..040d2d3458 --- /dev/null +++ b/src/sat/cnf/CMakeLists.txt @@ -0,0 +1,13 @@ +abc_libabc_add_sources( + NAME sat_cnf + SOURCES + cnfCore.c + cnfData.c + cnfWrite.c + cnfUtil.c + cnfMap.c + cnfFast.c + cnfCut.c + cnfMan.c + cnfPost.c +) diff --git a/src/sat/csat/CMakeLists.txt b/src/sat/csat/CMakeLists.txt new file mode 100644 index 0000000000..0b61e3e482 --- /dev/null +++ b/src/sat/csat/CMakeLists.txt @@ -0,0 +1,5 @@ +abc_libabc_add_sources( + NAME sat_csat + SOURCES + csat_apis.c +) diff --git a/src/sat/glucose/CMakeLists.txt b/src/sat/glucose/CMakeLists.txt new file mode 100644 index 0000000000..22dd086649 --- /dev/null +++ b/src/sat/glucose/CMakeLists.txt @@ -0,0 +1,10 @@ +abc_libabc_add_sources( + NAME sat_glucose + SOURCES + System.cpp + Options.cpp + AbcGlucose.cpp + Glucose.cpp + SimpSolver.cpp + AbcGlucoseCmd.cpp +) diff --git a/src/sat/glucose2/CMakeLists.txt b/src/sat/glucose2/CMakeLists.txt new file mode 100644 index 0000000000..a6930eb706 --- /dev/null +++ b/src/sat/glucose2/CMakeLists.txt @@ -0,0 +1,10 @@ +abc_libabc_add_sources( + NAME sat_glucose2 + SOURCES + System2.cpp + AbcGlucoseCmd2.cpp + Glucose2.cpp + SimpSolver2.cpp + Options2.cpp + AbcGlucose2.cpp +) diff --git a/src/sat/kissat/CMakeLists.txt b/src/sat/kissat/CMakeLists.txt new file mode 100644 index 0000000000..5dcffa3fb1 --- /dev/null +++ b/src/sat/kissat/CMakeLists.txt @@ -0,0 +1,95 @@ +abc_libabc_add_sources( + NAME sat_kissat + SOURCES + tiers.c + walk.c + resolve.c + propbeyond.c + collect.c + resize.c + vivify.c + promote.c + queue.c + kitten.c + reduce.c + assign.c + analyze.c + minimize.c + kissatTest.c + allocate.c + internal.c + reorder.c + averages.c + file.c + dump.c + stack.c + learn.c + propsearch.c + preprocess.c + ifthenelse.c + kissatSolver.c + forward.c + classify.c + backtrack.c + congruence.c + eliminate.c + sweep.c + config.c + warmup.c + utilities.c + transitive.c + propdense.c + resources.c + profile.c + krite.c + arena.c + clause.c + colors.c + shrink.c + gates.c + definition.c + equivalences.c + phases.c + terminate.c + bump.c + proprobe.c + heap.c + restart.c + statistics.c + decide.c + print.c + proof.c + propinitially.c + rephase.c + check.c + dense.c + substitute.c + search.c + extend.c + sort.c + kucky.c + import.c + fastel.c + vector.c + strengthen.c + probe.c + weaken.c + ands.c + deduce.c + reluctant.c + flags.c + smooth.c + trail.c + error.c + watch.c + report.c + kimits.c + backbone.c + kptions.c + logging.c + format.c + build.c + mode.c + factor.c + compact.c +) diff --git a/src/sat/kissat/bump.c b/src/sat/kissat/bump.c index 5dc365f51b..efe3fa46b2 100644 --- a/src/sat/kissat/bump.c +++ b/src/sat/kissat/bump.c @@ -85,7 +85,7 @@ static void move_analyzed_variables_to_front_of_queue (kissat *solver) { const links *const links = solver->links; for (all_stack (unsigned, idx, solver->analyzed)) { // clang-format off - const datarank rank = { .data = idx, .rank = links[idx].stamp }; + const datarank rank = { /*.data = */idx, /*.rank = */links[idx].stamp }; // c++20 only // clang-format on PUSH_STACK (solver->ranks, rank); } diff --git a/src/sat/kissat/colors.c b/src/sat/kissat/colors.c index f45260b297..7c41fba617 100644 --- a/src/sat/kissat/colors.c +++ b/src/sat/kissat/colors.c @@ -1,6 +1,7 @@ #include "colors.h" -#ifdef WIN32 +#if defined(WIN32) && !defined(__MINGW32__) +#include #define isatty _isatty #else #include diff --git a/src/sat/kissat/congruence.c b/src/sat/kissat/congruence.c index 221f6a13a0..364e35d44f 100644 --- a/src/sat/kissat/congruence.c +++ b/src/sat/kissat/congruence.c @@ -846,7 +846,7 @@ static void add_binary_clause (closure *closure, unsigned a, unsigned b) { kissat_new_binary_clause (solver, a, b); else { kissat_new_unwatched_binary_clause (solver, a, b); - litpair litpair = {.lits = {a < b ? a : b, a < b ? b : a}}; + litpair litpair = {/*.lits = */{a < b ? a : b, a < b ? b : a}}; // c++20 only PUSH_STACK (closure->binaries, litpair); } } @@ -2500,7 +2500,7 @@ static bool indexed_binary (closure *closure, unsigned lit, SWAP (unsigned, lit, other); if (lit > other) SWAP (unsigned, lit, other); - binary_clause binary = {.lits = {lit, other}}; + binary_clause binary = {/*.lits = */{lit, other}}; // c++20 only const unsigned hash = hash_binary (closure, &binary); const size_t size = bintab->size; const size_t size2 = bintab->size2; @@ -2986,7 +2986,7 @@ static void index_binary (closure *closure, unsigned lit, unsigned other) { KISSAT_assert (lit < other); binary_hash_table *bintab = &closure->bintab; KISSAT_assert (!binaries_hash_table_is_full (bintab)); - binary_clause binary = {.lits = {lit, other}}; + binary_clause binary = {/*.lits = */{lit, other}}; // c++20 only const unsigned hash = hash_binary (closure, &binary); const size_t size = bintab->size; const size_t size2 = bintab->size2; @@ -3416,10 +3416,10 @@ static void copy_conditional_equivalences (kissat *solver, unsigned lit, KISSAT_assert (second != INVALID_LIT); litpair pair; if (first < second) - pair = (litpair){.lits = {first, second}}; + pair.lits[0] = first, pair.lits[1] = second; else { KISSAT_assert (second < first); - pair = (litpair){.lits = {second, first}}; + pair.lits[0] = second, pair.lits[1] = first; } LOG ("literal %s conditional binary clause %s %s", LOGLIT (lit), LOGLIT (first), LOGLIT (second)); @@ -3491,13 +3491,13 @@ static void search_condeq (closure *closure, unsigned lit, unsigned pos_lit, KISSAT_assert (first < second); check_ternary (closure, lit, first, NOT (second)); check_ternary (closure, lit, NOT (first), second); - litpair equivalence = {.lits = {first, second}}; + litpair equivalence = {/*.lits = */{first, second}}; // c++20 only PUSH_STACK (*condeq, equivalence); if (NEGATED (second)) { - litpair inverse_equivalence = {.lits = {NOT (second), NOT (first)}}; + litpair inverse_equivalence = {/*.lits = */{NOT (second), NOT (first)}}; // c++20 only PUSH_STACK (*condeq, inverse_equivalence); } else { - litpair inverse_equivalence = {.lits = {second, first}}; + litpair inverse_equivalence = {/*.lits = */{second, first}}; // c++20 only PUSH_STACK (*condeq, inverse_equivalence); } } @@ -4549,7 +4549,7 @@ static void forward_subsume_matching_clauses (closure *closure) { } const reference ref = kissat_reference_clause (solver, c); KISSAT_assert (size <= UINT_MAX); - refsize refsize = {.ref = ref, .size = (unsigned)size}; + refsize refsize = {/*.ref = */ref, /*.size = */(unsigned)size}; // c++20 only PUSH_STACK (candidates, refsize); } DEALLOC (matchable, VARS); diff --git a/src/sat/kissat/dense.c b/src/sat/kissat/dense.c index 65c668cbcc..c5273e4807 100644 --- a/src/sat/kissat/dense.c +++ b/src/sat/kissat/dense.c @@ -60,7 +60,7 @@ static void flush_large_watches (kissat *solver, litpairs *irredundant) { if (irredundant) { const unsigned other = watch.binary.lit; if (lit < other) { - const litpair litpair = {.lits = {lit, other}}; + const litpair litpair = {/*.lits = */{lit, other}}; // c++20 only PUSH_STACK (*irredundant, litpair); } } else diff --git a/src/sat/kissat/file.c b/src/sat/kissat/file.c index e4486783d2..d9564e696e 100644 --- a/src/sat/kissat/file.c +++ b/src/sat/kissat/file.c @@ -5,14 +5,19 @@ #include #include #include -#include + #include +#include #ifdef WIN32 +#include #define unlink _unlink #define access _access #define R_OK 4 #define W_OK 2 +#ifndef S_ISDIR +# define S_ISDIR(mode) (((mode) & _S_IFMT) == _S_IFDIR) +#endif #else #include #endif diff --git a/src/sat/kissat/kitten.c b/src/sat/kissat/kitten.c index ea2e7f3607..9c08d73c6d 100644 --- a/src/sat/kissat/kitten.c +++ b/src/sat/kissat/kitten.c @@ -1892,7 +1892,7 @@ unsigned kitten_compute_clausal_core (kitten *kitten, if (reason_ref == INVALID) { LOG ("assumptions mutually inconsistent"); - + // goto DONE; if (learned_ptr) *learned_ptr = learned; @@ -1907,7 +1907,7 @@ unsigned kitten_compute_clausal_core (kitten *kitten, return original; - + } } @@ -2412,7 +2412,7 @@ static inline void print_lit (line *line, int lit) { static void print_witness (kitten *kitten, int max_var) { KISSAT_assert (max_var >= 0); - line line = {.size = 0}; + line line = {/*.size = */0}; // c++20 only const size_t parsed_lits = 2 * (size_t) max_var; for (size_t ulit = 0; ulit < parsed_lits; ulit += 2) { const value sign = kitten_value (kitten, ulit); diff --git a/src/sat/kissat/proplit.h b/src/sat/kissat/proplit.h index be0632d0cb..203c1eb398 100644 --- a/src/sat/kissat/proplit.h +++ b/src/sat/kissat/proplit.h @@ -8,7 +8,7 @@ static inline void kissat_watch_large_delayed (kissat *solver, while (d != end_delayed) { const unsigned lit = *d++; KISSAT_assert (d != end_delayed); - const watch watch = {.raw = *d++}; + const watch watch = {/*.raw =*/ *d++}; // c++20 only KISSAT_assert (!watch.type.binary); KISSAT_assert (lit < LITS); watches *const lit_watches = all_watches + lit; diff --git a/src/sat/kissat/sweep.c b/src/sat/kissat/sweep.c index 42420cc541..0e56669e5f 100644 --- a/src/sat/kissat/sweep.c +++ b/src/sat/kissat/sweep.c @@ -877,8 +877,8 @@ static void substitute_connected_clauses (sweeper *sweeper, unsigned lit, REMOVE_CHECKER_BINARY (lit, other); DELETE_BINARY_FROM_PROOF (lit, other); PUSH_STACK (*delayed, head.raw); - watch src = {.raw = head.raw}; - watch dst = {.raw = head.raw}; + watch src = {/*.raw = */head.raw}; // c++20 only + watch dst = {/*.raw = */head.raw}; // c++20 only src.binary.lit = lit; dst.binary.lit = repr; watches *other_watches = &WATCHES (other); @@ -970,7 +970,7 @@ static void substitute_connected_clauses (sweeper *sweeper, unsigned lit, LOGLIT (second)); KISSAT_assert (first == repr || second == repr); const unsigned other = first ^ second ^ repr; - const watch src = {.raw = head.raw}; + const watch src = {/*.raw = */head.raw}; // c++20 only watch dst = kissat_binary_watch (repr); watches *other_watches = &WATCHES (other); kissat_substitute_large_watch (solver, other_watches, src, dst); @@ -1029,7 +1029,7 @@ static void substitute_connected_clauses (sweeper *sweeper, unsigned lit, const unsigned *const begin_delayed = BEGIN_STACK (*delayed); const unsigned *const end_delayed = END_STACK (*delayed); for (const unsigned *p = begin_delayed; p != end_delayed; p++) { - const watch head = {.raw = *p}; + const watch head = {/*.raw = */*p}; // c++20 only watches *repr_watches = &WATCHES (repr); PUSH_WATCHES (*repr_watches, head); } diff --git a/src/sat/kissat/walk.c b/src/sat/kissat/walk.c index 72ce38a6c3..18ebdd6792 100644 --- a/src/sat/kissat/walk.c +++ b/src/sat/kissat/walk.c @@ -28,7 +28,7 @@ struct tagged { static inline tagged make_tagged (bool binary, unsigned ref) { KISSAT_assert (ref <= MAX_WALK_REF); - tagged res = {.ref = ref, .binary = binary}; + tagged res = {/*.ref = */ref, /*.binary = */binary}; // c++20 only return res; } diff --git a/src/sat/kissat/watch.c b/src/sat/kissat/watch.c index 78f9a69ce7..d444f18c26 100644 --- a/src/sat/kissat/watch.c +++ b/src/sat/kissat/watch.c @@ -36,7 +36,7 @@ void kissat_remove_binary_watch (kissat *solver, watches *watches, KISSAT_assert (begin + 1 <= end); watches->end -= 1; #endif - const watch empty = {.raw = INVALID_VECTOR_ELEMENT}; + const watch empty = {/*.raw = */INVALID_VECTOR_ELEMENT}; // c++20 only end[-1] = empty; KISSAT_assert (solver->vectors.usable < MAX_SECTOR - 1); solver->vectors.usable += 1; @@ -73,7 +73,7 @@ void kissat_remove_blocking_watch (kissat *solver, watches *watches, KISSAT_assert (begin + 2 <= end); watches->end -= 2; #endif - const watch empty = {.raw = INVALID_VECTOR_ELEMENT}; + const watch empty = {/*.raw = */INVALID_VECTOR_ELEMENT}; // c++20 only end[-2] = end[-1] = empty; KISSAT_assert (solver->vectors.usable < MAX_SECTOR - 2); solver->vectors.usable += 2; diff --git a/src/sat/msat/CMakeLists.txt b/src/sat/msat/CMakeLists.txt new file mode 100644 index 0000000000..79fe7a0aef --- /dev/null +++ b/src/sat/msat/CMakeLists.txt @@ -0,0 +1,17 @@ +abc_libabc_add_sources( + NAME sat_msat + SOURCES + msatSolverIo.c + msatClauseVec.c + msatActivity.c + msatMem.c + msatClause.c + msatSort.c + msatSolverApi.c + msatSolverSearch.c + msatSolverCore.c + msatOrderH.c + msatVec.c + msatRead.c + msatQueue.c +) diff --git a/src/sat/msat/msatSolverSearch.c b/src/sat/msat/msatSolverSearch.c index 2eda5038d6..a553a25456 100644 --- a/src/sat/msat/msatSolverSearch.c +++ b/src/sat/msat/msatSolverSearch.c @@ -52,7 +52,7 @@ int Msat_SolverAssume( Msat_Solver_t * p, Msat_Lit_t Lit ) { assert( Msat_QueueReadSize(p->pQueue) == 0 ); if ( p->fVerbose ) - printf(L_IND "assume(" L_LIT ")\n", L_ind, L_lit(Lit)); + printf(L_IND"assume(" L_LIT")\n", L_ind, L_lit(Lit)); Msat_IntVecPush( p->vTrailLim, Msat_IntVecReadSize(p->vTrail) ); // assert( Msat_IntVecReadSize(p->vTrailLim) <= Msat_IntVecReadSize(p->vTrail) + 1 ); // assert( Msat_IntVecReadSize( p->vTrailLim ) < p->nVars ); @@ -83,7 +83,7 @@ void Msat_SolverUndoOne( Msat_Solver_t * p ) Msat_OrderVarUnassigned( p->pOrder, Var ); if ( p->fVerbose ) - printf(L_IND "unbind(" L_LIT")\n", L_ind, L_lit(Lit)); + printf(L_IND"unbind(" L_LIT")\n", L_ind, L_lit(Lit)); } /**Function************************************************************* @@ -107,7 +107,7 @@ void Msat_SolverCancel( Msat_Solver_t * p ) { Msat_Lit_t Lit; Lit = Msat_IntVecReadEntry( p->vTrail, Msat_IntVecReadEntryLast(p->vTrailLim) ); - printf(L_IND "cancel(" L_LIT ")\n", L_ind, L_lit(Lit)); + printf(L_IND"cancel(" L_LIT")\n", L_ind, L_lit(Lit)); } } for ( c = Msat_IntVecReadSize(p->vTrail) - Msat_IntVecPop( p->vTrailLim ); c != 0; c-- ) @@ -188,7 +188,7 @@ int Msat_SolverEnqueue( Msat_Solver_t * p, Msat_Lit_t Lit, Msat_Clause_t * pC ) if ( p->fVerbose ) { // printf(L_IND"bind("L_LIT")\n", L_ind, L_lit(Lit)); - printf(L_IND "bind(" L_LIT ") ", L_ind, L_lit(Lit)); + printf(L_IND"bind(" L_LIT") ", L_ind, L_lit(Lit)); Msat_ClausePrintSymbols( pC ); } p->pAssigns[Var] = Lit; diff --git a/src/sat/psat/CMakeLists.txt b/src/sat/psat/CMakeLists.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/sat/satoko/CMakeLists.txt b/src/sat/satoko/CMakeLists.txt new file mode 100644 index 0000000000..3341a6f9c1 --- /dev/null +++ b/src/sat/satoko/CMakeLists.txt @@ -0,0 +1,7 @@ +abc_libabc_add_sources( + NAME sat_satoko + SOURCES + solver_api.c + solver.c + cnf_reader.c +) diff --git a/src/sat/xsat/CMakeLists.txt b/src/sat/xsat/CMakeLists.txt new file mode 100644 index 0000000000..a027e76ffe --- /dev/null +++ b/src/sat/xsat/CMakeLists.txt @@ -0,0 +1,7 @@ +abc_libabc_add_sources( + NAME sat_xsat + SOURCES + xsatSolver.c + xsatSolverAPI.c + xsatCnfReader.c +) diff --git a/test/gia/CMakeLists.txt b/test/gia/CMakeLists.txt index c9022dc8c0..034fe3b9b7 100644 --- a/test/gia/CMakeLists.txt +++ b/test/gia/CMakeLists.txt @@ -1,11 +1,15 @@ +if(ABC_USE_NAMESPACE) + set_source_files_properties(gia_test.cc PROPERTIES LANGUAGE CXX) +endif() + add_executable(gia_test gia_test.cc) -target_link_libraries(gia_test - gtest - gtest_main +target_compile_options(gia_test PUBLIC ${GTEST_CFLAGS}) +target_link_libraries(gia_test PUBLIC libabc + ${GTEST_LINK_LIBRARIES} ) gtest_discover_tests(gia_test - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) \ No newline at end of file + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) diff --git a/test/gia/gia_test.cc b/test/gia/gia_test.cc index a6b288f791..ae88c34607 100644 --- a/test/gia/gia_test.cc +++ b/test/gia/gia_test.cc @@ -1,4 +1,4 @@ -#include "gtest/gtest.h" +#include #include "aig/gia/gia.h" diff --git a/tools/clang_toolchain.cmake b/tools/clang_toolchain.cmake new file mode 100644 index 0000000000..4b167b3de7 --- /dev/null +++ b/tools/clang_toolchain.cmake @@ -0,0 +1,13 @@ +set(CMAKE_ASM_COMPILER "clang") +set(CMAKE_ASM-ATT_COMPILER "clang") +set(CMAKE_C_COMPILER "clang") +set(CMAKE_CXX_COMPILER "clang++") +set(CMAKE_Fortran_COMPILER "gfortran") +set(CMAKE_AR + ar + CACHE FILEPATH "Archive manager" FORCE +) +set(CMAKE_RANLIB + ranlib + CACHE FILEPATH "Archive index generator" FORCE +) diff --git a/tools/mk-cmakelists.py b/tools/mk-cmakelists.py new file mode 100644 index 0000000000..ad2a7e2626 --- /dev/null +++ b/tools/mk-cmakelists.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +import os +from pathlib import Path + +s = """abc_libabc_add_sources( + NAME {NAME} + SOURCES +{SOURCES} +) +""" +for root, _, files in os.walk("src"): + if "module.make" not in files: + continue + if "main" in root: + continue + r = Path(root).relative_to("src") + makefile = open(Path(root)/"module.make").read() + target = str(r).replace("/","_") + sources = list(filter(lambda s: s in makefile, files)) + if sources: + sources_str = "\n".join(" {}".format(source) for source in sources) + txt = s.format(NAME=target, SOURCES=sources_str) + else: + txt = "" + cmake = Path(root) / "CMakeLists.txt" + cmake.open("w").write(txt) diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000000..fe931bfa77 --- /dev/null +++ b/tox.ini @@ -0,0 +1,115 @@ +[tox] +envlist = abc,demo,soname,tests,lint,base,libs,clang,ctest,grind,ctestwin,cclean,clean +skip_missing_interpreters = true +skipsdist = true + +[base] +setenv = + CPUS={env:CPUS:8} + {abc,demo,soname,tests}: CFLAGS={env:CFLAGS:-O2 -g -DNDEBUG} + {abc,demo,soname,tests}: CXXFLAGS={env:CXXFLAGS:-O2 -g -DNDEBUG} + {abc,demo,soname,tests}: LDFLAGS={env:LDFLAGS:-O2 -g -DNDEBUG} + {base,libs,clang,ctest}: ABC_USE_NAMESPACE={env:ABC_USE_NAMESPACE:xxxx} + {base,libs,clang,ctest}: ABC_USE_SONAME={env:ABC_USE_SONAME:ON} + {base,libs,clang,ctest}: ABC_USE_PIC={env:ABC_USE_PIC:ON} + {base,libs,clang,ctest}: VENDOR_GTEST={env:VENDOR_GTEST:OFF} + {base,libs,clang,ctest}: LLVM_VER_DIR = {env:LLVM_VER_DIR:llvm-15} + {base,libs,clang}: BUILD_TYPE={env:BUILD_TYPE:Release} + {ctest,ctestwin}: BUILD_TYPE={env:BUILD_TYPE:Debug} + base: PREFIX={env:PREFIX:staging} + libs: PREFIX={env:PREFIX:../staging} + +passenv = + CC + CXX + LD + AR + NM + PYTHON + DISPLAY + XAUTHORITY + HOME + USERNAME + USER + CI + XDG_* + GITHUB* + PIP_DOWNLOAD_CACHE + +[testenv] +envdir = {toxinidir}/.env +skip_install = true + +description = + abc: Makefile build of abc binary and static library + demo: Makeflie build of demo app (requires CC, CXX set in environment or on cmd line) + soname: Makefile build with lib .so name and version + tests: Makefile test target + lint: Run cpplint on base/main and lib/ dirs + base: CMake shared libs with LTO and external/system googletest + libs: CMake shared libs with LTO and vendored googletest + clang: CMake with clang source-based coverage + ctest: CMake Ninja default with namespace=xxxx and vendored googletest + grind: Run valgrind memory checks after CMake Debug build + ctestwin: Ctest with Windows default generator and related options + cclean: Clean cmake build cruft + clean: Clean Makefile build cruft + +setenv = + {abc,tests}: {[base]setenv} + {base,libs,clang,ctest,ctestwin}: {[base]setenv} + +passenv = + {[base]passenv} + +allowlist_externals = + {abc,demo,soname,tests,lint,base,libs,clang,ctest,grind,cclean,clean}: bash + {abc,demo,soname,tests}: make + +changedir = + {base,libs,clang}: {toxinidir}/build + +deps = + {abc,demo,soname,tests,lint,base,libs,clang,ctest,grind,ctestwin}: pip>=21.3 + {abc,demo,soname,tests}: this-cli + {base,libs,clang,ctest,grind,ctestwin}: cmake + {base,libs,clang,ctest,grind,ctestwin}: ninja + lint: cpplint + grind: ValgrindCI + clang: https://github.com/sarnold/lcov-to-cobertura-xml/releases/download/2.0.3/lcov_cobertura-2.0.3-py3-none-any.whl + +commands_pre = + {base,libs,clang}: cmake -E make_directory {toxinidir}/build + +commands = + abc: make ABC_USE_PIC=1 {posargs} abc + abc: make {posargs} libabc.a + soname: make ABC_USE_PIC=1 ABC_USE_SONAME=1 {posargs} lib + tests: make test + # demo requires CC, CXX set in environment or on cmd line + # eg: CC=gcc CXX=g++ tox -e demo + demo: bash -c '{env:CC} {posargs} -Wall -c src/demo.c -o demo.o' + demo: bash -c '{env:CXX} -o demo demo.o libabc.a -lm -ldl -lreadline -lpthread' + demo: bash -c './demo i10.aig' + {abc,soname,tests}: bash -c 'ls -lh *abc* || true' + base: cmake -G {posargs:"Ninja"} -DCMAKE_BUILD_TYPE={env:BUILD_TYPE} -DABC_USE_NAMESPACE={env:ABC_USE_NAMESPACE} -DABC_ENABLE_LTO=ON -DBUILD_SHARED_LIBS=ON -DABC_USE_SONAME={env:ABC_USE_SONAME} -DCMAKE_INSTALL_PREFIX={env:PREFIX} .. + base: cmake --build . --target abc -j {env:CPUS} + libs: cmake -G {posargs:"Unix Makefiles"} -DCMAKE_BUILD_TYPE={env:BUILD_TYPE} -DVENDOR_GTEST={env:VENDOR_GTEST} -DABC_USE_NAMESPACE={env:ABC_USE_NAMESPACE} -DABC_ENABLE_LTO=ON -DBUILD_SHARED_LIBS=ON -DABC_USE_SONAME={env:ABC_USE_SONAME} -DCMAKE_INSTALL_PREFIX={env:PREFIX} .. + clang: cmake -G {posargs:"Unix Makefiles"} -DABC_USE_NAMESPACE={env:ABC_USE_NAMESPACE} -DCOVERAGE_BUILD=ON -DCOVERAGE_TEXT=ON -DBUILD_SHARED_LIBS=OFF .. + {libs}: cmake --build . -j {env:CPUS} + {clang}: cmake --build . --target coverage -j {env:CPUS} + {libs,clang}: ctest -V -C {env:BUILD_TYPE} --test-dir ./ + clang: lcov_cobertura {toxinidir}/build/coverage/lcov.info --base-dir {toxinidir}/src --output coverage.xml + {base,libs}: cmake --build . --target install + {base,libs}: bash -c 'find $PREFIX/ -type f -name \*abc\* -o -name demo | xargs ls -lh' + ctest: ctest -j {env:CPUS} --build-generator {posargs:"Ninja"} --build-and-test . build --build-options -DVENDOR_GTEST=ON -DABC_USE_NAMESPACE={env:ABC_USE_NAMESPACE} -DABC_SKIP_EXE=ON -DCMAKE_BUILD_TYPE={env:BUILD_TYPE} --test-command ctest -C {env:BUILD_TYPE} --rerun-failed --output-on-failure -V + ctestwin: ctest --build-generator {posargs:"Visual Studio 16 2019"} --build-and-test . build --build-options -DVENDOR_GTEST=ON -DBUILD_SHARED_LIBS=ON -DABC_USE_NO_PTHREADS=ON -DABC_USE_NO_READLINE=ON -DCMAKE_BUILD_TYPE={env:BUILD_TYPE} --test-command ctest -C {env:BUILD_TYPE} --rerun-failed --output-on-failure -V + ctest: bash -c 'ls -lh build/*abc* || true' + lint: bash -c 'cpplint --output=gsed {toxinidir}/src/base/main/* {toxinidir}/lib/*' + grind: bash -c 'cmake -G {posargs:"Ninja"} -S . -B build -DCMAKE_BUILD_TYPE=Debug' + grind: bash -c 'cmake --build build --target abc -j $CPUS' + grind: bash -c 'valgrind --tool=memcheck --xml=yes --xml-file=abc_check.xml --leak-check=full --show-leak-kinds=definite,possible --error-exitcode=127 ./build/src/base/main/abc "-c" "r i10.aig; b; ps; b; rw -l; rw -lz; b; rw -lz; b; ps; cec"' + grind: valgrind-ci abc_check.xml --number-of-errors + grind: valgrind-ci abc_check.xml --summary + cclean: bash -c 'rm -rf build/ *.xml *.blif *.profraw staging/' + clean: bash -c 'make clean && rm -f demo'