A covergroup can contain one or more coverage points. A coverage point can be an integral variable or an integral expression. A coverage point creates a hierarchical scope, and can be optionally labeled. If the label is specified then it designates the name of the coverage point.
program main;
bit [0:2] y;
bit [0:2] values[$]= '{3,5,6};
initial foreach(values[i])
begin y = values[i];
cg_inst.sample();
end
endprogram
In the above example, we are sampleing the cover point "y". The cover point is named "cover_point_y" . In the Coverage report you will see this name. A cover group "cg" is defined and its instance "cg_inst" is created. The value of "y" is sampled when cg_inst.sample() method is called. Total possible values for Y are 0,1,2,3,4,5,6,7. The variable "y" is assigned only values 3,5,6. The coverage engine should report that only 3 values are covered and there are 8 possible values.
Commands To Simulate And Get The Coverage Report:
VCS
Compilation command: vcs -sverilog -ntb_opts dtm filename.sv Simulation Command: ./simv Command to generate Coverage report: Coverage report in html format will be in the ./urgReport directory urg -dir simv.vdb
Coverage will be saved in UCDB Format in Questasim
Case 1) By default in modelsim.ini file to Name of UCDB file will be threre, If it is there, it will create one file filename.ucdb
Case 2) Sometimes in modelsim.ini file UCDB File name will be commented in that case we have to save UCDB File explicitly after vsim command Coverage save filename.ucdb
Once u are ready with UCDB File u need to generate coverage report from ucdb file To generate only Functional coverage report vcover cvg myreport.txt outfilename.ucdb
After running the above program, the coverage report will show,