Functional Coverage Collection using UVM register model : how to control sampling on certain events

Hi All,

I am trying to collect functional coverage through UVM register model.
The requirement is to collect coverage only when a certain event is happening.
I am doing front door register access. Please give suggestions how can this be done.

Another question is when we do backdoor register access, how can we collect functional
coverage through UVM register model.

Regards

In reply to Bhanu:

The best suitable control is its coverage field attributes, you can control sampling based on setting/retrieving attributes for register.
For sampling coverage while doing backdoor, RAL classes doesn’t provide any hook up. so probably you can create wrapper to all your register as mentioned follow and call sample methods explicitly.


class top_uvm_reg extends uvm_reg;
 ...
  task write(output uvm_status_e      status,
             input  uvm_reg_data_t    value,
             input  uvm_path_e        path = UVM_DEFAULT_PATH,
             input  uvm_reg_map       map = null,
             input  uvm_sequence_base parent = null,
             input  int               prior = -1,
             input  uvm_object        extension = null,
             input  string            fname = "",
             input  int               lineno = 0);

   uvm_reg_addr_t offset;
   uvm_reg_block  ip_block;
   super.write(status, wr_value, path, map, parent, prior, extension, fname, lineno);
   this.sample(wr_value, 0, map);
   
   offset = super.get_offset(map);
   ip_block = this.get_parent();
   ip_block.XsampleX(offset, 0, map);
endtask : write

//same way override read task, but change is_read to 1.
// Eg, this.sample(rd_value, 1, map);
//     ip_block.XsampleX(offset, 1, map);
endclass

Note : Extend your all the register class from top_uvm_reg, so that at every operation, sampling can be performed.

Regards,
Mitesh Patel