Jump to content

include_coverage() scope question.


Recommended Posts

So in my test I have a whole bunch of registers and would like to selectively enable coverage on some of the registers. This seems like it should be an easy task, I just replace my

uvm_reg::include_coverage("*",...)

with

uvm_reg::include_coverage("*reg_R*",...)

Now all registers containing the name reg_R will have coverage enabled right? However it doesn't appear to work that way. Digging in to both the register example I see:

Example Register Model New Function (from register/coverage/regmodel..sv) :

function new(string name = "reg_R");
      super.new(name, 8, build_coverage(UVM_CVR_REG_BITS +
                                        UVM_CVR_FIELD_VALS));
      if (has_coverage(UVM_CVR_REG_BITS))
         cg_bits = new();
      if (has_coverage(UVM_CVR_FIELD_VALS))
         cg_vals = new();
   endfunction: new

The call to super.new() takes an argument has_coverage which will make the decision whether or not to build coverage. So this calls build_coverage() which checks the name (using get_full_name()) against a scope database and determines if coverage should be included. However at this point super.new() has not been called so the name will not include in the above case "reg_R".

I suppose the user could call add_coverage() later on after the register model is built, but in the example the only place the cover structures are new'ed is in the new() function. So just changing the has_coverage() won't help at that point.

Am I missing something obvious here or is there no good way of enabling coverage on a specific register without manually editing the register model source.

Link to comment
Share on other sites

So I fixed the problem locally by changing my register model, adding the line add_coverage(build_coverage(UVM_CVR_REG_BITS + UVM_CVR_FIELD_VALS)) immediately following the call to super.new(). Easily fixed but still troublesome as I'm using automatic code generation for the register models, so now I have to convince a 3rd party to update their tool.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...