Compiling Multiple SystemC Libraries

Introduction

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 sharedobject.so

  4. Add shared object to work directory.

    addsc sharedobject.so –work work

  5. Compile all HDL files.

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

  6. Start simulation

    vsim -lib work testbench

Note.

  • The steps and commands above can be run either in GUI of Riviera-PRO or in the console mode, i.e. the OS shell.

  • The steps above do not depend on whether your top level is HDL (Verilog or VHDL) or SystemC.

Ask Us a Question
x

Ask Us a Question

x
Captcha ImageReload Captcha
Incorrect data entered.
Thank you! Your question has been submitted. Please allow 1-3 business days for someone to respond to your question.
Internal error occurred. Your question was not submitted. Please contact us using Feedback form.