mwhite_cp Posted October 12, 2012 Report Share Posted October 12, 2012 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. Thanks! 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]); endgroup covergroup cg_vals; F1: coverpoint F1.value[3:0]; F2: coverpoint F2.value[3:0]; F1F2: cross F1, F2; endgroup 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 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 `uvm_object_utils(reg_R) 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; cg_bits.sample(); end endfunction virtual function void sample_values(); super.sample_values(); if (get_coverage(UVM_CVR_FIELD_VALS)) cg_vals.sample(); endfunction endclass : reg_R Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.