6.Functional coverage
6.Functional coverage
Note: Coverage tools gather the information during simulation and post process them and generate the coverage report through which loop holes are identified so
modifying or creating new tests to fill those holes untill the desire coverage goal is met.
► Types of Coverage:
• Code Coverage(automatically generated): This tells the percentage of RTL Bug Rate: An Indirect way of measuring coverage is by looking at the bug
implementations hit by testcases, which include line coverage, path rate.
coverage, Toggle coverage, FSM coverage and Dead code analysis.
Consequences:
1. Have I exercised all the protocol request types and combinations(Burst
read/write)?
2. Did I accessed different memory alignments(Byte aligned, word aligned,
dword aligned)?
3. Did we verify sequence of transactions(write follows read)?
4. Did we verify queue full and empty conditions?
Note: If some block of code is missing in the design code coverage cant
catch this but functional coverage do.
How the code coverage is 100% but functional coverage is low? How can you approach the situation that Functional coverage is 100%
This may be due to but code coverage is low?
○ check the bins specified align with the design requirements. This may be due to
○ check if code coverage exclusions are valied. ○ Modify the stimulus.
○ Identify whether the covergroup for some feature is not specified.
What is covergroup?
Syntax:
covergroup cg [(tf_port_list)] [coverage_event];
{coverage_specs_or_option;}
endgroup [:covergroup_identifier]
Coverpoint:
○ A coverpoint is a variable/expression/Transitions that is expected to be analysed for coverage when the covergroup is sampled. Each coverpoint has
a set of bins which either hits/misses upon sampling the covergroup based on values taken by coverpoint.
○ The coverpoints are normally associated with the design.
endclass
Example-3
Exercise:
Syntax: Example-2:
package <package_name>; package pkg; import pkg::transaction;
... class transaction; module package_example;
endpackage int data = 5; initial begin
transaction tr = new();
function void display(); tr.display();
// To import package
$display("data = %0d", data); //pkg_funct(); // Not accessible
import <package_name> :: *; // All package items are endfunction end
imported endclass endmodule
import <package_name> :: <method_name>; // Only
<method_name> is imported function pkg_funct();
$display("Inside pkg_funct");
Example-1: endfunction
endpackage
package pkg; import pkg::*;
class transaction; module package_example;
int data = 5; initial begin
transaction tr = new();
function void display(); tr.display(); Example-3:
$display("data = %0d", data); pkg_funct(); package pkg_A; import pkg_A::*;
endfunction end int data = 5; import pkg_B::*;
endclass endmodule function pkg_funct();
$display("pkg_A: Inside pkg_funct, data = %0d", data); module package_example;
function pkg_funct(); endfunction initial begin
$display("Inside pkg_funct"); endpackage pkg_A::pkg_funct();
endfunction pkg_B::pkg_funct();
endpackage package pkg_B; end
int data = 10; endmodule
function pkg_funct();
$display("pkg_B: Inside pkg_funct, data = %0d", data);
endfunction
endpackage