Reputation: 11
I am sampling value from data bus, as the intended values are non-consecutive the bins are not hitting for transition coverage. While the bins are hitting standalone without transition.
Example: We want to cover transition of values for address W.
A: W | X | W | Z
D: 7 | 0 | 8 | 0
covergroup cg_ with function sample();
transtion_cp : coverpoint data {
bins seven_repeat = (7 [* 2]);
bins seven_eight = (7 => 8);
bins eight_seven = (8 => 7);
bins eigth_repeat = (8 [* 2]);
bins seven = {7};
bins eight = {8};
}
function new(string name, uvm_component parent);
cg_ = new();
endfunction
virtual function void write_axi_bus(svt_axi_transaction axi_tran);
reg [7:0] var_value;
if(W == axi_trans.addr && (axi_trans.xact_type == svt_axi_transaction::READ || axi_trans.xact_type == svt_axi_transaction::WRITE)) begin
var_value = axi_trans.data[0][7:0];
end
cg_.sample(var_value);
endfunction
Is anything wrong with the above code, as currently the transition bins are not hitting. But I see the standalone bins are hitting i.e (7,8). Let me know if I am missing anything in above code.
Upvotes: 1
Views: 351
Reputation: 62227
You override the built-in sample
function using with sample
, but you do not specify a signal list to pass to it. When you call sample
in the write_axi_bus
function, you pass var_value
, but var_value
is not being used for coverage sampling. Refer to IEEE Std 1800-2017, section 19.3 Defining the coverage model: covergroup.
Even if var_value
were used, it might not have the values you want to sample. When the write_axi_bus
function is called, var_value
is 1st set to x
(unknown) in the reg
declaration. Only when the if
condition is true do you set var_value
to a non-x value.
The value of data
is being used for coverage, which means you need to set it to the expected value when sample
is called.
Upvotes: 0