how to use and install SystemC in terminal mac OS X?

SunKyu Lee picture SunKyu Lee · Sep 21, 2014 · Viewed 7k times · Source

how to use and install SystemC in terminal mac OS X?
I tried the Logic poet application, But i use os x 10.10 so it doesn't work.
so i want to know how can i compile and execute SystemC in terminal.
I could't find the detail of SystemC in terminal.

Thank you

Answer

DarrylLawson picture DarrylLawson · Dec 6, 2014

The other answer is correct and perfectly fine, however, I thought I'd also answer and provide a little more detail.

Install Apple's "Command Line Tools"

You have two options: install Xcode (a big download), or just the command line tools (a much smaller download). If your goal is simply building SystemC applications at the command line, then I recommend the latter.

Install Apple's "Command Line Tools" by launching Terminal, entering

$ xcode-select --install

then clicking Install. After that, you'll have make, clang and more available at the command line.

Build and install Accellera's SystemC implementation

Download the latest release from the Accellera Downloads page (annoyingly, you'll have to provide a few personal details) and extract the contents of the .zip file.

I like to keep a copy of the SystemC source code available, because it can be useful for debugging or understanding how something works. Therefore, I move the extracted folder (systemc-2.3.1) into ~/Work/Other. That's where I keep source code for third party libraries. However, you can put it wherever you like.

Open Terminal, change into the extracted folder (systemc-2.3.1), and execute:

$ mkdir build
$ cd build
$ export CXX=clang++
$ ../configure --with-arch-suffix=
$ make install

The --with-arch-suffix= option prevents a -macosx64 suffix being add to the lib folder name, allowing your build scripts to be simpler.

After that process, the salient include and lib folders should be available within the systemc-2.3.1 folder.

Configure your build environment

There are many ways you can do this; I have a simple approach that I believe is close to what the SystemC maintainers envisioned. I define two environment variables in my .bash_profile (which is executed for every new Terminal session on OS X):

export CXX="clang++ -fcolor-diagnostics"
export SYSTEMC_HOME=~/Work/Other/systemc-2.3.1

Build a SystemC application

You could use Make, the quintessential build tool, which you get with Apple's "Command Line Tools", or any one of the plethora of other options. I use SCons with SConstruct files that look something like this:

import os
env = Environment(CXX=os.environ["CXX"],
                  SYSTEMC_HOME=os.environ["SYSTEMC_HOME"],
                  CPPPATH="$SYSTEMC_HOME/include",
                  LIBPATH="$SYSTEMC_HOME/lib")
env.Program("main.cpp", LIBS="systemc")

View trace (VCD) files

Scansion is a nice tool for this. GTKWave is another option, but it's a bit clunky.