Skip to content

Pull slang revert to fix missized ternary constants #297

Pull slang revert to fix missized ternary constants

Pull slang revert to fix missized ternary constants #297

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 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@v4
with:
fetch-depth: 0
- name: Initialize submodules
run: |
git submodule init
- name: Cache Yosys build
id: cache-yosys
uses: actions/cache@v4
env:
cache-name: cache-yosys
with:
path: tests/third_party/yosys
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.yosys_version }}
- if: ${{ steps.cache-yosys.outputs.cache-hit != 'true' }}
name: Pull Yosys
run: |
git clone --depth 1 --recursive \
--branch ${{ matrix.yosys_version }} \
-- https://github.com/YosysHQ/yosys.git tests/third_party/yosys
- if: ${{ steps.cache-yosys.outputs.cache-hit != 'true' }}
name: Build Yosys
shell: bash
run: |
cd tests/third_party/yosys
make config-gcc
echo "ENABLE_ABC := 0" >> Makefile.conf
make -j6
- name: Install Yosys
shell: bash
run: |
cd tests/third_party/yosys
sudo make install
- name: Find out Slang revision
run: |
{
echo -n "SLANG_HASH="
git submodule status --cached third_party/slang | awk '{print $1}'
} >> $GITHUB_ENV
- name: Find out Makefile revision
run: |
{
echo -n "MAKEFILE_HASH="
git log -n 1 --pretty=format:%H -- Makefile
} >> $GITHUB_ENV
- name: Cache Slang build
id: cache-slang
uses: actions/cache@v4
env:
cache-name: cache-slang
with:
path: build/slang_install
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.SLANG_HASH }}-${{ env.MAKEFILE_HASH }}
- if: ${{ steps.cache-slang.outputs.cache-hit != 'true' }}
name: Pull Slang
run: |
git submodule update --depth 0 -- third_party/slang
- name: Build yosys-slang
run: |
make -j$(nproc)
- 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
test:
runs-on: ubuntu-24.04
needs: [build, define-matrix]
strategy:
matrix:
yosys_version: ${{ fromJSON(needs.define-matrix.outputs.all_versions) }}
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: 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: |
cd tests/third_party/yosys
sudo make install
- name: Run tests
run: |
tests/run.sh
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: |
cd tests/third_party/yosys
sudo make install
- 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: |
cd tests/third_party/yosys
sudo make install
- 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