如何从代码覆盖率报告中排除文件:Modelsim 2021.4(Windows)

huangapple go评论65阅读模式
英文:

Modelsim 2021.4 (Windows): How to exclude files from code coverage report

问题

我正在尝试从我的代码覆盖报告中排除特定的VHDL文件,但我无法使其起作用。我的报告总是显示所有可用的文件。

我的工作流程如下:

  1. 在Modelsim中,我手动编译文件(在GUI中)并选择了代码覆盖选项。
  2. 测试台脚本如下所示:
# 开始模拟
vsim -coverage work.core_tb -t 1ps
do wave/core_wave.do
view wave -undock
when -label end_of_simulation {end_of_sim == '1'} {echo "模拟结束" ; stop ;

coverage exclude -src ../../../design/hdl/FILE_1.vhd
coverage exclude -src ../../../design/hdl/FILE_2.vhd
coverage exclude -src ../../../design/hdl/FILE_3.vhd

coverage report -output ../../../design/sim/cc_reports/report.txt -srcfile=* -assert -directive -cvg -codeAll};

run -all
wave zoomfull

# 复制模拟结果到本地目录
file copy -force ./_Log.txt ../../../design/sim/sim_reports/safety_core_sim_results.txt

Modelsim识别我的排除(在GUI中)为“待定的排除”。当我手动应用它们(在GUI中)时,“实例覆盖”窗口中显示的文件会按预期减少。但为什么报告不会改变/调整?我做错了什么?

编辑:
似乎在旧版本的Modelsim中可以这样做。

英文:

I am trying to exclude certain vhdl files from my code coverage report, but I can't get it to work. My report always shows all available files.

My workflow is as follows:

  1. in Modelsim I compile the files manually (in the GUI) with the Code Coverage option.
  2. the testbench is scripted like this
# Start simulation
vsim -coverage work.core_tb -t 1ps 
do wave/core_wave.do
view wave -undock
when -label end_of_simulation {end_of_sim == '1'} {echo "End of simulation" ; stop ;

coverage exclude -src ../../../design/hdl/FILE_1.vhd
coverage exclude -src ../../../design/hdl/FILE_2.vhd
coverage exclude -src ../../../design/hdl/FILE_3.vhd

coverage report -output ../../../design/sim/cc_reports/report.txt -srcfile=* -assert -directive -cvg -codeAll};

run -all
wave zoomfull

# Copy simulation results to local directory
file copy -force ./_Log.txt ../../../design/sim/sim_reports/safety_core_sim_results.txt

Modelsim recognizes my exclusions (in the GUI) as "pending exclusions". When I apply them manually (in the GUI), the files shown in the "Instance coverage" window are reduced as intended. But why does the report not change/adjust? What am I doing wrong?

Edit:
It seems that it worked that way with an older Modelsim Version.

答案1

得分: 0

解决方案是停用“两步排除”选项。要停用它,请转到Modelsim菜单:

工具 > 覆盖配置 并禁用‘Two-Step Exclusions’菜单选项。

或者可以使用以下TCL命令:

coverage configure -2stepexclusion off

当“Two-Step Exclusions”选项处于活动状态时,意味着所有应用的排除都会首先进入“待处理排除”选项卡。

英文:

The solution is to deactivate ‘Two-Step Exclusions’ option. To deactivate it go to the Modelsim menu:

Tools > Coverage Configuration and disable ‘Two-Step Exclusions’ menu option.

Alternatively the following TCL command could be used:

coverage configure -2stepexclusion off

When the ‘Two-Step Exclusions’ option is active it means that any applied exclusions always go to the ‘pending exclusions’ tab first.

huangapple
  • 本文由 发表于 2023年1月9日 16:09:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/75054551.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定