Skip to content

Commit

Permalink
Remove the outdated SystemC/TLM compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
kouchy committed Nov 18, 2020
1 parent 429ce02 commit dbd5f7c
Show file tree
Hide file tree
Showing 33 changed files with 15 additions and 1,741 deletions.
31 changes: 0 additions & 31 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -255,37 +255,6 @@ build-linux-gcc-mpi:
- source ./ci/tools/threads.sh
- ./ci/build-linux-macos.sh

build-linux-gcc-systemc:
stage: build
variables:
GIT_SUBMODULE_STRATEGY: recursive
except:
- schedules
needs:
- job: analysis-cppcheck
artifacts: false
- job: analysis-headers
artifacts: false
tags:
- linux
- gcc
- systemc
- cmake
artifacts:
name: build-linux-gcc-systemc
paths:
- build_linux_gcc_systemc
script:
- cp $SYSTEMC_HOME/FindSystemC.cmake cmake/Modules/
- cp $SYSTEMC_HOME/FindTLM.cmake cmake/Modules/
- export CC="gcc"
- export CXX="g++"
- export CFLAGS="-Wall -funroll-loops -march=native -Wno-deprecated-declarations"
- export CMAKE_OPT="-DAFF3CT_COMPILE_EXE=ON -DAFF3CT_PREC=MULTI -DAFF3CT_EXT_STRINGS=OFF -DAFF3CT_SYSTEMC_SIMU=ON"
- export NAME="build_linux_gcc_systemc"
- source ./ci/tools/threads.sh
- ./ci/build-linux-macos.sh

build-linux-clang:
stage: build
variables:
Expand Down
51 changes: 11 additions & 40 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,17 @@ project(aff3ct)
# ------------------------------------------------------------------------------------------------------- CMAKE OPTIONS
# ---------------------------------------------------------------------------------------------------------------------

option(AFF3CT_COMPILE_EXE "Compile the executable" ON )
option(AFF3CT_COMPILE_STATIC_LIB "Compile the static library" OFF)
option(AFF3CT_COMPILE_SHARED_LIB "Compile the shared library" OFF)
option(AFF3CT_LINK_GSL "Link with the GSL library (used in the channels)" OFF)
option(AFF3CT_LINK_MKL "Link with the MKL library (used in the channels)" OFF)
option(AFF3CT_LINK_HWLOC "Link with the hwloc library (used for threads pinning)" OFF)
option(AFF3CT_SYSTEMC_SIMU "Enable the SystemC simulation (incompatible with the library compilation)" OFF)
option(AFF3CT_SYSTEMC_MODULE "Enable the SystemC support (only for the modules)" OFF)
option(AFF3CT_MPI "Enable the MPI support" OFF)
option(AFF3CT_POLAR_BIT_PACKING "Enable the bit packing technique for Polar code SC decoding" ON )
option(AFF3CT_POLAR_BOUNDS "Enable the use of the external Tal & Vardy Polar best channels generator" OFF)
option(AFF3CT_COLORS "Enable the colors in the terminal" ON )
option(AFF3CT_OVERRIDE_VERSION "Compile without .git directory, provided a version and hash" OFF)
option(AFF3CT_COMPILE_EXE "Compile the executable" ON )
option(AFF3CT_COMPILE_STATIC_LIB "Compile the static library" OFF)
option(AFF3CT_COMPILE_SHARED_LIB "Compile the shared library" OFF)
option(AFF3CT_LINK_GSL "Link with the GSL library (used in the channels)" OFF)
option(AFF3CT_LINK_MKL "Link with the MKL library (used in the channels)" OFF)
option(AFF3CT_LINK_HWLOC "Link with the hwloc library (used for threads pinning)" OFF)
option(AFF3CT_MPI "Enable the MPI support" OFF)
option(AFF3CT_POLAR_BIT_PACKING "Enable the bit packing technique for Polar code SC decoding" ON )
option(AFF3CT_POLAR_BOUNDS "Enable the use of the external Tal & Vardy Polar best channels generator" OFF)
option(AFF3CT_COLORS "Enable the colors in the terminal" ON )
option(AFF3CT_OVERRIDE_VERSION "Compile without .git directory, provided a version and hash" OFF)

if (AFF3CT_COMPILE_EXE OR AFF3CT_COMPILE_STATIC_LIB OR AFF3CT_COMPILE_SHARED_LIB)
set(AFF3CT_COMPILE_OBJ ON)
Expand Down Expand Up @@ -55,10 +53,6 @@ endif()

set(AFF3CT_PREC "MULTI" CACHE STRING "Select the precision in bits (can be '8', '16', '32', '64' or 'MULTI')")

if(AFF3CT_SYSTEMC_SIMU AND (AFF3CT_COMPILE_STATIC_LIB OR AFF3CT_COMPILE_SHARED_LIB))
message(FATAL_ERROR "It is impossible to compile the AFF3CT library if AFF3CT_SYSTEMC_SIMU='ON'.")
endif()

if(AFF3CT_MPI AND (AFF3CT_COMPILE_STATIC_LIB OR AFF3CT_COMPILE_SHARED_LIB))
message(FATAL_ERROR "Building AFF3CT with the MPI support is incompatible with the library mode.")
endif()
Expand Down Expand Up @@ -423,29 +417,6 @@ macro(aff3ct_target_link_libraries privacy lib)
endif(AFF3CT_COMPILE_STATIC_LIB)
endmacro()

# SystemC (it is very important to have SystemC linked before the other libraries !!!)
if(AFF3CT_SYSTEMC_SIMU OR AFF3CT_SYSTEMC_MODULE)
if(AFF3CT_SYSTEMC_SIMU)
aff3ct_target_compile_definitions(PUBLIC "AFF3CT_SYSTEMC_SIMU")
aff3ct_target_compile_definitions(PUBLIC "AFF3CT_SYSTEMC_MODULE")
else()
aff3ct_target_compile_definitions(PUBLIC "AFF3CT_SYSTEMC_MODULE")
endif()

find_package(SystemC REQUIRED QUIET)
if(SystemC_FOUND)
message(STATUS "AFF3CT - Library found: SystemC")
aff3ct_target_include_directories2(PUBLIC "${SystemC_INCLUDE_DIRS}")
aff3ct_target_link_libraries(PUBLIC "${SystemC_LIBRARIES}")
endif(SystemC_FOUND)

find_package(TLM REQUIRED QUIET)
if(TLM_FOUND)
message(STATUS "AFF3CT - Library found: TLM")
aff3ct_target_include_directories2(PUBLIC "${TLM_INCLUDE_DIRS}")
endif(TLM_FOUND)
endif()

# GSL
if(AFF3CT_LINK_GSL)
aff3ct_target_compile_definitions(PUBLIC "AFF3CT_CHANNEL_GSL")
Expand Down
8 changes: 0 additions & 8 deletions doc/source/user/installation/compilation/compilation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,6 @@ this feature and provides the following options:
+-------------------------------+---------+---------+---------------------------------+
| ``AFF3CT_LINK_MKL`` | BOOLEAN | OFF | |cmake-opt-link_mkl| |
+-------------------------------+---------+---------+---------------------------------+
| ``AFF3CT_SYSTEMC_SIMU`` | BOOLEAN | OFF | |cmake-opt-systemc_simu| |
+-------------------------------+---------+---------+---------------------------------+
| ``AFF3CT_SYSTEMC_MODULE`` | BOOLEAN | OFF | |cmake-opt-systemc_module| |
+-------------------------------+---------+---------+---------------------------------+
| ``AFF3CT_MPI`` | BOOLEAN | OFF | |cmake-opt-mpi| |
+-------------------------------+---------+---------+---------------------------------+
| ``AFF3CT_POLAR_BIT_PACKING`` | BOOLEAN | ON | |cmake-opt-polar_bit_packing| |
Expand All @@ -285,10 +281,6 @@ this feature and provides the following options:
channels).
.. |cmake-opt-link_mkl| replace:: Link with the MKL library (used in the
channels).
.. |cmake-opt-systemc_simu| replace:: Enable the SystemC simulation
(incompatible with the library compilation).
.. |cmake-opt-systemc_module| replace:: Enable the SystemC support (only for the
modules).
.. |cmake-opt-mpi| replace:: Enable the MPI support.
.. |cmake-opt-polar_bit_packing| replace:: Enable the bit packing technique for
Polar code SC decoding.
Expand Down
106 changes: 4 additions & 102 deletions doc/source/user/library/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -420,113 +420,15 @@ possible to print debug information by toggling boolean to ``true`` at line
.. note:: The full source code is available here:
https://github.com/aff3ct/my_project_with_aff3ct/blob/master/examples/tasks/src/main.cpp.

.. _user_library_systemc:

SystemC/TLM
===========

Alternatively, the AFF3CT modules support SystemC/TLM interfaces,
:numref:`lst_systemc_main` highlights the modifications in the ``main`` function
to use standard TLM interfaces.

.. code-block:: cpp
:caption: SystemC/TLM: main function
:name: lst_systemc_main
:emphasize-lines: 13-18,33-54,59-61,70-72
:linenos:
#include <aff3ct.hpp>
using namespace aff3ct;
int sc_main(int argc, char** argv)
{
params1 p; init_params1 (p ); // create and initialize the parameters defined by the user
modules1 m; init_modules2(p, m); // create and initialize modules
utils1 u; init_utils1 (m, u); // create and initialize utils
// display the legend in the terminal
u.terminal->legend();
// add a callback to the monitor to call the "sc_core::sc_stop()" function
m.monitor->add_handler_check([&m, &u]() -> void
{
if (m.monitor->fe_limit_achieved())
sc_core::sc_stop();
});
// loop over the SNRs range
for (auto ebn0 = p.ebn0_min; ebn0 < p.ebn0_max; ebn0 += p.ebn0_step)
{
// compute the current sigma for the channel noise
const auto esn0 = tools::ebn0_to_esn0 (ebn0, p.R);
const auto sigma = tools::esn0_to_sigma(esn0 );
u.noise->set_values(sigma, ebn0, esn0);
// update the sigma of the modem and the channel
m.modem ->set_noise(*u.noise);
m.channel->set_noise(*u.noise);
// create "sc_core::sc_module" instances for each task
using namespace module;
m.source ->sc.create_module(+src::tsk::generate );
m.encoder->sc.create_module(+enc::tsk::encode );
m.modem ->sc.create_module(+mdm::tsk::modulate );
m.modem ->sc.create_module(+mdm::tsk::demodulate );
m.channel->sc.create_module(+chn::tsk::add_noise );
m.decoder->sc.create_module(+dec::tsk::decode_siho );
m.monitor->sc.create_module(+mnt::tsk::check_errors);
// declare a SystemC duplicator to duplicate the source 'generate' task output
tools::SC_Duplicator duplicator;
// bind the sockets between the modules
m.source ->sc[+src::tsk::generate ].s_out[+src::sck::generate ::U_K ](duplicator .s_in );
duplicator .s_out1 (m.monitor->sc[+mnt::tsk::check_errors].s_in[+mnt::sck::check_errors::U ]);
duplicator .s_out2 (m.encoder->sc[+enc::tsk::encode ].s_in[+enc::sck::encode ::U_K ]);
m.encoder->sc[+enc::tsk::encode ].s_out[+enc::sck::encode ::X_N ](m.modem ->sc[+mdm::tsk::modulate ].s_in[+mdm::sck::modulate ::X_N1]);
m.modem ->sc[+mdm::tsk::modulate ].s_out[+mdm::sck::modulate ::X_N2](m.channel->sc[+chn::tsk::add_noise ].s_in[+chn::sck::add_noise ::X_N ]);
m.channel->sc[+chn::tsk::add_noise ].s_out[+chn::sck::add_noise ::Y_N ](m.modem ->sc[+mdm::tsk::demodulate ].s_in[+mdm::sck::demodulate ::Y_N1]);
m.modem ->sc[+mdm::tsk::demodulate ].s_out[+mdm::sck::demodulate ::Y_N2](m.decoder->sc[+dec::tsk::decode_siho ].s_in[+dec::sck::decode_siho ::Y_N ]);
m.decoder->sc[+dec::tsk::decode_siho].s_out[+dec::sck::decode_siho::V_K ](m.monitor->sc[+mnt::tsk::check_errors].s_in[+mnt::sck::check_errors::V ]);
// display the performance (BER and FER) in real time (in a separate thread)
u.terminal->start_temp_report();
// start the SystemC simulation
sc_core::sc_report_handler::set_actions(sc_core::SC_INFO, sc_core::SC_DO_NOTHING);
sc_core::sc_start();
// display the performance (BER and FER) in the terminal
u.terminal->final_report();
// reset the monitor and the terminal for the next SNR
m.monitor->reset();
u.terminal->reset();
// dirty way to create a new SystemC simulation context
sc_core::sc_curr_simcontext = new sc_core::sc_simcontext();
sc_core::sc_default_global_context = sc_core::sc_curr_simcontext;
}
// display the statistics of the tasks (if enabled)
tools::Stats::show({ m.source.get(), m.encoder.get(), m.modem.get(), m.channel.get(), m.decoder.get(), m.monitor.get() }, true);
return 0;
}
.. note:: The full source code is available here:
https://github.com/aff3ct/my_project_with_aff3ct/blob/master/examples/systemc/src/main.cpp.

.. _user_library_factory:

Factory
=======

In the previous :ref:`user_library_bootstrap`, :ref:`user_library_tasks` and
:ref:`user_library_systemc` examples, the AFF3CT ``Module`` classes were built
statically in the source code. In the *Factory* example, ``factory`` classes
are used instead, to build modules dynamically from command line arguments.
In the previous :ref:`user_library_bootstrap` and :ref:`user_library_tasks`
examples, the AFF3CT ``Module`` classes were built statically in the source
code. In the *Factory* example, ``factory`` classes are used instead, to build
modules dynamically from command line arguments.

.. code-block:: cpp
:caption: Factory: main function
Expand Down
1 change: 0 additions & 1 deletion doc/source/user/simulation/parameters/other/other.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ Other parameters
* MPI: off
* GSL: off
* MKL: off
* SystemC: off
Copyright (c) 2016-2018 - MIT license.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Expand Down
9 changes: 0 additions & 9 deletions include/Module/Module.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
#include "Tools/Interface/Interface_clone.hpp"
#include "Module/Task.hpp"
#include "Module/Socket.hpp"
#ifdef AFF3CT_SYSTEMC_MODULE
#include "Module/SC_Module.hpp"
#endif

namespace aff3ct
{
Expand All @@ -43,12 +40,6 @@ class Module : public tools::Interface_clone

public:
std::vector<std::shared_ptr<Task>> tasks;
#ifdef AFF3CT_SYSTEMC_MODULE
#ifndef DOXYGEN_SHOULD_SKIP_THIS
friend SC_Module_container;
#endif
SC_Module_container sc;
#endif

/*!
* \brief Constructor.
Expand Down
Loading

0 comments on commit dbd5f7c

Please sign in to comment.