covergroup my_cover_group @(posedge aclk);
m_axi_awlen_cp : coverpoint m_axi_awlen;
m_axi_awcache_cp : coverpoint m_axi_awcache {
option.comment = "cp with transition bins";
bins a1 = (1=>2);
bins b1 = (1,3=>4,5);
bins b2[] = (1,3=>4,5);
bins b3 = (1=>2), ([4:6] => 11,12);
}
m_axi_bresp_cp : coverpoint m_axi_bresp;
endgroup
my_cover_group obj1 = new();
In this example, you are declaring a covergroup named my_cover_group and the sampling event as posedge aclk. This covergroup contains three coverpoints. You can add the cover group declaration code in the example design.
- In Tcl Console, invoke the following
command:
current_scope /axi_vip_0__exdes_adv_mst_active_pt_mem__slv_passive/DUT/ex_design/axi_vip_mst - Double-click axi_vip_mst scope
to see the source code.
- The following file path appears in the text editor, copy the path
and open the
file.
axi_vip_0_ex/axi_vip_0_ex.ip_user_files/bd/ex_sim/ip/ex_sim_axi_vip_mst_0/sim/ex_sim_axi_vip_mst_0.sv - In Tcl Console, invoke the
close_simcommand to close the simulation running previously. - In Tcl Console, invoke the
close_projectcommand and exit Vivado IDE. - To the file open earlier, add the
covergroupdeclaration beforeendmoduleand save it.
- In Windows terminal, invoke the following command to navigate to the
script file location and execute
./compile.sh,./elaborate.sh, and./simulate.shto launch simulation.cd axi_vip_0_ex/axi_vip_0_ex.sim/sim_adv_mst_active__pt_passive__slv_comb/behav/xsim/ - Invoke the
xsim% run -allandxsim% exitcommands to run all and exit the simulation.
The simulation stops after reaching the $finish statement. The AMD Vivado™ simulator has generated the coverage database at the following location with the name (default name) xsim.covdb:
./axi_vip_0_ex.sim/sim_adv_mst_active__pt_passive__slv_comb/behav/xsim/
Invoke the following command to generate a report:
xcrg -report_format html -dir ./xsim.covdb/ -report_dir ./
This will generate a directory with the name functionalCoverageReport, it contains a .html report. The following is the description of an example report:
- Open dashboard.html file. The
file contains details such as command, version, date, and coverage summary that
shows only 9.375% of total bins are covered.
- Click Groups button.
- Click the link under group report.
- You will see a detailed report as shown in the following
figure:
This way you can view the coverage and change your test bench/seed value to improve the coverage.