SV -- Coverage 覆盖率

article/2025/10/23 12:15:03

SV – Coverage 覆盖率

本文内容来自:

  1. http://www.asic-world.com/systemverilog/coverage.html
  2. https://verificationguide.com/systemverilog/systemverilog-array-manipulation-methods/
  3. https://blog.csdn.net/bleauchat/article/details/90445713 (本文的主要来源,只做了部分补充和修改)

————————————————
版权声明:本文为CSDN博主「bleauchat」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/bleauchat/article/details/90445713

@(SV)

文章目录

  • SV -- Coverage 覆盖率
    • 1. Coverage概念
    • 2. 功能覆盖率
    • 3. 覆盖点
      • 自动或隐式bin(Automatic Bins or Implicit Bins)
      • 显式bin
      • bins for transitions (bin值域的转变)
      • consecutive repetions creation 连续转换
      • Non consecutive repetition 非连续转换
      • wildcard bins 不定值bins
      • ignore_bins 忽略bin
      • illegal_bins 非法bin
      • Examples
    • 4. Cross Coverage 交叉覆盖
      • User defined cross bins
    • 5. Coverage Options 覆盖率选项
      • at_least
      • auto_bin_max
      • cross_auto_bin_max
    • 6. Coverage methods 覆盖率方法
    • 7. Coverage system task 覆盖率系统任务

1. Coverage概念

覆盖率用来衡量设计中已经被测部分和未测部分的比例,通常被定义为已达到所需验证部分的百分比.
目标覆盖率是指在验证计划中规定的需要验证点的目标值。 在验证计划中, 当验证点实际覆盖率没有达到 100% 的时候, 说明验证工作还未完成目标方案。 没有达到 100% 的项目需要通过 添 加 测 试 用 例 或 者 修 改 约 束 \color{red}{添加测试用例或者修改约束} 等来对其进行充分的验证;
验证计划中列出的项目都要一一被测试, 当然这需要一个比较全面和完整的验证计划。为此, 在验证环境搭建的前期, 制定验证计划, 明确验证点并确定目标覆盖率是一项艰巨而且细致的工作;

制定验证计划中的功能点的时候, 需要考虑如下三个问题:
1) 哪些功能点需要检查?
2) 这个功能点的哪些数据需要检查?
3) 如何对这些数据进行采样?

哪些功能点需要检查呢? 这要根据设计的具体情况而定, 一般情况下, 以下几类是参考的对象: 功能要求、 接口要求、 系统规范、 协议规范等。 具体验证计划中可能表现为:FIFO 是否溢出和空读、 外部接口是否遵从以太网物理层的传输协议、 是否满足系统规范要求的支持发送超长包、 内部的AMBA 总线是否符合协议要求等;

主要有两种coverage评估方式:

  • 代码覆盖率
    • 代码覆盖率度量执行了多少“设计代码”。
    • 包括行覆盖率FSM状态机覆盖率分支覆盖率条件覆盖率path路径覆盖率
      • 行覆盖率: 检查某行代码是否被执行过
      • 分支覆盖率: 检查条件分支是否都被执行过
      • 条件覆盖率, 表达式覆盖率: 通过真值表分析表达式各种逻辑组合
      • 有限状态机覆盖率: 检查每个状态是否被覆盖, 状态之间的跳转是否被执行
    • 仿真工具将自动从设计代码中提取代码覆盖率.代码覆盖率就算达到100%,这并不意味着不存在bug.
  • 功能覆盖率
    • 功能覆盖是一个用户定义的度量,它度量在验证中执行了多少设计规范。
    • 面向数据的覆盖(Data-oriented Coverage)——检查数据值的组合。对已进行的数据组合检查.我们可以通过编写覆盖组(coverage groups)、覆盖点(coverage points)和交叉覆盖(cross coverage)获得面向数据的覆盖率.
    • 面向控制的覆盖(Control-oriented Coverage)——检查行为序列(sequences of behaviors)是否已经发生.通过编写SVA来获得断言覆盖率(assertion coverage).

2. 功能覆盖率

使用覆盖组结构定义覆盖模型.覆盖组结构(covergroup construct)是一种用户自定义的类型,一旦被定义就可以创建多个实例就像类一样,也是通过new()来创建实例的.覆盖组可以定义在module、program、interface以及class中.在动手编写测试代码之前,我们需要首先弄清楚相关设计的关键特性、边界情形和可能的故障模式,这其实就是验证计划的内容

每一个覆盖组都必须明确一下内容:

  • 覆盖点(coverage points),也就是需要测试的变量;
  • 一个时钟事件以用来同步对覆盖点的采样(sampling of coverage points);
  • 可选的形式参数(Optional formal arguments);
  • 覆盖点之间的交叉覆盖(Cross coverage between coverage points);
  • 覆盖选项(Coverage options);

语法:

covergroup cov_grp @(posedge clk);cov_p1: coverpoint a;//定义覆盖点
endgroupcov_grp cov_inst = new();//实例化覆盖组

上面例子使用时钟上升沿作为采样点。

covergroup cov_grp;cov_p1: coverpoint a;//cov_p1为覆盖点名,a为覆盖点中的变量名,也就是模块中的变量名
endgroupcov_grp cov_inst = new();
@(abc) cov_inst.sample();

通过.sample()函数在外部申明采样点。

此外,覆盖组中允许带形式参数,外部在引用覆盖组时可以通过传递参数,从而对该覆盖组进行复用,如下:

covergroup address_cov (ref logic [7:0] address,input int low, int high) @ (posedge ce);ADDRESS : coverpoint address {bins low    = {0,low};bins med    = {low,high};}endgroupaddress_cov acov_low  = new(addr,0,10);address_cov acov_med  = new(addr,11,20);address_cov acov_high = new(addr,21,30);

3. 覆盖点

一个覆盖组可以包含多个覆盖点,一个覆盖点可以是一个整型变量也可以是一个整型表达式(integral variable or an integral expression);在验证环境中,覆盖点可以放置在下面四个位置:

推荐覆盖点一般放在DUT的输入输出的接口位置,也就是上图中的F2和F4.

每一个覆盖点都与**“bin(仓)”**关联,在每一个采样时钟仿真器都会自增关联的bin值(increment the associated bin value)
bin可以自动创建或者显示定义:

自动或隐式bin(Automatic Bins or Implicit Bins)

对于覆盖点变量范围内的每一个值都会有一个对应的bin,这种称为自动或隐式的bin.例如,对于一个位宽为nbit的覆盖点变量,2^n个自动bin将会被创建.看下面例子:

    module cov;logic       clk;logic [7:0] addr;logic       wr_rd;covergroup cg @(posedge clk);c1: coverpoint addr;c2: coverpoint wr_rd;endgroup : cgcg cover_inst = new();...endmodule

对于覆盖点addr,将会有c1.auto[0] c1.auto[1] c1.auto[2] … c1.auto[255]等256个bin被自动创建;
对于覆盖点wr_rd,将会有c2.auto[0]这一个bin被创建;

隐式bin示例:

module tb;// Declare some variables that can be "sampled" in the covergroupbit [1:0] mode;bit [2:0] cfg;// Declare a clock to act as an event that can be used to sample// coverage points within the covergroupbit clk;always #20 clk = ~clk;// "cg" is a covergroup that is sampled at every posedge clkcovergroup cg @ (posedge clk);//覆盖组中只有mode,取值范围为0~3,而且没有创建bin,这样系统自动创建4个bincoverpoint mode;endgroup// Create an instance of the covergroupcg  cg_inst;initial begin// Instantiate the covergroup object similar to a class objectcg_inst= new();// Stimulus : Simply assign random values to the coverage variables// so that different values can be sampled by the covergroup objectfor (int i = 0; i < 5; i++) begin@(negedge clk);mode = $random;cfg  = $random;$display ("[%0t] mode=0x%0h cfg=0x%0h", $time, mode, cfg);endend// At the end of 500ns, terminate test and print collected coverageinitial begin#500 $display ("Coverage = %0.2f %%", cg_inst.get_inst_coverage());$finish;end
endmodule

输出:

mode只取到了1和0两个值,所以只覆盖了两个自动创建的bin,所以覆盖率为50%.覆盖点的覆盖率就是用触发的bin的数目除以总的bin的数目

例二:

module tb;bit [1:0] mode;bit [2:0] cfg;bit clk;always #20 clk = ~clk;// "cg" is a covergroup that is sampled at every posedge clk// This covergroup has two coverage points, one to cover "mode"// and the other to cover "cfg". Mode can take any value from// 0 -> 3 and cfg can take any value from 0 -> 7covergroup cg @ (posedge clk);//覆盖组定义了4个coverpoint// Coverpoints can optionally have a name before a colon ":"cp_mode    : coverpoint mode;cp_cfg_10  : coverpoint cfg[1:0];cp_cfg_lsb : coverpoint cfg[0];cp_sum     : coverpoint (mode + cfg);endgroupcg  cg_inst;initial begincg_inst= new();for (int i = 0; i < 5; i++) begin@(negedge clk);mode = $random;cfg  = $random;$display ("[%0t] mode=0x%0h cfg=0x%0h", $time, mode, cfg);endendinitial begin#500 $display ("Coverage = %0.2f %%", cg_inst.get_coverage());$finish;end
endmodule

输出:

在modelsim中仿真,使用`view covergroups`可以得到报表信息:
可以看到各个仓的覆盖率如下: **cp\_mode:50% | cp\_cfg\_10 :100% | cp\_cfg\_1sb :100% | cp\_sum : 62.5% | Average = 78.125%** 其中,cp\_mode和cp\_cfg\_1sb都没问题,主要是cp\_sum和cp\_cfg\_10。cp\_sum的因为是一个表达式,覆盖点仓的数量实际是根据表达式最大位宽的变量来创建的,也就是cp\_sum创建了包含0-7这8个数值的仓,所以cp\_sum覆盖率是理论上应该是4/8=50%,但是实际上,这段代码的覆盖点是在上升沿采样的,而数据变化是在下降沿,这就导致在最开始的20ns的时候,mode和cfg都是0,这时采样后cp\_sum两个数的和就是0,所以多覆盖了一个0值,因此cp\_sum覆盖率为5/8=62.5。同理,因为一开始多采了一个0的缘故,cp\_cfg\_10的覆盖率为100%。

显式bin

"bins"关键字被用来显示定义一个变量的bin,可以为给定范围内的变量的每个值创建单独的bin,也可以将一个或多个bin指向变量的某个范围.使用显示bin,也就是用户自定义bin可以增加覆盖的准确度!它可以将变量的取值范围限定在你感兴趣的区域内!

显示bin紧跟在对应的覆盖点后面,用{ }包围起来,关键字"bins"后跟着bin名以及变量的值或范围。

格式如下:

covergroup 覆盖组名 @(posedge clk);//时钟可以没有覆盖点名1: coverpoint 变量名1{ bins bin名1   = (覆盖点取值范围);bins bin名2   = (覆盖点取值范围);bins bin名3   = (覆盖点取值范围);.......}//一般会将bin的数目限制在8或16覆盖点名2: coverpoint 变量名2{ bins bin名1   = (覆盖点取值范围);bins bin名2   = (覆盖点取值范围);bins bin名3   = (覆盖点取值范围);.......}。。。。。。endgroup : 覆盖组名//注意对coverpoint的bin的声明使用的是{},这是因为bin是声明语句而非程序语句,后者才用begin..end//围起来,而且{}后也没有加分号,这和end是一样的

示例:

module cov;logic       clk;logic [7:0] addr;logic       wr_rd;covergroup cg @(posedge clk);c1: coverpoint addr { bins b1 = {0,2,7};bins b2[3] = {11:20};bins b3   = {[30:40],[50:60],77};                       bins b4[] = {[79:99],[110:130],140};bins b5[] = {160,170,180};bins b6    = {200:$};bins b7 = default;}c2: coverpoint wr_rd {bins wrrd};endgroup : cgcg cover_inst = new();...
endmodule

上面几个仓的含义如下:

bins b1    = {0,2,7 };               //bin “b1” increments for addr = 0,2 or 7
bins b2[3] = {11:20};                //creates three bins b2[0],b2[1] and b2[3].
//and The 10 possible values are distributed as follows: (11,12,13),(14,15,16) 
//and (17,18,19,20) respectively.当不能均等分配时,最后一个数组要多
bins b3    = {[30:40],[50:60],77};   //bin “b3” increments for addr = 30-40 or 50-60 or 77
bins b4[]  = {[79:99],[110:130],140};//creates three bins b4[0],b4[1] and b4[2] with values 79-99,50-60 and 77 respectively
bins b5[]  = {160,170,180};          //creates three bins b5[0],b5[1] and b5[2] with values 160,170 and 180 respectively
bins b6    = {200:$};                //bin “b6” increments for addr = 200 to max value i.e, 255.
default bin;                         // catches the values of the coverage point that do not lie within any of the defined bins.
  • 说白了,覆盖组的作用就是将覆盖点的取值范围分为了多个bin,每个bin表示了一段取值范围
  • bin就表示了addr的取值范围,如果这个范围内有一个值被取到了,则这个bin就被覆盖了
  • 如果所有的bin都被覆盖,则覆盖率为100%
  • default 不会用于计算覆盖率,default的意思就是其他值

bins for transitions (bin值域的转变)

可以通过指定序列(sequence)来进行覆盖点的转换:

value1 =>  value2;
range_list_1 => range_list_2;//覆盖点的值从value1转变到value2,value1和value2可以是某个值,也可以是范围covergroup cg @(posedge clk);c1: coverpoint addr{ bins b1   = (10=>20=>30);bins b2[] = (40=>50),(80=>90=>100=>120);bins b3   = (1,5 => 6, 7);bins b4   = default sequence;}c2: coverpoint wr_rd;
endgroup : cgbins b1   = (10=>20=>30);                // addr的值转换次序为 10->20->30,如果没有执行这个次序,则这个bins没有覆盖
bins b2[] = (40=>50),(80=>90=>100=>120); // b2[0] = 40->50 and b2[1] = 80->90->100->120
bins b3 = (1,5 => 6, 7);                // b3 = 1=>6 or 1=>7 or 5=>6 or 5=>7
bins b4 = default sequence;  //其余没有出现的转换序列(sequence) 

consecutive repetions creation 连续转换

有的时候希望某个变量值连续出现几次,这个时候就需要用来连续转换序列,如下:

WRITE=>WRITE=>WRITE=>WRITE;//WRITE出现4次//上面的写法过于复杂,可以写成下面:WRITE[*4];//例子:
covergroup address_cov () @ (posedge ce);ADDRESS : coverpoint addr {bins adr_0_2times          = (0[*2]);//0连续出现2次bins adr_1_3times          = (1[*3]);//1连续出现3次bins adr_2_4times          = (2[*4]);//2连续出现4次bins adr1[]          = (1[*1:2]);//1连续出现1~2次}
endgroup

Non consecutive repetition 非连续转换

上面介绍的重复都要求是连续的,下面介绍非连续重复,这用到关键字->和=:

    	WRITE[->2];等效于: 	 ......=>WRITE.......=>WRITE;covergroup address_cov () @ (posedge ce);ADDRESS : coverpoint addr {bins adr  = (0=>2[->2]=>1);//addr=0,然后2出现2次,不要求连续,然后1}endgroup

或者:

    WRITE[=2];//WRITE至少出现两次,不要求连续等效于: 	 	....=>WRITE.....=>WRITE.....=>WRITE;例子:covergroup address_cov () @ (posedge ce);ADDRESS : coverpoint addr {bins adr  = (0=>2[=2]=>1);//addr=0,然后2至少出现两次,不要求连续,然后1}endgroup

wildcard bins 不定值bins

可以用x,z,?来表示某一位可以不定。

wildcard bins abc = {2'b1?};//覆盖10,11wildcard bins abc = (2'b1x => 2'bx0};//覆盖 10=>00 ,10=>10 ,11=>00 ,11=>10covergroup address_cov () @ (posedge ce);ADDRESS : coverpoint addr {// Normal transition bibswildcard bins adr0  = {3'b11?};// We can use wildcard in transition bins alsowildcard bins adr1  = (3'b1x0 => 3'bx00);wildcard bins adr2  = (3'b1?0 => 3'b?00);}
endgroup

ignore_bins 忽略bin

一组与覆盖点相关联的值的转换可以显式地进行,除了被ignore_bins修饰的bin,ignore_bins用于排除一些取值,如一个3位的数据,假如它的取值仅在0~5之间,如果使用自动bin那么它的覆盖率永远不会到100%,这个时候就可以使用ignore_bins来忽略6、7的取值; ignore_bins 不会用于计算覆盖率;

    covergroup cg @(posedge clk);c1: coverpoint addr{ ignore_bins b1 = {6,60,66};ignore_bins b2 = (30=>20=>10); }//被ignore_bins修饰的值都不在覆盖范围之内endgroup : cg

illegal_bins 非法bin

触发illegal bins会终止仿真并报错

    covergroup cg @(posedge clk);c1: coverpoint addr{ illegal_bins b1 = {7,70,77};ignore_bins b2 = (7=>70=>77);}endgroup : cg

Examples

 module tb;bit [2:0] mode;// This covergroup does not get sample automatically because// the sample event is missing in declarationcovergroup cg;coverpoint mode {// Declares 4 bins for the total range of 8 values// So bin0->[0:1] bin1->[2:3] bin2->[4:5] bin3->[6:7]bins range[4] = {[0:$]};//将mode的取值分为4个bin,如上}endgroup// Stimulus : Simply randomize mode to have different values and// manually sample each timeinitial begincg cg_inst = new();for (int i = 0; i < 5; i++) begin#10 mode = $random;$display ("[%0t] mode = 0x%0h", $time, mode);cg_inst.sample();//声明的覆盖组没有定义时钟,所以得调用sample()方法进行采样end$display ("Coverage = %0.2f %%", cg_inst.get_inst_coverage());endendmodule

输出:

取到了3个bin,覆盖率为3/4.

4. Cross Coverage 交叉覆盖

交叉覆盖是在覆盖点或变量之间指定的,必须先指定覆盖点,然后才能定义覆盖点之间的交叉覆盖.

可以通过覆盖点名或者变量名来定义交叉覆盖,看下面例子:

    //通过覆盖点来定义交叉覆盖bit [3:0] a, b;covergroup cg @(posedge clk);c1: coverpoint a;c2: coverpoint b;c1Xc2: cross c1,c2;endgroup : cg//通过变量名来定义交叉覆盖bit [3:0] a, b;covergroup cov @(posedge clk);aXb : cross a, b;endgroup//交叉覆盖的通用定义格式:交叉覆盖名:cross 交叉覆盖点名1,交叉覆盖点名2;

由于上面每个覆盖点都有16个bin,所以它们的交叉覆盖总共有256个交叉积(cross product),也就对应256个bin。

    bit [3:0] a, b, c;covergroup cov @(posedge clk);BC  : coverpoint b+c;aXb : cross a, BC;endgroup

注意:覆盖点中的表达式位宽按照表达式中最大数的位宽来看,所以b+c的位宽仍然是4,仓内有16个数。要符合实际情况(两个4位相加为5位)可以写为a+b+5’b0.
上例的交叉覆盖总共有256个交叉积(cross product),也对应256个bin.

User defined cross bins

在交叉覆盖中,除了使用上面自动创建的bins之外,还可以用户自定义交叉bins,这就用到关键字binsof和intersect,如下:

    covergroup address_cov () @ (posedge ce);ADDRESS : coverpoint addr {bins addr0 = {0};bins addr1 = {1};}CMD : coverpoint cmd {bins READ = {0};bins WRITE = {1};bins IDLE  = {2};}CRS_USER_ADDR_CMD : cross ADDRESS, CMD {bins USER_ADDR0_READ = binsof(CMD) intersect {0};//默认的bins本来应该是2*3=6个,但是这里只定义了两个bins}CRS_AUTO_ADDR_CMD : cross ADDRESS, CMD {ignore_bins AUTO_ADDR_READ = binsof(CMD) intersect {0};ignore_bins AUTO_ADDR_WRITE = binsof(CMD) intersect {1} && binsof(ADDRESS) intersect{0};}endgroup

5. Coverage Options 覆盖率选项

覆盖率选项用来控制覆盖组、覆盖点和交叉覆盖之间的行为.用下面几个关键字来控制:

at_least

定义一个bin在执行代码过程中至少触发的次数,低于这个触发次数的话,这个bin不算覆盖,默认值是1;

auto_bin_max

当没有bin为显示创建时,定义一个覆盖点的自动bin的最大数量,默认值为64;

cross_auto_bin_max

定义一个交叉覆盖的交叉积(cross product)的自动bin的最大数量,没有默认值;

    covergroup cg @(posedge clk);c1: coverpoint addr  { option.auto_bin_max = 128;}//addr自动bin的数目最大为128c2: coverpoint wr_rd { option.atleast = 2;}//wr_rd的每个bin至少要触发两次,否则不算覆盖c1Xc2: cross c1, c2  { option.cross_auto_bin_max = 128;}//交叉积的自动bin数目最大为128endgroup : cg//覆盖选项如果是在某个coverpoint中定义的,那么其作用范围仅限于该coverpoint;//如果是在covergroup中定义的,那么其作用范围是整个covergroup;

6. Coverage methods 覆盖率方法

  • void sample() : 触发覆盖组的采样
  • real get_coverage() : 返回覆盖组覆盖率
  • real get_inst_coverage() 返回覆盖组实例的覆盖率
  • void set_inst_name(string) : 设置实例名
  • void start() : 开启覆盖率收集
  • void stop() : 结束收集覆盖率

样例:

    module test();logic [2:0] addr;wire [2:0] addr2;assign addr2 = addr + 1;covergroup address_cov;ADDRESS : coverpoint addr {option.auto_bin_max = 10;}ADDRESS2 : coverpoint addr2 {option.auto_bin_max = 10;}endgroupaddress_cov my_cov = new;initial beginmy_cov.ADDRESS.option.at_least = 1;my_cov.ADDRESS2.option.at_least = 2;// start the coverage collectionmy_cov.start();// Set the coverage group namemy_cov.set_inst_name("ASIC-WORLD");$monitor("addr 8'h%x addr2 8'h%x",addr,addr2);repeat (10) beginaddr = $urandom_range(0,7);// Sample the covergroupmy_cov.sample();#10;end// Stop the coverage collectionmy_cov.stop();// Display the coverage$display("Instance coverage is %e",my_cov.get_coverage());endendmodule

7. Coverage system task 覆盖率系统任务

  • $set_coverage_db_name(name) : sets the filename of the coverage database into which coverage information is saved at the end of a simulation run.
  • $load_coverage_db(name) :loads from the given filename the cumulative coverage information for all coverage group types.
  • $get_coverage() :returns as a real number in the range of 0 to 100 the overall coverage of all coverage group types. This number is computed as described above
    module test();logic [2:0] addr;wire [2:0] addr2;assign addr2 = addr + 1;covergroup address_cov;ADDRESS : coverpoint addr {option.auto_bin_max = 10;}ADDRESS2 : coverpoint addr2 {option.auto_bin_max = 10;}endgroupaddress_cov my_cov = new;initial begin// Set the database name$set_coverage_db_name("asic_world");$monitor("addr 8'h%x addr2 8'h%x",addr,addr2);repeat (10) beginaddr = $urandom_range(0,7);my_cov.sample();#10;end// Get the final coverage$display("Total coverage %e",$get_coverage());endendmodule

http://chatgpt.dhexx.cn/article/cvKR9Hnf.shtml

相关文章

VCS coverage覆盖率工具常用功能

目录 简介 Coverage Metrics覆盖指标&#xff1a; merge VCS相关命令 常用编译选项&#xff1a; 常用仿真选项&#xff1a; 系统函数&#xff1a; 使用URG及其参数&#xff1a; 用DVE查看coverage&#xff1a; 简介 可通过 -cm_hier 配置文件来控制覆盖率收集范围 C…

vcs/urg 进行覆盖率coverage merge及部分merge到整体

目录 1.vcs收coverage基本Option 2.相同代码的merge 3.部分merge到整体 3.1 mapfile 3.2 -map使用语法 3.3合并的常见问题 3.3.1 UCAPI-MAP-SHAPEMISMATCH coverage相关的用户手册可以在本人的百度云盘中查看Coverage Technology User Guide.pdf 还可以参考gsithxy的博文…

代码覆盖率 ——语句覆盖 Statement Coverage、分支覆盖 Branch Coverage、 路径覆盖 Path Coverage的区别

我们以下面代码为例&#xff1a; public static boolean Method(boolean a, boolean b) {int x 2;int y -4;if(a)x y;elsex -2*x;if(b)y 0-x;return ((100/(xy))> 0);}语句覆盖 Statement Coverage 当我们要实现100% Statement Coverage&#xff0c;只需以下两个test…

NGS 测序深度和覆盖度—Depth、Coverage

文章目录 前言这是比较基本的两个概念&#xff1a;二者的关系&#xff1a;例子&#xff1a;使用**bamdst**计算覆盖度安装 使用参考&#xff1a; 前言 温故而知新&#xff0c;刚入门的时候没有好好记笔记&#xff0c;现在补上&#x1f611; 公众号&#xff1a;猪猪的乌托邦 这…

idea插件Coverage(用例覆盖率)使用

idea插件Coverage&#xff08;用例覆盖率&#xff09;使用 选择测试用例中要执行的包、类或方法&#xff0c;右键选择Run …with Coverage。 执行结束后可在右侧查看覆盖率结果。可以点击导出按钮导出覆盖率报告。注意&#xff1a;若只执行了包中的某个类或方法&#xff0c;则…

浅谈coverage

背景描述&#xff1a; 公司需要对测试用例的对工程代码的覆盖率做统计&#xff0c;因此需要用到coverage&#xff0c;这里有个特殊的点&#xff0c;公司的工程运行时要在容器中进行的。 实际应用&#xff1a; 1. 首先&#xff0c;需要下载coverage&#xff1a; pip3 install…

Python代码覆盖率分析工具Coverage

目录 简介 安装 命令行中使用 调用API使用 简介 Coverage是一个Python代码覆盖率分析工具&#xff0c;它可以用于衡量Python测试代码的质量。通过给代码执行带来的覆盖率数据&#xff0c;Coverage可以帮助开发人员找出被回归测试代码中的漏洞&#xff0c;并且指明哪些代码…

coverage 测试代码覆盖率

测试覆盖率&#xff0c;简单的说&#xff0c;就是评价测试活动覆盖产品代码的指标。测试的目的&#xff0c;是确认产品代码按照预期一样工作&#xff0c;也可以看作是产品代码工作方式的说明文档。进一步考虑&#xff0c;测试覆盖率可以看作是产品代码质量的间接指标&#xff0…

GIS原理篇 Coverage

一、什么是 Coverage Coverage 是一种用于存储矢量数据的地理相关数据模型&#xff0c;它包含地理要素的空间&#xff08;位置&#xff09;数据和属性&#xff08;描述性&#xff09;数据。Coverage 使用一组要素类来表示地理要素。每个要素类存储一组点、线&#xff08;弧&am…

Python:代码覆盖率工具coverage

简介&#xff1a;覆盖率测量通常用于衡量测试的有效性。它可以显示您的代码的哪些部分正在被测试执行&#xff0c;哪些不是。coverage是一个测量 Python 程序代码覆盖率的工具。它监视您的程序&#xff0c;注意代码的哪些部分已被执行&#xff0c;然后分析源代码以识别可能已执…

configure--prefix

本文主要说明--prefix参数的作用&#xff0c;其主要用在编译安装源代码应用中的./configure环节。 ./configure --help 查看详细的说明帮助 1、源码安装一般包括几个步骤&#xff1a;配置&#xff08;configure&#xff09;&#xff0c;编译&#xff08;make&#xff09;&…

路由策略 匹配工具 IP-Prefix

⦁ p-prefix-name&#xff1a;指定地址前缀列表的名称。字符串形式&#xff0c;长度范围是1&#xff5e;169&#xff0c;不支持空格&#xff0c;区分大小写。 ⦁ index index-number&#xff1a;指定本匹配项在地址前缀列表中的序号。整数形式&#xff0c;取值范围是1&am…

CondaValueError: The target prefix is the base prefix. Aborting.

报错截图 错误原因 conda命令错误 正确做法 conda create -n py38 python3.8

zuul 里面的 prefix 和 strip-prefix 怎么使用

首先两个是配置路由前缀的&#xff0c; 下面是我网上找的一段话&#xff1a; prefix &#xff1a;前缀&#xff0c;当请求匹配前缀时会进行代理strip-prefix &#xff1a;代理前缀默认会从请求路径中移除&#xff0c;通过该设置关闭移除功能&#xff0c; 当 stripPrefixtrue …

Trie树(Prefix Tree)介绍

本文用尽量简洁的语言介绍一种树形数据结构 —— Trie树。 一、什么是Trie树 Trie树&#xff0c;又叫字典树、前缀树&#xff08;Prefix Tree&#xff09;、单词查找树 或 键树&#xff0c;是一种多叉树结构。如下图&#xff1a; 上图是一棵Trie树&#xff0c;表示了关键字集…

configure --prefix=/的作用和用法

非root用户安装python和gcc的时候&#xff0c;总是需要设定这个&#xff0c;只知道是个路径&#xff0c;具体是什么路径&#xff0c;代表什么不清楚。 不明白就百度&#xff1a; configure --prefix/是干啥用的&#xff1f;这个路径代表了什么&#xff1f; Configure是一个可…

前缀和(Prefix Sum)

前缀和指一个数组的某下标之前的所有数组元素的和&#xff08;包含其自身&#xff09;。前缀和分为一维前缀和&#xff0c;以及二维前缀和。前缀和是一种重要的预处理&#xff0c;能够降低算法的时间复杂度&#xff0c;可以在 O ( 1 ) O(1) O(1)的时间复杂度内求出区间和。 一…

CMAKE_INSTALL_PREFIX

一、定义 CMAKE_INSTALL_PREFIX为cmake的内置变量&#xff0c;用于指定cmake执行install命令时&#xff0c;安装的路径前缀。Linux下的默认路径是/usr/local &#xff0c;Windows下默认路径是 C:/Program Files/${PROJECT_NAME} 二、用…

IP-Prefix List

地址前缀列表 一、IP-Prefix List二、语法及匹配规则1、语法2、匹配规则 三、配置案例1、拓扑2、分析ACL实现IP-Prefix List实现 四、IE考试题思考题 在进行配置案例前先了解一下基础知识 一、IP-Prefix List IP-Prefix List&#xff1a;能够同时匹配网络号和前缀长度 性能及可…

【脚本】更新依赖库pkgconfig文件中的prefix设置

在本地编译和安装了某个库后&#xff0c;如果其lib目录下存在pkgconfig子目录&#xff0c;则子目录下会存在若干.pc文件&#xff0c;文件中会有prefix的配置&#xff08;该配置标识当前库的安装路径&#xff09;&#xff0c;当要把该库拷贝到其他机器上时&#xff0c;如果库的路…