coverage merge

參考1
參考2
vcs仿真中,可以產(chǎn)生以下兩類coverage:

code coverage
function coverage
對(duì)于code coverage,在編譯和仿真需要加額外參數(shù)。對(duì)于function coverage,編譯和仿真不需要加額外參數(shù)。

一、code coverage

code coverage包含以下一些coverage:

line coverage
toggle coverage
condition coverage
branch coverage
FSM coverage
assert coverage
要使能這些coverage,vcs的-cm選項(xiàng),來(lái)控制,是否產(chǎn)生這些coverage

-cm <cov_metrics_name>
關(guān)于cov_metrics_name,有如下選擇:

line:使能line coverage
cond:使能cond coverage
tgl:使能toggle coverage
fsm:使能FSM coverage
branch:使能branch coverage
assert:使能assert coverage
多個(gè)選項(xiàng)之間,使用+進(jìn)行連接。例如,要使能line,fsm coverage,使用如下選項(xiàng):

-cm line+fsm
code coverage選項(xiàng),在編譯和仿真的時(shí)候,都必須要有,否則不能正常的生成coverage。

編譯如果帶有coverage coverage選項(xiàng),會(huì)在編譯目錄下,生成simv.vdb目錄,里面包含了coverage model。

二、function coverage

function coverage,沒(méi)有選項(xiàng)控制,因?yàn)槭窃诖a中指定的。

在編譯的時(shí)候,不會(huì)生成simv.vdb目錄,因?yàn)閒unction coverage不需要coverage model。

三、coverage其他選

-cm_dir選項(xiàng)

官方解釋:

The -cm_dir <directory_path_name> option enables you to specify an alternative name or location for saving the default simv.vdb directory. If not specified, VCS automatically generates the coverage database with the name simv.vdb or <exe_name>.vdb where, exe_name is the argument to -o option if included during compilation.
帶上coverage選項(xiàng),vcs編譯完畢后,默認(rèn)會(huì)在編譯目錄,生成simv.vdb文件夾。該文件夾里面,包含了coverage model。

可以通過(guò)-cm_dir選項(xiàng),更改默認(rèn)的coverage model生成的目錄。

仿真的時(shí)候,如果沒(méi)有指定-cm_dir選項(xiàng),那么使用編譯時(shí)候指定的simv.vdb的目錄。也可以仿真帶有-cm_dir選項(xiàng),修改仿真時(shí),生成的simv.vdb目錄位置。

-cm_name選項(xiàng)
官方解釋:

The -cm_name <filename> option as a compile-time or runtime option enables you to specify an alternative test name instead of the default name. The default test name is test
對(duì)于每一個(gè)test,生成的coverage數(shù)據(jù),默認(rèn)是在simv.vdb/snps/coverage/db/testdata/test目錄下

默認(rèn)coverage數(shù)據(jù),是在test目錄下,可以通過(guò)-cm_name選項(xiàng),修改默認(rèn)的test目錄。

比如-cm_name load_test,那么coverage數(shù)據(jù),就會(huì)生成在simv.vdb/snps/coverage/db/testdata/load_test目錄下。

  1. -cm_hier選項(xiàng)

該選項(xiàng),在coverage technology reference manual手冊(cè)上有介紹。

官方解釋該選項(xiàng):

The -cm_hier option is a compile-time option to specify module definitions, instances and sub-hierarchies, and source files that you want VCS to either exclude from coverage or exclusively compile for coverage.
在收集code coverage的時(shí)候,工具默認(rèn)會(huì)收集所有模塊的coverage。但是有時(shí)候,我們只關(guān)心某一層模塊以及之下的coverage。此時(shí)就需要-cm_hier選項(xiàng)來(lái)指定層次。

-cm_hier選項(xiàng),指定一個(gè)coverage配置文件。該配置文件,指定了收集coverage的模塊。

對(duì)于這個(gè)coverage配置文件,有如下一些語(yǔ)法:

3.1 +tree instance_name [level_number]

VC VCS compile only the specified instance and the instances under it for coverage. These instances can be Verilog module or VHDL entity instances. VCS exclude all other instances from coverage.A level number of 0 (or no level number) specifies the entire subhierarchy, 1 specifies only this instance, 2 specifies this instance and those instances directly under this instance, 3 specifies this instance and instances in the subhierarchies that are one and two levels below the specified instance. There is no limit to the integer you specify as the level number.If the subhierarchy includes instances in the other HDL, VCS does not include these instances.
只對(duì)指定層次的模塊,以及該層次下的模塊,統(tǒng)計(jì)coverage。level_number,表示從該層次模塊,向下統(tǒng)計(jì)coverage的層次。0表示統(tǒng)計(jì)所有,1表示只統(tǒng)計(jì)當(dāng)前層,2表示統(tǒng)計(jì)當(dāng)前層和下一層,之后依次類推。

3.2 -tree instance_name [level_number]

VC VCS exclude this instance from coverage and other instances under it. These instances can be Verilog module or VHDL entity instances. VCS include all other instances in coverage.A level number of 0 (or no level number) specifies the entire subhierarchy, 1 specifies only this instance, 2 specifies this instance and those instances directly under this instance, and so on.If the subhierarchy includes instances in the other HDL, VCS does not exclude these instances.
只對(duì)指定層次的模塊,以及該層次下的模塊,不統(tǒng)計(jì)coverage。level_number,表示從該層次模塊,向下不統(tǒng)計(jì)coverage的層次。0表示不統(tǒng)計(jì)所有,1表示只不統(tǒng)計(jì)當(dāng)前層,2表示不統(tǒng)計(jì)當(dāng)前層和下一層,之后依次類推。

3.3 +module module_name | entity_name

VCS compiles all instances of the specified Verilog module or VHDL entity definition, and excludes all other definitions under it, for coverage.
只對(duì)指定模塊統(tǒng)計(jì)coverage。

3.4 -module module_name | entity_name

VCS does not compile all instances of the specified Verilog module or VHDL entity definition, and includes all other definitions under it, for coverage.
只對(duì)指定模塊不統(tǒng)計(jì)coverage

3.5 +file file_name

VCS compile for coverage only the code in this file. If the file is not in the current directory, specify the path name of the file.
對(duì)指定的文件,統(tǒng)計(jì)該文件內(nèi)模塊的coverage。如果file_name不是當(dāng)前路徑下,那么需要使用絕對(duì)路徑。

3.6 -file file_name

VCS exclude the code in this file from coverage. If the file is not in the current directory, specify the path name of the file.
對(duì)指定的文件,不統(tǒng)計(jì)該文件內(nèi)模塊的coverage。如果file_name不是當(dāng)前路徑下,那么需要使用絕對(duì)路徑。

3.7 +filelist file_name

VCS compile for coverage only the source files listed in the specified file.
只對(duì)file_name文件,統(tǒng)計(jì)該文件里面指定的源文件中模塊的coverage。

3.8 -filelist file_name

VCS exclude from coverage the source files listed in the specified file.
只對(duì)file_name文件,不統(tǒng)計(jì)該文件里面指定的源文件中模塊的coverage。

3.9 +moduletree module_name [level_number]

VCS provides coverage metrics for all instances of the specified module and for all module instances in the hierarchy below the specified module. In other words, each hierarchy tree starting at each instance of the specified module will have coverage metrics provided. The coverage metrics are only provided for the number of levels of hierarchy specified by the optional level_number.
對(duì)指定的模塊,以及該模塊下的模塊,統(tǒng)計(jì)coverage。level_number,表示從該模塊,向下統(tǒng)計(jì)coverage的層次。0表示統(tǒng)計(jì)所有,1表示只統(tǒng)計(jì)當(dāng)前層,2表示統(tǒng)計(jì)當(dāng)前層和下一層,之后依次類推。

3.10 -moduletree module_name [level_number]

VCS excludes coverage metrics for all instances of the specified module and for all module instances in the hierarchy below the specified module. In other words, each hierarchy tree starting at each instance of the specified module will have coverage metrics excluded. The coverage metrics are only excluded for the number of levels of hierarchy specified by the optional level_number.
對(duì)指定的模塊,以及該模塊下的模塊,不統(tǒng)計(jì)coverage。level_number,表示從該模塊,向下統(tǒng)計(jì)coverage的層次。0表示統(tǒng)計(jì)所有,1表示只統(tǒng)計(jì)當(dāng)前層,2表示統(tǒng)計(jì)當(dāng)前層和下一層,之后依次類推。

3.11 +/-node

Excludes or includes a signal in toggle coverage.
去除或者包括對(duì)指定信號(hào)toggle coverage的統(tǒng)計(jì)。后面跟信號(hào)的絕對(duì)路徑,可以使用通配符*。

如:

+node top.cnt_inst.out[7:5] //對(duì)該信號(hào),不統(tǒng)計(jì)toggler-node top.cnt_inst.out[4:0] //對(duì)該信號(hào),統(tǒng)計(jì)toggler
比如我們想收集,tb_top.aaa.bbb.ccc 這個(gè)模塊,以及模塊之下的coverage,那config文件內(nèi)容如下:

+tree tb_top.aaa.bbb.ccc 0
比如我們想收集,ccc 這個(gè)模塊,以及模塊之下的coverage,那config文件內(nèi)容如下:

+moduletree ccc 0
如果只想收集ccc這個(gè)模塊呢:

+moduletree ccc 1
四、查看coverage

  1. dve

如果使用dve,使用如下命令查看coverage數(shù)據(jù):

dve -full64 -cov -dir simv.vdb
如果使用verdi,使用如下命令查看coverage數(shù)據(jù):

verdi -cov -cov_dir simv.vdb
urg
urg命令,可以將coverage數(shù)據(jù),轉(zhuǎn)換成html。

urg -dir simv.vdb
在當(dāng)前目錄下,會(huì)生成 urgReport 目錄,里面有生成的html文件,使用瀏覽器即可查看這些文件。

映射覆蓋---摘自《覆蓋技術(shù)參考手冊(cè)》。
代碼覆蓋率數(shù)據(jù)是按模塊和實(shí)例收集的。如果
設(shè)計(jì)層次結(jié)構(gòu)的改變,模塊或?qū)嵗牧斜?br> 使用map可以把來(lái)自不同的設(shè)計(jì)環(huán)境下的覆蓋率合并。

使用map可以把來(lái)自不同設(shè)計(jì)環(huán)境下的覆蓋率合并。可以在不同的環(huán)境下編譯一個(gè)設(shè)計(jì)(或是設(shè)計(jì)的一部分),但是任然可以獲取合并的覆蓋率,只有當(dāng)設(shè)計(jì)的subtree在進(jìn)行合并的所有不同版本的設(shè)計(jì)中保持一致才可以。 在以下情況下可以使用map進(jìn)行覆蓋率的合并:。
1)從block level收集部分覆蓋率,且又從system level收集部分覆蓋率時(shí);。
2)驗(yàn)證流程設(shè)計(jì)替換不同的頂層試驗(yàn)臺(tái),這些試驗(yàn)臺(tái)例化設(shè)計(jì)時(shí);。
可以合并來(lái)自一些非相同地區(qū)的覆蓋數(shù)據(jù)。
使用映射的設(shè)計(jì)。您可以編譯一個(gè)設(shè)計(jì)(或一個(gè)設(shè)計(jì)的一部分)。
設(shè)計(jì))與多個(gè)不同的語(yǔ)境,并仍然合并覆蓋面
數(shù)據(jù),但只針對(duì)設(shè)計(jì)的子樹(shù),這些子樹(shù)在所有的
的版本,您要合并的設(shè)計(jì)。當(dāng)一些
在區(qū)塊一級(jí)收集覆蓋數(shù)據(jù),并收集該區(qū)塊的其他數(shù)據(jù)。
塊在系統(tǒng)級(jí)仿真中被收集,或者當(dāng)檢驗(yàn)
這個(gè)過(guò)程涉及到交換不同的頂層測(cè)試平臺(tái),這些測(cè)試平臺(tái)是
每一個(gè)實(shí)例化設(shè)計(jì)。

可以在2個(gè)不同的設(shè)計(jì)環(huán)鏡下例化較低層次的模塊,即例化subhierarchy(設(shè)計(jì)中的模塊實(shí)例,以及此模塊實(shí)例下的所有子模塊)??梢詮?個(gè)設(shè)計(jì)的仿真結(jié)果中看到subhierarchy結(jié)合的覆蓋率coverage。
你可以實(shí)例化一個(gè)子層次(設(shè)計(jì)中的模塊實(shí)例,以及此模塊實(shí)例下的所有子模塊)。
以及該實(shí)例下的所有模塊實(shí)例的層次結(jié)構(gòu))中的
兩種不同的設(shè)計(jì),并查看合并后的覆蓋范圍。
使用-map選項(xiàng)來(lái)map 多個(gè)設(shè)計(jì)環(huán)境下subhierarchy的覆蓋率。

使用-map選項(xiàng)來(lái)map 多個(gè)設(shè)計(jì)環(huán)境下subhierarchy的覆蓋率。在文件hierarchy.html文件中會(huì)產(chǎn)生全路徑(絕對(duì)路徑)。-map選項(xiàng)可以再code coverage和assertion coverage中使用,不可以在group coverage中使用。
使用-map選項(xiàng)可以映射一個(gè)設(shè)計(jì)中的子層次覆蓋率。
到另一個(gè)。完整的層次結(jié)構(gòu)應(yīng)在
hierachy.html文件。這個(gè)選項(xiàng)在代碼覆蓋和
斷言覆蓋,但不支持群體覆蓋。

-map選項(xiàng)的語(yǔ)言如下
urg -dir [BaseDesign].vdb -dir [InputDesign].vdb -map
也可以理解為
urg -dir [fullchip].vdb -dir [standalone].vdb -map
第一個(gè).vdb文件來(lái)自BaseDesign,第二個(gè).vdb文件來(lái)自InputDesgin。InputDesign的覆蓋率合并到BaseDesign中。合并后的coverage可以再BaseDesign的覆蓋率目錄中找到。
以我merge coverage實(shí)例來(lái)說(shuō),在fullchip和standalone的coverage進(jìn)行merge時(shí),需要把fullchip的database放在前面,standalone的放在后面。
以我merge覆蓋實(shí)例來(lái)說(shuō),在fullchip和standalone的覆蓋進(jìn)行merge時(shí),需要把fullchip的database放在前面,standalone的放在后面。
第二個(gè)提供給URG命令行的目錄是Input design。
輸入的設(shè)計(jì)覆蓋范圍將被合并到基礎(chǔ)設(shè)計(jì)中。
累計(jì)覆蓋率將與基礎(chǔ)設(shè)計(jì)覆蓋率目錄一起提供。

指定subhierarchy頂層模塊名字,但不頂層模塊名字前不可加上路徑。
從一個(gè)設(shè)計(jì)到另一個(gè)設(shè)計(jì)map覆蓋率時(shí),源文件名字必須一致。
從一個(gè)設(shè)計(jì)到另一個(gè)map設(shè)計(jì)覆蓋率時(shí),源文件名字必須一致。
子級(jí)。不要把頂層的層級(jí)名稱寫(xiě)成
的模塊實(shí)例。
如果模塊不是來(lái)自默認(rèn)的邏輯庫(kù),則模塊的名稱為
必須在模塊名前加上庫(kù)名(大寫(xiě))。
例如:
% urg -map HDL_WORK.su_top ...
注意:
當(dāng)您把一個(gè)設(shè)計(jì)的覆蓋范圍映射到另一個(gè)設(shè)計(jì)上時(shí),源文件
文件名必須相同。例如,考慮以下內(nèi)容
圖例

如第38頁(yè)圖5-6所示,有兩種設(shè)計(jì)。
實(shí)例化一個(gè)共同的子層級(jí),標(biāo)記為sub1。的代碼。
子層次結(jié)構(gòu),在這兩種設(shè)計(jì)中,都是在名為sub1.v的源文件中。
中的頂層模塊的模塊名(標(biāo)識(shí)符)。
子層級(jí)為sub1。這個(gè)圖示顯示了映射覆蓋率
從模擬設(shè)計(jì)2到該子層次的信息。
該子層級(jí)的覆蓋信息從模擬的。
設(shè)計(jì)1。子層級(jí)可以有多個(gè)實(shí)例,在
覆蓋率信息映射的設(shè)計(jì)(映射)。
設(shè)計(jì))。) 然而,只能有一個(gè)實(shí)例的
設(shè)計(jì)中的子層次,其中覆蓋信息是指
映射(基礎(chǔ)設(shè)計(jì))。

下面的程序說(shuō)明如何映射覆蓋信息。

  1. 編譯覆蓋的基礎(chǔ)設(shè)計(jì),然后模擬該
    設(shè)計(jì),同時(shí)監(jiān)測(cè)覆蓋率。例如
    cd /net/design1
    vcs -cm line sub1.v sub2.v sub3.v sub4.v main.v test.v
    simv -cm line
  2. 編制覆蓋范圍的映射設(shè)計(jì),然后模擬該設(shè)計(jì)。
    設(shè)計(jì),同時(shí)監(jiān)測(cè)覆蓋率。例如
    cd /net/design2
    vcs -cm line sub1.v sub5.v main.v test.v
    simv -cm line

3 運(yùn)行URG,指定頂層模塊的名稱,在
子級(jí)。同時(shí),指定覆蓋目錄為基礎(chǔ)的
設(shè)計(jì),然后指定映射的設(shè)計(jì)。例如
urg -dir /net/design1/simv.vdb /net/design2/simv.vdb -。
地圖sub1
使用上面的命令,生成的報(bào)告文件只含有
的模塊實(shí)例的部分。這些模塊
實(shí)例通過(guò)其在第一個(gè)(或第二個(gè))層次結(jié)構(gòu)名稱來(lái)識(shí)別。
基礎(chǔ))設(shè)計(jì)。這些部分的覆蓋信息是
的覆蓋信息。
如果您還包含了 -hier 編譯時(shí)選項(xiàng),以指定一個(gè)更大的
的子層級(jí),其中包括你想要的子層級(jí)。
繪制的覆蓋范圍,由此產(chǎn)生的報(bào)告文件包含了以下部分: 1.
模塊實(shí)例,但在這個(gè)更大的層次結(jié)構(gòu)中,
在較小的子層級(jí)中,也就是具有以下特征的子層級(jí)中的實(shí)例
覆蓋范圍,也包含來(lái)自其他國(guó)家的覆蓋信息。
設(shè)計(jì)。

####################################################################
如果您為中間數(shù)據(jù)文件指定了不同的位置,那么在
運(yùn)行時(shí),您必須使用-dir
選項(xiàng)為URG,當(dāng)生成報(bào)告時(shí),所有的目錄都可以是...。
也用一個(gè)-dir選項(xiàng)列出。
例如,-dir db1.vdb db2.vdb。

命名中間數(shù)據(jù)文件
默認(rèn)情況下,當(dāng)VCS監(jiān)控任何類型的覆蓋范圍時(shí),它記錄的是
結(jié)果在中間數(shù)據(jù)文件中命名為 "test",并帶有各種
擴(kuò)展,如下所示。

  • line.verilog.data.xml用于行覆蓋率

  • fsm.verilog.data.xml for FSM coverage

  • 用于條件覆蓋的 cond.verilog.data.xml。

  • tgl.verilog.data.xml,用于切換覆蓋范圍。

  • 分支覆蓋率的 branch.verilog.data.xml。
    默認(rèn)情況下,VCS將這些文件寫(xiě)入./simv.vdb/snps/。
    coverage/db/testdata目錄。URG將這些文件讀取到
    顯示覆蓋結(jié)果。

  • 在編譯時(shí)包含-cm_name選項(xiàng)。例如
    vcs source.v -cm line -cm_name testm
    此命令行編譯成可執(zhí)行文件的名稱為
    可執(zhí)行文件在寫(xiě)入中間數(shù)據(jù)文件時(shí)將會(huì)使用。
    仿真結(jié)束后,simv.vdb/snps/coverage/db/testm
    目錄中包含行.verilog.data.xml文件。

  • 例如,在運(yùn)行時(shí)加入-cm_name選項(xiàng)。
    simv -cm line -cm_name testm
    您可以覆蓋您所擁有的目錄名(testm)。
    在編譯過(guò)程中,通過(guò)提供一個(gè)不同的目錄
    名稱與simv命令行選項(xiàng)(如testn)。
    你不能使用選項(xiàng)-cm_name來(lái)指定不同的位置。
    為這些文件。使用-cm_dir選項(xiàng)讓simv將這些文件放置在
    生成的文件在不同的目錄下。

URG讀取./simv.vdb/snps/中的所有測(cè)試數(shù)據(jù)文件。
coverage/db目錄下,并將報(bào)告文件用
合并結(jié)果在 urgReport 目錄中。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 本文是基于我寫(xiě)的一個(gè)培訓(xùn)材料,內(nèi)容除了沒(méi)有寄存器模型以及一些大型環(huán)境中需要用到的配置文件,其他的都有涵蓋。下面...
    小可爸爸閱讀 13,758評(píng)論 1 8
  • Spring Cloud為開(kāi)發(fā)人員提供了快速構(gòu)建分布式系統(tǒng)中一些常見(jiàn)模式的工具(例如配置管理,服務(wù)發(fā)現(xiàn),斷路器,智...
    卡卡羅2017閱讀 136,569評(píng)論 19 139
  • 幾乎所有的芯片設(shè)計(jì)、芯片驗(yàn)證工程師,每天都在和VCS打交道,但是由于驗(yàn)證環(huán)境的統(tǒng)一化管理,一般將不同的編譯仿真選項(xiàng)...
    ICer消食片閱讀 3,909評(píng)論 0 1
  • Python語(yǔ)言特性 1 Python的函數(shù)參數(shù)傳遞 看兩個(gè)如下例子,分析運(yùn)行結(jié)果: 代碼一: a = 1 def...
    時(shí)光清淺03閱讀 568評(píng)論 0 0
  • File types(文件類型) go命令檢查目錄中特定文件的集合。它根據(jù)文件的擴(kuò)展名表示要檢查的文件。這些擴(kuò)展名...
    Cxb168閱讀 1,883評(píng)論 0 0

友情鏈接更多精彩內(nèi)容