Skip to content

Commit f4228f9

Browse files
authored
Merge branch 'YosysHQ:main' into master
2 parents 995044f + 1b07d20 commit f4228f9

Some content is hidden

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

71 files changed

+2376
-203
lines changed

Diff for: CHANGELOG

+18-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,26 @@
22
List of major changes and improvements between releases
33
=======================================================
44

5-
Yosys 0.50 .. Yosys 0.51-dev
5+
Yosys 0.51 .. Yosys 0.52-dev
66
--------------------------
77

8+
Yosys 0.50 .. Yosys 0.51
9+
--------------------------
10+
* New commands and options
11+
- Added "abstract" pass to allow reducing and never increasing
12+
the constraints on a circuit's behavior in a formal verification setting.
13+
14+
* Various
15+
- "splitcells" pass now splits "aldff" cells.
16+
- FunctionalIR documentation
17+
18+
* QuickLogic support
19+
- Added IOFF inference for qlf_k6n10f
20+
21+
* Intel support
22+
- Fixed RAM and DSP support.
23+
- Overall performance improvement for "synth_intel".
24+
825
Yosys 0.49 .. Yosys 0.50
926
--------------------------
1027
* Various

Diff for: CONTRIBUTING.md

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Introduction
2+
3+
Thanks for thinking about contributing to the Yosys project. If this is your
4+
first time contributing to an open source project, please take a look at the
5+
following guide:
6+
https://opensource.guide/how-to-contribute/#orienting-yourself-to-a-new-project.
7+
8+
Information about the Yosys coding style is available on our Read the Docs:
9+
https://yosys.readthedocs.io/en/latest/yosys_internals/extending_yosys/contributing.html.
10+
11+
# Using the issue tracker
12+
13+
The [issue tracker](https://github.com/YosysHQ/yosys/issues) is used for
14+
tracking bugs or other problems with Yosys or its documentation. It is also the
15+
place to go for requesting new features.
16+
When [creating a new issue](https://github.com/YosysHQ/yosys/issues/new/choose),
17+
we have a few templates available. Please make use of these! It will make it
18+
much easier for someone to respond and help.
19+
20+
### Bug reports
21+
22+
Before you submit an issue, please have a search of the existing issues in case
23+
one already exists. Making sure that you have a minimal, complete and
24+
verifiable example (MVCE) is a great way to quickly check an existing issue
25+
against a new one. Stack overflow has a guide on [how to create an
26+
MVCE](https://stackoverflow.com/help/minimal-reproducible-example). The
27+
[`bugpoint`
28+
command](https://yosyshq.readthedocs.io/projects/yosys/en/latest/cmd/bugpoint.html)
29+
in Yosys can be helpful for this process.
30+
31+
32+
# Using pull requests
33+
34+
If you are working on something to add to Yosys, or fix something that isn't
35+
working quite right, make a [PR](https://github.com/YosysHQ/yosys/pulls)! An
36+
open PR, even as a draft, tells everyone that you're working on it and they
37+
don't have to. It can also be a useful way to solicit feedback on in-progress
38+
changes. See below to find the best way to [ask us
39+
questions](#asking-questions).
40+
41+
In general, all changes to the code are done as a PR, with [Continuous
42+
Integration (CI)](https://github.com/YosysHQ/yosys/actions) tools that
43+
automatically run the full suite of tests compiling and running Yosys. Please
44+
make use of this! If you're adding a feature: add a test! Not only does it
45+
verify that your feature is working as expected, but it can also be a handy way
46+
for people to see how the feature is used. If you're fixing a bug: add a test!
47+
If you can, do this first; it's okay if the test starts off failing - you
48+
already know there is a bug. CI also helps to make sure that your changes still
49+
work under a range of compilers, settings, and targets.
50+
51+
52+
### Labels
53+
54+
We use [labels](https://github.com/YosysHQ/yosys/labels) to help categorise
55+
issues and PRs. If a label seems relevant to your work, please do add it; this
56+
also includes the labels beggining with 'status-'. The 'merge-' labels are used
57+
by maintainers for tracking and communicating which PRs are ready and pending
58+
merge; please do not use these labels if you are not a maintainer.
59+
60+
61+
# Asking questions
62+
63+
If you have a question about how to use Yosys, please ask on our [discussions
64+
page](https://github.com/YosysHQ/yosys/discussions) or in our [community
65+
slack](https://join.slack.com/t/yosyshq/shared_invite/zt-1aopkns2q-EiQ97BeQDt_pwvE41sGSuA).
66+
The slack is also a great place to ask questions about developing or
67+
contributing to Yosys.
68+
69+
We have open dev 'jour fixe' (JF) meetings where developers from YosysHQ and the
70+
community come together to discuss open issues and PRs. This is also a good
71+
place to talk to us about how to implement larger PRs. Please join the
72+
community slack if you would like to join the next meeting, the link is
73+
available in the description of the #devel-discuss channel.

Diff for: Makefile

+44-11
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ ifneq ($(shell :; command -v brew),)
123123
BREW_PREFIX := $(shell brew --prefix)/opt
124124
$(info $$BREW_PREFIX is [${BREW_PREFIX}])
125125
ifeq ($(ENABLE_PYOSYS),1)
126-
CXXFLAGS += -I$(BREW_PREFIX)/boost/include/boost
127-
LINKFLAGS += -L$(BREW_PREFIX)/boost/lib
126+
CXXFLAGS += -I$(BREW_PREFIX)/boost/include
127+
LINKFLAGS += -L$(BREW_PREFIX)/boost/lib -L$(BREW_PREFIX)/boost-python3/lib
128128
endif
129129
CXXFLAGS += -I$(BREW_PREFIX)/readline/include
130130
LINKFLAGS += -L$(BREW_PREFIX)/readline/lib
@@ -153,7 +153,14 @@ ifeq ($(OS), Haiku)
153153
CXXFLAGS += -D_DEFAULT_SOURCE
154154
endif
155155

156-
YOSYS_VER := 0.50+0
156+
YOSYS_VER := 0.51+0
157+
YOSYS_MAJOR := $(shell echo $(YOSYS_VER) | cut -d'.' -f1)
158+
YOSYS_MINOR := $(shell echo $(YOSYS_VER) | cut -d'.' -f2 | cut -d'+' -f1)
159+
YOSYS_COMMIT := $(shell echo $(YOSYS_VER) | cut -d'+' -f2)
160+
CXXFLAGS += -DYOSYS_VER=\\"$(YOSYS_VER)\\" \
161+
-DYOSYS_MAJOR=$(YOSYS_MAJOR) \
162+
-DYOSYS_MINOR=$(YOSYS_MINOR) \
163+
-DYOSYS_COMMIT=$(YOSYS_COMMIT)
157164

158165
# Note: We arrange for .gitcommit to contain the (short) commit hash in
159166
# tarballs generated with git-archive(1) using .gitattributes. The git repo
@@ -169,7 +176,7 @@ endif
169176
OBJS = kernel/version_$(GIT_REV).o
170177

171178
bumpversion:
172-
sed -i "/^YOSYS_VER := / s/+[0-9][0-9]*$$/+`git log --oneline b5170e1.. | wc -l`/;" Makefile
179+
sed -i "/^YOSYS_VER := / s/+[0-9][0-9]*$$/+`git log --oneline c4b5190.. | wc -l`/;" Makefile
173180

174181
ABCMKARGS = CC="$(CXX)" CXX="$(CXX)" ABC_USE_LIBSTDCXX=1 ABC_USE_NAMESPACE=abc VERBOSE=$(Q)
175182

@@ -330,8 +337,13 @@ TARGETS += libyosys.so
330337
endif
331338

332339
ifeq ($(ENABLE_PYOSYS),1)
340+
# python-config --ldflags includes -l and -L, but LINKFLAGS is only -L
341+
LINKFLAGS += $(filter-out -l%,$(shell $(PYTHON_CONFIG) --ldflags))
342+
LIBS += $(shell $(PYTHON_CONFIG) --libs)
343+
CXXFLAGS += $(shell $(PYTHON_CONFIG) --includes) -DWITH_PYTHON
344+
333345
# 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
334-
CHECK_BOOST_PYTHON = (echo "int main(int argc, char ** argv) {return 0;}" | $(CXX) -xc -o /dev/null $(shell $(PYTHON_CONFIG) --ldflags) -l$(1) - > /dev/null 2>&1 && echo "-l$(1)")
346+
CHECK_BOOST_PYTHON = (echo "int main(int argc, char ** argv) {return 0;}" | $(CXX) -xc -o /dev/null $(LINKFLAGS) $(LIBS) -l$(1) - > /dev/null 2>&1 && echo "-l$(1)")
335347
BOOST_PYTHON_LIB ?= $(shell \
336348
$(call CHECK_BOOST_PYTHON,boost_python-py$(subst .,,$(PYTHON_VERSION))) || \
337349
$(call CHECK_BOOST_PYTHON,boost_python-py$(PYTHON_MAJOR_VERSION)) || \
@@ -343,11 +355,7 @@ ifeq ($(BOOST_PYTHON_LIB),)
343355
$(error BOOST_PYTHON_LIB could not be detected. Please define manually)
344356
endif
345357

346-
LIBS += $(shell $(PYTHON_CONFIG) --libs) $(BOOST_PYTHON_LIB) -lboost_system -lboost_filesystem
347-
# python-config --ldflags includes LIBS for some reason
348-
LINKFLAGS += $(filter-out -l%,$(shell $(PYTHON_CONFIG) --ldflags))
349-
CXXFLAGS += $(shell $(PYTHON_CONFIG) --includes) -DWITH_PYTHON
350-
358+
LIBS += $(BOOST_PYTHON_LIB) -lboost_system -lboost_filesystem
351359
PY_WRAPPER_FILE = kernel/python_wrappers
352360
OBJS += $(PY_WRAPPER_FILE).o
353361
PY_GEN_SCRIPT= py_wrap_generator
@@ -651,6 +659,9 @@ OBJS += libs/fst/fastlz.o
651659
OBJS += libs/fst/lz4.o
652660
endif
653661

662+
techlibs/%_pm.h: passes/pmgen/pmgen.py techlibs/%.pmg
663+
$(P) mkdir -p $(dir $@) && $(PYTHON_EXECUTABLE) $< -o $@ -p $(notdir $*) $(filter-out $<,$^)
664+
654665
ifneq ($(SMALL),1)
655666

656667
OBJS += libs/subcircuit/subcircuit.o
@@ -775,6 +786,15 @@ check-git-abc:
775786
elif [ -f "$(YOSYS_SRC)/abc/.gitcommit" ] && ! grep -q '\$$Format:%[hH]\$$' "$(YOSYS_SRC)/abc/.gitcommit"; then \
776787
echo "'abc' comes from a tarball. Continuing."; \
777788
exit 0; \
789+
elif git -C "$(YOSYS_SRC)" submodule status abc 2>/dev/null | grep -q '^+'; then \
790+
echo "'abc' submodule does not match expected commit."; \
791+
echo "Run 'git submodule update' to check out the correct version."; \
792+
echo "Note: If testing a different version of abc, call 'git commit abc' in the Yosys source directory to update the expected commit."; \
793+
exit 1; \
794+
elif git -C "$(YOSYS_SRC)" submodule status abc 2>/dev/null | grep -q '^U'; then \
795+
echo "'abc' submodule has merge conflicts."; \
796+
echo "Please resolve merge conflicts before continuing."; \
797+
exit 1; \
778798
elif [ -f "$(YOSYS_SRC)/abc/.gitcommit" ] && grep -q '\$$Format:%[hH]\$$' "$(YOSYS_SRC)/abc/.gitcommit"; then \
779799
echo "Error: 'abc' is not configured as a git submodule."; \
780800
echo "To resolve this:"; \
@@ -997,6 +1017,18 @@ docs/source/cell/word_add.rst: $(TARGETS) $(EXTRA_TARGETS)
9971017
docs/source/generated/cells.json: docs/source/generated $(TARGETS) $(EXTRA_TARGETS)
9981018
$(Q) ./$(PROGRAM_PREFIX)yosys -p 'help -dump-cells-json $@'
9991019

1020+
docs/source/generated/%.cc: backends/%.cc
1021+
$(Q) mkdir -p $(@D)
1022+
$(Q) cp $< $@
1023+
1024+
# diff returns exit code 1 if the files are different, but it's not an error
1025+
docs/source/generated/functional/rosette.diff: backends/functional/smtlib.cc backends/functional/smtlib_rosette.cc
1026+
$(Q) mkdir -p $(@D)
1027+
$(Q) diff -U 20 $^ > $@ || exit 0
1028+
1029+
PHONY: docs/gen/functional_ir
1030+
docs/gen/functional_ir: docs/source/generated/functional/smtlib.cc docs/source/generated/functional/rosette.diff
1031+
10001032
PHONY: docs/gen docs/usage docs/reqs
10011033
docs/gen: $(TARGETS)
10021034
$(Q) $(MAKE) -C docs gen
@@ -1032,7 +1064,7 @@ docs/reqs:
10321064
$(Q) $(MAKE) -C docs reqs
10331065

10341066
.PHONY: docs/prep
1035-
docs/prep: docs/source/cmd/abc.rst docs/source/generated/cells.json docs/gen docs/usage
1067+
docs/prep: docs/source/cmd/abc.rst docs/source/generated/cells.json docs/gen docs/usage docs/gen/functional_ir
10361068

10371069
DOC_TARGET ?= html
10381070
docs: docs/prep
@@ -1053,6 +1085,7 @@ clean:
10531085
rm -rf vloghtb/Makefile vloghtb/refdat vloghtb/rtl vloghtb/scripts vloghtb/spec vloghtb/check_yosys vloghtb/vloghammer_tb.tar.bz2 vloghtb/temp vloghtb/log_test_*
10541086
rm -f tests/svinterfaces/*.log_stdout tests/svinterfaces/*.log_stderr tests/svinterfaces/dut_result.txt tests/svinterfaces/reference_result.txt tests/svinterfaces/a.out tests/svinterfaces/*_syn.v tests/svinterfaces/*.diff
10551087
rm -f tests/tools/cmp_tbdata
1088+
rm -f $(addsuffix /run-test.mk,$(MK_TEST_DIRS))
10561089
-$(MAKE) -C docs clean
10571090
rm -rf docs/source/cmd docs/util/__pycache__
10581091

Diff for: abc

Submodule abc updated 332 files

Diff for: backends/functional/smtlib_rosette.cc

+18-9
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,8 @@ struct SmtrModule {
210210
state_struct.insert(state->name, state->sort);
211211
}
212212

213-
void write(std::ostream &out)
214-
{
215-
SExprWriter w(out);
216-
217-
input_struct.write_definition(w);
218-
output_struct.write_definition(w);
219-
state_struct.write_definition(w);
220-
213+
void write_eval(SExprWriter &w)
214+
{
221215
w.push();
222216
w.open(list("define", list(name, "inputs", "state")));
223217
auto inlined = [&](Functional::Node n) {
@@ -240,7 +234,10 @@ struct SmtrModule {
240234
output_struct.write_value(w, [&](IdString name) { return node_to_sexpr(ir.output(name).value()); });
241235
state_struct.write_value(w, [&](IdString name) { return node_to_sexpr(ir.state(name).next_value()); });
242236
w.pop();
237+
}
243238

239+
void write_initial(SExprWriter &w)
240+
{
244241
w.push();
245242
auto initial = name + "_initial";
246243
w.open(list("define", initial));
@@ -259,6 +256,18 @@ struct SmtrModule {
259256
}
260257
w.pop();
261258
}
259+
260+
void write(std::ostream &out)
261+
{
262+
SExprWriter w(out);
263+
264+
input_struct.write_definition(w);
265+
output_struct.write_definition(w);
266+
state_struct.write_definition(w);
267+
268+
write_eval(w);
269+
write_initial(w);
270+
}
262271
};
263272

264273
struct FunctionalSmtrBackend : public Backend {
@@ -267,7 +276,7 @@ struct FunctionalSmtrBackend : public Backend {
267276
void help() override {
268277
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
269278
log("\n");
270-
log(" write_functional_rosette [options] [selection] [filename]\n");
279+
log(" write_functional_rosette [options] [filename]\n");
271280
log("\n");
272281
log("Functional Rosette Backend.\n");
273282
log("\n");

Diff for: docs/source/code_examples/functional/dummy.cc

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#include "kernel/functional.h"
2+
#include "kernel/yosys.h"
3+
4+
USING_YOSYS_NAMESPACE
5+
PRIVATE_NAMESPACE_BEGIN
6+
7+
struct FunctionalDummyBackend : public Backend {
8+
FunctionalDummyBackend() : Backend("functional_dummy", "dump generated Functional IR") {}
9+
void execute(std::ostream *&f, std::string filename, std::vector<std::string> args, RTLIL::Design *design) override
10+
{
11+
// backend pass boiler plate
12+
log_header(design, "Executing dummy functional backend.\n");
13+
14+
size_t argidx = 1;
15+
extra_args(f, filename, args, argidx, design);
16+
17+
for (auto module : design->selected_modules())
18+
{
19+
log("Processing module `%s`.\n", module->name.c_str());
20+
21+
// convert module to FunctionalIR
22+
auto ir = Functional::IR::from_module(module);
23+
*f << "module " << module->name.c_str() << "\n";
24+
25+
// write node functions
26+
for (auto node : ir)
27+
*f << " assign " << id2cstr(node.name())
28+
<< " = " << node.to_string() << "\n";
29+
*f << "\n";
30+
31+
// write outputs and next state
32+
for (auto output : ir.outputs())
33+
*f << " " << id2cstr(output->kind)
34+
<< " " << id2cstr(output->name)
35+
<< " = " << id2cstr(output->value().name()) << "\n";
36+
for (auto state : ir.states())
37+
*f << " " << id2cstr(state->kind)
38+
<< " " << id2cstr(state->name)
39+
<< " = " << id2cstr(state->next_value().name()) << "\n";
40+
}
41+
}
42+
} FunctionalDummyBackend;
43+
44+
PRIVATE_NAMESPACE_END

Diff for: docs/source/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
project = 'YosysHQ Yosys'
77
author = 'YosysHQ GmbH'
88
copyright ='2025 YosysHQ GmbH'
9-
yosys_ver = "0.50"
9+
yosys_ver = "0.51"
1010

1111
# select HTML theme
1212
html_theme = 'furo-ys'

Diff for: docs/source/yosys_internals/extending_yosys/contributing.rst

+8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
Contributing to Yosys
22
=====================
33

4+
.. note::
5+
6+
For information on making a pull request on github, refer to our
7+
|CONTRIBUTING|_ file.
8+
9+
.. |CONTRIBUTING| replace:: :file:`CONTRIBUTING.md`
10+
.. _CONTRIBUTING: https://github.com/YosysHQ/yosys/CONTRIBUTING.md
11+
412
Coding Style
513
------------
614

0 commit comments

Comments
 (0)