Hello,
I have the following associative array that I am trying to generate coverage for. I would like to only have bins for the values specified. This is an attempt to streamline coverage in my process.
I am passing the following define into the sim:
DRAM_TYPE_FREQ_ARR='{eDDR4:'{eDDR_FREQ_800,eDDR_FREQ_1067},eLPDDR4:'{eDDR_FREQ_1467,eDDR_FREQ_2133}}
My fcov class looks like this, I have removed failed attempts to accomplish my goal:
class one_hot_x_dram_type_x_dram_speed_fcov#(int WIDTH=16, bit [WIDTH-1:0] ignore_vec=0);
eFREQ_TYPE freq_arr[eDramTech][] = `DRAM_TYPE_FREQ_ARR;
function void sample_one_hot(bit[WIDTH-1:0] vec, eDramTech dram, eFREQ_TYPE freq);
for(int i = 0; i < WIDTH; i++) begin
cg__one_hot_x_dram.sample(vec, i, dram, freq);
end
endfunction
function bit is_bin(int val);
return !ignore_vec[val];
endfunction // is_bin
covergroup cg__one_hot_x_dram with function sample(bit[WIDTH-1:0] x, int position, eDramTech dram_type_loc, eFREQ_TYPE dram_freq_loc);
cp__one_hot_vector : coverpoint position iff(x[position] == 1 && $onehot(x)) {
bins vec[] = {[0:WIDTH-1]} with (is_bin(item));
}
endgroup // cg__one_hot
function new(string name="one_hot_x_dram_type_x_freq");
cg__one_hot_x_dram = new();
endfunction // new
endclass // one_hot_x_dram_type_fcov
My goal is to only create bins to be used in a cross that fall within the type-speed combinations in the associative array. I would like to only have to modify the defined associative array to add or take away combinations without having to modify any code. I have been successful in using only an array for each, but the cross generates unnecessary bins that have to be waived in coverage analysis.
I would appreciate thoughts or suggestions on how to accomplish this.
Thanks