Transition coverage from even to even values in SV

I want to define transition coverage bins for all even number to even number transition for a fsm_state which has values [0…99] . like all bins as follows : { 0->2 } { 0->4 } { 44->4 } etc .

There may well be a more elegant solution but the following worked for me

c2: coverpoint data iff(data %2 ==0) {
bins mybins = {[0:$]} with (( item inside {[0:99]} )&&(item %2 ==0) );

 //bins even_trans[] = ( [0:31] => [0:31] ) iff (data %2 == 0);

bins even_trans[] = ( 0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30 => \
                      0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30 );

}

The commented out line still created bins for even numbers

I couldn’t find a way to restrict the transition bins to only even numbers other than to explicitly list them. If I tried using ‘with’ conditions then I got compile errors.
I only created bins here in the range 0:30 just to save mysefl some typing.

Try the following ::


  typedef  enum  int  { STATE0 , STATE1 , ... , STATE99 }  fsm_state ;  

   fsm_state  state ;
  
   covergroup gc ;   
      
      e_trans : coverpoint  state
      {   
        wildcard  bins  even_trans[]  =  ( 7'b?0 => 7'b?0 ) ;  
      }                                                        
          
   endgroup