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:
- what materials to use for learning SystemC
- download SystemC
- 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:
- “SystemC Tutorial” from Asic-World – text
- “SystemC Tutorial” from Verification Guide – text
- “Learn SystemC” from ForteDesignSystems – YouTube video playlist
- “SystemC and TLM-2.0” from John Aynsley – YouTube video playlist
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:
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:
---------------------------------------------------------------------
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 :
Libraries :
Documentation :
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:
make install
This executed without any errors.
Next I tried the command for checking the installation:
make check
Apparently this runs all the examples. At the end I got the following output:
=============================================================
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

Click: Next > 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

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:

Click: Finish
Create a new source folder called src:


Next create a new source file called Top.cpp


Next just add the following code in Top.cpp
#include "systemc.h"
#include
int sc_main(int , char* []) {
cout << "Hello World!!!" << endl;
return 0;
}
And just press Run button:

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
If you want to gain an in-depth knowledge on how to do module level verification using SystemVerilog and UVM language then checkout my Udemy course called “Design Verification with SystemVerilog/UVM“



Thanks Cristian for sharing this.Your articles are bring clarity and piques readers interest. I can’ t help myself trying this out.
Thanks!
Thank You Cristian,
I was looking for something like this everywhere in web. Now I can start using SystemC
Hello Shahadat,
I’m also new to SystemC, and I have a lot of learning to do. If you don’t mind, please contact me on ijikekingsley@yahoo.com. I will really like to get in touch with you.
Hello Shahadat,
I am also new to SystemC, and I have a lot of learning to do. If you don’t mind, please contact me on ijikekingsley@yahoo.com. I will like to get in touch with you.
Great tutorial! When I tried to compile with Cygwin I’ve founded the same problem that tests have failed, here in this link they provide a solution to the problem (http://forums.accellera.org/topic/5627-systemc-231-installation-problem-on-windows-7-with-cygwin/) . Make sure you have the “–enable-pthreads” option set when you do the configuring of the library.