Ok to be honest the reason I got my hands on eclipse once again was that I wanted to try out SystemC with that. To do that I have to compile the SystemC source code using Cygwin but I have failed doing that so I present you what I have accomplished so far. Cygwin will be covered in a future post maybe.
There are many installation guides around the web and most of them are lookalike but in my case none of them covered the issues I got into so this is my guide for the task.
First of all the Microsoft Visual Studio 2005 should be installed. This is trivial and as I have done it a long time ago I won’t get into details. To get SystemC you need to go to the official site of Open SystemC Initiative (here) go to downloads –> OSCI Standards and look for the systemc-2.2.0.tgz file. In it there is a systemc-2.2.0 folder with a ton of stuff. Unzip it in C:\ so that you have c:\systemc-2.2.0.
Once unzipping is finished go to c:\sustemc-2.2.0\msvc71\SystemC\ and open either the solution or the VS project file with visual studio 2005. (Some guides suggest the folder msvc60 that does exist but is empty…)
Once the studio is opened you have to build the project using debug and release configuration. As I have barely used MS Visual Studio I have no idea what that meant so I demonstrate it here in more detail in case others are like me
As seen in the picture above there is this tiny arrow that switches between debug and release. I first built the debug and afterwards the release. Now I could find the folders debug and release with a SystemC.lib file in each one of them in
To proceed I had to create an environmental variable called
SYSTEMC that pointed to the above path. It was unclear where to create it I figured out that it should be done in the windows environmental variables. So: left click on computer –> properties –> advanced system settings –> environmental variables. There you can find user variables and system variables. It was not clear where to add it (I suspect it works fine just in user variables) so I added the same variable in both fields (variable name:
SYSTEMC , variable value:
Most guides suggest that it works using the fir example found in an examples folder somewhere in the unzipped files. It is most unfortunate that the current example seems to be buggy. Once I tried to built it I got the following fatal error:
fatal error LNK1169: one or more multiply defined symbols found
and that is because there are two files (
main_rtl.cpp ) that contain the sc_main. I found a solution around the web suggesting that the removal of the
main_rtl.cpp file from the project ends up with correct compile/link. I tried so but then I got an error message that the
main_rtl.cpp was missing! So after some frustration I decided to try other examples like the fft and I found out that they built nicely! So I proceeded with the next big step: trying to make a SystemC project of my own.
I had some source files so I created a new project and added those files. Here are the changes needed to be done on order to make it work:
Right click on the project name –> properties.
From tab C/C++ / General :
- Detect 64-bit Portability Issues –> No
From tab C/C++ / Preprocessor :
- Add the definition:
From tab C/C++ / Code Generation:
- For Debug built: Runtime Library –> Multi-threaded Debug(/MTd)
- For Release built: Runtime Library –> Multi-threaded (/MT)
From tab C/C++ / Language
- Enable Run-Time Type info –> Yes
From tab C/C++ / Command LIne
- Add the command /vmg in Addition Options box
From tab Linker / Input
- Write systemc.lib in additional dependences field.
To locate the headers and the libraries of SystemC (for any project the following should be done:
Tools –> Options –> Projects –> VC++ Directories
Choose Show Directories for: Library files
Select New and write:
Choose Show Directories for: Include files
Select New and write:
For the last one to work you also need to copy the source folder found in
c:\systemc-2.2.0 in c:\systemc-2.2.0\msvc71\ .
With all the above you should be able to use SystemC with visual studio. Next: GTKWave viewer.