Multiple clocking events with a time step

Hi All ,

Section 19.3 of the LRM states :

If the clocking event occurs multiple times in a time step, the coverage point will also be sampled multiple times 

I was curious on how a clocking event could occur multiple times in same time step .

Would be helpful if someone could provide a small example of the same

In reply to MICRO_91:
Here is an example where the variable k has 2 events in a time step.


module m;
  bit [4:0] a;
    bit clk, b=0, c, k, w, q;
    initial forever #5 clk = !clk;
  always @(posedge clk) begin 
     a <= a + 1; b<=!b; c <= 0;  end
  
    ap_1: assert property (@(posedge clk) b |-> c) 
      else begin k=!k; w=!w; end 
// k and w change in the Reactive region 
// ap_2 is scheduled in the Observed region in the loopback 
      
      ap_2: assert property (@(k) b |-> c) 
      else  w=!w;
// ap_2 is processed in the lopback in the Observed region 
// and w toggles again 
//THUS, in that same time step w has 2 transitions 
     
    initial begin
      $dumpfile("dump.vcd"); $dumpvars;
      repeat(6) @(posedge clk);
      $finish;
    end
  endmodule 

If I write the following, I would have clocking event occurs multiple times in a time step,

covergroup g1 @(w);
c: coverpoint color;
endgroup

Ben Cohen
http://www.systemverilog.us/ ben@systemverilog.us
** SVA Handbook 4th Edition, 2016 ISBN 978-1518681448

  1. SVA Package: Dynamic and range delays and repeats SVA: Package for dynamic and range delays and repeats - SystemVerilog - Verification Academy
  2. Free books:
  1. Papers:
    Understanding the SVA Engine,
    Verification Horizons
    Reflections on Users’ Experiences with SVA, part 1
    Reflections on Users’ Experiences with SVA
    Reflections on Users’ Experiences with SVA, part 2
    Reflections on Users’ Experiences with SVA - Part II
    Understanding and Using Immediate Assertions
    Understanding and Using Immediate Assertions
    SUPPORT LOGIC AND THE ALWAYS PROPERTY
    http://systemverilog.us/vf/support_logic_always.pdf
    SVA Alternative for Complex Assertions
    https://verificationacademy.com/news/verification-horizons-march-2018-issue
    SVA in a UVM Class-based Environment
    https://verificationacademy.com/verification-horizons/february-2013-volume-9-issue-1/SVA-in-a-UVM-Class-based-Environment
    SVA for statistical analysis of a weighted work-conserving prioritized round-robin arbiter.
    https://verificationacademy.com/forums/coverage/sva-statistical-analysis-weighted-work-conserving-prioritized-round-robin-arbiter.
    Udemy courses by Srinivasan Venkataramanan (http://cvcblr.com/home.html)
    https://www.udemy.com/course/sva-basic/
    https://www.udemy.com/course/sv-pre-uvm/

In reply to MICRO_91:

There are many convoluted ways.

bit b,c;
initial repeat (20)
               begin
                 c <= !c;
                 @c;
               end
covergroup cg @(poesedge c);
coverpoint b {
  bins bs[2] = {0,1};
}
endgroup
cg cgi=new;

In reply to dave_59:

Hi Dave ,

Your code invoked an interest to understand the Region where sampling occurs :
I tried 2 variations ::


  //  Code 1  ::
  bit [1:0]  a ;   
  bit   clk ;    
 
   covergroup cg1 @( posedge clk ) ; 
      a_auto : coverpoint a ;   
   endgroup

   cg1  cg_1  =  new() ;

   initial  forever  #5  clk  =  !clk ;

   always @ ( posedge clk )  a  <=  a + 1 ;


  //  CODE2  ::
   bit c;   
   initial 
     repeat (2) 
       begin    
         c <= !c; @c;    
       end 

   covergroup cg @(posedge c); 
    
      coverpoint c  //  For 0 -> 1 transition , c would be sampled 1
      {   
        bins bs[2] = {0,1};
      }   
   
   endgroup
    
   cg cgi = new ;


For 1st case : 3 bins corresponding to values of a = 0 , 1 , 2 are covered .
For 2nd case : bin corresponding to value of bs[1] is covered .

Can I say the coverpoint expression in sampled in Active region ?

In reply to MICRO_91:

The sentence before the one you quote in section 19.3 says “a coverage point is sampled the instant the clocking event takes place”. This means the covergroup does not care about event regions. The sampling takes place in the region the event occurs.