ubuntu搭建verilator仿真环境 |
您所在的位置:网站首页 › vcd设置 › ubuntu搭建verilator仿真环境 |
文章目录
安装流程简单C++测试用例真实电路模块自动化Makefile脚本
Ubuntu(22.04.2 LTS)中,使用verilator开源verilog仿真工具,进行RTL功能仿真。现构建版本为5.008的verilator仿真环境。 安装流程安装依赖 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 eval(); } delete top; delete contextp; return 0; } EOF使用verilator仿真 verilator --cc --exe --build -Wall sim_main.cpp our.v --cc:获取C++输出。--exe:创建可执行文件。--build:verilator自动进行make。Wall:更严格的warning检查。 运行仿真 obj_dir/Vour现在测试真实电路模块,并记录仿真过程。 创建Verilog/SystemVerilog文件top.v,内容如下 module top( input a, input b, output f ); assign f = a ^ b; endmodule将Verilog/SystemVerilog文件转换(Verilate)成C++ # --cc表示将文件转换成C++ verilator -cc top.v转换后会生成文件夹obj_dir,包含转换后所有的文件 创建C++ testbench文件tb_top.cpp,内容如下 #include #include #include #include "verilated.h" #include "verilated_vcd_c.h" #include "Vtop.h" #define MAX_SIM_TIME 20 vluint64_t sim_time = 0; int main(int argc, char** argv) { Vtop *dut = new Vtop; Verilated::traceEverOn(true); VerilatedVcdC* m_trace = new VerilatedVcdC; dut->trace(m_trace, 5); m_trace->open("waveform.vcd"); while (sim_time |
今日新闻 |
点击排行 |
|
推荐新闻 |
图片新闻 |
|
专题文章 |
CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭 |