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.
Compile the testbench components.
gcc -c -fPIC -O2 -I "$aldec/systemc/interface" $ProjectDir/testbench.cpp $ProjectDir/test.cpp -o testbench.o
Compile the test case 1.
gcc -c -fPIC -O2 -I "$aldec/systemc/interface" $ProjectDir/testcase1.cpp -o testcase1.o
Link the previously compiled object files.
ccomp -scv testbench.o testcase1.o -o sharedobject.so
Add shared object to work directory.
addsc sharedobject.so –work work
Compile all HDL files.
vcom -work work -o $ ProjectDir /src/*.vhd
vsim -lib work testbench
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.