summaryrefslogtreecommitdiff
path: root/md/writeup
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2018-10-12 22:16:27 +0100
committerFreeArtMan <dos21h@gmail.com>2018-10-12 22:16:27 +0100
commita875779284f53a9a632aa24e5bd6d5c5465cb5ec (patch)
tree8479be18b22341b32fd15f93ff32cf227fb17486 /md/writeup
parent582bef71d29f524748ef9059eea9ec1e9a361eb3 (diff)
downloadmd-content-a875779284f53a9a632aa24e5bd6d5c5465cb5ec.tar.gz
md-content-a875779284f53a9a632aa24e5bd6d5c5465cb5ec.zip
Add systemc helloworld
Diffstat (limited to 'md/writeup')
-rw-r--r--md/writeup/systemc_hello_world.md72
1 files changed, 72 insertions, 0 deletions
diff --git a/md/writeup/systemc_hello_world.md b/md/writeup/systemc_hello_world.md
new file mode 100644
index 0000000..b832d2e
--- /dev/null
+++ b/md/writeup/systemc_hello_world.md
@@ -0,0 +1,72 @@
+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/)