【一生一芯】搭建verilator仿真环境

发布时间 2023-05-31 22:34:26作者: 老吴家的小阿哲

完成Linux环境配置之后,安装“一生一芯”项目所需要的仿真环境。这一步预学习讲义中并没有给出详细步骤,可以参考互联网以及官方指南

打开终端,输入以下命令,安装仿真环境需要的依赖:

# Prerequisites:
sudo apt-get install help2man
sudo apt-get install git perl python3 make autoconf g++ flex bison ccache
sudo apt-get install libgoogle-perftools-dev numactl perl-doc
sudo apt-get install libfl2  # Ubuntu only (ignore if gives error)
sudo apt-get install libfl-dev  # Ubuntu only (ignore if gives error)
sudo apt-get install zlibc zlib1g zlib1g-dev  # Ubuntu only (zlibc is needed for the Fst/GTKwave support at runtime, if you aren't using that you should be fine without it.)

从Github安装verilator:

git clone git@github.com:verilator/verilator.git

安装完成后,可以发现桌面上增加了一个名为verilator的文件夹。进入文件夹,控制版本为5.008:

cd verilator
git checkout v5.008

终端返回以下信息:

Note: switching to 'v5.008'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 21093fd1b Version bump

然后生成安装verilator需要的make文件:

autoconf
unset VERILATOR_ROOT .
/configure make -j `nproc`

最后安装verilator:

sudo make install

 查询安装的版本:

verilator --version

返回内容为:

Verilator 5.008 2023-03-04 rev v5.008

说明安装的版本是5.008,是要求的版本。