quick.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

   

space.gif

   

space.gif

  ../images/main/bulllet_4dots_orange.gif Coverage System Tasks

Systemverilog provides set of system tasks to help manage coverage data collection as shown below

   

space.gif

  • $set_coverage_db_name(name) : sets the filename of the coverage database into which coverage
  • information is saved at the end of a simulation run.
  • $load_coverage_db(name) :loads from the given filename the cumulative coverage information for all coverage group types.
  • $get_coverage() :returns as a real number in the range of 0 to 100 the overall coverage of all coverage group types. This number is computed as described above.
   

space.gif

   

space.gif

  ../images/main/bullet_star_pink.gif Example : Coverage system
   

space.gif


  1 module test();
  2 
  3 logic [2:0] addr;
  4 wire [2:0] addr2;
  5 
  6 assign addr2 = addr + 1;
  7 
  8 covergroup address_cov;
  9   ADDRESS : coverpoint addr {
 10     option.auto_bin_max = 10;
 11   }
 12   ADDRESS2 : coverpoint addr2 {
 13     option.auto_bin_max = 10;
 14   }
 15 endgroup
 16 
 17 address_cov my_cov = new;
 18 
 19 initial begin
 20   // Set the database name
 21   $set_coverage_db_name("asic_world");
 22   $monitor("addr 8'h%x addr2 8'h%x",addr,addr2);
 23   repeat (10) begin
 24     addr = $urandom_range(0,7);
 25     my_cov.sample();
 26      #10 ;
 27   end
 28   // Get the final coverage
 29   $display("Total coverage %e",$get_coverage());
 30 end
 31 
 32 endmodule
You could download file coverage_system.sv here
   

space.gif

  ../images/main/bullet_star_pink.gif Simulation : Coverage system
   

space.gif

 addr 8'h6 addr2 8'h7
 addr 8'h4 addr2 8'h5
 addr 8'h5 addr2 8'h6
 addr 8'h2 addr2 8'h3
 addr 8'h3 addr2 8'h4
 addr 8'h7 addr2 8'h0
 addr 8'h0 addr2 8'h1
 addr 8'h7 addr2 8'h0
 addr 8'h6 addr2 8'h7
 addr 8'h3 addr2 8'h4
 Total coverage 8.750000e+01
   

space.gif

  ../images/main/bullet_star_pink.gif Report : Coverage system
   

space.gif

 ===========================================================
 Group : test::address_cov
 ===========================================================
 SCORE  WEIGHT GOAL   
  87.50 1      100    
 
 -----------------------------------------------------------
 Summary for Group   test::address_cov
 
 CATEGORY  EXPECTED UNCOVERED COVERED PERCENT 
 Variables 16       2         14      87.50   
 
 Variables for Group  test::address_cov
 
 VARIABLE EXPECTED UNCOVERED COVERED PERCENT GOAL WEIGHT 
 ADDRESS  8        1         7       87.50   100  1      
 ADDRESS2 8        1         7       87.50   100  1      
 -----------------------------------------------------------
 Summary for Variable ADDRESS
 
 CATEGORY                     EXPECTED UNCOVERED COVERED PERCENT 
 Automatically Generated Bins 8        1         7       87.50   
 
 Automatically Generated Bins for ADDRESS
 
 Uncovered bins
 
 NAME      COUNT AT LEAST NUMBER 
 [auto[1]] 0     1        1      
 
 Covered bins
 
 NAME    COUNT AT LEAST  
 auto[0] 1     1        
 auto[2] 1     1        
 auto[3] 2     1        
 auto[4] 1     1        
 auto[5] 1     1        
 auto[6] 2     1        
 auto[7] 2     1        
 -----------------------------------------------------------
 Summary for Variable ADDRESS2
 
 CATEGORY                     EXPECTED UNCOVERED COVERED PERCENT 
 Automatically Generated Bins 8        1         7       87.50   
 
 Automatically Generated Bins for ADDRESS2
 
 Uncovered bins
 
 NAME      COUNT AT LEAST NUMBER 
 [auto[2]] 0     1        1      
 
 Covered bins
 
 NAME    COUNT AT LEAST  
 auto[0] 2     1        
 auto[1] 1     1        
 auto[3] 1     1        
 auto[4] 2     1        
 auto[5] 1     1        
 auto[6] 1     1        
 auto[7] 2     1        
   

space.gif

   

space.gif

   

space.gif

   

space.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

  

Copyright © 1998-2014

Deepak Kumar Tala - All rights reserved

Do you have any Comment? mail me at:deepak@asic-world.com