Using 4 - state variable in coverpoint

Hi all ,

I was wondering about 4-state variable within coverpoint expression ::
(a) For automatic bins will 4-state values be used ?
(b) What if value and transition bin has 4-state value like X / Z ? Would it be valid ?
(c) Coverpoint expression using case equality ’ === ’ operator .

I have done some homework and have a fair understanding . Just wanted to confirm if I have got it right .


module  Four_State_Values ;

   logic [1:0]  a ; 

   logic   b ;   
   
   logic [1:0]  c ; 

   covergroup cg_exp ;
   
      //Coverpoint1
      b_auto : coverpoint b ;   // [Q1]  Will  4-state  Values  be  Covered  ??  
    
      // Coverpoint2
      a_bin : coverpoint a      // [Q2]  Value  N  Transition  bins  using  4-state  value  , Valid  ??  
      {   
         bins   All_X           =  { 2'bX }  ;         
         bins   X_to_Zero       =  ( 2'bX => 2'b0 ) ;  
      }   
    
      // Coverpoint3
      c_bin : coverpoint ( c === 2'bXX )   //  [Q3]  Using  ' === '  , Valid  ??  
      {
         bins   True    =  { 1'b1 }  ;
         bins   False   =  { 1'b0 }  ;
      }

   endgroup

   cg_exp  cg1  =  new() ;

endmodule

When I run the code I observe ::

(A1) ONLY 2 state values are generated for automatic bins . So coverpoint ’ b_auto ’ has 2 automatic bins

(A2) Bins ’ All_X ’ and ’ X_to_Zero ’ are observed

(A3) Bins ’ True ’ and ’ False ’ are generated indicating that ’ === ’ is valid within coverpoint expression .

LRM Section 19.5.3 , 19.5.4 do mention regarding (Q1) and (Q2) ( However some EDA tools throw error , hence I have some confusion )

Is my understanding correct OR have I missed out on anything ?

In reply to hisingh:

Yes, this is correct. The LRM needs some clarification that a covergroup expression may contain any type operands or operators as long as the resulting expression is a 4-state value. And you can only have a 4-state value bins with an X or Z by specifying an explicit singleton value bin, not a range.

In reply to dave_59:

And you can only have a 4-state value bins with an X or Z by specifying an explicit singleton value bin, not a range

Could you please elaborate on this ?


      // Coverpoint2
      a_bin : coverpoint a 
      {   
         bins   All_X           =  { 2'bX }  ;           
         bins   X_to_Zero       =  ( 2'bX => 2'b0 ) ;    
         bins   dynamic_X[]     =  { 2'b1X , 2'bX1 }  ;  //  Dynamic  bin 
      }

I tried the above code and observe that it does works and creates 2 bins :: dynamic_X['b1x] and dynamic_X['bx1]

Does the LRM mention anything regarding this ?

Also my understanding is following wouldn’t be Legal ::


      // Coverpoint2
      a_bin : coverpoint a 
      {   
         bins   X_to_Z          =  { [2'bX:2'bZ] }  ;           
      }

as there is No lower and upper bound with X and Z

When I run the code I observe warning message and No bin is generated for X_to_Z ::

A value '‘bxx’ with unknown bits is specified as the bound of a value range in bin ‘range’ of Coverpoint ‘a_bin’. The range will be ignored.

In reply to hisingh:

The LRM mentions this in a roundabout way in section 19.5.4 Wildcards, and in section 19.5.7 Value resolution. I hope to make this clearer in the next revision.

In reply to hisingh:

The LRM mentions this in a roundabout way in section 19.5.4 Wildcards, and in section 19.5.7 Value resolution. I hope to make this clearer in the next revision.

In reply to dave_59:


LRM 19.5.4 ::  By default, a value or transition bin definition can specify 4-state values.

LRM 19.5.7 ::  If an element of a bins covergroup_range_list is a range [b1 : b2] and either b1 or b2 contains any x or z bits or every value in the range would generate a warning, then the element shall not  participate in the bins values.

Hence bin ’ X_to_Z ’ issues a warning and no bin is generated as range has X / Z,
whereas bin ’ dynamic_X[] ’ is Legal as value bin can specify 4-state values.