Compiling Multiple SystemC Libraries


In order to save time on compilation of SystemC files some customers break the SystemC testbench into independent parts and compile them separately. The application note below explains how to compile SystemC files into separate independent object files and link them together into one shared object to be used in Riviera-PRO.

Let us assume that we have the following three SystemC files in our Project directory: testbench.cpp, test.cpp, testcase1.cpp. The testbench.cpp and test.cpp are the testbench components. The testcase1.cpp is the test case file.

In order to save compilation time, it is sometimes better to compile the testbench and test cases separately, so that, when you add new tests you can just compile the test cases separately.

Script Example

  1. Compile the testbench components.

    gcc -c -fPIC -O2 -I "$aldec/systemc/interface" $ProjectDir/testbench.cpp $ProjectDir/test.cpp -o testbench.o

  2. Compile the test case 1.

    gcc -c -fPIC -O2 -I "$aldec/systemc/interface" $ProjectDir/testcase1.cpp -o testcase1.o

  3. Link the previously compiled object files.

    ccomp -scv testbench.o testcase1.o -o

  4. Add shared object to work directory.

    addsc –work work

  5. Compile all HDL files.

    vcom -work work -o $ ProjectDir /src/*.vhd

  6. Start simulation

    vsim -lib work testbench


Printed version of site: