Jump to content

UVM register model example from uvm-1.1b

Recommended Posts

I ran an register model example from UVM 1.1 package and have a question about this. This example is at uvm-1.1b/examples/simple/registers/models/coverage. I ran the Makefile.ius after adding coverage option for coverage analysis. Based on the coverage analysis result, coverage results for cg_bits are all 50%. For each coverpoint, there are 4 auto bins. The auto[0] and auto[3] get hit, but auto[1] and auto[2] don't get hit. Is it possible to achieve 100% coverage result with this code below? This is extracted from regmodel.sv under the directory.


class reg_R extends uvm_reg;

rand uvm_reg_field F1;

rand uvm_reg_field F2;

local uvm_reg_data_t m_current;

local uvm_reg_data_t m_data;

local uvm_reg_data_t m_be;

local bit m_is_read;

covergroup cg_bits;

wF1_0: coverpoint {m_current[0],m_data[0]} iff (!m_is_read && m_be[0]);

wF1_1: coverpoint {m_current[1],m_data[1]} iff (!m_is_read && m_be[0]);

wF1_2: coverpoint {m_current[2],m_data[2]} iff (!m_is_read && m_be[0]);

wF1_3: coverpoint {m_current[3],m_data[3]} iff (!m_is_read && m_be[0]);

wF2_0: coverpoint {m_current[4],m_data[4]} iff (!m_is_read && m_be[0]);

wF2_1: coverpoint {m_current[5],m_data[5]} iff (!m_is_read && m_be[0]);

wF2_2: coverpoint {m_current[6],m_data[6]} iff (!m_is_read && m_be[0]);

wF2_3: coverpoint {m_current[7],m_data[7]} iff (!m_is_read && m_be[0]);


covergroup cg_vals;

F1: coverpoint F1.value[3:0];

F2: coverpoint F2.value[3:0];

F1F2: cross F1, F2;


function new(string name = "reg_R");

super.new(name, 8, build_coverage(UVM_CVR_REG_BITS +


if (has_coverage(UVM_CVR_REG_BITS))

cg_bits = new();

if (has_coverage(UVM_CVR_FIELD_VALS))

cg_vals = new();

endfunction: new

virtual function void build();

F1 = uvm_reg_field::type_id::create("F1",,get_full_name());

F1.configure(this, 4, 0, "RW", 0, 8'h0, 1, 1, 1);

F2 = uvm_reg_field::type_id::create("F2",,get_full_name());

F2.configure(this, 4, 4, "RO", 0, 8'h0, 1, 1, 1);

endfunction: build


virtual function void sample(uvm_reg_data_t data,

uvm_reg_data_t byte_en,

bit is_read,

uvm_reg_map map);

if (get_coverage(UVM_CVR_REG_BITS)) begin

m_current = get();

m_data = data;

m_be = byte_en;

m_is_read = is_read;




virtual function void sample_values();


if (get_coverage(UVM_CVR_FIELD_VALS))



endclass : reg_R

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.

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...