Skip to content

Commit d563d39

Browse files
authored
Merge branch 'YosysHQ:main' into master
2 parents d617bf5 + cec48c6 commit d563d39

File tree

97 files changed

+7977
-4863
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+7977
-4863
lines changed

.github/actions/setup-build-env/action.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@ runs:
88
shell: bash
99
run: |
1010
sudo apt-get update
11-
sudo apt-get install 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 libbz2-dev
11+
sudo apt-get install gperf build-essential bison flex libfl-dev libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev libbz2-dev
1212
1313
- name: Install macOS Dependencies
1414
if: runner.os == 'macOS'
1515
shell: bash
1616
run: |
17-
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew update
18-
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install bison flex gawk libffi pkg-config bash autoconf llvm lld || true
17+
brew bundle
1918
2019
- name: Linux runtime environment
2120
if: runner.os == 'Linux'
@@ -29,7 +28,7 @@ runs:
2928
shell: bash
3029
run: |
3130
echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH
32-
echo "$(brew --prefix llvm)/bin" >> $GITHUB_PATH
31+
echo "$(brew --prefix llvm@20)/bin" >> $GITHUB_PATH
3332
echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH
3433
echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH
3534
echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Install deps
14-
run: sudo apt-get install bison flex libreadline-dev tcl-dev libffi-dev
14+
run: sudo apt-get install bison flex libfl-dev libreadline-dev tcl-dev libffi-dev
1515

1616
- name: Checkout repository
1717
uses: actions/checkout@v4

.github/workflows/extra-builds.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,20 @@ jobs:
2727
with:
2828
submodules: true
2929
persist-credentials: false
30+
- run: sudo apt-get install libfl-dev
3031
- name: Build
3132
run: make vcxsrc YOSYS_VER=latest
3233
- uses: actions/upload-artifact@v4
3334
with:
3435
name: vcxsrc
3536
path: yosys-win32-vcxsrc-latest.zip
36-
37+
3738
vs-build:
3839
name: Visual Studio build
3940
runs-on: windows-latest
4041
needs: [vs-prep, pre_job]
4142
if: needs.pre_job.outputs.should_skip != 'true'
42-
steps:
43+
steps:
4344
- uses: actions/download-artifact@v4
4445
with:
4546
name: vcxsrc
@@ -50,7 +51,7 @@ jobs:
5051
uses: microsoft/setup-msbuild@v2
5152
- name: MSBuild
5253
working-directory: yosys-win32-vcxsrc-latest
53-
run: msbuild YosysVS.sln /p:PlatformToolset=v142 /p:Configuration=Release /p:WindowsTargetPlatformVersion=10.0.17763.0
54+
run: msbuild YosysVS.sln /p:PlatformToolset=v142 /p:Configuration=Release /p:WindowsTargetPlatformVersion=10.0.26100.0
5455

5556
wasi-build:
5657
name: WASI build
@@ -68,9 +69,20 @@ jobs:
6869
WASI_SDK_URL=https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/wasi-sdk-19.0-linux.tar.gz
6970
if ! [ -d ${WASI_SDK} ]; then curl -L ${WASI_SDK_URL} | tar xzf -; fi
7071
72+
FLEX_VER=2.6.4
73+
FLEX=flex-${FLEX_VER}
74+
FLEX_URL=https://github.com/westes/flex/releases/download/v${FLEX_VER}/${FLEX}.tar.gz
75+
if ! [ -d ${FLEX} ]; then curl -L ${FLEX_URL} | tar xzf -; fi
76+
77+
mkdir -p flex-build
78+
(cd flex-build &&
79+
../${FLEX}/configure --prefix=$(pwd)/../flex-prefix &&
80+
make &&
81+
make install)
82+
7183
mkdir -p build
7284
cat > build/Makefile.conf <<END
73-
export PATH := $(pwd)/${WASI_SDK}/bin:${PATH}
85+
export PATH := $(pwd)/${WASI_SDK}/bin:$(pwd)/flex-prefix/bin:${PATH}
7486
WASI_SYSROOT := $(pwd)/${WASI_SDK}/share/wasi-sysroot
7587
7688
CONFIG := wasi
@@ -80,6 +92,8 @@ jobs:
8092
ENABLE_READLINE := 0
8193
ENABLE_PLUGINS := 0
8294
ENABLE_ZLIB := 0
95+
96+
CXXFLAGS += -I$(pwd)/flex-prefix/include
8397
END
8498
8599
make -C build -f ../Makefile CXX=clang -j$(nproc)
@@ -98,7 +112,7 @@ jobs:
98112
with:
99113
submodules: true
100114
persist-credentials: false
101-
- uses: cachix/install-nix-action@v26
115+
- uses: cachix/install-nix-action@v31
102116
with:
103-
install_url: https://releases.nixos.org/nix/nix-2.18.1/install
117+
install_url: https://releases.nixos.org/nix/nix-2.30.0/install
104118
- run: nix build .?submodules=1 -L

.github/workflows/test-build.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,44 @@ jobs:
161161
run: |
162162
find tests/**/*.err -print -exec cat {} \;
163163
164+
test-cells:
165+
name: Run test_cell
166+
runs-on: ${{ matrix.os }}
167+
needs: [build-yosys, pre_job]
168+
if: needs.pre_job.outputs.should_skip != 'true'
169+
env:
170+
CC: clang
171+
strategy:
172+
matrix:
173+
os: [ubuntu-latest]
174+
sanitizer: [undefined]
175+
steps:
176+
- name: Checkout Yosys
177+
uses: actions/checkout@v4
178+
with:
179+
persist-credentials: false
180+
181+
- name: Setup environment
182+
uses: ./.github/actions/setup-build-env
183+
184+
- name: Download build artifact
185+
uses: actions/download-artifact@v4
186+
with:
187+
name: build-${{ matrix.os }}-${{ matrix.sanitizer }}
188+
189+
- name: Uncompress build
190+
shell: bash
191+
run:
192+
tar -xvf build.tar
193+
194+
- name: test_cell
195+
shell: bash
196+
run: |
197+
./yosys -p 'test_cell -n 20 -s 1 all'
198+
./yosys -p 'test_cell -n 20 -s 1 -nosat -aigmap $pow $pmux'
199+
./yosys -p 'test_cell -n 20 -s 1 -nosat -aigmap $eqx $nex $bweqx'
200+
./yosys -p 'test_cell -n 20 -s 1 -aigmap $buf'
201+
164202
test-docs:
165203
name: Run docs tests
166204
runs-on: ${{ matrix.os }}

.github/workflows/test-compile.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,12 @@ jobs:
3636
- 'clang-19'
3737
- 'gcc-13'
3838
include:
39-
# macOS
39+
# macOS x86
4040
- os: macos-13
41-
compiler: 'clang'
41+
compiler: 'clang-19'
42+
# macOS arm
43+
- os: macos-latest
44+
compiler: 'clang-19'
4245
fail-fast: false
4346
steps:
4447
- name: Checkout Yosys

.github/workflows/wheels.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: Build Wheels for PyPI
44
on:
55
workflow_dispatch:
66
schedule:
7-
- cron: '0 10 * * 0'
7+
- cron: "0 10 * * 0"
88

99
jobs:
1010
build_wheels:
@@ -54,9 +54,6 @@ jobs:
5454
fetch-depth: 0
5555
submodules: true
5656
persist-credentials: false
57-
- if: ${{ matrix.os.family == 'linux' }}
58-
name: "[Linux] Set up QEMU"
59-
uses: docker/setup-qemu-action@v3
6057
- uses: actions/setup-python@v5
6158
- name: Get Boost Source
6259
shell: bash
@@ -68,14 +65,19 @@ jobs:
6865
run: |
6966
mkdir -p ffi
7067
curl -L https://github.com/libffi/libffi/releases/download/v3.4.6/libffi-3.4.6.tar.gz | tar --strip-components=1 -xzC ffi
68+
- if: ${{ matrix.os.family == 'linux' }}
69+
name: "[Linux] Bison 3.8.2"
70+
shell: bash
71+
run: |
72+
mkdir -p bison
73+
curl -L https://ftpmirror.gnu.org/gnu/bison/bison-3.8.2.tar.gz | tar --strip-components=1 -xzC bison
7174
## Software installed by default in GitHub Action Runner VMs:
7275
## https://github.com/actions/runner-images
7376
- if: ${{ matrix.os.family == 'macos' }}
7477
name: "[macOS] Flex/Bison"
7578
run: |
7679
brew install flex bison
77-
echo "PATH=$(brew --prefix flex)/bin:$PATH" >> $GITHUB_ENV
78-
echo "PATH=$(brew --prefix bison)/bin:$PATH" >> $GITHUB_ENV
80+
echo "PATH=$(brew --prefix flex)/bin:$(brew --prefix bison)/bin:$PATH" >> $GITHUB_ENV
7981
- if: ${{ matrix.os.family == 'windows' }}
8082
name: "[Windows] Flex/Bison"
8183
run: |
@@ -100,16 +102,20 @@ jobs:
100102
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
101103
CIBW_BEFORE_ALL: bash ./.github/workflows/wheels/cibw_before_all.sh
102104
CIBW_ENVIRONMENT: >
105+
OPTFLAGS=-O3
103106
CXXFLAGS=-I./boost/pfx/include
104107
LINKFLAGS=-L./boost/pfx/lib
105108
PKG_CONFIG_PATH=./ffi/pfx/lib/pkgconfig
106109
makeFlags='BOOST_PYTHON_LIB=./boost/pfx/lib/libboost_python*.a'
110+
PATH="$PWD/bison/src:$PATH"
107111
CIBW_ENVIRONMENT_MACOS: >
112+
OPTFLAGS=-O3
108113
CXXFLAGS=-I./boost/pfx/include
109114
LINKFLAGS=-L./boost/pfx/lib
110115
PKG_CONFIG_PATH=./ffi/pfx/lib/pkgconfig
111116
MACOSX_DEPLOYMENT_TARGET=11
112117
makeFlags='BOOST_PYTHON_LIB=./boost/pfx/lib/libboost_python*.a CONFIG=clang'
118+
PATH="$PWD/bison/src:$PATH"
113119
CIBW_BEFORE_BUILD: bash ./.github/workflows/wheels/cibw_before_build.sh
114120
CIBW_TEST_COMMAND: python3 {project}/tests/arch/ecp5/add_sub.py
115121
- uses: actions/upload-artifact@v4

.github/workflows/wheels/_run_cibw_linux.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,19 @@
2020
import yaml
2121
import platform
2222
import subprocess
23+
from pathlib import Path
2324

24-
__dir__ = os.path.dirname(os.path.abspath(__file__))
25+
__yosys_root__ = Path(__file__).absolute().parents[3]
2526

27+
for source in ["boost", "ffi", "bison"]:
28+
if not (__yosys_root__ / source).is_dir():
29+
print(
30+
"You need to download boost, ffi and bison in a similar manner to wheels.yml first."
31+
)
32+
exit(-1)
2633

27-
workflow = yaml.safe_load(open(os.path.join(os.path.dirname(__dir__), "wheels.yml")))
34+
with open(__yosys_root__ / ".github" / "workflows" / "wheels.yml") as f:
35+
workflow = yaml.safe_load(f)
2836

2937
env = os.environ.copy()
3038

@@ -40,5 +48,5 @@
4048
continue
4149
env[key] = value
4250

43-
env["CIBW_ARCHS"] = os.getenv("CIBW_ARCHS") or platform.machine()
51+
env["CIBW_ARCHS"] = os.getenv("CIBW_ARCHS", platform.machine())
4452
subprocess.check_call(["cibuildwheel"], env=env)
Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,37 @@
1-
set -e
2-
set -x
1+
#!/bin/bash
2+
set -e -x
33

44
# Build-time dependencies
55
## Linux Docker Images
66
if command -v yum &> /dev/null; then
7-
yum install -y flex bison
7+
yum install -y flex # manylinux's bison versions are hopelessly out of date
88
fi
99

1010
if command -v apk &> /dev/null; then
1111
apk add flex bison
1212
fi
1313

14+
if ! printf '%s\n' '%require "3.8"' '%%' 'start: ;' | bison -o /dev/null /dev/stdin ; then
15+
(
16+
set -e -x
17+
cd bison
18+
./configure
19+
make clean
20+
make install -j$(getconf _NPROCESSORS_ONLN 2>/dev/null || sysctl -n hw.ncpu)
21+
)
22+
fi
23+
1424
## macOS/Windows -- installed in GitHub Action itself, not container
1525

16-
# Build Static FFI (platform-dependent but not Python version dependent)
17-
cd ffi
18-
## Ultimate libyosys.so will be shared, so we need fPIC for the static libraries
19-
CFLAGS=-fPIC CXXFLAGS=-fPIC ./configure --prefix=$PWD/pfx
20-
## Without this, SHELL has a space in its path which breaks the makefile
21-
make install -j$(getconf _NPROCESSORS_ONLN 2>/dev/null || sysctl -n hw.ncpu)
22-
## Forces static library to be used in all situations
23-
sed -i.bak 's@-L${toolexeclibdir} -lffi@${toolexeclibdir}/libffi.a@' ./pfx/lib/pkgconfig/libffi.pc
26+
# Runtime Dependencies
27+
## Build Static FFI (platform-dependent but not Python version dependent)
28+
(
29+
set -e -x
30+
cd ffi
31+
## Ultimate libyosys.so will be shared, so we need fPIC for the static libraries
32+
CFLAGS=-fPIC CXXFLAGS=-fPIC ./configure --prefix=$PWD/pfx
33+
make clean
34+
make install -j$(getconf _NPROCESSORS_ONLN 2>/dev/null || sysctl -n hw.ncpu)
35+
## Forces static library to be used in all situations
36+
sed -i.bak 's@-L${toolexeclibdir} -lffi@${toolexeclibdir}/libffi.a@' ./pfx/lib/pkgconfig/libffi.pc
37+
)

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
/kernel/python_wrappers.cc
4848
/boost
4949
/ffi
50+
/bison
5051
/venv
5152
/*.whl
5253
/*.egg-info

Brewfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ brew "git"
66
brew "graphviz"
77
brew "pkg-config"
88
brew "python3"
9-
brew "tcl-tk"
109
brew "xdot"
1110
brew "bash"
1211
brew "boost-python3"
13-
brew "llvm"
12+
brew "llvm@20"
1413
brew "lld"

0 commit comments

Comments
 (0)