SystemC Development of Eclipse on Linux



    SystemC Development on Eclipse on Linux


For setting up the systemc development enviornment on Linux requires below packages available in you pc.

  • SystemC packages : Contains all SystenC related library/header file and esential stuff defined by accellera.
    Registration is required @ Accellera.org
  • Eclipse with C/C++ tools.
    Form linux software packages center or “apt-get install eclipse”
  • Before proceeding for systemC build enviornment run below command to be free from all intermideate troubles :)
  • sudo apt-get upgrade
  • sudo apt-get install build-essential
  • sudo apt-get update
Installing systemc Packages in Linux PC

Untar the SystemC packages
  • tar -xzvf systemc-2.3.1.tgz
Crating SystemC install Dir
  • sudo mkdir /usr/local/systemc-2.3.1
Configuiring the system c
./configure –prefix=/usr/local/systemc-2.3.1
  • Compile the packages and install
  • sudo make
  • sudo make clean
  • sudo make -j 3
  • sudo make install
  • Exporting the SystemC variable path in
  • export SYSTEMC_HOME=/usr/local/systemc-2.3.1/
  • sudo gedit /etc/environment
    and
    add below lines.
    SYSTEMC_HOME=”/usr/local/systemc-2.3.1/”
    export LD_LIBRARY_PATH=/usr/local/systemc-2.3.1/lib-linux64
  • sudo ~/.bashrc
    SYSTEMC_HOME=”/usr/local/systemc-2.3.1/”
    export LD_LIBRARY_PATH=/usr/local/systemc-2.3.1/lib-linux64:$LD_LIBRARY_PATH


Installing Eclipse Packages in Linux PC

Install below commands for eclipse and dependent packages
  • sudo apt-get install eclipse eclipse-cdt g++

Create a new C/C++ project using the menu File -> New -> Other.
Add all your systemc program files to the project.
It is time to inform eclipse+CDT where our systemC include headers and library files are.
  • Click Project -> Properties. Navigate to C/C++ Build -> Settings -> Tool Settings tab.
  • Under GCC C++ Compiler -> Includes, Add /usr/local/systemc-2.3.1/include to Include Paths.


































Add systemc dependent Library location in C++ linker settings.
Under
  • GCC C++ Linker -> Libraries,
  • Add /usr/local/systemc-2.3.1/lib-linux to Library Search Paths.
  • Add systemc and m to Libraries.































Reboot the pc

Create a basic Hello world kind of project and use the eclipse normally.

Run Configuration :
































Example code :
//==========================================================================
// Name : Hello.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;
// All systemc modules should include systemc.h header file
#include "systemc.h"
// Hello_world is module name
SC_MODULE (hello_world) {
SC_CTOR (hello_world) {
// Nothing in constructor
}
void say_hello() {
//Print "Hello World" to the console.
cout << "Hello World.\n";
}
};

// sc_main in top level function like in C++ main
int sc_main(int argc, char* argv[]) {
hello_world hello("HELLO");
// Print the hello world
hello.say_hello();
printf("Hello");
return(0);
}




=====================================
Output after running :

SystemC 2.3.1-Accellera --- Feb 13 2016 02:15:11
Copyright (c) 1996-2014 by all Contributors,
ALL RIGHTS RESERVED
Hello World.


Post a Comment

0 Comments