The problem:
I’m trying to trigger a failure with the mirror check, but even if the mirror value does not match the readback value, the mirror check passes. What am I doing wrong?
The details:
I’m trying to do the following to trigger a failure:
- Use predict to update the mirror value to an invalid value
- Use get_mirrored_value() to check the mirror value
- Use mirror to check the readback value and the mirror value
I’ve tried the above with a read-only register defined as:
class rx_data_reg extends uvm_reg;
…
uvm_reg_field VALUE;
…
virtual function void build();
this.VALUE = uvm_reg_field::type_id::create(“VALUE”);
this.VALUE.configure(this, 16, 0, “RO”, 0, 16’h0, 1, 0, 1);
endfunction : build
endclass : rx_data_reg
I’ve also tried the above with a read-write register defined as:
class rx_count_reg extends uvm_reg;
…
uvm_reg_field VALUE;
…
virtual function void build();
this.VALUE = uvm_reg_field::type_id::create(“VALUE”);
this.VALUE.configure(this, 16, 0, “RW”, 0, 16’h0, 1, 0, 1);
endfunction : build
endclass : rx_count_reg
Here’s a sample sequence for triggering the failure:
// first, a read to double-check the readback value
model.rx_data.read(status, data);
uvm_info("RSEQ", $sformatf("Read value of rx_data register is: %0h", data), UVM_MEDIUM) // now the predict if (!model.rx_data.predict(16'h1234))
uvm_fatal(“RSEQ”, “Predict failed!”)
// call get_mirrored_value to check that the mirror value was updated
data = model.rx_data.get_mirrored_value();
if (data != 'h1234)
uvm_fatal("RSEQ", $sformatf("Mirrored data is not 0x1234: %0h", data)) else
uvm_info(“RSEQ”, $sformatf(“Mirrored value is: %0h”, data), UVM_MEDIUM)
// do the mirror check - should FAIL!
model.rx_data.mirror(status, UVM_CHECK);
if ( status != UVM_IS_OK )
uvm_fatal("RSEQ", "Mirror check failed!") else
uvm_info(“RSEQ”, “Mirror check passed!”, UVM_MEDIUM)
Thank you advance for your help!