Thursday, March 29, 2012

Use vcs to sim systemc file

My ubuntu is 10.04, the default g++ is 4.4. But for simulating systemc file, you need to specify the lower version of g++.

The problem can be solved as follows:
1.  Go to the archive link to download the following five files:
    gcc-3.4-base_3.4.6-6Ubuntu3_i386.deb、
    gcc-3.4_3.4.6-6Ubuntu3_i386.deb、
    cpp-3.4_3.4.6-6Ubuntu3_i386.deb、
    g++-3.4_3.4.6-6Ubuntu3_i386.deb、
    libstdc++6-dev_3.4.6-6Ubuntu3_i386.deb
Put them into the same folder, like g++-3.4, and then run command "dpkg -i *.deb";

2. redirect the g++ link to use the lower version
   You can find the g++-3.4 with find / -name g++-3.4* command, however, it is already inside the /usr/bin if you are familiar. All you need to do right now is to redirect the g++ to your newly installed file.
   The command is "ln -sf /usr/bin/g++-3.4 /usr/bin/g++";
   There is also another way, check the reference link(in Chinese)

With the user guide, the easiest way is to run simulations of your systemc file is :
   syscan adder.cpp
   syscan adder_tb.cpp adder_main.cpp
   vcs -sysc sc_main
   ./simv

Tuesday, March 27, 2012

Verdi and VCS cosim

1. add fsdb functions into your testbench
  $fsdbDumpfile("test.fsdb");
  $fsdbDumpvars;
use `ifdef macros to optionally enable. Need to specify +define+DumpFSDB(`ifdef DumpFSDB) in your vcs command options

2. Find fsdb PLI lib files
  for vcs ${NOVAS_INST_DIR}/share/PLI/VCS/${PLATFORM}/pli.a(or novas.tab)
  also include the lib directory
  ${NOVAS_INST_DIR}/share/PLI/lib/${PLATFORM}
  better to specify the path for the LD_LIBRARY_PATH within your ~/.bashrc file

3. Specify the PLI archive files
  My method is copy the files(novas.tab and pli.a) into the working directory, and use the vcs command:
  vcs filename.v +v2k -P novas.tab pli.a(${abosulute_path/pli.a} if not copied)

4. ./simv to get the .fsdb file

5. use Verdi to check the .fsdb file
  command like, verdi -2001 -f vcs.args -ssf test.fsdb