Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/OSCI-WG/systemc into main
Browse files Browse the repository at this point in the history
  • Loading branch information
lmailletcontoz committed Oct 8, 2024
2 parents f91cd00 + 5db59e4 commit 80e1d19
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 30 deletions.
28 changes: 17 additions & 11 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ obtain from the following sources:
* Clang http://clang.llvm.org/
* make http://www.gnu.org/software/make/make.html

Note: _IEEE Std. 1666-2023 mandates C++17 as the baseline for SystemC implementations,
see [RELEASENOTES.md](RELEASENOTES.md). Make sure to configure your compiler
accordingly (see below)_.


## Basic SystemC Installation

Expand Down Expand Up @@ -133,19 +137,19 @@ To install SystemC on a UNIX system, do the following steps:
it prints messages to inform you of the features it is checking.
It also detects the platform.

_Note for System V users_:
If you are using 'csh' on an older version of System V, you might
need to use the `sh ../configure` command instead of `../configure`.
Otherwise, 'csh' will attempt to 'configure' itself.

Note: _As IEEE Std. 1666-2023 mandates C++17 as the baseline for SystemC
implementations, make sure you enable the compiler flag to
select C++17, e.g.:
implementations, make sure you enable the compiler flag to
select C++17, e.g._:

```bash
../configure 'CXXFLAGS=-std=c++17'
```

Compiling this implementation for newer C++ standards is generally
possible and tested at a best effort basis. Prefer C++17 for full
IEEE Std. 1666-2023 conformance, see also `SC_CPLUSPLUS` macro
documentation below.

SystemC 3.0.0 includes a fixed-point package that is always built.
When compiling your applications with fixed-point types, you still have
to use compiler flag `-DSC_INCLUDE_FX`. Note that compile times might
Expand Down Expand Up @@ -579,15 +583,17 @@ settings to all build configurations.
* `SC_CPLUSPLUS`
Override automatically detected C++ standard support

This setting allows downgrading the assumed version of the
This setting allows _downgrading_ the assumed version of the
underlying C++ standard on the current platform. By default,
the latest supported version is chosen.
Supported values are
the compiler-selected version is chosen.

Currently known values are:
* `SC_CPLUSPLUS=201703L` (C++17, ISO/IEC 14882:2017)
* `SC_CPLUSPLUS=202002L` (C++20, ISO/IEC 14882:2020)
* `SC_CPLUSPLUS=202302L` (C++23, ISO/IEC 14882:2023)

Note: _This symbol needs to be consistently defined in the library
and any application linking against the built library._
and any application linking against the built library._


* `SC_DEFAULT_WRITER_POLICY=<sc_writer_policy>`
Expand Down
2 changes: 1 addition & 1 deletion RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ Here is an overview of deprecated features:

IEEE Std. 1666-2023 mandates C++17 as the baseline for SystemC implementations.
`std::string_view` is used in new APIs. However, `const char *` are still used
in several locations and will be progressively cleaned-up in the upcoming
in several locations and will be progressively cleaned-up in the upcoming
releases.


Expand Down
2 changes: 1 addition & 1 deletion docs/sysc/doxygen/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -1519,7 +1519,7 @@ INCLUDE_FILE_PATTERNS =
# instead of the = operator.

PREDEFINED = \
SC_CPLUSPLUS=201103L \
SC_CPLUSPLUS=201703L \
SC_DOXYGEN_IS_RUNNING

# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
Expand Down
32 changes: 18 additions & 14 deletions src/sysc/kernel/sc_cmnhdr.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,25 +96,29 @@
// Selected C++ standard baseline, supported values are
// 201703L (C++17, ISO/IEC 14882:2017)
// 202002L (C++20, ISO/IEC 14882:2020)
// 202302L (C++23, ISO/IEC 14882:2023)
//
// This macro can be used inside the library sources to make certain assumptions
// on the available features in the underlying C++ implementation.
//
#ifndef SC_CPLUSPLUS
# if defined(_MSVC_LANG) // MSVC 2015 Update 3 or later, use compiler setting
# define SC_CPLUSPLUS _MSVC_LANG
# else // not _MSVC_LANG
// use compiler setting
# define SC_CPLUSPLUS __cplusplus
# endif
#endif // SC_CPLUSPLUS

// SystemC reference implementation requires C++17
#define SC_CPLUSPLUS_BASE_ 201703L
#if SC_CPLUSPLUS < SC_CPLUSPLUS_BASE_
# error **** SystemC requires a C++ compiler version of at least C++17 ****
//
// The SC_CPLUSPLUS macro can be used inside the library sources to make certain
// assumptions on the available features in the underlying C++ implementation.
//
#if defined(_MSVC_LANG) // MSVC 2015 Update 3 or later, use compiler setting
# define SC_CPLUSPLUS_AUTO_ _MSVC_LANG
#else // not _MSVC_LANG, use standard macro
# define SC_CPLUSPLUS_AUTO_ __cplusplus
#endif
#if SC_CPLUSPLUS_AUTO_ < SC_CPLUSPLUS_BASE_
# error **** SystemC requires a C++ standard version of at least C++17 ****
#endif

#ifndef SC_CPLUSPLUS // assume standard version selected by the compiler
# define SC_CPLUSPLUS SC_CPLUSPLUS_AUTO_
#elif SC_CPLUSPLUS > SC_CPLUSPLUS_AUTO_
# error **** SC_CPLUSPLUS cannot be higher than C++ standard selected by the compiler ****
#endif // SC_CPLUSPLUS

// The IEEE_1666_CPLUSPLUS macro is meant to be queried in the models,
// checking for availability of SystemC features relying on specific
// C++ standard versions.
Expand Down
6 changes: 3 additions & 3 deletions tests/systemc/kernel/dynamic_processes/test11/test11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class top : public sc_module
{
public:

top(sc_module_name name) : sc_module(name)
top(sc_module_name name) : sc_module(name)
{
SC_THREAD(main);
}
Expand Down Expand Up @@ -90,14 +90,14 @@ class top : public sc_module
// Test that threads in thread pool are successfully reused ...

for (int i = 0 ; i < 10; i++)
sc_spawn(&r, [=]{ return wait_and_end(i); } );
sc_spawn(&r, [i,this]{ return wait_and_end(i); } );

wait(20, SC_NS);

// Test thread reuse

for (int i = 0 ; i < 10; i++)
sc_spawn(&r, [=]{ return wait_and_end(i); } );
sc_spawn(&r, [i,this]{ return wait_and_end(i); } );

wait(20, SC_NS);

Expand Down

0 comments on commit 80e1d19

Please sign in to comment.