In reply to TransVerif:
I didn’t run on Questa. But by adding that line you can see with any tool without any extra switch the results. For Questa specific - do refer to the command that I indicated (fcover). My modified code:
program main;
typedef enum {PINK,BLUE} my_color;
`define cov_macro coverpoint my_c {\
bins PINK_C={PINK};\
bins BLUE_C={BLUE};\
}
class basic;
rand my_color my_c;
rand bit en;
int my_en;
covergroup my_cg;
cp_macro:`cov_macro
en_cp: coverpoint en
{
bins BIN_1={1};
bins BIN_0={0};
}
cross_cov: cross en_cp,cp_macro{
ignore_bins my_ig = binsof(en_cp.BIN_1);
}
endgroup:my_cg
function new();
my_cg=new();
endfunction:new
task run();
my_cg.sample();
endtask:run
endclass
initial begin
basic b_obj=new();
repeat(11) begin // Srini increased to 11
b_obj.randomize();
$display(",b_obj=%p",b_obj);
b_obj.run();
end
$display ("FCOV obtained: %3.2f%%", $get_coverage()); // Srini added for results
end
endprogram:main