ubuntu搭建verilator仿真环境

本文详细介绍了在Ubuntu22.04上安装verilator5.008版本以进行RTL功能仿真的步骤,包括安装依赖、获取源码、编译和安装。接着展示了如何创建简单的C++测试用例,并给出了如何将Verilog模块转换为C++代码进行仿真。最后,文章提到了自动化Makefile脚本,以支持不同执行模式下的仿真流程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Ubuntu(22.04.2 LTS)中,使用verilator开源verilog仿真工具,进行RTL功能仿真。现构建版本为5.008verilator仿真环境。

安装流程

安装依赖

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
sudo apt-get install libfl-dev
sudo apt-get install zlibc zlib1g zlib1g-dev

获取源码

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

选择合适的版本(5.008)

unsetenv VERILATOR_ROOT
unset VERILATOR_ROOT
cd verilator
git pull
git tag
git checkout v5.008

编译

autoconf
./configure
make
sudo make install

简单C++测试用例

创建测试文件夹test_our

mkdir test_our
cd test_our

创建Verilog/SystemVerilog文件our.v,内容如下

cat >our.v <<'EOF'
  module our;
     initial begin $display("Hello World"); $finish; end
  endmodule
EOF

创建C++文件sim_main.cpp,内容如下

cat >sim_main.cpp <<'EOF'
  #include "Vour.h"
  #include "verilated.h"
  int main(int argc, char** argv) {
      VerilatedContext* contextp = new VerilatedContext;
      contextp->commandArgs(argc, argv);
      Vour* top = new Vour{contextp};
      while (!cont
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值