Cross only two specific bins of two coverpoints

Hi everyone,

I am trying to cover that my design which does some vector operations covers the following cases:

  • Uses vector length multiple of 8 for configurations of an element 0 and 1, and uses vector length multiple of 16 for configurations 2 and 3.
    Vector length ranges from 0 to 64 and the configurations are named 0, 1, 2, 3.

I tried:


    confs: coverpoint configs iff (rsn) {                                                  
        bins conf0 = {0};                                                                             
        bins conf1 = {1};                                                                            
        bins conf2 = {2};                                                                            
        bins conf3 = {3};                                                                            
    }                                                                                                
                                                                                                     
    len: coverpoint length iff (rsn) {                                                   
        bins max_len[] = {[0:64]};                                                                  
        bins len8[] = {[0:64]} with (item % 8 == 0);                                           
        bins len16[] = {[0:64]} with (item % 16 == 0);
    }                                                                                                
                                                                                                                                                                                  
    confs_len: cross len, confs iff (rsn) {                                                                
        bins mul_8 = binsof(len.len8) && (binsof(confs.conf0) || binsof(confs.conf1));
        bins mul_16 = binsof(len.len16) && (binsof(confs.conf2) || binsof(confs.conf3));
    }

This is not generating what I would expect:


<len8[0], conf0>, <len8[8], conf0> ... <len8[64], conf0>
<len8[0], conf1>, <len8[8], conf1> ... <len8[64], conf1>
<len16[0], conf2>, <len16[16], conf1> ... <len16[64], conf2>
<len16[0], conf3>, <len16[16], conf3> ... <len16[64], conf3>

Any idea on how to do it? I think it’s a hard topic to understand and I don’t see much info about it.

Thanks in advance, Marc

In reply to Marc43:

Specifying bins for crosses is counterintuitive from coverpoints—you’re specifying the bins you want to get rid of, not the ones you want. A cross automatically creates all your individual bins, and the bin construct just collapses those individual bin into a single bin.

What you want to do is ignore the bins you don’t want

  confs_len: cross len, confs iff (rsn) {   
        ignore_bins max = binsof(len.max_len);                                                          
        bins mul_8 = binsof(len.len8) && (binsof(confs.conf2) || binsof(confs.conf3));
        bins mul_16 = binsof(len.len16) && (binsof(confs.conf0) || binsof(confs.conf1));
    }

Sometimes separating your coverpoint bins into individual coverpoints is a cleaner approach.

confs01: coverpoint configs iff (rsn) {                                                  
        bins conf0 = {0};                                                                             
        bins conf1 = {1};                                                                            
    }                                                                                                
confs23: coverpoint configs iff (rsn) {                                                                                                                        
        bins conf2 = {2};      
        bins conf3 = {3};    
    }   
    cplenmax: coverpoint length iff (rsn) {                                                   
        bins max_len[] = {[0:64]}; 
    }                                                                                                
    cplen8: coverpoint length iff (rsn) {                                                   
        bins len8[] = {[0:64]} with (item % 8 == 0);                                           
    }  
    cplen16: coverpoint length iff (rsn) {                                                   
        bins len16[] = {[0:64]} with (item % 16 == 0);
    }      
    confs_len: cross len8, confs01 iff (rsn);
    confs_len: cross len16, confs23 iff (rsn);

In reply to dave_59:

Thanks Dave, worked for me!

Only one more question, can I prevent that cplen8 or cplen16 bins are incremented even when their configuration is not set? My coverage would have some useless information because of that, the cross is the interesting one.

Thanks again!
Marc

In reply to Marc43:

You can add an iff clause to a bin statement as well as the entire coverpoint if you need to guard selective bins.