diff --git a/docs/source/getting_started/installation.rst b/docs/source/getting_started/installation.rst index 43b996353..2a90a8071 100644 --- a/docs/source/getting_started/installation.rst +++ b/docs/source/getting_started/installation.rst @@ -87,7 +87,7 @@ not regularly tested: Build prerequisites ^^^^^^^^^^^^^^^^^^^ -A C++ compiler with C++17 support is required as well as some standard tools +A C++ compiler with C++20 support is required as well as some standard tools such as GNU Flex, GNU Bison (>=3.8), Make, and Python (>=3.11). Some additional tools: readline, libffi, Tcl and zlib; are optional but enabled by default (see :makevar:`ENABLE_*` settings in Makefile). Graphviz and Xdot are used by the diff --git a/docs/source/yosys_internals/extending_yosys/contributing.rst b/docs/source/yosys_internals/extending_yosys/contributing.rst index 1ff77a1fd..8d90d2cbe 100644 --- a/docs/source/yosys_internals/extending_yosys/contributing.rst +++ b/docs/source/yosys_internals/extending_yosys/contributing.rst @@ -286,7 +286,7 @@ have incorrect results in unusual situations. Coding style ~~~~~~~~~~~~ -Yosys is written in C++17. +Yosys is written in C++20. In general Yosys uses ``int`` instead of ``size_t``. To avoid compiler warnings for implicit type casts, always use ``GetSize(foobar)`` instead of diff --git a/docs/source/yosys_internals/index.rst b/docs/source/yosys_internals/index.rst index 483cc2bf8..217b88e36 100644 --- a/docs/source/yosys_internals/index.rst +++ b/docs/source/yosys_internals/index.rst @@ -25,7 +25,7 @@ wide range of real-world designs, including the `OpenRISC 1200 CPU`_, the .. _k68 CPU: http://opencores.org/projects/k68 -Yosys is written in C++, targeting C++17 at minimum. This chapter describes some +Yosys is written in C++, targeting C++20 at minimum. This chapter describes some of the fundamental Yosys data structures. For the sake of simplicity the C++ type names used in the Yosys implementation are used in this chapter, even though the chapter only explains the conceptual idea behind it and can be used diff --git a/kernel/yosys_common.h b/kernel/yosys_common.h index 47dae5473..062036dba 100644 --- a/kernel/yosys_common.h +++ b/kernel/yosys_common.h @@ -120,10 +120,10 @@ # define YS_MAYBE_UNUSED #endif -#if __cplusplus >= 201703L +#if __cplusplus >= 202002L # define YS_FALLTHROUGH [[fallthrough]]; #else -# error "C++17 or later compatible compiler is required" +# error "C++20 or later compatible compiler is required" #endif #if defined(__has_cpp_attribute) && __has_cpp_attribute(gnu::cold) diff --git a/pyosys/generator.py b/pyosys/generator.py index f1d429724..4fd7a5698 100644 --- a/pyosys/generator.py +++ b/pyosys/generator.py @@ -376,7 +376,7 @@ class PyosysWrapperGenerator(object): def make_preprocessor_options(self): py_include = get_paths()["include"] preprocessor_bin = shutil.which("clang++") or "g++" - cxx_std = os.getenv("CXX_STD", "c++17") + cxx_std = os.getenv("CXX_STD", "c++20") return ParserOptions( preprocessor=make_gcc_preprocessor( defines=["_YOSYS_", "YOSYS_ENABLE_PYTHON"], diff --git a/tests/functional/test_functional.py b/tests/functional/test_functional.py index aa7500f8b..661af14d1 100644 --- a/tests/functional/test_functional.py +++ b/tests/functional/test_functional.py @@ -21,7 +21,7 @@ def yosys(script): run([base_path / 'yosys', '-Q', '-p', script]) def compile_cpp(in_path, out_path, args): - run(['g++', '-g', '-std=c++17'] + args + [str(in_path), '-o', str(out_path)]) + run(['g++', '-g', '-std=c++20'] + args + [str(in_path), '-o', str(out_path)]) def yosys_synth(verilog_file, rtlil_file): yosys(f"read_verilog {quote(verilog_file)} ; prep ; setundef -undriven -undef ; write_rtlil {quote(rtlil_file)}")