verilator手册中 9.1.10 How do I generate FST waveforms (traces) in C++ or SystemC?

FST Trace File Format Support in Verilator

FST is a trace file format developed by GTKWave. Verilator provides basic FST support. To dump traces in FST format, add the --trace-fst option to Verilator and either:

1. Use $dumpfile & $dumpvars in Verilog

This is similar to the VCD example above.

2. In C++:

Change the include described in the VCD example above:

#include "verilated_fst_c.h"
VerilatedFstC* tfp = new VerilatedFstC;

3. In SystemC:

Change the include described in the VCD example above:

#include "verilated_fst_sc.h"
VerilatedFstC* tfp = new VerilatedFstSc;

Currently, supporting both FST and VCD in a single simulation is not supported, but such usage should be unlikely. You can, however, #ifdef around the trace format in your C++ main loop and select either VCD or FST at compile time.

Verilator 中的 FST 跟踪文件格式支持

FST 是 GTKWave 开发的一个跟踪文件格式。Verilator 提供了基本的 FST 支持。要以 FST 格式导出跟踪,向 Verilator 添加 --trace-fst 选项,并采取以下任一方法:

1. 在 Verilog 中使用 $dumpfile$dumpvars

这与上面的 VCD 示例类似。

2. 在 C++ 中:

更改 VCD 示例中的包含方式:

#include "verilated_fst_c.h"
VerilatedFstC* tfp = new VerilatedFstC;

3. 在 SystemC 中:

更改 VCD 示例中的包含方式:

#include "verilated_fst_sc.h"
VerilatedFstC* tfp = new VerilatedFstSc;

目前,Verilator 不支持在同一仿真中同时使用 FST 和 VCD,但这种用法应该不太可能发生。然而,您可以在 C++ 主循环中使用 #ifdef 来选择编译时使用 VCD 或 FST 格式。

参考手册9.1.8的代码可以很轻松的完成。

注意!!!

生成.fst文件时(比如.cpp文件里面有个循环还在执行),如果在终端里用Ctrl+C终端循环,将会导致.fst文件生成失败,出现以下报错:

xxxx:xxxx$ gtkwave waveform.fst

GTKWave Analyzer v3.3.121 (w)1999-2024 BSI

GTKWAVE | Could not initialize 'waveform.fst', exiting.

具体可参考下面这篇文章:verilator生成.fit文件GTKwave无法读取

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值