Jump to content

uvm_reg : do_check for read-only register


Recommended Posts

In my IPXACT file, I specify a register to be “read-onlyâ€. When I do a read, I do not expect the check function to be turned on, but it did. As a result, my test failed because of the mis-compare.

The uvm_reg.svh has the following source code. How come the “if†statement is checking for “WO†rather than “RO†? How would I specify the “UVM_NO_CHECK†in the IPXACT file ? Should a "RO" register implies "UVM_NO_CHECK" ?

Here's the "do_check" source code from uvm 1.1a

// do_check

function bit uvm_reg::do_check(input uvm_reg_data_t expected,

input uvm_reg_data_t actual,

uvm_reg_map map);

uvm_reg_data_t dc = 0;

foreach(m_fields) begin

string acc = m_fields.get_access(map);

acc = acc.substr(0, 1);

if (m_fields.get_compare() == UVM_NO_CHECK ||

acc == "WO") begin

dc |= ((1 << m_fields.get_n_bits())-1)

<< m_fields.get_lsb_pos();

end

end

Link to comment
Share on other sites

set_compare

function void set_compare( uvm_check_e check = UVM_CHECK )

Sets the compare policy during a mirror update. The field value is checked against its mirror only when both the check argument in uvm_reg_block::mirror, uvm_reg::mirror, or uvm_reg_field::mirror and the compare policy for the field is UVM_CHECK.

The generator should have a vendor extension for this. But some don't so you manually have to set it:

For a field:

status_reg.fld0.set_compare(UVM_NO_CHECK);

For a register:

//this depends on the generator

config_reg.data.set_compare(UVM_NO_CHECK);

You have to extend the register file that contains these registers and create a derived class that call super.build(). Does the set_compare and then build();

Your generator may have an XML vendor extension for this.

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