0% found this document useful (0 votes)
24 views5 pages

Getting Started With SystemC - ElectroBucket

This document provides a guide for setting up SystemC, a C++ library for concurrent simulation in electronic system design, on an Ubuntu 12.04 machine. It includes step-by-step instructions for downloading, installing, and running a simple 'Hello World!' program using SystemC. Additionally, it addresses common issues and errors encountered during the installation process.

Uploaded by

jzz712846
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views5 pages

Getting Started With SystemC - ElectroBucket

This document provides a guide for setting up SystemC, a C++ library for concurrent simulation in electronic system design, on an Ubuntu 12.04 machine. It includes step-by-step instructions for downloading, installing, and running a simple 'Hello World!' program using SystemC. Additionally, it addresses common issues and errors encountered during the installation process.

Uploaded by

jzz712846
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

2014年3月26日 Getting Started with SystemC | electroBucket

electroBucket

SYSTEMC

GETTING STARTED WITH SYSTEMC


APRIL 20, 2013 | SANTOSH | 13 COMMENTS

SystemC is a set of C++ libraries, which enables a designer to perform cuncurrent simulation of system level model.
It is used for Electronic System Level design and Transaction Level Modelling(TLM). In this article we will discuss the
setup of SystemC in an Ubuntu 12.04 Machine and executing our first Hello World! program.

1. Download SystemC source from Accellera website.

2. Untar the package using 㫛㫘㫙㫔㫕㫚㫜㫝㫝㫔㫚㫛㫚㫛㫜㫤㫚㫕㫕㫖㫖㫖㫘㫖㫛㫞㫜

3. Change to the top level directory systemc-2.3.0 : 㫚㫛㫔㫚㫛㫚㫛㫜㫤㫚㫕㫕㫖㫖㫖㫘

4. Make a directory systemc230 for installation in your 㫗㫜㫚㫙㫗㫣㫦㫚㫘㫣㫗 path.

sudo mkdir /usr/local/systemc230


5. Create a directory for object code using 㫤㫢㫛㫠㫙㫔㫦㫙㫡㫛㫠㫙

6. Change directory to objdir using 㫚㫛㫔㫦㫙㫡㫛㫠㫙

7. Run configure from your top level directory: 㫖㫖㫗㫚㫦㫥㫝㫠㫞㫜㫙㫜㫔㫕㫕㫧㫙㫜㫝㫠㫚㫖㫗㫜㫚㫙㫗㫣㫦㫚㫘㫣㫗㫚㫛㫚㫛㫜㫤㫚㫕㫖㫘

8. Do 㫤㫘㫢㫜

9. Install by typing command: 㫚㫜㫛㫦㫔㫤㫘㫢㫜㫔㫠㫥㫚㫛㫘㫣㫣

You are done with installation of SystemC 2.3.0. This version is packed with TLM package also. Now we can run our
first Hello World! program.

Open your favourite text editor and enter the following program:

// All systemc modules should include systemc.h header file


#include <systemc.h>
// Hello_world is module name
SC_MODULE (hello_world) {

http://www.electrobucket.com/systemc/getting-started-with-systemc 1/5
2014年3月26日 Getting Started with SystemC | electroBucket

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();
return(0);
}

Save the file as hello.cpp. Use following command to export a variable 㫗㫘㫗㫘㫖㫗㫖㫘㫗㫗㫗㫖 .

㫜㫚㫧㫦㫙㫛㫔㫗㫘㫗㫘㫖㫗㫖㫘㫗㫗㫗㫖㫖㫗㫜㫚㫙㫗㫣㫦㫚㫘㫣㫗㫚㫛㫚㫛㫜㫤㫚㫕㫖㫘㫗

Now you can use following command to compile the program:

g++ -I. -I$SYSTEMC_HOME/include -L. -L$SYSTEMC_HOME/lib-linux -Wl,-rpath=$SYSTEMC_HOME/lib-linux -o hello hell

Once the program is compiled type following to run your program

㫖㫗㫟㫜㫣㫣㫦

and you should get output

SystemC 2.3.0-ASI --- Aug 12 2012 09:27:22


Copyright (c) 1996-2012 by all Contributors,
ALL RIGHTS RESERVED

Hello World.
If you get above output, you have successfully completed the setup and run your first SystemC program.

Note: This set of instruction has been tested with Linux Mint 14 which is derivative of Ubuntu Linux. In Ubuntu
12.10, user might need to install g++ before going through these steps.

http://www.electrobucket.com/systemc/getting-started-with-systemc 2/5
2014年3月26日 Getting Started with SystemC | electroBucket

► TGZ Ubuntu ► 0 Install ► Ubuntu Install ► 2.3 0 Download

SYSTEMC

AROUND THE WEB WHAT'S THIS?

Older Homes Are Better Than Newer 10 Breathtaking Places in the World Pope Francis Reveals He Used to Work
Ones Porch.com Amerikanki as a Bar Bouncer World News

ALSO ON ELECTROBUCKET

Remove the Trojan.PWS.Legmir.AD / W32.Ahlem.A@mm Show Desktop Notification for all mails in Outlook
virus from your PC 3 comments 2 comments

Wifi not working in Linux Mint 14 13 comments Pull­Up and Pull­Down Resistor 4 comments

13 Comments electroBucket Login

Sort by Best Share Favorite

Join the discussion…

Paul Ehrlich • 10 months ago


Thanks worked even for Ubuntu 13.04.

Two thinks a had to to additionally

1)sudo apt­get install g++ (wasn't somehow not on my system, maybe 13.04 standard?)

2) export LD_LIBRARY_PATH=/usr/local/systemc­2.3.0/lib­linux64:$LD_LIBRARY_PATH

oterwise my SystemC example wouldn't start and stop with the followin error

./example.o: error while loading shared libraries: libsystemc­2.3.0.so:


http://www.electrobucket.com/systemc/getting-started-with-systemc 3/5
2014年3月26日 Getting Started with SystemC | electroBucket
./example.o: error while loading shared libraries: libsystemc­2.3.0.so:
cannot open shared object file: No such file or directory
1 • Reply • Share ›

Santosh Mod Paul Ehrlich • 10 months ago


Yes Paul.
Somehow 㫞㫕㫕 is not installed by defult in Ubuntu 12.10 too.

I was not aware of LD_LIBRARY_PATH issue. I will test it and update the article accordingly. Thanks a lot
for updating.
• Reply • Share ›

Santosh Mod • 11 months ago


Hi All,

Sorry for creating confusions. There were some mistakes in the article. Article has been updated now.

Thanks Nathanael for pointing out.


• Reply • Share ›

bhargv • 11 months ago


any one please help me on this.
when i execute step 5 i got this error.
“bash: ../configure: No such file or directory”
& if just use ../configure then at a time of compilion it gives error
“fatal error as systemc.h:No such file or directory”
• Reply • Share ›

skjoshi bhargv • 11 months ago


The article has been updated. Please follow it now and let me know if problem persists.
• Reply • Share ›

Chi • 11 months ago


Hello,

While I am trying to compile your hello example, the follow error shows:

/usr/bin/ld: cannot find ­lsystemc


collect2: ld returned 1 exit status
Anhy idea?
Thanks
• Reply • Share ›

Sanju Chi • 11 months ago


Did you define㫔㫗㫘㫗㫘㫖㫗㫖㫘㫗㫗㫗㫖? If yes, is it pointing to the correct path?
• Reply • Share ›

Sanju • 11 months ago


I am not sure about 2.2.0.
Have you added the systemC installation path in include directories while compiling?
㫕㫘㫖㫔㫕㫘㫔㫗㫘㫗㫘㫖㫗㫖㫘㫗㫗㫗㫖㫗㫠㫥㫚㫣㫜㫛㫜

option can add the include path where 㫕㫘㫖㫔㫕㫘㫔㫗㫘㫗㫘㫖㫗㫖㫘㫗㫗㫗㫖㫔should point to your SystemC installation directory. Try
additing proper command options. It will be helpful you could post your compilation command here.
• Reply • Share ›

nikilla • 11 months ago


I am getting the error while compiling the code given in examples (i.e) in systemc­2.2.0­examples….
http://www.electrobucket.com/systemc/getting-started-with-systemc 4/5
2014年3月26日 Getting Started with SystemC | electroBucket
I am getting the error while compiling the code given in examples (i.e) in systemc­2.2.0­examples….
Commands used are..
cd —installation path of systemc till simple_fifo
make check….
after this i am getting as systemc.h file not found..
Help me out..
• Reply • Share ›

Nathanael nikilla • 11 months ago


please please please !!!!

when you make a copy paste do it well !!!

when you are to the step 5 before running the configuration, you have to do:

mkdir objdir
cd objdir

after you have to configure:


../configure –prefix=/usr/local/systemc230

and now you can do the rest.

ps the command make have to be run in objdir directory


• Reply • Share ›

nikilla • 11 months ago


can you plz help me to rectify the error

Thank you
• Reply • Share ›

nikilla • 11 months ago


i am getting fatal error as systemc.h:No such file or directory
Compilation terminated
• Reply • Share ›

Sanju nikilla • 11 months ago


Is this error appearing while compiling SystemC or your program?
• Reply • Share ›

Subscribe Add Disqus to your site

http://www.electrobucket.com/systemc/getting-started-with-systemc 5/5

You might also like