How to do Scoreboarding or checking the WR_data and read data matching in RAL



What is the best way to implement the checking the Write data and read data are matching.

Lets say we have one control register whoes bit 5:8 is RO or reserved it will return the 0 irrespective of any write data. so how to implement the expected data in UVM env for compare the write data and read data are matching wrt Write mask and read mask value of registers.

Do we have any API which return the Wr mask or rd mask value of registers ?


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;


  function new(string name = "my_reg_model");, 32, UVM_NO_COVERAGE);

  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


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.
Freelancer/verification engineer