返回介绍

29.2.2.1 $coverage_control

发布于 2020-09-09 22:56:01 字数 7013 浏览 1118 评论 0 收藏 0

$coverage_control(control_constant,
                  coverage_type,
                  scope_def,
                  modules_or_instance)

This function is used to control or query coverage availability in the specified portion of the hierarchy. The following control options are available:

‘SV_COV_START

If possible, starts collecting coverage information in the specified hierarchy. No effect if coverage is already being collected. Note that coverage is automatically started at the beginning of simulation for all portions of the hierarchy enabled for coverage.

‘SV_COV_STOP

Stops collecting coverage information in the specified hierarchy. No effect if coverage is not being collected.

‘SV_COV_RESET

Resets all available coverage information in the specified hierarchy. No effect if coverage not available.

‘SV_COV_CHECK

Checks if coverage information can be obtained from the specified hierarchy. Note the possibility of having coverage information does imply that coverage is being collected, as the coverage could have been stopped.

The return value is a ‘define name, with the value indicating the success of the action.

‘SV_COV_OK

On a check operation denotes that coverage is fully available in the specified hierarchy. For all other operations, represents successful and complete execution of the desired operation.

‘SV_COV_ERROR

On all operations means that the control operation failed without any effect, typically due to errors in arguments, such as a non-existing module.

‘SV_COV_NOCOV

On a check or start operation, denotes that coverage is not available at any point in the specified hierarchy.

‘SV_COV_PARTIAL

On a check or start operation, denotes that coverage is only partially available in the specified hierarchy.

The table below describes the possible return values for each of the coverage control options:

Table 29-1: Coverage control return values

‘SV_COV_OK‘SV_COV_ERROR‘SV_COV_NOCOV‘SV_COV_PARTIAL
‘SV_COV_STARTsuccessbad argsno coveragepartial coverage
‘SV_COV_STOPsuccessbad args--
‘SV_COV_RESETsuccessbad args--
‘SV_COV_CHECKfull coveragebad argsno coveragepartial coverage

Starting, stopping, or resetting coverage multiple times in succession for the same instance(s) has no further effect if coverage has already been started, stopped, or reset for that/those instance(s).

The hierarchy(ies) being controlled or queried are specified as follows.

‘SV_MODULE_COV, "unique module def name"

provides coverage of all instances of the given module (the unique module name is a string), excluding any child instances in the instances of the given module. The module definition name can use special notation to describe nested module definitions.

‘SV_COV_HIER, "module name"

provides coverage of all instances of the given module, including all the hierarchy below.

‘SV_MODULE_COV, instance_name

provides coverage of the one named instance. The instance is specified as a normal Verilog hierarchical path.

‘SV_COV_HIER, instance_name

provides coverage of the named instance, plus all the hierarchy below it.

All the permutations are summarized in Table 29-2.

Table 29-2: Instance coverage permutations

Control/query“Definition name”instance.name
‘SV_COV_MODULEThe sum of coverage for all instances of the named module, excluding any hierarchy below those instances.Coverage for just the named instance, excluding any hierarchy in instances below that instance.
‘SV_COV_HIERThe sum of coverage for all instances of the named module, including all coverage for all hierarchy below those instances.Coverage for the named instance and any hierarchy below it.

NOTE—Definition names are represented as strings, whereas instance names are referenced by hierarchical paths. A hierarchical path need not include any . if the path refers to an instance in the current context (i.e., normal Verilog hierarchical path rules apply).

Example 29-1 — Hierarchical instance example

If coverage is enabled on all instances shown in Example 29-1 —, then:

$coverage_control(‘SV_COV_CHECK, ‘SV_COV_TOGGLE, ‘SV_COV_HIER, $root)

checks all instances to verify they have coverage and, in this case, returns ‘SV_COV_OK.

$coverage_control(‘SV_COV_RESET, ‘SV_COV_TOGGLE, ‘SV_COV_MODULE, "DUT")

resets coverage collection on both instances of the DUT, specifically, $root.tb.unit1 and

$root.tb.unit2, but leaves coverage unaffected in all other instances.

$coverage_control(‘SV_COV_RESET, ‘SV_COV_TOGGLE, ‘SV_COV_MODULE,

$root.tb.unit1)

resets coverage of only the instance $root.tb.unit1, leaving all other instances unaffected.

$coverage_control(‘SV_COV_STOP, ‘SV_COV_TOGGLE, ‘SV_COV_HIER,

$root.tb.unit1)

resets coverage of the instance $root.tb.unit1 and also reset coverage for all instances below it, specifically

$root.tb.unit1.comp and $root.tb.unit1.ctrl.

$coverage_control(‘SV_COV_START, ‘SV_COV_TOGGLE, ‘SV_COV_HIER, "DUT")

starts coverage on all instances of the module DUT and of all hierarchy(ies) below those instances. In this design, coverage is started for the instances $root.tb.unit1, $root.tb.unit1.comp, $root.tb.unit1.ctrl, $root.tb.unit2, $root.tb.unit2.comp, and $root.tb.unit2.ctrl.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文