100% found this document useful (1 vote)
179 views

Functional Coverage

Functional Coverage encapsulates the specification of a coverage model using covergroups and coverpoints. A bug is identified and fixed in the code by creating an instance of the covergroup cg. 4 bins are created with values distributed between 0-3. Explicit bins are used when the exact values to be covered are known. 5 bins are created in the example code. The coverage would be 75% with 4 bins ignored in the coverpoint for y. Ignore_bins ignore values during sampling while illegal_bins cause sampling to fail. Cross_yz creates a cross coverage between the coverpoint for y and z, making 16 bins. Code coverage measures exercised code structures while functional coverage measures exercised functionality or scenarios. High functional coverage with either high

Uploaded by

anjaliswe
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
179 views

Functional Coverage

Functional Coverage encapsulates the specification of a coverage model using covergroups and coverpoints. A bug is identified and fixed in the code by creating an instance of the covergroup cg. 4 bins are created with values distributed between 0-3. Explicit bins are used when the exact values to be covered are known. 5 bins are created in the example code. The coverage would be 75% with 4 bins ignored in the coverpoint for y. Ignore_bins ignore values during sampling while illegal_bins cause sampling to fail. Cross_yz creates a cross coverage between the coverpoint for y and z, making 16 bins. Code coverage measures exercised code structures while functional coverage measures exercised functionality or scenarios. High functional coverage with either high

Uploaded by

anjaliswe
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Functional Coverage

28. What encapsulates the specification of a coverage model


a) Coverpoint
b) Covergroup
c) Interface
d) Bins

29. In the below code, there is a bug. Fix it and what will be the coverage(%) and why?
module top;
bit [0:2] p;
bit [0:2] q[$]= '{3,5,6};

covergroup cg;
cp : coverpoint p;
endgroup

initial
foreach(q[i])
begin
p = q[i];
cg_inst.sample();
end

endmodule

Ans:bug: instance of cg is not created...coverage 37.50%


30. Which construct specifies an optional condition that disables coverage for that cover
point?

Ans – iff

31. In the below code, How many bins are created? And show the distribution of values
for these bins
bit [0:2] y;
covergroup cg;
cp_y : coverpoint y
{ option.auto_bin_max = 4 ; }
endgroup

32. Not all values are interesting or relevant in a cover point, so when the user knows the
exact values he is going to cover, he will use
a) Explicit bins
b) Implicit bins
c) Cross bins
d) All of the above

33. How many bins are created below?


bit [0:2] y;
covergroup cg;
cp_y : coverpoint y {
bins a[] = {0,1};
bins b[] = {2,3};
bins c[] = {4,5};
bins d = default;
}
endgroup

34. How many bins are created below :


int y;
covergroup cg;
cp_y : coverpoint y {
bins a[4] = {[0:7]};
} endgroup

35. How many bins are created in the below example and what is the coverage. Explain
module top;
bit [0:2] y;
bit [0:2] p[$]= '{1,6,3,7,3,4,3,5};
event ev;

covergroup cg @(ev);
cp_y : coverpoint y {
ignore_bins ig = {1,2,3,4,5};}
endgroup
cg cg_inst = new();
initial
foreach(p[i])
begin
y = p[i];
-> ev;
end
endmodule
36. What is the difference between ignore_bins and illegal_bins.

37. List all the bins for the following code :


bit [0:1] y;
bit [0:1] z;
covergroup cg;
cp_y : coverpoint y ;
cross_yz : cross cp_y, z ;
endgroup

38. Describe the difference between Code Coverage and Functional Coverage Which is
more important and Why we need them.

39. The key aspect of functional coverage is


a) It is user defined
b) Automatically extracted by the design code
c) Expression and statement coverage
d) The end result is a measure of how much your tests exercise the design code

40. You get a good coverage for a given design with


a) Low code coverage and high functional coverage
b) High functional coverage and high code coverage
c) Low functional coverage and high code coverage
d) Low functional coverage and low code coverage

You might also like