ISSUE WITH CROSS COVEPOINT

module cover_points;
  event smpl;
  class cpoints;
     rand bit [5:0] a;
     rand bit [5:0] b;
     bit expr = 1;
     bit ok =1;
     int arg_a = 33;
     covergroup cg_a (int val) @(smpl);
         cp_a : coverpoint a iff (expr)
            {
              bins a_1 = {[1:3]};
              bins a_2 = {[3:5]};
              ignore_bins val_ignored = {[6:7]};
            }

         cp_b : coverpoint b iff (expr)
            {
              bins b_1 = {2};
              bins b_2 = {9};
              bins b_3 = {[4:5]};
            }

         cp_c : cross cp_a, cp_b iff (expr)
            {
              //bins c_1 = binsof (a) intersect {[5:9]};
              bins c_2 = binsof (cp_a.a_1) && binsof (cp_b.b_1);
            }

     endgroup : cg_a

     function new();
        cg_a = new(arg_a);
     endfunction : new
  
  endclass : cpoints

  cpoints cp;

  initial begin
     cp = new();
     for(int i =0 ; i < 10 ; i++) begin
     void'(cp.randomize() with {a == i; b == i;});
     -> smpl;
     $display("cp.a=%0d cp.b=%0d coverage = ",cp.a,cp.b,cp.cg_a.cp_c.get_coverage());
     //`uvm_info("PRINT_NAME",$psprintf("coverage = %0d",cp.cg_a.get_coverage()),UVM_LOW)
     end
  end

VCS SIMULATION REPORT :
cp.a=0 cp.b=0 coverage = 0
cp.a=1 cp.b=1 coverage = 0
cp.a=2 cp.b=2 coverage = 16.6667
cp.a=3 cp.b=3 coverage = 16.6667
cp.a=4 cp.b=4 coverage = 33.3333
cp.a=5 cp.b=5 coverage = 33.3333
cp.a=6 cp.b=6 coverage = 33.3333
cp.a=7 cp.b=7 coverage = 33.3333
cp.a=8 cp.b=8 coverage = 33.3333
cp.a=9 cp.b=9 coverage = 33.3333
V C S S i m u l a t i o n R e p o r t

can someone please explain me how it is working ??
result i was expecting is
(a=1,b=2) coverage 33.33
(a=2,b=2) coverage 66.67
(a=3,b=2) coverage 100

since in this case it is hitting only (a=2,b=2) so it should be 33%, why it is going to 16.67% .
can someone please explain the same??

thanks,
samir

No idea where you got your 33.(3)% from, but 16.(6)% is the right answer. You have 2 bins for cp_a and 3 bins for cp_c, this means that cp_c has 2x3 = 6 bins. Filling one of those bins will mean you have 1/6 = 16.(6)% coverage.

In reply to Tudor Timi:

hi tudor,
cp_c should have only 3 beans what i feel as i am defining bins c_2 = binsof (cp_a.a_1) && binsof (cp_b.b_1);__
by default there should be 6 bins but here i am defining the bin so i don’t think there should be 6 bins.

In reply to samir singh:

Hey, you’re right, sorry I didn’t read the code fully. I’ve tried it out in two of the other Big Three simulators. In one I get the exact same result (16%) and in the other I get 0%. It might be that the syntax binsof(cp_a.a_1) isn’t yet supported and it just defaults to binsof(cp_a) (i.e. all bins define in coverpoint cp_a).