Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Generate covergroup for accesses to registers #34

Open
quoll99 opened this issue Oct 18, 2024 · 0 comments
Open

Feature: Generate covergroup for accesses to registers #34

quoll99 opened this issue Oct 18, 2024 · 0 comments

Comments

@quoll99
Copy link

quoll99 commented Oct 18, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant