In reply to rkg__:
In UVM (Universal Verification Methodology), you can implement checking of write data and read data matching by using the uvm_reg_predictor or uvm_reg_adapter classes. These classes provide hooks for you to implement your custom prediction or checking logic.
When dealing with registers that have reserved bits or read-only bits, you can use the UVM_REG macros and classes to model these aspects.
Here’s an example of how you can model a register with reserved bits and implement checking:
class my_reg_model extends uvm_reg;
`uvm_object_utils(my_reg_model)
function new(string name = "my_reg_model");
super.new(name, 32, UVM_NO_COVERAGE);
endfunction
virtual function bit check(uvm_reg_item rw);
// Implement your custom check logic here
// You can use rw.value, rw.path, and other properties to access the write data
// and rw.status and rw.value to access the read data
// Return 1 if the data matches, 0 otherwise
endfunction
endclass
You can then use the uvm_reg_predictor to connect this register model with your DUT and perform automatic prediction and checking. If you need custom behavior, you can extend uvm_reg_predictor and override its methods.
Regarding your question about Write mask and Read mask, the UVM Register Layer provides the get(), set(), and mirror() methods that allow you to access the value, mask, and other properties of a register.
Here’s an example of how you might use these methods:
my_reg_model my_reg;
// Writing to the register
my_reg.set(32'h1234, UVM_REG_WO, .path(my_path));
// Reading from the register
bit [31:0] read_data = my_reg.get(.path(my_path));
// Getting the write mask
bit [31:0] write_mask = my_reg.get_msk(UVM_REG_WR);
// Getting the read mask
bit [31:0] read_mask = my_reg.get_msk(UVM_REG_RD);
You can use these methods to retrieve the values and masks associated with a register and perform your custom checking logic in the check() function.
rahulvala@gmail.com
Freelancer/verification engineer
https://www.linkedin.com/in/rahulvala/