Hard Reset / Soft Reset UVM registers ! How to take care of Soft reset?

Hello All,

a. Have implemented the register model with setting the reset values for all registers.
b. And I see there is a function called .reset(kind(HARD), where it resets the register value to the specified default reset value.
c. Say If a register is of type SOFT reset meaning, the register value doesn’t get cleared during the SOFT reset, how should I take care of such scenarios ?

Any suggestions/tips are pretty welcome !!

Thanks,
Desperado

Here’s the cheap answer first. If all of your registers behave like this, then just don’t call reset(“SOFT”).

If this applies to only one register, you can just override the reset(…) method in that class to do nothing on a soft reset:


class some_reg extends uvm_reg;
  // ...
  
  function void reset(string kind = "HARD");
    if (kind != "SOFT")
      super.reset(kind);
  endfunction

endclass

If it applies to multiple registers, you can create a base class with the code from above and extend all of the registers that have this behavior from that.

In reply to Tudor Timi:
Can you please explain the difference between this HARD and SOFT kind?