Learning SystemC: #000 Learning Materials and Initial Setup

Learning SystemC: #000 Learning Materials and Initial Setup

Posted by

I always wanted to learn SystemC and today I decided to actually allocate some of my time for this long pending task of mine.

Along the way I will document all the steps I am making with the hope that somebody else might benefit from my experience/mistakes or at least I will be able to better secure in my mind the newly acquired knowledge.

I am setting a target for me once I have some basic SystemC knowledge: develop an AES library in SystemC.

Before I get to the actual learning I need to figure out a couple of things:

  1. what materials to use for learning SystemC
  2. download SystemC
  3. setting up an IDE with a basic way of running any examples that I will write



1. Learning Materials

After a quick search on the internet I came across these tutorials:

For me, most appealing seamed to be “SystemC Tutorial” from Asic-World but a friend of mine gave me this book: SystemC: From the Ground Up and he told me it is pretty good.

So I decided to go with this book and if it will not work for me I will go back to the tutorial form Asic-World.

By the way, it looks like there is a newer edition of this book here: SystemC: From the Ground Up

2. Download SystemC

I went to Accellera website and got “Core SystemC Language and Examples”, currently at version 2.3.1.

3. SystemC with Eclipse and Cygwin

I downloaded Eclipse IDE for C/C++ Developers.

I found a quick guide on how to setup SystemC with Eclipse and Cygwin from Danish Technological institute. I also upload the PDF on my site just for backup: Guide for getting started with SystemC development

Keep in mind that this is a guide for setting up an older version of SystemC but I was able to extract from it a lot of useful information.

Because I already had Cygwin installed on by computer I jump to the section Installing SystemC with cygwin

I did NOT changed systemc.h file as in the PDF. In the version I used (2.3.1) the file already had the preprocessor directives.

I run the following commands in the Cygwin terminal:

1
2
3
4
cd C://Users/Cristi/software/SystemC/systemc-2.3.1a/systemc-2.3.1a
mkdir objdir
cd objdir/
../configure

I got in the end an output like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
---------------------------------------------------------------------
Configuration summary of SystemC 2.3.1 for x86_64-unknown-cygwin
---------------------------------------------------------------------

 Directory setup (based on classic layout):
   Installation prefix (aka SYSTEMC_HOME):
      /cygdrive/c/Users/Cristi/software/SystemC/systemc-2.3.1a/systemc-2.3.1a
   Header files  : <SYSTEMC_HOME>/include
   Libraries     : <SYSTEMC_HOME>/lib-cygwin64
   Documentation : <SYSTEMC_HOME>/docs
   Examples      : <SYSTEMC_HOME>/examples

 Architecture    : cygwin64
 Compiler (flags): g++


 Build settings:
   Enable compiler optimizations  : yes
   Include debugging symbols      : no
   Coroutine package for processes: QuickThreads
   Disable async_request_update   : no
   Phase callbacks (experimental) : no
   Additional settings            :

---------------------------------------------------------------------

To install SystemC I just run:

1
make install

This executed without any errors.
Next I tried the command for checking the installation:

1
make check

Apparently this runs all the examples. At the end I got the following output:

1
2
3
4
5
6
7
8
9
10
11
=============================================================
11 of 21 tests failed
Please report to http://forums.accellera.org/forum/9-systemc/
=============================================================
make[3]: *** [Makefile:2684: check-TESTS] Error 1
make[3]: Leaving directory '/cygdrive/c/Users/Cristi/software/SystemC/systemc-2.3.1a/systemc-2.3.1a/objdir/examples/sysc'
make[2]: *** [Makefile:2808: check-am] Error 2
make[2]: Leaving directory '/cygdrive/c/Users/Cristi/software/SystemC/systemc-2.3.1a/systemc-2.3.1a/objdir/examples/sysc'
make[1]: *** [Makefile:357: check-recursive] Error 1
make[1]: Leaving directory '/cygdrive/c/Users/Cristi/software/SystemC/systemc-2.3.1a/systemc-2.3.1a/objdir/examples'
make: *** [Makefile:434: check-recursive] Error 1

I do not know why some tests failed (maybe it was intended) but at least I can see that some tests where passing and this is a proof that SystemC was installed and run correctly.

I moved to section Creating SystemC Applications in Eclipse:

Select File > New > C++ Project

New SystemC project in Eclipse

New SystemC project in Eclipse

Click: Next > Advanced Settings

Select Advanced Settings

Select Advanced Settings

Go to: C/C++ Build > Settings > Tool Settings > Cygwin C++ Compiler > Includes > Include Paths -I
Add the path to systemc-2.3.1a/include

Add the path to SystemC include

Add the path to SystemC include

Go to: C/C++ Build > Settings > Tool Settings > Cygwin C++ Linker > Libraries

Configure “Libraries -l” and “Library search path -L” as in the picture bellow:

Add the SystemC library for Cygwin

Add the SystemC library for Cygwin

Click: Finish

Create a new source folder called src:

Create a new source folder

Create a new source folder

Create a new source folder

Create a new source folder

Next create a new source file called Top.cpp

Create a new source file

Create a new source file

Create a new source file

Create a new source file

Next just add the following code in Top.cpp

1
2
3
4
5
6
7
#include "systemc.h"
#include <iostream>

int sc_main(int , char* []) {
    cout << "Hello World!!!" << endl;
    return 0;
}

And just press Run button:

Create a new source file

Create a new source file

And that’s it!
We now have Eclipse configured for SystemC and Cygwin running – let the learning begin!!!

Next Lesson: Learning SystemC: #001 Data Types



Cristian Slav

6 Comments

Leave a Reply to Pradeep Naraharirao Cancel Reply

Your email address will not be published.