Merge branch 'povik:master' into master #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and test | |
| on: [push, pull_request] | |
| jobs: | |
| define-matrix: | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| all_versions: ${{ steps.final.outputs.all_versions }} | |
| filtered_versions: ${{ steps.final.outputs.filtered_versions }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - id: final | |
| shell: bash | |
| run: | | |
| { | |
| versions=$(sed -rn 's/.+Yosys installed: supported versions are \*\*(.+)\*\*/\1/gp' README.md) | |
| declare -A remap | |
| remap["0.44"]="yosys-0.44" | |
| remap["0.45"]="0.45" | |
| remap["0.46"]="0.46" | |
| remap["0.47"]="0.47" | |
| echo -n "all_versions=[" | |
| first=""; | |
| last=""; | |
| for v in $versions; do | |
| if [[ -z "${remap["$v"]+x}" ]] then | |
| tag="v$v"; | |
| else | |
| tag=${remap[$v]}; | |
| fi | |
| if [[ -z "$first" ]] then | |
| first="$tag"; | |
| fi | |
| last="$tag"; | |
| echo -n "\"$tag\","; | |
| done | |
| echo "]" | |
| echo "filtered_versions=[\"$first\",\"$last\"]" | |
| } >> "$GITHUB_OUTPUT" | |
| build: | |
| runs-on: ubuntu-24.04 | |
| needs: [define-matrix] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| yosys_version: ${{ fromJSON(needs.define-matrix.outputs.all_versions) }} | |
| steps: | |
| - name: Install Dependencies | |
| shell: bash | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y git build-essential pkg-config cmake ccache gperf bison flex libreadline-dev gawk tcl-dev libffi-dev graphviz xdot python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| - name: Set up caching | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/ccache | |
| key: slang-${{ hashFiles('third_party') }}-${{ hashFiles('src') }} | |
| restore-keys: | | |
| slang-${{ hashFiles('third_party') }}-${{ hashFiles('src') }} | |
| slang-${{ hashFiles('third_party') }}- | |
| slang- | |
| - name: Set up ccache | |
| run: | | |
| ccache --max-size=2G -z | |
| # This cache is shared with the `coverage.yaml` workflow. | |
| - name: Cache Yosys build | |
| id: cache-yosys | |
| uses: actions/cache@v4 | |
| env: | |
| cache-name: cache-yosys | |
| with: | |
| path: tests/third_party/yosys | |
| key: yosys-${{ runner.os }}-${{ matrix.yosys_version }} | |
| - if: ${{ steps.cache-yosys.outputs.cache-hit != 'true' }} | |
| name: Pull Yosys | |
| run: | | |
| cd tests/third_party | |
| git clone --depth 1 --recursive \ | |
| --branch ${{ matrix.yosys_version }} \ | |
| -- https://github.com/YosysHQ/yosys.git yosys_build | |
| make -C yosys_build config-gcc | |
| echo "ENABLE_ABC := 0" >> yosys_build/Makefile.conf | |
| make -C yosys_build -j$(nproc) | |
| make -C yosys_build install DESTDIR=$(pwd)/yosys/ | |
| - name: Install Yosys | |
| shell: bash | |
| run: | | |
| sudo cp -r -t / tests/third_party/yosys/* | |
| - name: Build yosys-slang | |
| run: | | |
| make -j$(nproc) CMAKE_FLAGS="-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=Debug" | |
| - name: Test yosys-slang | |
| run: | | |
| cd build | |
| ctest --rerun-failed --output-on-failure | |
| - name: Pack build | |
| shell: bash | |
| run: | | |
| tar -cvf build.tar build/slang.so tests/third_party/yosys/ | |
| - name: Store build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-${{ matrix.yosys_version }}.tar | |
| path: build.tar | |
| retention-days: 1 | |
| - name: Print ccache statistics | |
| run: | | |
| ccache -s | |
| test-croc-boot: | |
| runs-on: ubuntu-24.04 | |
| needs: [build, define-matrix] | |
| strategy: | |
| matrix: | |
| yosys_version: ${{ fromJSON(needs.define-matrix.outputs.filtered_versions) }} | |
| fail-fast: false | |
| env: | |
| # bender -d . script flist-plus --relative-path > croc.f | |
| # /patch absolute paths in croc.f/ | |
| # tar --exclude='.git' --exclude='*/libs.doc/*' -cvf ../croc-checkout-250109-846ce38.tar . | |
| CROC_CHECKOUT: 'croc-checkout-250120-846ce380.tar.gz' | |
| CROC_CHECKOUT_HASH: '6e7b193fe51c3fe3dad00a675c729b9e12d1fc3c72e8d06c580d92fdeba64403 croc-checkout-250120-846ce380.tar.gz' | |
| steps: | |
| - name: Install Dependencies | |
| shell: bash | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake build-essential libfmt-dev | |
| sudo apt-get install -y gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Initialize submodules | |
| run: | | |
| git submodule init | |
| - name: Download build artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-${{ matrix.yosys_version }}.tar | |
| - name: Unpack build | |
| shell: bash | |
| run: | |
| tar -xvf build.tar | |
| - name: Install Yosys | |
| shell: bash | |
| run: | | |
| sudo cp -r -t / tests/third_party/yosys/* | |
| - name: Cache Croc checkout | |
| id: cache-croc | |
| uses: actions/cache@v4 | |
| env: | |
| cache-name: cache-croc | |
| with: | |
| path: tests/third_party/croc | |
| key: ${{ env.CROC_CHECKOUT }} | |
| - if: ${{ steps.cache-yosys.outputs.cache-hit != 'true' }} | |
| name: Unpack Croc | |
| run: | | |
| wget https://cutebit.org/$CROC_CHECKOUT | |
| echo "$CROC_CHECKOUT_HASH" | sha256sum --check | |
| tar -xvf $CROC_CHECKOUT -C tests/third_party/croc/ | |
| - name: Install OpenOCD | |
| run: | | |
| wget https://github.com/xpack-dev-tools/openocd-xpack/releases/download/v0.12.0-4/xpack-openocd-0.12.0-4-linux-x64.tar.gz | |
| sudo tar xvf xpack-openocd-0.12.0-4-linux-x64.tar.gz -C /opt | |
| echo "/opt/xpack-openocd-0.12.0-4/bin" >> $GITHUB_PATH | |
| - name: Run OpenOCD once | |
| run: | | |
| openocd -v | |
| - name: Run tests | |
| run: | | |
| tests/croc_boot/run.sh | |
| test-compat: | |
| runs-on: ubuntu-24.04 | |
| needs: [build, define-matrix] | |
| strategy: | |
| matrix: | |
| yosys_version: ${{ fromJSON(needs.define-matrix.outputs.filtered_versions) }} | |
| ip: [black-parrot, bsc-core_tile, cv32e40p, ibex, opentitan, rsd] | |
| fail-fast: false | |
| steps: | |
| - name: Install Dependencies | |
| shell: bash | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake build-essential libfmt-dev | |
| sudo apt-get install -y gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download build artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-${{ matrix.yosys_version }}.tar | |
| - name: Unpack build | |
| shell: bash | |
| run: | |
| tar -xvf build.tar | |
| - name: Install Yosys | |
| shell: bash | |
| run: | | |
| sudo cp -r -t / tests/third_party/yosys/* | |
| - name: Pull IP sources | |
| run: | | |
| git clone https://github.com/povik/yosys-slang-compat-suite/ compat-suite --depth 1 | |
| cd compat-suite | |
| git submodule init ${{ matrix.ip }} | |
| git submodule update --init --recursive --depth 1 ${{ matrix.ip }} | |
| - if: ${{ matrix.ip == 'opentitan' }} | |
| run: | | |
| sudo apt-get install libxml2-dev libxslt-dev | |
| pip3 install --user -r compat-suite/opentitan/python-requirements.txt --require-hashes | |
| - name: Run script | |
| run: | | |
| cd compat-suite | |
| yosys -m ../build/slang.so ${{ matrix.ip }}.tcl |