You are on page 1of 4

WWW.TESTBENCH.

IN - SystemVerilog Functional Coverage 11/12/12

|HOME |ABOUT |ARTICLES |ACK |FEEDBACK |TOC |LINKS |BLOG |JOBS |

Search

TUTORIALS SystemVerilog
Verification Constructs Interface OOPS Randomization Functional Coverage Assertion DPI UVM Tutorial VMM Tutorial OVM Tutorial Easy Labs : SV Easy Labs : UVM Easy Labs : OVM Easy Labs : VMM AVM Switch TB VMM Ethernet sample

EXPLICIT BIN CREATION

Index Introduction Cover Group Explicit bin creation is recommended method. Not all values are interesting or Sample relevant in a cover point, so when the user knows the exact values he is going to Cover Points Coverpoint Expression cover, he can use explicit bins. You can also name the bins. Generic Coverage Groups Coverage Bins Explicit Bin Creation program main; Transition Bins bit [0:2] y; Wildcard Bins bit [0:2] values[$]= '{3,5,6}; Ignore Bins Illegal Bins covergroup cg; Cross Coverage cover_point_y : coverpoint y { Coverage Options bins a = {0,1}; Coverage Methods bins b = {2,3}; System Tasks bins c = {4,5}; Cover Property bins d = {6,7}; } endgroup cg cg_inst = new(); initial foreach(values[i]) begin y = values[i]; cg_inst.sample(); end endprogram
Report a Bug or Comment on This section - Your input is what keeps Testbench.in improving with time!

Verilog
Verification Verilog Switch TB Basic Constructs

In the above example, bins are created explicitly. The bins are named a,b,c and d.

OpenVera

Coverage report: ------------------VARIABLE : cover_point_y Switch TB Expected : 4 RVM Switch TB Covered : 3 RVM Ethernet sample Percent: 75.00
Constructs

Specman E Interview Questions

Uncovered bins -------------------a Covered bins -------------------b c d

testbench.in/CO_08_EXPLICIT_BIN_CREATION.html

1/4

Array Of Bins To create a separate bin for each value (an array of bins) the square brackets, [], must follow the bin name.

program main; bit [0:2] y; bit [0:2] values[$]= '{3,5,6}; covergroup cg; cover_point_y : coverpoint y { bins a[] = {[0:7]}; } endgroup cg cg_inst = new(); initial foreach(values[i]) begin y = values[i]; cg_inst.sample(); end endprogram In the above example, bin a is array of 8 bins and each bin associates to one number between 0 to 7.

Coverage report: -------------------VARIABLE : cover_point_y Expected : 8 Covered : 3 Percent: 37.50 Uncovered bins ------------------a_0 a_1 a_2 a_4 a_7 Covered bins ------------------a_3 a_5 a_6

To create a fixed number of bins for a set of values, a number can be specified inside the square brackets.

program main; bit [0:3] y; bit [0:2] values[$]= '{3,5,6}; covergroup cg; cover_point_y : coverpoint y { bins a[4] = {[0:7]};

WWW.TESTBENCH.IN - SystemVerilog Functional Coverage 11/12/12

} endgroup cg cg_inst = new(); initial foreach(values[i]) begin y = values[i]; cg_inst.sample(); end endprogram

In the above example, variable y is 4 bit width vector. Total possible values for this vector are 16. But in the cover point bins, we have giving the interested range as 0 to 7. So the coverage report is calculated over the range 0 to 7 only. In this example, we have shown the number bins to be fixed to size 4.

Coverage report: -------------------VARIABLE : cover_point_y Expected : 4 Covered : 3 Percent: 75.00 Uncovered bins ------------------a[0:1] Covered bins -----------------a[2:3] a[4:5] a[6:7]

Default Bin The default specification defines a bin that is associated with none value bins. The default bin catches the values of the coverage point within any of t he defined bins. However, the coverage calculation point shall not take into account the coverage captured by the default of the defined that do not lie for a coverage bin.

program main; bit [0:3] y; bit [0:2] values[$]= '{3,5,6}; covergroup cg; cover_point_y : coverpoint y { bins a[2] = {[0:4]}; bins d = default; } endgroup cg cg_inst = new(); initial foreach(values[i]) begin y = values[i];
testbench.in/CO_08_EXPLICIT_BIN_CREATION.html 3/4

WWW.TESTBENCH.IN - SystemVerilog Functional Coverage 11/12/12

cg_inst.sample(); end endprogram

In the above example, we have specified only 2 bins to cover values from 0 to 4. Rest of values are covered in default bin <93>d<94> which is not using in calculating the coverage percentage.

Coverage report: -------------------VARIABLE : cover_point_y Expected : 2 Covered : 1 Percent: 50.00 Uncovered bins -----------------a[0:1] Covered bins ---------------a[2:4] Default bin ----------------d

<< PREVIOUS PAGE

TOP

NEXT PAGE >>

copyr ight 2007-2017 :: all r ights r eser ved www.te stbe nch.in ::Disclaim e r

testbench.in/CO_08_EXPLICIT_BIN_CREATION.html

4/4

You might also like