Skip to content

bug fix: allow (as intended) CMake specified VERILATOR_ROOT #93

bug fix: allow (as intended) CMake specified VERILATOR_ROOT

bug fix: allow (as intended) CMake specified VERILATOR_ROOT #93

Workflow file for this run

name: CI
on:
push:
branches:
- master
tags:
- v*
pull_request:
branches:
- master
env:
BUILD_DIR: build
INSTALL_DIR: installed
jobs:
requirements:
strategy:
matrix:
config:
- {name: "Ubuntu-20.04-Release", os: ubuntu-20.04, python: "3.9", cmakegen: "Release", llvm: "x86_64-linux-gnu-ubuntu-18.04", llvm_prefix: "clang+llvm", llvm_version: "13.0.1", llvm_postfix: "-", llvm-ext: "tar.xz", unpack: "tar xf", conan: "1.59.0", packages: "libboost-filesystem-dev cmake make perl g++ gdb libfl2 libfl-dev zlib1g zlib1g-dev ccache numactl perl-doc autoconf flex bison"}
#- {name: "Ubuntu-22.04-Release", os: ubuntu-22.04, python: "3.9", cmakegen: "Release", verilator: "v4.228", llvm: "src", llvm_prefix: "llvm-project", llvm_version: "13.0.1", llvm_postfix: ".", llvm-ext: "tar.xz", unpack: "tar xf", conan: "1.59.0", packages: "libboost-filesystem-dev cmake make perl g++ gdb libfl2 libfl-dev zlib1g zlib1g-dev ccache numactl perl-doc autoconf flex bison libncurses5"}
verilator: ["v4.202", "v4.204", "v4.228"]
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.name }}-verilator_${{ matrix.verilator }}_requirements
steps:
- uses: actions/cache@v3
id: cache-llvm
with:
path: ${{runner.workspace}}/llvm
key: ${{ matrix.config.name }}-${{ matrix.config.llvm_prefix }}_${{ matrix.config.llvm_version }}_${{ matrix.config.llvm }}
restore-keys: |
${{ matrix.config.name }}-${{ matrix.config.llvm_prefix }}_${{ matrix.config.llvm_version }}_${{ matrix.config.llvm }}
- uses: actions/cache@v3
id: cache-verilator
with:
path: ${{runner.workspace}}/verilator
key: ${{ matrix.config.name }}-verilator_${{ matrix.verilator }}
restore-keys: |
${{ matrix.config.name }}-verilator_${{ matrix.verilator }}
- name: Requirements (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get install ${{ matrix.config.packages }}
- if: ${{ steps.cache-llvm.outputs.cache-hit != 'true' }}
name: Requirements LLVM+Clang
working-directory: ${{runner.workspace}}
shell: bash
run: |
LLVM_NAME="${{ matrix.config.llvm_prefix }}-${{ matrix.config.llvm_version }}${{ matrix.config.llvm_postfix }}${{ matrix.config.llvm }}"
LLVM_SOURCE="https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ matrix.config.llvm_version }}"
wget -nv --show-progress ${LLVM_SOURCE}/${LLVM_NAME}.${{ matrix.config.llvm-ext }}
${{ matrix.config.unpack }} ${LLVM_NAME}.${{ matrix.config.llvm-ext }}
if [[ "${{ matrix.config.llvm }}" = "src" ]]
then
cmake -S ${LLVM_NAME}/llvm -B /tmp/llvm-build -D CMAKE_BUILD_TYPE=${{ matrix.config.cmakegen }} -D LLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -D CMAKE_INSTALL_PREFIX=${{runner.workspace}}/llvm
cmake --build /tmp/llvm-build --parallel $(nproc) --target install
else
mv ${LLVM_NAME} ${{runner.workspace}}/llvm
fi
- name: Check (cached) Clang
continue-on-error: false
shell: bash
working-directory: ${{runner.workspace}}
run: ${{runner.workspace}}/llvm/bin/clang --version
- if: ${{ steps.cache-verilator.outputs.cache-hit != 'true' }}
name: Requirements Verilator
working-directory: ${{runner.workspace}}
shell: bash
run: |
sudo apt-get install ${{ matrix.config.packages }}
VERILATOR_SOURCE="https://github.com/verilator/verilator.git"
git clone ${VERILATOR_SOURCE} ${{runner.workspace}}/verilator-src
cd ${{runner.workspace}}/verilator-src
git checkout ${{ matrix.verilator }}
autoconf
./configure --prefix ${{runner.workspace}}/verilator
make -j $(nproc)
make install
- name: Check (cached) Verilator
continue-on-error: false
shell: bash
working-directory: ${{runner.workspace}}
run: ${{runner.workspace}}/verilator/bin/verilator --version
build:
strategy:
matrix:
config:
- {name: "Ubuntu-20.04-Release", os: ubuntu-20.04, python: "3.9", cmakegen: "Release", llvm: "x86_64-linux-gnu-ubuntu-18.04", llvm_prefix: "clang+llvm", llvm_version: "13.0.1", llvm_postfix: "-", llvm-ext: "tar.xz", unpack: "tar xf", conan: "1.59.0", packages: "libboost-filesystem-dev cmake make perl g++ gdb libfl2 libfl-dev zlib1g zlib1g-dev ccache numactl perl-doc autoconf flex bison"}
#- {name: "Ubuntu-22.04-Release", os: ubuntu-22.04, python: "3.9", cmakegen: "Release", verilator: "v4.228", llvm: "src", llvm_prefix: "llvm-project", llvm_version: "13.0.1", llvm_postfix: ".", llvm-ext: "tar.xz", unpack: "tar xf", conan: "1.59.0", packages: "libboost-filesystem-dev cmake make perl g++ gdb libfl2 libfl-dev zlib1g zlib1g-dev ccache numactl perl-doc autoconf flex bison libncurses5"}
verilator: ["v4.202", "v4.204", "v4.228"]
needs: requirements
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.name }}-verilator_${{ matrix.verilator }}_build
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Requirements (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get install ${{ matrix.config.packages }}
- name: Cache (LLVM)
uses: actions/cache@v3
id: cache-llvm
with:
path: ${{runner.workspace}}/llvm
key: ${{ matrix.config.name }}-${{ matrix.config.llvm_prefix }}_${{ matrix.config.llvm_version }}_${{ matrix.config.llvm }}
restore-keys: |
${{ matrix.config.name }}-${{ matrix.config.llvm_prefix }}_${{ matrix.config.llvm_version }}_${{ matrix.config.llvm }}
- name: Cache (Verilator)
uses: actions/cache@v3
id: cache-verilator
with:
path: ${{runner.workspace}}/verilator
key: ${{ matrix.config.name }}-verilator_${{ matrix.verilator }}
restore-keys: |
${{ matrix.config.name }}-verilator_${{ matrix.verilator }}
- name: Cache (Conan)
uses: actions/cache@v3
id: cache-conan
with:
path: ${HOME}/.conan
key: ${{ matrix.config.name }}-conan_${{ matrix.config.conan }}
restore-keys: |
${{ matrix.config.name }}-conan_${{ matrix.config.conan }}
- name: Check (cached) Verilator
continue-on-error: false
shell: bash
working-directory: ${{runner.workspace}}
run: ${{runner.workspace}}/verilator/bin/verilator --version
- name: Check (cached) Clang
continue-on-error: false
shell: bash
working-directory: ${{runner.workspace}}
run: ${{runner.workspace}}/llvm/bin/clang --version
- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}
run: |
export VERILATOR_ROOT=${{runner.workspace}}/verilator
export LLVM_DIR=${{runner.workspace}}/llvm
cmake -S ${GITHUB_WORKSPACE} -B ${BUILD_DIR} -D CMAKE_BUILD_TYPE=${{ matrix.config.cmakegen }} -D CMAKE_INSTALL_PREFIX=${INSTALL_DIR}
- name: Build
working-directory: ${{runner.workspace}}
shell: bash
run: cmake --build ${BUILD_DIR} --config ${{ matrix.config.cmakegen }} --parallel $(nproc)
- name: Install
working-directory: ${{runner.workspace}}
shell: bash
run: cmake --install ${BUILD_DIR} --config ${{ matrix.config.cmakegen }}
- name: (CTest) Requirements (Linux) Python+Conan
if: runner.os == 'Linux'
working-directory: ${{runner.workspace}}
shell: bash
run: |
pip install --force-reinstall "conan==${{ matrix.config.conan }}"
if [[ $(conan --version | grep 'version 2.') ]]
then
conan profile detect
else
conan user
if ! [[ $(conan profile list) = *default* ]]
then
conan profile new default --detect
fi
conan profile update settings.compiler.libcxx=libstdc++11 default
fi
- name: (CTest) Configure Build Environment
shell: bash
working-directory: ${{runner.workspace}}
run: |
export VERILATOR_ROOT=${{runner.workspace}}/verilator
export LLVM_DIR=${{runner.workspace}}/llvm
cmake -S ${GITHUB_WORKSPACE} -B ${BUILD_DIR} -D CMAKE_BUILD_TYPE=${{ matrix.config.cmakegen }} -D CMAKE_INSTALL_PREFIX=${INSTALL_DIR} -D BUILD_TESTING=On
- name: (CTest) Build Environment
shell: bash
working-directory: ${{runner.workspace}}
run: |
cmake --build ${BUILD_DIR} --config ${{ matrix.config.cmakegen }} --parallel $(nproc)
cd ${BUILD_DIR}
ctest -C ${{ matrix.config.cmakegen }} --parallel $(nproc) --rerun-failed --output-on-failure
cat Testing/Temporary/LastTest.log
cat Testing/Temporary/CTestCostData.txt
- name: (CTest) Pack Test Artifacts on Failure
if: ${{ failure() }}
run: tar -C ${{runner.workspace}} -czvf ${{runner.workspace}}/vrtlmod-failed-test.tar.gz ${{runner.workspace}}/${BUILD_DIR}/Testing
- name: (CTest) Upload Artifacts on Failure
uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: vrtlmod-failed-test-${{matrix.config.name}}.tar.gz
path: ${{runner.workspace}}/vrtlmod-failed-test.tar.gz
if-no-files-found: error
retention-days: 15
- name: Compress Compiled System
if: runner.os == 'Linux'
run: tar -C ${{runner.workspace}} -czvf ${{runner.workspace}}/vrtlmod.tar.gz ${INSTALL_DIR}
- name: Upload Compiled System
if: runner.os == 'Linux'
uses: actions/upload-artifact@v2
with:
name: vrtlmod-${{matrix.config.name}}-verilator_${{ matrix.verilator }}.tar.gz
path: ${{runner.workspace}}/vrtlmod.tar.gz
benchmark:
strategy:
matrix:
config:
- {name: "Ubuntu-20.04-Release", os: ubuntu-20.04, python: "3.9", cmakegen: "Release", llvm: "x86_64-linux-gnu-ubuntu-18.04", llvm_prefix: "clang+llvm", llvm_version: "13.0.1", llvm_postfix: "-", llvm-ext: "tar.xz", unpack: "tar xf", conan: "1.59.0", packages: "libboost-filesystem-dev cmake make perl g++ gdb libfl2 libfl-dev zlib1g zlib1g-dev ccache numactl perl-doc autoconf flex bison"}
#- {name: "Ubuntu-22.04-Release", os: ubuntu-22.04, python: "3.9", cmakegen: "Release", verilator: "v4.228", llvm: "src", llvm_prefix: "llvm-project", llvm_version: "13.0.1", llvm_postfix: ".", llvm-ext: "tar.xz", unpack: "tar xf", conan: "1.59.0", packages: "libboost-filesystem-dev cmake make perl g++ gdb libfl2 libfl-dev zlib1g zlib1g-dev ccache numactl perl-doc autoconf flex bison libncurses5"}
verilator: ["v4.202", "v4.204", "v4.228"]
duts: ["foo", "cv32e40p", "cv32e40s", "cva6"]
needs: build
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.name }}-verilator_${{ matrix.verilator }}_benchmark_${{ matrix.duts }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v3
id: cache-llvm
with:
path: ${{runner.workspace}}/llvm
key: ${{ matrix.config.name }}-${{ matrix.config.llvm_prefix }}_${{ matrix.config.llvm_version }}_${{ matrix.config.llvm }}
restore-keys: |
${{ matrix.config.name }}-${{ matrix.config.llvm_prefix }}_${{ matrix.config.llvm_version }}_${{ matrix.config.llvm }}
- uses: actions/cache@v3
id: cache-verilator
with:
path: ${{runner.workspace}}/verilator
key: ${{ matrix.config.name }}-verilator_${{ matrix.verilator }}
restore-keys: |
${{ matrix.config.name }}-verilator_${{ matrix.verilator }}
- uses: actions/cache@v3
id: cache-conan
with:
path: ${HOME}/.conan
key: ${{ matrix.config.name }}-conan_${{ matrix.config.conan }}
restore-keys: |
${{ matrix.config.name }}-conan_${{ matrix.config.conan }}
- name: Fetch Compiled System
uses: actions/download-artifact@v2
with:
name: vrtlmod-${{matrix.config.name}}-verilator_${{ matrix.verilator }}.tar.gz
path: ${{runner.workspace}}
- name: Requirements (Linux)
run: |
sudo apt-get install ${{ matrix.config.packages }}
- name: Unpack Compiled System
working-directory: ${{runner.workspace}}
run: tar -xf vrtlmod.tar.gz
- name: Check (cached) Verilator
continue-on-error: false
shell: bash
working-directory: ${{runner.workspace}}
run: ${{runner.workspace}}/verilator/bin/verilator --version
- name: Check (cached) Clang
continue-on-error: false
shell: bash
working-directory: ${{runner.workspace}}
run: ${{runner.workspace}}/llvm/bin/clang --version
- name: Requirements (Linux) Python+Conan
working-directory: ${{runner.workspace}}
shell: bash
run: |
pip install --force-reinstall "conan==${{ matrix.config.conan }}"
if [[ $(conan --version | grep 'version 2.') ]]
then
conan profile detect
else
conan user
if ! [[ $(conan profile list) = *default* ]]
then
conan profile new default --detect
fi
conan profile update settings.compiler.libcxx=libstdc++11 default
fi
- name: Configure Benchmarks
shell: bash
working-directory: ${{runner.workspace}}
run: |
export VERILATOR_ROOT=${{runner.workspace}}/verilator
export LLVM_DIR=${{runner.workspace}}/llvm
cmake -S ${GITHUB_WORKSPACE}/test/benchmark -B build-${{matrix.duts}} -D VP=${{matrix.duts}} -D CMAKE_BUILD_TYPE=${{ matrix.config.cmakegen }} -D VRTLMOD_ROOT=${{runner.workspace}}/installed
- name: Compile Benchmarks
shell: bash
working-directory: ${{runner.workspace}}
run: |
cmake --build build-${{matrix.duts}} --parallel $(nproc)
- name: Run Benchmarks
shell: bash
working-directory: ${{runner.workspace}}
run: |
build-${{matrix.duts}}/SC_TEST_VRTLMOD ${GITHUB_WORKSPACE}/test/benchmark/${{matrix.duts}}/dhry.elf 5 10 > ${{matrix.duts}}-log.txt
cat ${{matrix.duts}}-log.txt
- name: Save Benchmark Results
uses: actions/upload-artifact@v2
with:
name: ${{matrix.duts}}-log.txt
path: ${{runner.workspace}}/${{matrix.duts}}-log.txt