4.3.10 SoCLib based platforms
[Platforms module]
The SoCLib based platforms module is described through the following subsections:
- 4.3.10.1 Module API
Building SystemCASS [link]
Building SoCLib requires SystemCASS, a SystemC replacement that can be used as a hardware description language. Checkout SystemCASS from svn:
svn co https://www.soclib.fr/svn/systemcass/sources
Install automake and libtool, then go into the SystemCASS directory and configure it:
cd sources
./bootstrap
mkdir objdir
cd objdir
../configure
By default, the SystemCASS libraries and header files are installed in /usr/local. You can optionally specify the installation directory for SystemCASS with the --prefix switch:
mkdir ~/bin/systemcass
export SYSTEMCASS=~/bin/systemcass
../configure --prefix=SYSTEMCASS
Export the following variable:
export CXX=g++
Then install SystemCASS (root access is needed if SystemCASS was configured without --prefix):
make install
This step may fail for recent compilers with the following error:
../../src/entity.cc: In function 'std::ostream& sc_core::operator<<(std::ostream&, const equi_t&)':
../../src/entity.cc:466:16: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
466 | o << ((nb++) ? " = " : "") << ity;
| ^~
make[1]: *** [Makefile:672: libsystemc_la-entity.lo] Error 1
If this is the case, edit the file sources/src/entity.cc and replace the line
o << ((nb++) ? " = " : "") << ity;
with
o << ((nb) ? " = " : "") << ity;
nb = !nb;
Building SoCLib [link]
The next step is to compile SoCLib for MutekH. Clone the repository:
hg clone https://code.ssji.net/hg/diaxen/soclib-ng/
Add the SoCLib utils/bin directory to the path environment variable:
export PATH=$PATH:/path/to/soclib-ng/utils/bin
Export the SystemCASS binary directory and proceed to build the MutekH kernel tutorial. If SystemCASS was installed by default to /usr/local, export SYSTEMC as being /usr/local:
export SYSTEMC=/usr/local
If SystemCASS was configured with --prefix, export SYSTEMC with the prefix value. Following the above example:
export SYSTEMC=~/bin/systemcass
Before building the MutekH kernel tutorial, you need to edit a configuration file if you are bulding for 64-bit platforms. Assuming you are building for GNU/Linux, edit soclib-ng/utils/lib/python/soclib_cc/config/built-in.conf and change the line
("x86_64*linux*", 'linux64' ),
to
("x86_64*linux*", 'linux' ),
Add lib-linux to the shared library path. If SystemCASS was installed by default in /usr/local:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib-linux
If --prefix was used for configuring SystemCASS, following the above example:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/bin/systemcass/lib-linux
Now build the MutekH kernel tutorial from a Python environment where the Python version is 2.7:
cd soclib-ng/platform/mutekh_kernel_tutorial
make
This generates the executable system.x. In order to start the simulation, you need a MutekH image. For example, here is how to generate one for ARM:
cd /path/to/mutekh
make CONF=examples/hello/config BUILD=soclib-arm:pf-tutorial:shell
Now run the simulation as follows:
/path/to/soclib-ng/platform/mutekh_kernel_tutorial/system.x arm:1 hello-soclib-arm.out
Note that SoCLib requires xterm to be installed.