当前位置:网站首页>代码覆盖率
代码覆盖率
2022-07-24 22:51:00 【傻童:CPU】
代码覆盖率
代码覆盖率
代码覆盖率是衡量验证进展的最简易的方式。它的作用是检查代码是否冗余,设计要点是否遍历,被检测的对象是RTL代码,而代码覆盖率的检测一般由工具自动生成的,不需要自定义收集条件。代码覆盖率主要包括以下几种:
1.行覆盖率(Line coverage)
行覆盖率度量的是多少行代码已经被执行过。比如,你有100行代码,执行了90行,那么覆盖率就是90%。
2.分支覆盖率(Branch coverage)
分支覆盖率衡量的是代码中的分支覆盖的情况,包括:
if-else语句覆盖情况
case语句覆盖情况
三元操作符(“?:”)覆盖情况
3.路径覆盖率(Path Coverage)
路径覆盖率衡量的是在穿过代码和表达式的路径中有哪些已经被执行过,表明代码中数据通路的覆盖情况。
4.条件覆盖率(Conditional coverage)
判定式中有多个条件时,要求每个条件的取值均得到验证。这里的条件覆盖率很容易与分支覆盖率产生混淆,为了方便大家区别,下面举一个例子:
假设我们有如下两种情况:
test1()为true
test1()和test2()都为false
如果只是为了验证分支覆盖率,以上的两种情况就足够了,因为if语句中两种分支条件都有了,但是对于第一条分支中的只有在test1()为false情况下的BUG,这里并没有覆盖到。
而在条件覆盖率下,还需要验证test1()为false且test2()为true这种情况,只有这三种情况都验证到了,才算是满足了条件覆盖率。
5.翻转覆盖率(Toggle coverage)
翻转覆盖率衡量的是哪些单比特变量的值为0或1,表明代码中信号的0到1和1到0的翻转情况。
6.有限状态机覆盖率(FSM coverage)
有限状态机覆盖率衡量的是状态机中哪些状态和状态转换已经被访问过。表明状态机中各个状态的覆盖情况。
边栏推荐
- Is it safe to log in the securities account on the flush
- A compatible, smaller and easy-to-use web font API
- 用VS Code搞Qt6:编译源代码与基本配置
- 中金证券新课理财产品的收益有百分之六吗?我想要开户理财
- burp从溯源到反制思路
- Website resources
- PGPLSQL中的:=和=
- Background image and QR code synthesis
- Lidar obstacle detection and tracking: CUDA European clustering
- Implementation of graph structure, from point to edge and then to graph
猜你喜欢

How to propose effective solutions for high-end products? (1 methodology + 2 cases + 1 List)

谢振东:公共交通行业数字化转型升级的探索与实践

Time series data in industrial Internet of things

Burp's thinking from tracing to counteracting

郑慧娟:基于统一大市场的数据资产应用场景与评估方法研究

CA certificate production practice

IndexTree

Network Security Learning (II) IP address

QT6 with vs Code: compiling source code and basic configuration
![洛谷 P2024 [NOI2001] 食物链](/img/7f/6ccbc19942f0d4a153025346496834.png)
洛谷 P2024 [NOI2001] 食物链
随机推荐
Oracle中实现对指定数据分组且获取重复次数
MySQL查询慢的一些分析
Morris traversal
聊聊 Redis 是如何进行请求处理
Value driven provides the core driving force for the transformation of commercial BP - BP realization under business scenarios - Commercial BP sharing
Use kettle to read the data in Excel file and store it in MySQL
Monotonic stack structure
HLS编程入门
Connector in C
Website resources
Get the solution to the slow running speed of Mengxin Xiaobai computer! ٩ ( ‘ ω‘ )و get! ٩ ( ‘ ω‘ )و
Segment tree,,
Let‘s Encrypt
EL & JSTL: JSTL summary
《JUC并发编程 - 高级篇》05 -共享模型之无锁 (CAS | 原子整数 | 原子引用 | 原子数组 | 字段更新器 | 原子累加器 | Unsafe类 )
Monotonic stack structure exercise -- cumulative sum of minimum values of subarrays
Filter list
RichTextBox save as picture
图结构的实现,从点到边再到图
Network Security Learning (IV) user and group management, NTFS