Build and Install SystemC and ArchC


  • Unix layout for installed software. [Read it]({{ .Site.BaseURL }}document/unix_layout)
  • Basics of Git. Read the book
  • What is SystemC and ArchC.

Build Setup

First you need choose where you will keep the source and installed files. I like to keep all installed files of all project’s softwares in the same prefix, and for organization, keep the prefix in the same directory tree of the project sources.

export SOURCE_PREFIX="/A/B/ac_project"
export PREFIX="${SOURCE_PREFIX}/usr"

You can use you home to store this files. But keep in mind that a network mounted home (as NFS) have advantages and disadvantages.

export SOURCE_PREFIX="/${HOME}/A/B/ac_project"
export PREFIX="${SOURCE_PREFIX}/usr"

Both paths must exists:

mkdir -p "${SOURCE_PREFIX}"
mkdir -p "${PREFIX}"

Now, that you know where you will put the installed files, you can setup your paths to this project:

$ export PATH="${PREFIX}/bin/:${PATH}"
$ export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig:${PKG_CONFIG_PATH}"


SystemC uses the autotools build system. This is a very used build system, maybe you should ever considerate that the software are using this build system or similar one.

Fetch the SystemC, we suggest that you use (our git version)[]. But you can use the (Accellera vanilla code)[].

$ git clone "${SOURCE_PREFIX}/SystemC"

PS: We are using the commit (a7605fd)[].

The SystemC adopts a strange installation layout that you must avoid. In the version 2.3.1 they offer a flag to force use unix layout.

$ cd "${SOURCE_PREFIX}/SystemC"
$ autoreconf -vif
$ ./configure --with-unix-layout --prefix="${PREFIX}"
$ make # Build the source
$ make check # Build and execute the tests
$ make install # Install SystemC in defined $PREFIX


Similar to SystemC, the ArchC uses the autotools build system.

Fetch ArchC project:

$ git clone "${SOURCE_PREFIX}/ArchC"

PS: We are using the commit (594942b)[].

The ArchC will search the SystemC using the pkg-config, remember to use the correct path to help it find your SystemC installation.

$ cd "${SOURCE_PREFIX}/ArchC"
$ autoreconf -vif
$ ./configure --prefix="${PREFIX}"
$ make # Build the source
$ make check # Build and execute the tests
$ make install # Install ArchC in defined $PREFIX


The ArchC project maintains 4 processor models:

  • MIPS
  • ARM

You can fetch and build them:

mkdir -p "${SOURCE_PREFIX}/ACModels"
for model in mips arm sparc powerpc; do
  git clone "${model}.git" "${SOURCE_PREFIX}/ACModels/${model}";
  cd "${SOURCE_PREFIX}/ACModels/${model}";
  acsim ${model}.ac;

Guest Toolchain

You can get the compiled toolchain for each of the maintained models.

Run Guest Binaries

$ cd "${SOURCE_PREFIX}/ACModels/<model name>"
$ ./<model name>.x --load=<full path to binary>


$ cd "${SOURCE_PREFIX}/ACModels/mips"
$ ./mips.x --load=/tmp/

Debug processor models

Execution flow

You can compare two execution of same binary using the output and the trace. To generate the trace, you must print the list of PC used. Uncomment the debug line at <model>_isa.cpp :

//#define DEBUG_MODEL

Execute your binary:

$ make clean
$ make
$ ./<model name>.x --load=<full path to binary> 2>/tmp/ac_stderr

Get the trace of PC addresses:

$ LINES = 1000
$ grep '^DBG:.* PC=0x[0-9a-f]\+ .*$' /tmp/ac_stderr | head -n ${LINES} | sed 's/^DBG:.* PC=\(0x[0-9a-f]\+\) .*$/\1/g' >/tmp/ac_trace

If your binary was compiled with debug symbols, you can translate the address to source file and line:

$ cat /tmp/ac_trace | xargs <model>-newlib-elf-addr2line -a -f -p -e <full path to binary> >/tmp/ac_hltrace