Skip to content

Commit 03f25e9

Browse files
authored
Merge branch 'YosysHQ:main' into master
2 parents 99159e7 + a80462f commit 03f25e9

File tree

102 files changed

+3829
-7236
lines changed

Some content is hidden

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

102 files changed

+3829
-7236
lines changed

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ indent_style = space
1111
indent_size = 2
1212
trim_trailing_whitespace = false
1313

14+
[*.rst]
15+
indent_style = space
16+
indent_size = 3
17+
1418
[*.yml]
1519
indent_style = space
1620
indent_size = 2

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@ body:
66
attributes:
77
value: >
88
9-
If you have a general question, please ask it in the [Discussions](https://github.com/YosysHQ/yosys/discussions) area
10-
or join our [IRC Channel](https://web.libera.chat/#yosys) or [Community Slack](https://join.slack.com/t/yosyshq/shared_invite/zt-1aopkns2q-EiQ97BeQDt_pwvE41sGSuA).
9+
If you have a general question, please ask it on the [Discourse forum](https://yosyshq.discourse.group/).
1110
1211
1312
If you have a feature request, please fill out the appropriate issue form, this form is for bugs and/or regressions.
1413
1514
1615
Please contact [YosysHQ GmbH](https://www.yosyshq.com/) if you need
17-
commercial support for Yosys.
16+
commercial support or work done for Yosys.
1817
1918
- type: input
2019
id: yosys_version

.github/ISSUE_TEMPLATE/docs_report.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ body:
66
attributes:
77
value: >
88
9-
If you have a general question, please ask it in the [Discussions](https://github.com/YosysHQ/yosys/discussions) area
10-
or join our [IRC Channel](https://web.libera.chat/#yosys) or [Community Slack](https://join.slack.com/t/yosyshq/shared_invite/zt-1aopkns2q-EiQ97BeQDt_pwvE41sGSuA).
9+
If you have a general question, please ask it on the [Discourse forum](https://yosyshq.discourse.group/).
1110
1211
1312
If you have found a bug in Yosys, or in building the documentation,

.github/ISSUE_TEMPLATE/feature_request.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
name: Feature Request
2-
description: "Submit a feature request for Yosys"
2+
description: "Submit a feature request for Yosys"
33
labels: ["feature-request"]
44
body:
55
- type: markdown
66
attributes:
77
value: >
88
9-
If you have a general question, please ask it in the [Discussions](https://github.com/YosysHQ/yosys/discussions) area
10-
or join our [IRC Channel](https://web.libera.chat/#yosys) or [Community Slack](https://join.slack.com/t/yosyshq/shared_invite/zt-1aopkns2q-EiQ97BeQDt_pwvE41sGSuA).
11-
9+
If you have a general question, please ask it on the [Discourse forum](https://yosyshq.discourse.group/).
10+
1211
1312
If you have a bug report, please fill out the appropriate issue form, this form is for feature requests.
1413
15-
14+
1615
Please contact [YosysHQ GmbH](https://www.yosyshq.com/) if you need
1716
commercial support or work done for Yosys.
1817

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
_If your work is part of a larger effort, please discuss your general plans on [Discourse](https://yosyshq.discourse.group/) first to align your vision with maintainers._
2+
13
_What are the reasons/motivation for this change?_
24

35
_Explain how this is achieved._
46

5-
_If applicable, please suggest to reviewers how they can test the change._
7+
_Make sure your change comes with tests. If not possible, share how a reviewer might evaluate it._
8+
9+
_These template prompts can be deleted when you're done responding to them._

.github/workflows/wheels.yml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ jobs:
5555
submodules: true
5656
persist-credentials: false
5757
- uses: actions/setup-python@v5
58-
- name: Get Boost Source
59-
shell: bash
60-
run: |
61-
mkdir -p boost
62-
curl -L https://github.com/boostorg/boost/releases/download/boost-1.86.0/boost-1.86.0-b2-nodocs.tar.gz | tar --strip-components=1 -xzC boost
6358
- name: Get FFI
6459
shell: bash
6560
run: |
@@ -103,21 +98,16 @@ jobs:
10398
CIBW_BEFORE_ALL: bash ./.github/workflows/wheels/cibw_before_all.sh
10499
CIBW_ENVIRONMENT: >
105100
OPTFLAGS=-O3
106-
CXXFLAGS=-I./boost/pfx/include
107-
LINKFLAGS=-L./boost/pfx/lib
108101
PKG_CONFIG_PATH=./ffi/pfx/lib/pkgconfig
109-
makeFlags='BOOST_PYTHON_LIB=./boost/pfx/lib/libboost_python*.a'
110102
PATH="$PWD/bison/src:$PATH"
111103
CIBW_ENVIRONMENT_MACOS: >
112104
OPTFLAGS=-O3
113-
CXXFLAGS=-I./boost/pfx/include
114-
LINKFLAGS=-L./boost/pfx/lib
115105
PKG_CONFIG_PATH=./ffi/pfx/lib/pkgconfig
116106
MACOSX_DEPLOYMENT_TARGET=11
117-
makeFlags='BOOST_PYTHON_LIB=./boost/pfx/lib/libboost_python*.a CONFIG=clang'
107+
makeFlags='CONFIG=clang'
118108
PATH="$PWD/bison/src:$PATH"
119109
CIBW_BEFORE_BUILD: bash ./.github/workflows/wheels/cibw_before_build.sh
120-
CIBW_TEST_COMMAND: python3 {project}/tests/arch/ecp5/add_sub.py
110+
CIBW_TEST_COMMAND: python3 {project}/tests/pyosys/run_tests.py
121111
- uses: actions/upload-artifact@v4
122112
with:
123113
name: python-wheels-${{ matrix.os.runner }}
Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
set -e
22
set -x
33

4-
# Don't use objects from previous compiles on Windows/macOS
5-
make clean
4+
# Don't use Python objects from previous compiles
5+
make clean-py
66

77
# DEBUG: show python3 and python3-config outputs
88
if [ "$(uname)" != "Linux" ]; then
@@ -11,24 +11,3 @@ if [ "$(uname)" != "Linux" ]; then
1111
fi
1212
python3 --version
1313
python3-config --includes
14-
15-
# Build boost
16-
cd ./boost
17-
## Delete the artefacts from previous builds (if any)
18-
rm -rf ./pfx
19-
## Bootstrap bjam
20-
./bootstrap.sh --prefix=./pfx
21-
## Build Boost against current version of Python, only for
22-
## static linkage (Boost is statically linked because system boost packages
23-
## wildly vary in versions, including the libboost_python3 version)
24-
./b2\
25-
-j$(getconf _NPROCESSORS_ONLN 2>/dev/null || sysctl -n hw.ncpu)\
26-
--prefix=./pfx\
27-
--with-filesystem\
28-
--with-system\
29-
--with-python\
30-
cxxflags="$(python3-config --includes) -std=c++17 -fPIC"\
31-
cflags="$(python3-config --includes) -fPIC"\
32-
link=static\
33-
variant=release\
34-
install

CHANGELOG

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,28 @@
22
List of major changes and improvements between releases
33
=======================================================
44

5-
Yosys 0.57 .. Yosys 0.58-dev
5+
Yosys 0.58 .. Yosys 0.59-dev
66
--------------------------
77

8+
Yosys 0.57 .. Yosys 0.58
9+
--------------------------
10+
* Various
11+
- Run ABC passes in parallel.
12+
- Extending support for buffer normalization.
13+
- Overhaul of logging APIs.
14+
- read_blif: Represent sequential elements with gate cells.
15+
- Support multiple lib files in abc9_exe.
16+
17+
* New commands and options
18+
- Added "-wireshape" option to "show" command to allow
19+
control the shape of wire nodes.
20+
- Added "-relativeshare" option to "read_verilog", "synth"
21+
and "techmap" pass for synthesis reproducibility testing.
22+
- "write_rtlil" pass no longer sorts design, added "-sort"
23+
option to match old behavior
24+
- Added "-sva-continue-on-err" to "verific" pass to allow
25+
processing designs that includes unsupported SVA.
26+
827
Yosys 0.56 .. Yosys 0.57
928
--------------------------
1029
* New commands and options

CODEOWNERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ techlibs/gowin/ @pepijndevos
3838
techlibs/gatemate/ @pu-cc
3939

4040
# pyosys
41-
misc/*.py @btut
41+
pyosys/* @donn
42+
setup.py @donn
4243

4344
backends/firrtl @ucbjrl @azidar
4445

Makefile

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ all: top-all
102102
YOSYS_SRC := $(dir $(firstword $(MAKEFILE_LIST)))
103103
VPATH := $(YOSYS_SRC)
104104

105-
CXXSTD ?= c++17
105+
export CXXSTD ?= c++17
106106
CXXFLAGS := $(CXXFLAGS) -Wall -Wextra -ggdb -I. -I"$(YOSYS_SRC)" -MD -MP -D_YOSYS_ -fPIC -I$(PREFIX)/include
107107
LIBS := $(LIBS) -lstdc++ -lm
108108
PLUGIN_LINKFLAGS :=
@@ -133,10 +133,6 @@ LINKFLAGS += -rdynamic
133133
ifneq ($(shell :; command -v brew),)
134134
BREW_PREFIX := $(shell brew --prefix)/opt
135135
$(info $$BREW_PREFIX is [${BREW_PREFIX}])
136-
ifeq ($(ENABLE_PYOSYS),1)
137-
CXXFLAGS += -I$(BREW_PREFIX)/boost/include
138-
LINKFLAGS += -L$(BREW_PREFIX)/boost/lib -L$(BREW_PREFIX)/boost-python3/lib
139-
endif
140136
CXXFLAGS += -I$(BREW_PREFIX)/readline/include -I$(BREW_PREFIX)/flex/include
141137
LINKFLAGS += -L$(BREW_PREFIX)/readline/lib -L$(BREW_PREFIX)/flex/lib
142138
PKG_CONFIG_PATH := $(BREW_PREFIX)/libffi/lib/pkgconfig:$(PKG_CONFIG_PATH)
@@ -164,7 +160,7 @@ ifeq ($(OS), Haiku)
164160
CXXFLAGS += -D_DEFAULT_SOURCE
165161
endif
166162

167-
YOSYS_VER := 0.57+218
163+
YOSYS_VER := 0.58+0
168164
YOSYS_MAJOR := $(shell echo $(YOSYS_VER) | cut -d'.' -f1)
169165
YOSYS_MINOR := $(shell echo $(YOSYS_VER) | cut -d'.' -f2 | cut -d'+' -f1)
170166
YOSYS_COMMIT := $(shell echo $(YOSYS_VER) | cut -d'+' -f2)
@@ -187,7 +183,7 @@ endif
187183
OBJS = kernel/version_$(GIT_REV).o
188184

189185
bumpversion:
190-
sed -i "/^YOSYS_VER := / s/+[0-9][0-9]*$$/+`git log --oneline 3aca860.. | wc -l`/;" Makefile
186+
sed -i "/^YOSYS_VER := / s/+[0-9][0-9]*$$/+`git log --oneline 157aabb.. | wc -l`/;" Makefile
191187

192188
ABCMKARGS = CC="$(CXX)" CXX="$(CXX)" ABC_USE_LIBSTDCXX=1 ABC_USE_NAMESPACE=abc VERBOSE=$(Q)
193189

@@ -348,31 +344,24 @@ ifeq ($(ENABLE_LIBYOSYS),1)
348344
TARGETS += libyosys.so
349345
endif
350346

347+
PY_WRAPPER_FILE = pyosys/wrappers
348+
349+
# running make clean on just those and then recompiling saves a lot of
350+
# time when running cibuildwheel
351+
PYTHON_OBJECTS = pyosys/wrappers.o kernel/drivers.o kernel/yosys.o passes/cmds/plugin.o
352+
351353
ifeq ($(ENABLE_PYOSYS),1)
352354
# python-config --ldflags includes -l and -L, but LINKFLAGS is only -L
353355
LINKFLAGS += $(filter-out -l%,$(shell $(PYTHON_CONFIG) --ldflags))
354356
LIBS += $(shell $(PYTHON_CONFIG) --libs)
355357
EXE_LIBS += $(filter-out $(LIBS),$(shell $(PYTHON_CONFIG_FOR_EXE) --libs))
356-
CXXFLAGS += $(shell $(PYTHON_CONFIG) --includes) -DWITH_PYTHON
358+
PYBIND11_INCLUDE ?= $(shell $(PYTHON_EXECUTABLE) -m pybind11 --includes)
359+
CXXFLAGS += -I$(PYBIND11_INCLUDE) -DYOSYS_ENABLE_PYTHON
360+
CXXFLAGS += $(shell $(PYTHON_CONFIG) --includes) -DYOSYS_ENABLE_PYTHON
357361

358-
# Detect name of boost_python library. Some distros use boost_python-py<version>, other boost_python<version>, some only use the major version number, some a concatenation of major and minor version numbers
359-
CHECK_BOOST_PYTHON = (echo "int main(int argc, char ** argv) {return 0;}" | $(CXX) -xc -o /dev/null $(LINKFLAGS) $(EXE_LIBS) $(LIBS) -l$(1) - > /dev/null 2>&1 && echo "-l$(1)")
360-
BOOST_PYTHON_LIB ?= $(shell \
361-
$(call CHECK_BOOST_PYTHON,boost_python-py$(subst .,,$(PYTHON_VERSION))) || \
362-
$(call CHECK_BOOST_PYTHON,boost_python-py$(PYTHON_MAJOR_VERSION)) || \
363-
$(call CHECK_BOOST_PYTHON,boost_python$(subst .,,$(PYTHON_VERSION))) || \
364-
$(call CHECK_BOOST_PYTHON,boost_python$(PYTHON_MAJOR_VERSION)) \
365-
)
366-
367-
ifeq ($(BOOST_PYTHON_LIB),)
368-
$(error BOOST_PYTHON_LIB could not be detected. Please define manually)
369-
endif
370-
371-
LIBS += $(BOOST_PYTHON_LIB) -lboost_system -lboost_filesystem
372-
PY_WRAPPER_FILE = kernel/python_wrappers
373362
OBJS += $(PY_WRAPPER_FILE).o
374-
PY_GEN_SCRIPT= py_wrap_generator
375-
PY_WRAP_INCLUDES := $(shell $(PYTHON_EXECUTABLE) -c "from misc import $(PY_GEN_SCRIPT); $(PY_GEN_SCRIPT).print_includes()")
363+
PY_GEN_SCRIPT = pyosys/generator.py
364+
PY_WRAP_INCLUDES := $(shell $(PYTHON_EXECUTABLE) $(PY_GEN_SCRIPT) --print-includes)
376365
endif # ENABLE_PYOSYS
377366

378367
ifeq ($(ENABLE_READLINE),1)
@@ -530,8 +519,12 @@ ifeq ($(ENABLE_VERIFIC_YOSYSHQ_EXTENSIONS),1)
530519
VERIFIC_COMPONENTS += extensions
531520
CXXFLAGS += -DYOSYSHQ_VERIFIC_EXTENSIONS
532521
else
522+
# YosysHQ flavor of Verific always needs extensions linked
523+
# if disabled it will just not be invoked but parts
524+
# are required for it to initialize properly
533525
ifneq ($(wildcard $(VERIFIC_DIR)/extensions),)
534526
VERIFIC_COMPONENTS += extensions
527+
OBJS += kernel/log_compat.o
535528
endif
536529
endif
537530
CXXFLAGS += $(patsubst %,-I$(VERIFIC_DIR)/%,$(VERIFIC_COMPONENTS)) -DYOSYS_ENABLE_VERIFIC
@@ -561,6 +554,13 @@ $(subst //,/,$(1)/$(notdir $(2))): $(2)
561554
$$(Q) cp "$(YOSYS_SRC)"/$(2) $(subst //,/,$(1)/$(notdir $(2)))
562555
endef
563556

557+
define add_share_file_and_rename
558+
EXTRA_TARGETS += $(subst //,/,$(1)/$(3))
559+
$(subst //,/,$(1)/$(3)): $(2)
560+
$$(P) mkdir -p $(1)
561+
$$(Q) cp "$(YOSYS_SRC)"/$(2) $(subst //,/,$(1)/$(3))
562+
endef
563+
564564
define add_gen_share_file
565565
EXTRA_TARGETS += $(subst //,/,$(1)/$(notdir $(2)))
566566
$(subst //,/,$(1)/$(notdir $(2))): $(2)
@@ -775,9 +775,9 @@ endif
775775
$(P) cat $< | grep -E -v "#[ ]*(include|error)" | $(CXX) $(CXXFLAGS) -x c++ -o $@ -E -P -
776776

777777
ifeq ($(ENABLE_PYOSYS),1)
778-
$(PY_WRAPPER_FILE).cc: misc/$(PY_GEN_SCRIPT).py $(PY_WRAP_INCLUDES)
778+
$(PY_WRAPPER_FILE).cc: $(PY_GEN_SCRIPT) pyosys/wrappers_tpl.cc $(PY_WRAP_INCLUDES) pyosys/hashlib.h
779779
$(Q) mkdir -p $(dir $@)
780-
$(P) $(PYTHON_EXECUTABLE) -c "from misc import $(PY_GEN_SCRIPT); $(PY_GEN_SCRIPT).gen_wrappers(\"$(PY_WRAPPER_FILE).cc\")"
780+
$(P) $(PYTHON_EXECUTABLE) $(PY_GEN_SCRIPT) $(PY_WRAPPER_FILE).cc
781781
endif
782782

783783
%.o: %.cpp
@@ -1024,12 +1024,12 @@ ifeq ($(ENABLE_LIBYOSYS),1)
10241024
if [ -n "$(STRIP)" ]; then $(INSTALL_SUDO) $(STRIP) -S $(DESTDIR)$(LIBDIR)/libyosys.so; fi
10251025
ifeq ($(ENABLE_PYOSYS),1)
10261026
$(INSTALL_SUDO) mkdir -p $(DESTDIR)$(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys
1027+
$(INSTALL_SUDO) cp pyosys/__init__.py $(DESTDIR)$(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys/__init__.py
10271028
$(INSTALL_SUDO) cp libyosys.so $(DESTDIR)$(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys/libyosys.so
10281029
$(INSTALL_SUDO) cp -r share $(DESTDIR)$(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys
10291030
ifeq ($(ENABLE_ABC),1)
10301031
$(INSTALL_SUDO) cp yosys-abc $(DESTDIR)$(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys/yosys-abc
10311032
endif
1032-
$(INSTALL_SUDO) cp misc/__init__.py $(DESTDIR)$(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys/
10331033
endif
10341034
endif
10351035
ifeq ($(ENABLE_PLUGINS),1)
@@ -1119,12 +1119,10 @@ DOC_TARGET ?= html
11191119
docs: docs/prep
11201120
$(Q) $(MAKE) -C docs $(DOC_TARGET)
11211121

1122-
clean:
1122+
clean: clean-py
11231123
rm -rf share
1124-
rm -rf kernel/*.pyh
1125-
rm -f $(OBJS) $(GENFILES) $(TARGETS) $(EXTRA_TARGETS) $(EXTRA_OBJS) $(PY_WRAP_INCLUDES) $(PY_WRAPPER_FILE).cc
1124+
rm -f $(OBJS) $(GENFILES) $(TARGETS) $(EXTRA_TARGETS) $(EXTRA_OBJS) $(PY_WRAP_INCLUDES)
11261125
rm -f kernel/version_*.o kernel/version_*.cc
1127-
rm -f kernel/python_wrappers.o
11281126
rm -f libs/*/*.d frontends/*/*.d passes/*/*.d backends/*/*.d kernel/*.d techlibs/*/*.d
11291127
rm -rf tests/asicworld/*.out tests/asicworld/*.log
11301128
rm -rf tests/hana/*.out tests/hana/*.log
@@ -1138,8 +1136,14 @@ clean:
11381136
rm -f $(addsuffix /run-test.mk,$(MK_TEST_DIRS))
11391137
-$(MAKE) -C docs clean
11401138
rm -rf docs/util/__pycache__
1139+
rm -f libyosys.so
1140+
1141+
clean-py:
1142+
rm -f $(PY_WRAPPER_FILE).inc.cc $(PY_WRAPPER_FILE).cc
1143+
rm -f $(PYTHON_OBJECTS)
11411144
rm -f *.whl
11421145
rm -f libyosys.so
1146+
rm -rf kernel/*.pyh
11431147

11441148
clean-abc:
11451149
$(MAKE) -C abc DEP= clean

0 commit comments

Comments
 (0)