「博文精選」使用fsdbedit工具修改fsdb波形的層次結構

verdi工具有一個很強大的功能,可以將代碼和波形對應起來,這樣debug效率就很高。但是這需要有一個前提,代碼的信號的層次路徑,要和波形裡面該信號的層次路徑一致,這樣verdi工具才能夠進行對應。

但是如果代碼裡面的信號層次路徑,和波形裡面的信號層次路徑不一致,那verdi工具就無能為力了。也就不能進行代碼和波形的對應。

但是有時候,會有這樣的一種情況。對於同一個模塊,在不同的仿真環境下,所在的層次路徑是不一樣的。比如對於模塊D:

  • 在仿真環境A中,所在的層次路徑為 tb_top1.xxx.a

  • 在仿真環境B中,所在的層次路徑為 tb_top2.yyy.a

此時在A仿真環境中生成的fsdb波形,如果我只想看模塊D的波形,那麼該fsdb波形,能夠在仿真環境B中查看了嗎?

當然,在仿真環境B中,能夠直接打開該fsdb波形,但是不能將模塊D的代碼和波形中模塊D的波形進行對應,因為他們的層次路徑不一樣。

所以,這個時候,如果能直接修改fsdb波形文件的層次路徑,將tb_top1.xxx.a,修改為tb_top2.yyy.a,那麼就可以直接在仿真環境B中,將模塊D的代碼和波形中模塊D的波形進行對應了。

一、fsdbedit工具

為了實現這個功能,我們需要使用 fsdbedit 工具。該工具屬於verdi的子工具之一。

使用 fsdbedit -h 命令,可以查看該命令的使用方法:

Usage fsdbedit: fsdb_file_name [options]

options:

[-insert configFile]

[-delete configFile]

[-insert_scope scope_string [-attribute attr_string]]

[-delete_scope scope_string]

[-add_top_analog_scope scope_name]

[-rename_scope ]

[-o fsdb_file_name]

help信息中,還提供了一個例子:

examples:

1. Insert a leaf scope.

%fsdbedit verilog.fsdb -insert_scope '/system/$scope(test1)' -o sig.fsdb

2. Insert a scope before another scope.

%fsdbedit verilog.fsdb -insert_scope '/system/$scope(test1)/i_cpu' -o sig.fsdb

3. Delete one scope.

%fsdbedit verilog.fsdb -delete_scope '/system/$scope(i_cpu)' -o sig.fsdb

4. Delete one scope and all the sub-scopes and signals.

%fsdbedit verilog.fsdb -delete_scope '/system/$scope(i_cpu)/*' -o sig.fsdb

5. Insert the scope in the configuration file.

%fsdbedit verilog.fsdb -insert insert.cfg -o sig.fsdb

6. Delete the scope in the configuration file.

%fsdbedit verilog.fsdb -delete delete.cfg -o sig.fsdb

7. Add top scopes for Nanosim or Spice FSDB files.

%fsdbedit analog_or_nanosim.fsdb -add_top_analog_scope 'aa.bb' -o sig.fsdb

8. Rename scope.

%fsdbedit verilog.fsdb -rename_scope 'top/system' 'A' -o sig.fsdb

其中的$scope,就是需要操作的波形的層次路徑。

下面,介紹一下幾個常用的選項的用法:

二、-insert_scope

該選項,用於向fsdb波形中,插入指定的層次路徑。

比如我之前的層級路徑為 tb_top/u_my_and。

「博文精选」使用fsdbedit工具修改fsdb波形的层次结构

現在想在 u_my_and 層次之上,插入 xxx.yyyy 層次。

那麼命令為:

fsdbedit -insert_scope '/tb_top/$scope(xxx/yyy)/u_my_and' -o a.fsdb

此時生成的a.fsdb波形文件,層次路徑如下:

「博文精选」使用fsdbedit工具修改fsdb波形的层次结构

$scope,參數指定要插入的層次路徑信息,使用 / 作為層次分隔符。

三、-rename_scope

該選項,用於向fsdb波形中,重命名指定的層次路徑。

比如我之前的層級路徑為 tb_top/xxx/yyy/u_my_and。

「博文精选」使用fsdbedit工具修改fsdb波形的层次结构

現在想把 xxx,給重命名成mmm。

那麼命令為:

fsdbedit a.fsdb -rename_scope /tb_top/xxx' 'mmm' -o b.fsdb

此時生成的fsdb波形中,層次路徑信息如下:

「博文精选」使用fsdbedit工具修改fsdb波形的层次结构

四、-delete_scope

該選項,用於向fsdb波形中,刪除指定的層次路徑。

比如我之前的層級路徑為 tb_top/xxx/yyy/u_my_and。

「博文精选」使用fsdbedit工具修改fsdb波形的层次结构

現在想在刪除xxx層次。那麼命令為:

fsdbedit a.fsdb -delete_scope '/tb_top/$scope(xxx)' -o c.fsdb

此時生成的fsdb波形中,層次路徑信息如下:

「博文精选」使用fsdbedit工具修改fsdb波形的层次结构

五、總結

利用fsdbedit工具,可以方便的修改fsdb波形文件中的模塊的層次路徑信息,從而match不同的仿真環境的模塊的層次路徑信息,從而能夠高效的利用verdi進行debug。


分享到:


相關文章: