Code Coverage Functionality Supported by xelab/xsim - 2024.1 English

Vivado Design Suite Tutorial: Logic Simulation (UG937)

Document ID
UG937
Release Date
2024-06-12
Version
2024.1 English
  • Line/Statement coverage with exact execution count of statements
  • Branch Coverage for if-else, if-elseif-else, switch case, ternary operators (?)
  • Detection and Highlighting of Missing else and Missing default in code coverage report
  • Condition Coverage with an exact count of the number of times a condition has been checked and evaluated to TRUE/FALSE
  • Toggle Coverage for packed/unpacked reg, bit, logic, wire datatypes
  • Toggle Coverage for int, shortint, integer, byte datatypes, and non-dynamic struct members
  • Generation of code coverage HTML report by using xcrg
  • Dashboard view of code coverage of design
  • List of files, list of modules, hierarchical list of instances of module for the entire design
  • File Specific Code Coverage view, Module and Instance Specific Code Coverage view
  • Merging of Line/Statement, Branch, Condition, and Toggle coverage from different runs using xcrg
Note: Currently, Vivado Simulator supports the above features for System Verilog/Verilog. VHDL code coverage is not supported yet.

In the present example design, add a code coverage switch at elaboration to view the utility using xcrg.

  1. Under elaboration tab in settings menu, add coverage types, coverage directory, and coverage database name as shown below and select OK.
    You should be able to see the following Tcl commands set in Tcl console after the previous step:
    set_property -name {xsim.elaborate.coverage.name} -value {DB1} -objects [get_filesets sim_adv_mst_active__pt_passive__slv_comb]
    set_property -name {xsim.elaborate.coverage.dir} -value {cRun1} -objects [get_filesets sim_adv_mst_active__pt_passive__slv_comb]
    set_property -name {xsim.elaborate.coverage.type} -value {sbct} -objects [get_filesets sim_adv_mst_active__pt_passive__slv_comb]
  2. Invoke the close_sim command in the Tcl console to close the simulation running previously.
  3. Invoke the reset_simulation command in the Tcl console to clean the simulation directory.
  4. Invoke the launch_simulation command in the Tcl console to run the simulation.
  5. Invoke the following command in the Tcl console to dump the current coverage database into the disk.
    write_xsim_coverage -cov_db_dir cRun1 -cov_db_name DB1
  6. Invoke the following command in the Tcl console to read the coverage database generated by Vivado simulator and export it as an HTML report.
    export_xsim_coverage -cov_db_name DB1 -cov_db_dir cRun1 -output_dir cReport1 -open_html true 
  7. Now you can see the HTML report opened in the default browser as shown below.
  8. Click on Files in the top right corner to see the File Specific Information.
  9. Click on Modules in the top right corner to see Module Specific Information.
  10. Click on axi_vip_v1_1_15_top_default module under module name in module specific information table and select statement coverage to see the statement coverage of the module.
  11. Select branch coverage to see the branch coverage of the module.
  12. Select condition coverage to see the condition coverage of the module.
  13. Select toggle coverage to see the toggle coverage of the module.