domingo, 9 de fevereiro de 2014

Install Verilator from sources

Prerequisites

This guide pretends to contain a summary of the necessary steps to complete a Verilator instalation from sources with also verilog-perl, SystemPerl and SystemC so coverage metrics can be extracted from a system simulation.
If you don't need those you can just use the packed binary from debian repo. It may also be usefull to install Gtkwave which is used to load the VCD files, in case you want take a look at some wave traces.

First let's start to install the necessary packages from the Debian repository:
:~$ sudo apt-get install bison flex autoconf build-essential perl g++ gtkwave

Install SystemC

Go to Accellera and download the SystemC 2.3.0 (now the file extension matches the file format). To compile all the needed software we will create a folder named softwr inside our home folder ~ . To install SystemC we will uncompress the file, create a directory to where it will be installed, configure and install.
:~$ mkdir softwr
:~$ mv Downloads/systemc-2.3.0.tgz softwr/.
:~$ cd softwr
:~/softwr$ tar -xzf systemc-2.3.0.tgz
:~/softwr$ cd systemc-2.3.0
:~/softwr/systemc-2.3.0$ mkdir objdir
:~/softwr/systemc-2.3.0$ cd objdir
:~/softwr/systemc-2.3.0/objdir$ sudo mkdir /usr/local/systemc-2.3.0
:~/softwr/systemc-2.3.0/objdir$ ../configure --prefix=/usr/local/systemc-2.3.0 --disable-shared
:~/softwr/systemc-2.3.0/objdir$ make 
:~/softwr/systemc-2.3.0/objdir$ sudo make install

Install Verilog-Perl

To install Verilog-Perl we will fetch the source code from veripool git repository.
:~/softwr/systemc-2.3.0/objdir$ cd ../../
:~/softwr$ git clone http://git.veripool.org/git/Verilog-Perl
:~/softwr$ cd Verilog-Perl 
:~/softwr/Verilog-Perl$ git pull 
Already up-to-date.
:~/softwr/Verilog-Perl$ git tag 
:~/softwr/Verilog-Perl$ perl Makefile.PL 
-Note: If building from 'git' sources (not from a CPAN tar file),
-Note: ignore any 'files are missing' below for */gen/ and README:
Checking if your kit is complete...
Warning: the following files are missing in your kit:
(...)
:~/softwr/Verilog-Perl$ make
(...)
:~/softwr/Verilog-Perl$ make test
(...)
t/86_vhier_tick.t .... ok 
All tests successful.
Files=32, Tests=419, 12 wallclock secs ( 0.25 usr  0.06 sys + 10.12 cusr  0.91 csys = 11.34 CPU)
Result: PASS
:~/softwr/Verilog-Perl$ sudo make install
Now let's add the following to .bashrc:
# SystemC 2.3.0
export SYSTEMC=/usr/local/systemc-2.3.0/
export SYSTEMC_INCLUDE=/usr/local/systemc-2.3.0/include/
export SYSTEMC_LIBDIR=/usr/local/systemc-2.3.0/lib-linux64/
export SYSTEMC_CXX_FLAGS=-pthread
Note: Do not add the SystemC lib path to LD_LIBRARY_PATH as we are using static lib. Let's finish this step by sourcing the new bashrc configuration.
:~/softwr/Verilog-Perl$ source ~/.bashrc

Install SystemPerl

To install SystemPerl we will also fetch the source code from veripool git repository.
:~/softwr/Verilog-Perl$ cd ..
:~/softwr$ git clone http://git.veripool.org/git/SystemPerl
:~/softwr$ cd SystemPerl
:~/softwr/SystemPerl$ git pull
Already up-to-date.
:~/softwr/SystemPerl$ git tag
:~/softwr/SystemPerl$ perl Makefile.PL
(...)
:~/softwr/SystemPerl$ make
:~/softwr/SystemPerl$ make test
...
All tests successful.
Files=19, Tests=167, 19 wallclock secs ( 0.13 usr  0.05 sys + 27.29 cusr  2.13 csys = 29.60 CPU)
Result: PASS
:~/softwr/SystemPerl$ sudo make install
Note: If make test fails, try calling with VERILATOR_AUTHOR_SITE=1 make test .
After we will have to add SystemPerl to the path. Add the following to .bashrc:
#SystemPerl
export SYSTEMPERL=/usr/local/bin/
export SYSTEMPERL_INCLUDE=/home/yourhomedir/softwr/SystemPerl/src
Now source bashrc again:
:~/softwr/SystemPerl$ source ~/.bashrc

Install Verilator

:~/softwr/SystemPerl$ cd ..
:~/softwr$ git clone http://git.veripool.org/git/verilator
:~/softwr$ cd verilator
:~/softwr/verilator$ git pull
Already up-to-date.
:~/softwr/verilator$ git tag
:~/softwr/verilator$ autoconf
(...)
:~/softwr/verilator$ unset VERILATOR_ROOT
(...)
:~/softwr/verilator$ ./configure
:~/softwr/verilator$ make
:~/softwr/verilator$ make test
(...)
Total coverage (72/146) 49.32%
See lines with '' in logs/coverage_source
(...)
:~/softwr/verilatorl$ sudo make install
Now add verilator root to the path. Add the following to .bashrc:
#Verilator
export VERILATOR_ROOT=/home/yourdir/softwr/verilator
Source bashrc.
:~/softwr/verilator$ source ~/.bashrc
And it is done!

Sources:
Verilator Installation Guide
Verilator Manual

Sem comentários:

Enviar um comentário