fsdb那些事

文摘   2024-09-08 08:40   上海  

1.  在使用VCS 调用verdi dump波形时,可以在.v里面使用  
$fsdbDumpfile("abc.fsdb",1000); // 后面的数字1000就表示1000M,表示限定这个fsdb最大1000M就不dump了$fsdbAutoSwitchDumpfile(200,"abc.fsdb",5); //表示dump 5个最大200M的fsdb,最后得到的应该是5个 abc***.fsdb

2.  另外的通过hierarchical存多个fsdb

$fsdbDumpvars(1,top,"+fsdbfile+abc.fsdb"); //dump top这一层到abc.fsdb这个文件里$fsdbDumpvars(0,top.cpu,"+fsdbfile+cd.fsdb") ;  //dump top.cpu全部到cd.fsdb里面

3.  指定时间dump,,当你的pattern已经跑过一次之后,加入你只想从1ms才开始dump
initial  begin#1000_000;$fsdbDumpvars("aa.fsdb");end


4. 可以在先关闭dump,#delay 多少时间之后使用打开dump命令,来断断续续的dump.
$fsdbDumpon; // - 打开 FSDB dumping$fsdbDumpoff; // - 关闭 FSDB dumping


5.  Conventional Issues & Verdi’s Approach

Issues and Conventional Approach
• Today’s complex SOC designs usually require huge amounts of data
for verification which introduces some problems when dealing with big simulation dump files.
• A common problem with complex design dumping is that the dumped simulation file may exceed the OS limitation, or the simulation
process may exceed the OS memory limitation during dumping.
• The workarounds is to limit the signal number by dumping from a specified scope in hierarchy or start dumping after a certain time.

Verdi’s Approach
• Verdi provides various environment variables and system tasks to restrict the FSDB file size in different constraints, to get the best balance between data accuracy and performance
• Verdi also provides a parallel dumping mechanism to speed up the dumping performance in dual CPU machines.

5.1 Restrict the FSDB File Size (1/4)

NOVAS_FSDB_ENV_WRITER_MEM_LIMIT variable:

• The default value is 64.

• When the user uses the nWave auto-update feature, the recommendation is to set this environment variable to a smaller value before running the simulation. For example:% 

setenv NOVAS_FSDB_ENV_WRITER_MEM_LIMIT 20

5.2 Skip dumping VHDL complex data.

• Including array of array and record signals.

% setenv IGNORE_COMPLEX 1


5.3 Skip dumping Verilog cell instances
• To skip the FSDB dumping for primitive cells, for example:
% setenv SKIP_CELL_INSTANCE 1

5.4 Restrict the FSDB File Size (2/4)

Use $fsdbAutoSwitchDumpfileto reduce the size and control the number of FSDB files.

• For example, if the maximum desired FSDB file size is 1G and at most 20 FSDB dump files can be created, add following task in source code:

$fsdbAutoSwitchDumpfile(1000, "ALU.fsdb", 20, "my.log");


• Where 1000 (1G) is the size of each file and 20 is the number of dump files.


5.5 Use $fsdbDumpvars to reduce the number of scopes to be dumped.
• For example, to start dumping from scope top.u_foo.u_bar with depth=3 and dumping location and file name of ../log/test1.u_bar.3.fsdb, add following task into source code (or testbench):
initial begin$fsdbDumpfile ("../log/test1.u_bar.3.fsdb");$fsdbDumpvars (3, top.u_foo.u_bar);end

5.6 Restrict the FSDB File Size (3/4)
Use $fsdbSuppress to suppress the scopes that should not be dumped.• For example, if not going to dump scope “system.i_pram” and “system.i_cpu.i_CCU”, add following task into source code or testbench:
$fsdbSuppress(system.i_pram, system.i_cpu.i_CCU);$fsdbDumpvars;

5.7 Use $fsdbDumpMem/$fsdbDumpMDA to dump the relevant cells of the memory/MDA at specific time intervals.
• Dump the memory cells from mem[0] to mem[31] at the time the system task is called:

$fsdbDumpMem(mem, 0, 32);
• Dump the memory cells from mem[0] to mem[31] after 23 simulation time units when the trigger signal, WR_ENABLE, changes to 1:
$fsdbDumpMem(mem, 0, 32, , WR_ENABLE, 23);
• Evaluate the value of signal WR_ENABLE at #0, #500, #1000... 
If WR_ENABLE=1, dump all memory cells of mem after 20 time units:
$fsdbDumpMem(mem, , , 500, WR_ENABLE, 20);
5.8 Restrict the FSDB File Size (4/4)
Use $fsdbDumpon and $fsdbDumpoffto change the start and stop dumping time for the needed time interval.
• For example, to generate a FSDB file that will record all the scopes from 1000 time units to 70000 time units, add the following to the testbench:
initial begin$fsdbDumpvars;#1000 $fsdbDumpoff;#70000 $fsdbDumpon;end

5.9 Use environment variables to prevent dumping of glitches and event sequence information.
NOVAS_FSDB_ENV_MAX_GLITCH_NUM is used to specify glitch dumping:
• Default: does not record glitches
• 0: all glitches are stored.
• 1: the last glitch is stored.
• 2: the first and the last glitch are stored
NOVAS_FSDB_ENV_DUMP_SEQ_NUM set to ‘on’ is used to enable event sequence dumping.

5.10 Parallel Dumping for FSDB

Two functions are includedin the process when dumping FSDB:

• Running the simulation and

• Writing the FSDB.

Use parallel dumping mechanism to separate these two process in a multi-processor system.Two ways to run simulation in parallel mode:

• Add +fsdb_parallel option in command line when runningsimulation.

• Set environment variable FSDB_PARALLEL before runningsimulation.

• setenv FSDB_PARALLEL 1


5.11 Summary
Use environment variables and system tasks to get balance between accuracy and performance when dumping FSDB.
NOVAS_FSDB_ENV_WRITER_MEM_LIMIT
IGNORE_COMPLEX
SKIP_CELL_INSTANCE
$fsdbAutoSwitchDumpfile
$fsdbDumpvars
$fsdbSuppress
$fsdbDumpMem/$fsdbDumpMDA
$fsdbDumpon and $fsdbDumpoff
NOVAS_FSDB_ENV_MAX_GLITCH_NUM and 

NOVAS_FSDB_ENV_DUMP_SEQ_NUM

Use command line option +fsdb_parallel or environment variable FSDB_PARALLEL to improve the dumping performance on dual CPU machines.

6.fsdbDumplimit - 限制FSDB 文件size  如何使用?

$fsdbDumpvars([<level>], <scope | signal>*)
fsdbDumpfile - 指定FSDB 文件名
$fsdbDumpfile(“<FSDB name>”)
fsdbDumpvars - Dump 指定的变量
fsdbDumpSingle - Dump 指定的信号
fsdbDumpvariable - Dump 指定的VHDL 变量
fsdbSwitchDumpFile - 将dumping 切换到另一个FSDB 文件
$fsdbSwitchDumpFile(“<new FSDB name>”)
$fsdbAutoSwitchDumpfile - 限制文件大小并在数据量过大时自动创建新的FSDB 文件
$fsdbAutoSwitchDumpfile(<file size>, “<FSDB name>”,< number of file>)
fsdbDumpflush - Force to Dump Result to FSDB file
fsdbDumpMem - Dump 指定的memory 的内容
$fsdbDumpMem(<reg name>, [<start addr>, [<size>]])
$fsdbDumpon - 打开 FSDB dumping
$fsdbDumpoff - 关闭 FSDB dumping

7. Specify the option in an FSDB dumping command to enable dumping allsupported signals:

$fsdbDumpvars("+all");

The Novas object files for FSDB dumping provide the following FSDB dumpingcommands for Verilog:

$fsdbAutoSwitchDumpfile$fsdbDumpfile$fsdbDumpflush$fsdbDumpon, $fsdbDumpoff $fsdbDumpvars$fsdbDumpvarsByFile$fsdbDumpvarsES$fsdbDumpFinish$fsdbDumpMDA$fsdbDumpSVA$fsdbLog$fsdbReplay$fsdbSuppress$fsdbSwitchDumpfile$fsdbDumpfile
Description

To specify the FSDB file name created by the Novas object files for FSDBdumping. If not specified, the default FSDB file name is "novas.fsdb" . This command is valid only before $fsdbDumpvars is executed and is ignored if specified after $fsdbDumpvars . 

To restrict the largest dump file size to the user-defined size limitation, pleasespecify the limit size in megabyte format. This function will affect the FSDB filethat is specified in "FSDB_Name" . The FSDB dumper uses the sliding windowscheme to keep the last signal values in the FSDB file. It drops the old values if file size exceeds the user-specified limitation.

For $fsdbDumpvars ,$fsdbDumpMDA,$fsdbDumpvarsES,$fsdbDumpSVA and $fsdbDumpvarsByFile , user can use the option "+fsdbfile+filename.fsdb" tospecify the target FSDB file to dump. It is equal to using $fsdbDumpfile then $fsdbDumpvars.

Syntax
When specified in the design:
$fsdbDumpfile("FSDB_Name" | FSDB_Name_var [ ,Limit_Size |,Limit_Size_var ]);

when specified on the simulator command line:

Cadence:
xcelium> call fsdbDumpfile \"rtl.fsdb\"xcelium> call fsdbDumpvars 0 TB //1st argument is 'level', 2nd argument is 'scope'//the 'level' values allow different depths of the hierarchy below the named scope//0: all signals in all scopes//1: all signals in current scope//2: all signals in the current scope and all scopes one level below//n: all signals in the current scope and all scopes n-1 level below

 Synopsys:
$fsdbDumpfile("FSDB_Name");$fsdbDumpfile("FSDB_Name", Limit_Size);
Arguments
FSDB_Name
Specify the name of the FSDB file generated by the Novas object files forFSDB dumping.
FSDB_Name_var
Specify the FSDB file name in a variable
Limit_Size
Specify the maximum FSDB file size in megabyte.
Limit_Size_var
Specify the maximum FSDB file size in a variable.
NOTE:
Valid only if the command is specified inside the design.
NOTE:
The minimum file size of the FSDB file is 10M. If you set the size to lessthan 10M, it will be set to 10M instead.

8. fsdb dump操作命令记录

8.1 命令介绍:

$fsdbDumpon- 打开 FSDB dumping
$fsdbDumpoff - 关闭 FSDB dumping
$fsdbDumpfile("FSDB_NAME",Limit_Size) - 指定dump文件
FSDB_NAME 为user指定的文件名,如"my_sim.fsdb"
Limit_Size  为dump波形的最大size


$fsdbDumpvars(depth,instance,"option=") dump指定模块的信号
depth - 0 表示dump instance下所有层级的信号 1表示只dump instance这一层的信号, instance - 指定dump的hierarchy 如 dut.top.ddr_controller
option - dump时可以选择的一些选项,"+mda" 表示dump memory或者MDA(多维数据)的数据,"+packedmda"表示dump压缩的memory数据,"+functions" dump function和task里的信号,"+Reg_Only"只dump reg类型的数据,"+all" dump all,"+struct" dump struct数据
这个命令可以多次使用,用来dump不同instance的波形

还可以直接指定dump的fsdb file

$fsdbDumpvars(0,top.arbiter,"+fsdbfile+novas.fsdb");

$fsdbDumpMDA(depth, instance, "options") dump指定模块中的多维数组

$fsdbDumpSVA(depth,instance,"option"),dump指定模块的assertion

$fsdbDumpSVA(1,system.arbiter,"+fsdbfile=SVA.fsdb"),将该instance下所有assert全部dump到该fsdb中  可以用+fsdbfile=SVA.fsdb dump到新的fsdb文件中.

$fsdbSwitchDumpfile(“new_file_name”[, “+fsdbfile+src_file”])

关闭现有的波形文件,以一个新的文件名开始加载波形;

new_file_name—创建一个新的波形文件,将波形加载到这个文件中;

+fsdbfile+src_file—指定要停止加载并关闭的波形文件, 这个参数不指定时,将默认使用当前正在加载的波形文件;


$fsdbDumpflush  
在仿真过程中强制将信号值加载到波形中,便于在仿真过程中查看波形.
$fsdbAutoSwitchDumpfile(file_size, “fsdb_name”, number_of_files[, “log_file_name”, “+fsdb+no_overwrite”])
当波形的大小达到限制后自动以一个新的波形文件起始加载波形;在所有的波形文件加载完成后,会创建一个virtual FSDB文件,文件后缀.vf。查看波形时只需要加载此文件就可以合并所有的波形文件。
file_size—波形文件大小限制,单位为MB,最小为10M,若值小于10M则默认10M;
file_name—波形文件的名字,在实际加载波形时,文件名为file_name_000.fsdb ile_name_001.fsdb…;
number_of_files—最多可以加载多少个file_size这么大的波形文件,如果写为0,则默认没有限制;
log_file_name—指定log文件的名字,log文件中会记录每段波形的起始和中止时间
+fsdb+no_overwrite—当number_of_files限制的个数达到时停止dump波形;
$fsdbDumpvarsToFile("dump.list");
将需要dump的hier以及depth放到一个文件里吃进来
比如dump.list 内容 #用于注释)
0 test_top
#1 test_top
#0 test_top.dut
#0 test_top.dut.m1
#0 test_top.dut.m2
波形裁剪:
fsdbextract source.fsdb -bt 1500ns -et 2000ns -o output.fsdb
source.fsdb是原始波形文件,-bt 1500ns裁剪的开始时间点 -et  2000ns裁剪的结束时间点,output.fsdb是截取出来的波形文件名

8.2 实际操作:

有按size切不同fsdb文件需求,可以如下操作,这里fsdbDumpvars指定了特定的module,也可以直接从top上dump所有的波形.

付费文章汇总(截止2024年06月02日)

fsdbDump用法

将fsdb波形文件dump到多个文件中

分享《verdi用法小结》的pdf

Verdi用法小结

欢迎加入知识星球。每天都会解答大家提出的技术问题。欢迎加入知识星球,助您快速成长。
最后,由于TX修改规则,为了不错过后续内容,欢迎加入QQ群,

另外,由于微信群已经超过200人,添加小编的微信,拉你进入WX学习群。

最后的最后,如果对您有帮助,希望点个“在看”。好好学习,天天向上

芯片验证日记
分享芯片验证相关的知识。
 最新文章