Jump to content
Sign in to follow this  
uvm_rookie

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

Share this post


Link to post
Share on other sites

You can't have a UVM_NO_CHECK for a 'RO' field.. You would want to check that a WRITE to the field actually doesn't take effect.. This can be validated when you do a READ,

I was referring to a RO register, not individual field.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
I was referring to a RO register, not individual field.

There is no such thing as a RO register. Even if the register contains only one field, it is still the field that is RO.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×