Skip to content

Feature: Generate covergroup for accesses to registers #34

@quoll99

Description

@quoll99

Hi @amykyta3
I propose to extend this tool to generate a covergroup in uvm_reg_block that will cover accesses (read/write) to registers defined within the register block. The coverage model type would be UVM_CVR_ADDR_MAP. Here is an example:

class my_regmodel extends uvm_reg_block;

  covergroup addr_cg with function sample(uvm_reg_addr_t offset, bit is_read);

    offset_cp: coverpoint offset {
      bins r_config = {0};
      bins r_status = {4};
      bins r_addr = {8};
      ...
    }

    dir_cp: coverpoint is_read {
      bins read = {1};
      bins write = {0};

    cross offset_cp, dir_cp;
  endgroup: my_regmodel

  virtual function void sample(uvm_reg_addr_t offset, bit is_read, uvm_reg_map map);
    if (get_coverage(UVM_CVR_ADDR_MAP)) begin
      addr_cg.sample(offset, is_read);
    end
  endfunction: sample

Adding a switch (e.g. --coverage) to allow the covergroup to be generated would be handy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions