I have a code as per the recommendation by Mentor Graphics UVM Cookbook wherein the covergroups have been defined inside the subscriber code and NOT in the register block.
Here is a snippet of the subscriber code :
class subscriber extends uvm_subscriber#(transaction);
`uvm_component_utils(subscriber)
xyz_reg_block xyz_reg_block_h;
covergroup coverage;
option.per_instance = 1;
Reg_1: coverpoint xyz_reg_block_h.Reg1_reg.Reg_Field1.value[3:0]
{
bins zero = {'h0};
bins one = {'h1};
bins zero_to_one = ( 0=>1 ); // To check for transition of 0->1
}
Reg_2: coverpoint xyz_reg_block_h.Reg2_reg.Reg_Field1.value[2:0]
{
bins zero = {0};
bins three = {3};
bins three_to_zero = ( 3=>0 ); // To check for transition
}
endgroup // coverage
function new(string name = "subscriber", uvm_component parent = null);
super.new(name, parent);
coverage = new();
endfunction // new
function void build_phase(uvm_phase phase);
super.build_phase(phase);
endfunction:build_phase
function void write(transaction t);
coverage.sample(); // Will this collect coverage for all registers even if a single register is read/ written to ?
endfunction // write
endclass // subscriber
My Register Block code looks like this :
class xyz_reg_block extends uvm_reg_block;
`uvm_object_utils(xyz_reg_block)
rand Reg1 Reg1_reg;
rand Reg2 Reg2_reg;
uvm_reg_map xyz_map;
function new(string name = "xyz_reg_block");
super.new(name,UVM_NO_COVERAGE); // How is the UVM_NO_COVERAGE or any other option here going to affect my coverage report ?
endfunction // new
virtual function void build();
Reg1_reg=Reg1::type_id::create("Reg1");
Reg1_reg.configure(this,null,"");
Reg1_reg.build();
Reg2_reg=Reg2::type_id::create("Reg2");
Reg2_reg.configure(this,null,"");
Reg2_reg.build();
xyz_map=create_map("xyz_map",'h0,1,UVM_LITTLE_ENDIAN);
xyz_map.add_reg(Reg1_reg,'h0,"RW");
xyz_map.add_reg(Reg2_reg,'h1,"RW");
lock_model();
endfunction // build
endclass
Q1. If I am using front-door access to my registers I am not getting any coverage for my coverpoints. How will the super.new(name,UVM_NO_COVERAGE) inside new function for reg block affect my coverage ?
Q2. If I modify my reg block to have access for Back-door path then I am able to get coverage. What changed in this scenario ?
Q3. Since the sample() function is part of write function in subscriber, will I get coverage for all registers when only a single Register is read or written to ?
Any information or comments would be highly appreciated.