Skip to content

fix(infra): upgrade yosys 0.15 → OSS CAD Suite 2026-05-06 (closes #36) #34

fix(infra): upgrade yosys 0.15 → OSS CAD Suite 2026-05-06 (closes #36)

fix(infra): upgrade yosys 0.15 → OSS CAD Suite 2026-05-06 (closes #36) #34

Workflow file for this run

# SPDX-License-Identifier: CC-BY-SA-4.0
name: ci
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
verilator-cocotb:
name: Verilator + cocotb tests
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Verilator build deps
run: |
sudo apt-get update
sudo apt-get install -y \
git make autoconf flex bison \
libfl2 libfl-dev zlib1g zlib1g-dev \
help2man perl ccache
- name: Cache Verilator install
id: verilator-cache
uses: actions/cache@v4
with:
path: ~/.local/verilator
key: verilator-v5.040-${{ runner.os }}-x64
- name: Build Verilator 5.040 from source (only on cache miss)
if: steps.verilator-cache.outputs.cache-hit != 'true'
run: |
git clone --branch v5.040 --depth 1 \
https://github.com/verilator/verilator.git /tmp/verilator
cd /tmp/verilator
autoconf
./configure --prefix=$HOME/.local/verilator
make -j$(nproc)
make install
- name: Add Verilator to PATH and verify
run: |
echo "$HOME/.local/verilator/bin" >> $GITHUB_PATH
$HOME/.local/verilator/bin/verilator --version
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install cocotb
run: |
python -m pip install --upgrade pip
pip install cocotb cocotb-bus pytest
cocotb-config --version
- name: Run axi4_mem_model tests
run: |
cd verif/axi4_mem_model
make
- name: Run axi4_master_simple tests
run: |
cd verif/axi4_master_simple
make
- name: Run core_axi4_adapter tests
run: |
cd verif/core_axi4_adapter
make
- name: Summarize
if: always()
shell: bash {0} # no -e — grep returns 1 on no-match, that is OK here
run: |
{
echo "## Test summary"
for d in verif/axi4_mem_model verif/axi4_master_simple verif/core_axi4_adapter; do
if [ -f "$d/results.xml" ]; then
passed=$(grep -oE 'tests="[0-9]+"' "$d/results.xml" | head -1 | grep -oE '[0-9]+' || echo "?")
failed=$(grep -oE 'failures="[0-9]+"' "$d/results.xml" | head -1 | grep -oE '[0-9]+' || echo "?")
echo "- \`$d\`: $passed tests, $failed failures"
else
echo "- \`$d\`: no results.xml (test build failed?)"
fi
done
} >> $GITHUB_STEP_SUMMARY
yosys-ecp5-smoke:
name: yosys synth_ecp5 smoke (closes #36)
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache OSS CAD Suite
id: oss-cad-cache
uses: actions/cache@v4
with:
path: ~/.local/oss-cad-suite
key: oss-cad-suite-2026-05-06-${{ runner.os }}-x64
- name: Download OSS CAD Suite (only on cache miss)
if: steps.oss-cad-cache.outputs.cache-hit != 'true'
run: |
mkdir -p ~/.local
wget -q https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2026-05-06/oss-cad-suite-linux-x64-20260506.tgz \
-O /tmp/oss-cad-suite.tgz
tar -xzf /tmp/oss-cad-suite.tgz -C ~/.local
rm /tmp/oss-cad-suite.tgz
- name: Add OSS CAD Suite to PATH and verify yosys version
run: |
echo "$HOME/.local/oss-cad-suite/bin" >> $GITHUB_PATH
$HOME/.local/oss-cad-suite/bin/yosys -V
- name: Run synth_ecp5 smoke pass on src/int/mul_pipeline_32bit.sv
run: |
# Smoke-tests the open ECP5 synth path against a rev-A RTL module.
# Picks mul_pipeline_32bit (124 lines, no module instances) so the
# smoke test does not pull in the AXI4 fabric. The module references
# the `assert_known` macro from src/assert.sv, so we feed both files
# to read_verilog (assert.sv first so the macros are in scope when
# the module body is parsed). If this passes, the yosys + lattice
# techlib half of the open ECP5 flow is live for rev-A.
# See cicd/Dockerfile and #36.
mkdir -p /tmp/smoke
yosys -p "read_verilog -sv src/assert.sv src/int/mul_pipeline_32bit.sv; synth_lattice -family ecp5 -top mul_pipeline_32bit; write_json /tmp/smoke/mul_pipeline_32bit.json" \
| tee /tmp/smoke/yosys.log
test -s /tmp/smoke/mul_pipeline_32bit.json
{
echo "## yosys ECP5 smoke result"
echo ""
echo "- yosys version: \`$(yosys -V | head -1)\`"
echo "- json size: \`$(wc -c < /tmp/smoke/mul_pipeline_32bit.json) bytes\`"
} >> $GITHUB_STEP_SUMMARY
- name: Upload smoke artefacts
if: always()
uses: actions/upload-artifact@v4
with:
name: yosys-ecp5-smoke
path: /tmp/smoke/
if-no-files-found: warn