Installing SystemC using Microsoft Visual Studio 2005

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 Smile

visual_studio01

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 C:\systemc-2.2.0\msvc71\SystemC\.

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: c:\systemc-2.2.0\msvc71 ).

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.cpp and 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: _CRT_SECURE_NO_DEPRECATE

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: $(SYSTEMC)\SystemC\Debug

Choose Show Directories for: Include files

Select New and write: &(SYSTEMC)\\src

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.

Introducing eclipse

And I don’t mean the vampire series. I mean the IDE (Integrated Development Environment). I used eclipse to write Java for quite some time. I finished my pre-graduate thesis with it. Lately I’ve been writing code almost exclusively on notepad++ but the idea of having an integrated environment to write any code is flickering in my mind.

The challenge. To write and compile most common code using eclipse. Apart from Java eclipse supports much more. So let’s start with installation. Eclipse is developed in Java itself so it will need a JRE to run. You can get the latest Java Runtime Environment here.

Last time I got to use eclipse I remembered that there was a package including everything. However as I was to download eclipse from the eclipse.org I could not find one. I downloaded the standard Java package (Eclipse Classic 3.6.2), the C/C++ package (Eclipse IDE for C/C++ Developers) and the PHP package (Eclipse for PHP Developers) that suffice for my needs. Then I extracted the eclipse folder of each one of them zips and merged the three folders into one overwriting everything. (As I guessed so it worked like a charm and I got to have java,C,C++ and web projects available).

My problem at first was that for some reason eclipse was searching for the JRE exclusively in …/eclipse/jre/ so I could not get the IDE get started at all. What I did eventually was to copy paste the JRE in my case …/java/jre6/ and rename the jre6 folder to jre.

So far I have Java, C , C++ and PHP support among with Javascript and HTML. To use LaTeX and VHDL as well I had to intall two plugins: TeXlipse and simplifide.The thing with simplifide is that it is not free. You can try it as there is a trial and it also has an academic license.

To install TeXlipse I went to Help –> Install new software and in the field “work with” I entered the url: http://texlipse.sourceforge.net. Below TeXlipse was available to install so I checked it and then clicked on Next. Coming soon: more details on how to use eclipse.