title: SystemC hello world keywords:c,macro,c++,systemc,HDL # SystemC hello world Miniaml example how to run SystemC without installation ## Compiling SystemC Downloadin and compiling systemc framework ```bash curl http://www.accellera.org/images/downloads/standards/systemc/systemc-2.3.2.tar.gz --output systemc-2.3.2.tar.gz tar -xvf systemc-2.3.2.tar.gz cd systemc-2.3.2/ ./configure ``` ## Prepare Makefile After compilation of systemc libraries we can create "Hello World" example. ```bash SYSTEMC_PATH=/home/user/downloads/source/systemc/systemc-2.3.2 SYSTEMC_INC=$(SYSTEMC_PATH)/src SYSTEMC_LIB=$(SYSTEMC_PATH)/src/.libs make: g++ hello_world.cpp -I$(SYSTEMC_INC) -L$(SYSTEMC_LIB) -Wl,-rpath=$(SYSTEMC_LIB)\ -o hello_world -lsystemc -lm ``` ```c #include "systemc.h" SC_MODULE (hello_world) { SC_CTOR(hello_world) { } void say_hello() { cout << "Hello world\n"; } }; int sc_main(int argc, char **argv) { hello_world hello("HELLO"); hello.say_hello(); return(0); } ``` after compilation try to run ```bash ./hello_world ``` output of this example is ```bash SystemC 2.3.2-Accellera --- Jul 13 2018 19:20:02 Copyright (c) 1996-2017 by all Contributors, ALL RIGHTS RESERVED Hello world ``` ## Links 1. [http://www.accellera.org/downloads/standards/systemc](http://www.accellera.org/downloads/standards/systemc) 2. [http://cfs-vision.com/systemc-tutorial/](http://cfs-vision.com/systemc-tutorial/)